lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <27ac48c0-b19c-4104-8ec9-08232e3f42f6@fiberby.net>
Date: Fri, 12 Apr 2024 09:01:15 +0000
From: Asbjørn Sloth Tønnesen <ast@...erby.net>
To: Suman Ghosh <sumang@...vell.com>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Sunil Kovvuri Goutham <sgoutham@...vell.com>,
 Geethasowjanya Akula <gakula@...vell.com>,
 Subbaraya Sundeep Bhatta <sbhatta@...vell.com>,
 Hariprasad Kelam <hkelam@...vell.com>
Subject: Re: [PATCH net] octeontx2-pf: fix FLOW_DIS_IS_FRAGMENT implementation

Hi Suman,

On 4/12/24 5:34 AM, Suman Ghosh wrote:
>> 		if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) {
>> +			val = match.key->flags & FLOW_DIS_IS_FRAGMENT;
>> 			if (ntohs(flow_spec->etype) == ETH_P_IP) {
>> -				flow_spec->ip_flag = IPV4_FLAG_MORE;
>> +				flow_spec->ip_flag = val ? IPV4_FLAG_MORE : 0;
> [Suman] Do we need this? If user provide the command "tc filter add .... ip_flags nofrags" then the above if check should not be hit right? If we are inside the check then we always want to set IPV4_FLAG_MORE right?

In iproute2, the "frag"/"nofrag" is parsed in flower_parse_matching_flags(),
it sets TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT in TCA_FLOWER_KEY_FLAGS and
TCA_FLOWER_KEY_FLAGS_MASK.

Back in the kernel, in fl_set_key_flags() (net/sched/cls_flower.c) then,
directly translates TCA_FLOWER_KEY_FLAGS_IS_FRAGMENT into FLOW_DIS_IS_FRAGMENT,
while only setting the key bit, if the mask bit is being set.

There are therefore 3 possible cases:

- `tc flower ...` (no ip_flags frag or nofrag)
    (match.key->flags & FLOW_DIS_FIRST_FRAG)  is false
    (match.mask->flags & FLOW_DIS_FIRST_FRAG) is false

- `tc flower ... ip_flags nofrag`
    (match.key->flags & FLOW_DIS_FIRST_FRAG)  is false
    (match.mask->flags & FLOW_DIS_FIRST_FRAG) is true

- `tc flower ... ip_flags frag`
    (match.key->flags & FLOW_DIS_FIRST_FRAG)  is true
    (match.mask->flags & FLOW_DIS_FIRST_FRAG) is true

The `nofrag` case will still have the mask bit set, and hence pass the entry condition.


 >> 				flow_mask->ip_flag = IPV4_FLAG_MORE;

Yes, you should always set IPV4_FLAG_MORE in flow_mask, but not always in flow_spec.


-- 
Best regards
Asbjørn Sloth Tønnesen
Network Engineer
Fiberby - AS42541

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ