netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Eugene Crosser <crosser@average.org>
Cc: Florian Westphal <fw@strlen.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Jan Engelhardt <jengelh@inai.de>,
	netfilter-devel@vger.kernel.org
Subject: Re: Expose skb_gso_validate_network_len() [Was: ebtables: load-on-demand extensions]
Date: Sun, 21 Jun 2020 05:24:29 +0200	[thread overview]
Message-ID: <20200621032429.GH26990@breakpoint.cc> (raw)
In-Reply-To: <2dad5797-6643-da2b-3dcf-350d1d501be1@average.org>

Eugene Crosser <crosser@average.org> 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.

(Yes, they could also use tcpdump of course).

Or maybe someone wants to do QoS markings on packet sizes, so tehy could
have a map like

{ 0 - 64 : 0x1, 65-1280 : 0x2, 1281-1400 : 0x3 } or whatever.

Point is that nft tries to provide only basic building blocks and allow
users to plumb this together.

> Do you think this is a valid argument to implement a boolean predicate rather
> than expose an arithmetic value?

I would rather see an arithmetic value.

GSO_BY_FRAGS should not occur in forwarding path nornally, but I guess
it might show up with veth coming from a VM, and I indeed forgot about it.

  reply	other threads:[~2020-06-21  3:24 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 [this message]
2020-06-21 10:03                   ` Jan Engelhardt
2020-06-21 18:48                     ` Eugene Crosser
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=20200621032429.GH26990@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=crosser@average.org \
    --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).