netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Florian Westphal <fw@strlen.de>,
	netfilter-devel@vger.kernel.org, nevola@gmail.com
Subject: Re: [PATCH nft 2/2] doc: payload and conntrack statement
Date: Fri, 9 Sep 2016 01:49:44 +0200	[thread overview]
Message-ID: <20160908234944.GC26062@breakpoint.cc> (raw)
In-Reply-To: <20160908223015.GB29687@salvia>

Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> On Fri, Sep 09, 2016 at 12:16:56AM +0200, Florian Westphal wrote:
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> 
> Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> BTW, related to payload mangling, Laura sent me this report:
> 
> When adding this rule:
> 
>   # nft add rule netdev filter ingress \
>         ip daddr 192.168.0.92 tcp dport 80 \
>         ether daddr set 00:03:2d:2b:74:ec fwd to enp3s0
> 
> The listing shows:
> 
>   # nft list ruleset
>   table netdev filter {
>       chain ingress {
>          type filter hook ingress device enp0s25 priority 0; policy accept;
>          ip daddr 192.168.0.92 tcp dport http ether daddr set ec:74:2b:2d:03:00 fwd to "enp3s0"
>                                                               ^^^^^^^^^^^^^^^^^
> 
> Note that the MAC address is reversed, probably something wrong in the
> delinearize path. In case you have some spare cycle, I didn't look at
> this yet.

Too late for now, but it looks like the postprocessing
for payload statements does not set byteorder of the immediate value
(its 0/undefined).

For ip addresses this doesn't matter as 0 is treated like BIG_ENDIAN.
But ether_addr is set as HOST_ENDIAN.

The normal payload expression path contains conversion calls for this
case:

if (tmp->byteorder == BYTEORDER_HOST_ENDIAN)
           mpz_switch_byteorder(tmp->value, tmp->len / BITS_PER_BYTE);

Will check more later today.

  reply	other threads:[~2016-09-08 23:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 22:16 [PATCH nft 1/2] doc: update meta expression Florian Westphal
2016-09-08 22:16 ` [PATCH nft 2/2] doc: payload and conntrack statement Florian Westphal
2016-09-08 22:30   ` Pablo Neira Ayuso
2016-09-08 23:49     ` Florian Westphal [this message]
2016-09-08 22:23 ` [PATCH nft 1/2] doc: update meta expression 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=20160908234944.GC26062@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=nevola@gmail.com \
    --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).