[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1637ec50-daae-65df-fcaa-bfd763dbb1d9@solarflare.com>
Date: Fri, 6 Sep 2019 17:49:07 +0100
From: Edward Cree <ecree@...arflare.com>
To: Pablo Neira Ayuso <pablo@...filter.org>
CC: <netfilter-devel@...r.kernel.org>, <davem@...emloft.net>,
<netdev@...r.kernel.org>, <jakub.kicinski@...ronome.com>,
<jiri@...nulli.us>, <saeedm@...lanox.com>, <vishal@...lsio.com>,
<vladbu@...lanox.com>
Subject: Re: [PATCH net-next,v3 0/4] flow_offload: update mangle action
representation
On 06/09/2019 16:58, Pablo Neira Ayuso wrote:
> In tc pedit ex, those are _indeed_ two separated actions:
I read the code again and I get it now, there's double iteration
already over tcf_exts_for_each_action and tcf_pedit_nkeys, and
it's only within the latter that you coalesce.
However, have you considered that iproute2 (i.e. tc tool) isn't
guaranteed to be the only userland consumer of the TC uAPI? For all
we know there could be another user out there producing things like
a single pedit action with two keys, same offset but different
masks, to mangle sport & dport separately, which your code now
_would_ coalesce into a single mangle. I don't know if that would
lead to any problems, but I want to be sure you've thought about it ;)
>> Proper thing to do is have helper functions available to drivers to test
>> the pedit, and not just switch on the offset. Why do I say that?
>>
>> Well, consider a pedit on UDP dport, with mask 0x00ff (network endian).
>> Now as a u32 pedit that's 0x000000ff offset 0, so field-blind offset
>> calculation (ffs in flow_action_mangle_entry()) will turn that into
>> offset 3 mask 0xff. Now driver does
>> switch(offset) { /* 3 */
>> case offsetof(struct udphdr, dest): /* 2 */
>> /* Whoops, we never get here! */
>> }
>>
>> Do you see the problem?
> This scenario you describe cannot _work_ right now, with the existing
> code. Without my patchset, this scenario you describe does _not_ work,
>
> The drivers in the tree need a mask of 0xffff to infer that this is
> UDP dport.
>
> The 'tc pedit ex' infrastructure does not allow for the scenario that
> you describe above.
>
> No driver in the tree allow for what you describe already.
Looks to me like existing nfp_fl_set_tport() handles just fine any
arbitrary mask across the u32 that contains UDP sport & dport.
And the uAPI we have to maintain is the uAPI we expose, not the subset
that iproute2 uses. I could write a patched tc tool *today* that does
a pedit of 'UDP header, offset 0, mask 0xff0000ff' and the nfp driver
would accept that fine (no idea what the fw / chip would do with it,
but presumably it works or Netronome folks would have put checks in),
whereas with your patch it'll complain "invalid pedit L4 action"
because the mask isn't all-1s.
And if I made it produce my example from above, mask 0x000000ff, you'd
calculate an offset of 3 and hit the other error, "unsupported section
of L4 header", which again would have worked before.
Powered by blists - more mailing lists