netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Suryaputra <ssuryaextr@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH nf-next] netfilter: add support for matching IPv4 options
Date: Sat, 1 Jun 2019 22:27:06 -0400	[thread overview]
Message-ID: <20190602022706.GA24477@ubuntu> (raw)
In-Reply-To: <20190603123006.urztqvxyxcm7w3av@salvia>

On Mon, Jun 03, 2019 at 02:30:06PM +0200, Pablo Neira Ayuso wrote:
> > I developed this patchset to suit my employer needs and there is no plan
> > for a follow up patchset, however I think non-zero offset might be useful
> > in the future for tunneled packets.
> 
> For tunneled traffic, we can store the network offset in the
> nft_pktinfo object. Then, add a new extension to update this network
> offset to point to the network offset inside the tunnel header, and
> use this pkt->network_offset everywhere.

OK. I'm changing so that offset isn't being used as input. But, it's
still being passed as reference for output. See further response
below...

> I think this new IPv4 options extension should use priv->offset to
> match fields inside the IPv4 option specifically, just like in the
> IPv6 extensions and TCP options do. If you look on how the
> priv->offset is used in the existing code, this offset points to
> values that the specific option field conveys.

I believe that's what I have coded:

	err = ipv4_find_option(nft_net(pkt), skb, &offset, priv->type, NULL, NULL);
	if (priv->flags & NFT_EXTHDR_F_PRESENT) {
		*dest = (err >= 0);
		return;
	} else if (err < 0) {
		goto err;
	}
	offset += priv->offset;

offset is returned as the offset where it matches the sought priv->type
then priv->offset is added to get to the right field between the offset.

If this is satisfactory, I can submit v2 of the kernel patch.

Thanks,

Stephen.

  reply	other threads:[~2019-06-03 19:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23  9:38 [PATCH nf-next] netfilter: add support for matching IPv4 options Stephen Suryaputra
2019-05-31 17:11 ` Pablo Neira Ayuso
2019-05-31 19:35   ` Stephen Suryaputra
2019-06-01  0:22     ` Pablo Neira Ayuso
2019-06-01  8:27       ` Florian Westphal
2019-06-01  8:40         ` Pablo Neira Ayuso
2019-06-01  8:53           ` Florian Westphal
2019-06-01 15:04       ` Stephen Suryaputra
2019-06-03 12:30         ` Pablo Neira Ayuso
2019-06-02  2:27           ` Stephen Suryaputra [this message]
2019-06-10 15:50             ` Pablo Neira Ayuso

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=20190602022706.GA24477@ubuntu \
    --to=ssuryaextr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --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).