From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 1/2] evaluate: shift immediate value when adjusting size for csum fixup
Date: Thu, 17 Aug 2017 12:00:56 +0200 [thread overview]
Message-ID: <20170817100056.GA6928@salvia> (raw)
In-Reply-To: <20170816170156.11594-1-fw@strlen.de>
On Wed, Aug 16, 2017 at 07:01:55PM +0200, Florian Westphal wrote:
> nft add rule .. ip ttl set 64
>
> erronously mangles ip protocol instead of ttl.
>
> Because the kernel can't deal with odd-sized data (ttl is one byte) when
> doing checksum fixups, so the write to 'ttl' is turned into
>
> [ payload load 2b @ network header + 8 => reg 1 ]
> [ bitwise reg 1 = (reg=1 & 0x000000ff ) ^ $new_value ]
> [ payload write reg 1 => 2b @ network header + 8 csum_type 1 csum_off 10 csum_flags 0x0 ]
>
> While doing so, we did fail to shift the imm value, i.e.
> we clear the wrong half of the u16 (protocol) instead of csum.
>
> The correct mask is 0xff00, and $new_value needs to be shifted
> so we leave the protocol value (which is next to ttl) alone.
>
> Fixes: f9069cefdf ("netlink: make checksum fixup work with odd-sized header fields")
> Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
prev parent reply other threads:[~2017-08-17 10:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 17:01 [PATCH nft 1/2] evaluate: shift immediate value when adjusting size for csum fixup Florian Westphal
2017-08-16 17:01 ` [PATCH nft 2/2] tests: add test case for ttl/protocol set Florian Westphal
2017-08-17 10:01 ` Pablo Neira Ayuso
2017-08-17 10:00 ` 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=20170817100056.GA6928@salvia \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.