From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nftables] meta: iif/oifname should be host byte order
Date: Tue, 24 Sep 2013 12:44:26 +0200 [thread overview]
Message-ID: <20130924104426.GA8151@localhost> (raw)
In-Reply-To: <1379685693-2854-1-git-send-email-fw@strlen.de>
On Fri, Sep 20, 2013 at 04:01:33PM +0200, Florian Westphal wrote:
> src/nft add rule filter output meta oifname eth0
>
> doesn't work on x86. Problem is that nft declares these as
> BYTEORDER_INVALID, but when converting the string mpz_import_data
> treats INVALID like BIG_ENDIAN.
>
> [ cmp eq reg 1 0x00000000 0x00000000 0x65000000 0x00306874 ]
>
> as kernel nft_cmp_eval basically boils down to
>
> memcmp(reg, skb->dev->name, sizeof(reg) comparision fails.
>
> with patch:
> [ cmp eq reg 1 0x30687465 0x00000000 0x00000000 0x00000000 ]
Applied with small change:
Error: Byteorder mismatch: expected invalid, got host endian
add rule filter output ct helper "ftp" counter
^^^^^
I was hitting that error here. I have mangled your patch to change
endianess of the helper name, I couldn't find any other string type in
the current tree that needs to be adjusted.
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> On a related note:
> Instead of
> memcmp(register, devicename, strlen(register)+1) [i.e., strcmp]
> The comparision in kernel is always
> memcmp(register, dev->name, IFNAMSIZ).
>
> IOW, why does expr_evaluate_value() replace the interface names
> string length with the template length (IFNAMSIZ)?
I see, it's adjusting the expression to use the type length. I cannot
currently find a reason any reason for not changing that.
> It doesn't seem to be needed, and without it supporting
> iptables-style wildcard name match (oifname "eth+") should be quite simple.
We support this in iptables-nftables, to interpret the data from the
kernel the assumption is that if_nametoindex fails to resolve the
interface name, then it handles the interface name as an interface
wildcard. But that's a problem, if the interface is removed, all
existing rules for it will be interpreted as wildcard.
Regards.
prev parent reply other threads:[~2013-09-24 10:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-20 14:01 [PATCH nftables] meta: iif/oifname should be host byte order Florian Westphal
2013-09-24 10:44 ` Pablo Neira Ayuso [this message]
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=20130924104426.GA8151@localhost \
--to=pablo@netfilter.org \
--cc=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).