From: Eugene Crosser <crosser@average.org>
To: Jan Engelhardt <jengelh@inai.de>, Florian Westphal <fw@strlen.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Subject: Re: Expose skb_gso_validate_network_len() [Was: ebtables: load-on-demand extensions]
Date: Sun, 21 Jun 2020 20:48:25 +0200 [thread overview]
Message-ID: <e34c54de-81d4-f7dd-0c55-e9086bb612e4@average.org> (raw)
In-Reply-To: <nycvar.YFH.7.77.849.2006211201270.18408@n3.vanv.qr>
[-- Attachment #1.1: Type: text/plain, Size: 1770 bytes --]
On 21/06/2020 12:03, Jan Engelhardt wrote:
>>>> No, nft already has "< $value" logic.
>>>> The only missing piece of the puzzle is a way to populate an nft
>>>> register with the "size per segment" value.
>>>
>>> I don't think that it works. `skb_gso_network_seglen()` gives the (same for all
>>> segments) segment length _only_ when `shinfo->gso_size != GSO_BY_FRAGS`. If we
>>> were to expose maximum segment length for skbs with `gso_size == GSO_BY_FRAGS`,
>>> we'd need a new function that basically replicates the functionality of
>>> `skb_gso_size_check()` and performs `skb_walk_frags()`, only instead of
>>> returning `false` on first violation finds and then returns the maximum
>>> encoutered value.
>>
>> Yes.
>>
>>> That means we'd need to introduce a new function for the sole purpose of making
>>> the proposed check fit in the "less-equal-greater" model.
>>
>> Yes and no.
>>
>>> And the only practical
>>> use of the feature is to check "fits-doesn't fit" anyway.
>>
>> Why? Maybe someone wants to collect statistics on encountered packet
>> size or something like that.
>
> Possibly so, but you would not want to penalize users who do
> want the short-circuiting behavior when they are not interested
> in the statistics.
In my opinion, for what it's worth, performance pentalty will likely be
insignificant, and in most cases (`shinfo->gso_size != GSO_BY_FRAGS`) non-existent.
But the thing that makes me feel rather uneasy about the "expose the value" plan
is that the kernel will get two distinct, very similar in their workflow, but
slightly different functions. Next time someone wants to change GSO processing
they will need to take care of both places.
So, which way to go?..
Regards,
Eugene
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-06-21 18:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 14:48 ebtables: load-on-demand extensions Eugene Crosser
2020-06-16 15:21 ` Jan Engelhardt
2020-06-16 15:54 ` Eugene Crosser
2020-06-16 16:33 ` Jan Engelhardt
2020-06-19 13:45 ` Eugene Crosser
2020-06-19 15:15 ` Pablo Neira Ayuso
2020-06-19 16:21 ` Eugene Crosser
2020-06-20 10:34 ` Expose skb_gso_validate_network_len() [Was: ebtables: load-on-demand extensions] Eugene Crosser
2020-06-20 11:04 ` Florian Westphal
2020-06-20 21:16 ` Eugene Crosser
2020-06-21 3:24 ` Florian Westphal
2020-06-21 10:03 ` Jan Engelhardt
2020-06-21 18:48 ` Eugene Crosser [this message]
2020-06-21 23:52 ` Florian Westphal
2020-06-22 4:50 ` Jan Engelhardt
2020-06-22 7:41 ` Eugene Crosser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e34c54de-81d4-f7dd-0c55-e9086bb612e4@average.org \
--to=crosser@average.org \
--cc=fw@strlen.de \
--cc=jengelh@inai.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).