From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 2/2] rule: don't reorder protocol payload expressions when merging
Date: Tue, 6 Oct 2015 12:33:28 +0200 [thread overview]
Message-ID: <20151006103328.GC12921@breakpoint.cc> (raw)
In-Reply-To: <1443237243-4571-2-git-send-email-fw@strlen.de>
Florian Westphal <fw@strlen.de> wrote:
> An instruction like
>
> bridge filter input ip saddr 1.2.3.4 ether saddr a:b:c:d:e:f
>
> is displayed as
>
> unknown unknown 0x1020304 [invalid type] ether saddr 00:0f:54:0c:11:04 ether type ip
>
> .. because the (implicit) 'ether type ip' that is injected before the
> network header match gets merged into the ether saddr instruction.
>
> This inverts the merge in case the merge candidate contains
> a next header protocol field.
>
> After this change, the rule will be displayed as
>
> bridge filter input ether saddr a:b:c:d:e:f ip saddr 1.2.3.4
One side-effect with this approach is that it will reorder the
instructions depending on the family dependencies.
So, f.e.
tcp dport 22 ip daddr 1.2.3.4 ether saddr 00:0f:54:0c:11:4
will be added/displayed as
tcp dport 22 ether saddr 00:0f:54:0c:11:04 ip daddr 1.2.3.4
for bridge family, but as
tcp dport 22 ip daddr 1.2.3.4 ether saddr 00:0f:54:0c:11:04
for ip and inet.
In the bridge case we do need a 'is this ip' dependency test, so we
now merge the ether saddr x into the (implicitly inserted)
'ether protocol ip' expression.
ip family doesn't have such a dependency, since network header is
always ipv4.
For INET the dependency is expressed via 'meta load nfproto', so
no payload merge takes place either.
I pushed a rebased version including tests to
https://git.breakpoint.cc/cgit/fw/nftables.git/log/?h=ether_tests_02
next prev parent reply other threads:[~2015-10-06 10:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-26 3:14 [PATCH nft 1/2] src: allow filtering on L2 header in inet family Florian Westphal
2015-09-26 3:14 ` [PATCH nft 2/2] rule: don't reorder protocol payload expressions when merging Florian Westphal
2015-10-06 10:33 ` Florian Westphal [this message]
2015-11-06 13:35 ` Pablo Neira Ayuso
2015-11-06 13:31 ` [PATCH nft 1/2] src: allow filtering on L2 header in inet family 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=20151006103328.GC12921@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.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).