From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Giuseppe Longo <giuseppelng@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [{ip,ip6}tables-compat PATCH] nft: fix network prefixes
Date: Tue, 26 Aug 2014 10:55:13 +0200 [thread overview]
Message-ID: <20140826085513.GA3800@salvia> (raw)
In-Reply-To: <1409000096-4335-1-git-send-email-giuseppelng@gmail.com>
On Mon, Aug 25, 2014 at 10:54:56PM +0200, Giuseppe Longo wrote:
> This is fixing the network prefixes (eg. /24) in the {ip,ip6} compat utility
>
> The following below
Please, include the command line that generates this code as well.
> generate respectively the following netlink code:
> ip filter INPUT 20
> [ payload load 1b @ network header + 9 => reg 1 ]
> [ cmp eq reg 1 0x00000006 ]
> [ payload load 4b @ network header + 12 => reg 1 ]
> [ cmp eq reg 1 0x0000a8c0 ]
> [ match name tcp rev 0 ]
> [ match name conntrack rev 3 ]
> [ counter pkts 0 bytes 0 ]
> [ immediate reg 0 accept ]
>
> ip6 filter INPUT 36
> [ payload load 16b @ network header + 8 => reg 1 ]
> [ cmp eq reg 1 0x00004023 0x00000000 0x00000000 0x00000000 ]
> [ counter pkts 0 bytes 0 ]
> [ immediate reg 0 accept ]
>
> With this patch the netlink code becomes:
>
> ip filter INPUT 20
> [ payload load 1b @ network header + 9 => reg 1 ]
> [ cmp eq reg 1 0x00000006 ]
> [ payload load 4b @ network header + 12 => reg 1 ]
> [ cmp eq reg 1 0x0000a8c0 ]
> [ bitwise reg 1 = (reg=1 & 0x00ffffff ) ^ 0x00000000 ]
# nft --debug=netlink add rule filter test ip saddr 192.168.0.0/24
ip filter test
[ payload load 4b @ network header + 12 => reg 1 ]
[ bitwise reg 1 = (reg=1 & 0x00ffffff ) ^ 0x00000000 ]
[ cmp eq reg 1 0x0000a8c0 ]
The bitwise has to come before the cmp.
Fix this a send a v2. Thanks.
next prev parent reply other threads:[~2014-08-26 8:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-25 20:54 [{ip,ip6}tables-compat PATCH] nft: fix network prefixes Giuseppe Longo
2014-08-26 8:55 ` Pablo Neira Ayuso [this message]
2014-08-26 11:43 ` Giuseppe Longo
2014-08-26 11:45 ` Giuseppe Longo
2014-08-26 19:29 ` Pablo Neira Ayuso
2014-08-27 11:17 ` Giuseppe Longo
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=20140826085513.GA3800@salvia \
--to=pablo@netfilter.org \
--cc=giuseppelng@gmail.com \
--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).