From: Florian Westphal <fw@strlen.de>
To: Shivani Bhardwaj <shivanib134@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] extensions: libxt_connlabel: Add translation to nft
Date: Sun, 6 Mar 2016 01:07:03 +0100 [thread overview]
Message-ID: <20160306000703.GA31513@breakpoint.cc> (raw)
In-Reply-To: <20160305214746.GA16464@gmail.com>
Shivani Bhardwaj <shivanib134@gmail.com> wrote:
> Add translation for connlabel to nftables.
> Full translation for this match awaits the support for --set option.
Hmm, I sent patches for that a while ago, don't know why they were
not applied... Pablo?
> Examples:
>
> $ sudo iptables-translate -A INPUT -m connlabel --label eth0-in
> nft add rule ip filter INPUT ct label eth0-in counter
Looks good, thanks!
> $ sudo iptables-translate -A INPUT -m connlabel ! --label eth0-out
> nft add rule ip filter INPUT ct label != eth0-out counter
This one however is not correct.
It will match when eth0-out is not set, yes, but it will also match
if eth0-out and something else is also set.
(!= generates
[ cmp neq reg 1 0x00000004 0x00000000 0x00000000 0x00000000 ]
This should do the same thing as the -m connlabel ! --label ... command:
nft add rule ip filter INPUT ct label & eth0-in != eth0-in counter
[ ct load label => reg 1 ]
[ bitwise reg 1 = (reg=1 & 0x00000004 0x00000000 0x00000000 0x00000000 ) ^ 0x00000000 0x00000000 0x00000000 0x00000000 ]
[ cmp neq reg 1 0x00000004 0x00000000 0x00000000 0x00000000 ]
... so we load labels, then mask out everything except eth0-in, then
we check that this bit was not set.
next prev parent reply other threads:[~2016-03-06 0:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-05 21:47 [PATCH] extensions: libxt_connlabel: Add translation to nft Shivani Bhardwaj
2016-03-06 0:07 ` Florian Westphal [this message]
2016-03-07 13:05 ` Pablo Neira Ayuso
2016-03-07 13:25 ` Shivani Bhardwaj
2016-03-07 13:30 ` Florian Westphal
2016-03-07 13:33 ` Pablo Neira Ayuso
2016-03-07 13:32 ` Pablo Neira Ayuso
2016-03-07 13:33 ` Shivani Bhardwaj
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=20160306000703.GA31513@breakpoint.cc \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=shivanib134@gmail.com \
/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).