From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, kaber@trash.net, fw@strlen.de
Subject: Re: [PATCH nft 2/2] src: fix sub-bytes protocol header definition
Date: Thu, 3 Dec 2015 01:21:35 +0100 [thread overview]
Message-ID: <20151203002135.GA31167@breakpoint.cc> (raw)
In-Reply-To: <1448991867-21247-2-git-send-email-pablo@netfilter.org>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> Update bitfield definitions to match according to the way they are
> expressed in RFC and IEEE specifications.
[..]
> len = round_up(expr->len, BITS_PER_BYTE);
>
> Then, we substract the offset bits and the bitfield length.
>
> shift = len - (offset + expr->len);
>
> From the delinearize, payload_expr_trim() needs to obtain the real
> offset through:
>
> off = round_up(mask->len, BITS_PER_BYTE) -
> mpz_fls(mask->value, mask->len);
>
> For vlan id (offset 12), this gets the position of the last bit set in
> the mask (ie. 12), then we substract the length we fetch in bytes (16),
> so we obtain the real bitfield offset (4).
>
> Then, we add that to the original payload offset that was expressed in
> bytes:
>
> payload_offset += off;
>
> Note that payload_expr_trim() now also adjusts the payload expression to
> its real length and offset.
>
> Reported-by: Patrick McHardy <kaber@trash.net>>
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> This aims to fix what we have, I'm willing to give another pass to this.
vlan type ip vlan id 4094 ip version 4 counter packets 567 bytes 37720
vlan type ip vlan id 4094 vlan pcp 0 vlan cfi 0 counter packets 567 bytes 37720
vlan type ip vlan id 4094 vlan pcp 1 vlan cfi 1 counter packets 0 bytes 0
vlan type ip vlan id 4094 vlan pcp 1 vlan cfi 0 counter packets 0 bytes 0
vlan type ip vlan id 4094 vlan pcp 0 vlan cfi 1 counter packets 0 bytes 0
tpcdump says:
'length 194: vlan 4094, p 0, ethertype IPv4', i.e. this looks correct.
Thanks Pablo!
next prev parent reply other threads:[~2015-12-03 0:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-01 17:44 [PATCH nft 1/2] tests: vlan pcp and cfi are located in the first byte Pablo Neira Ayuso
2015-12-01 17:44 ` [PATCH nft 2/2] src: fix sub-bytes protocol header definition Pablo Neira Ayuso
2015-12-03 0:21 ` Florian Westphal [this message]
2015-12-04 18:45 ` 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=20151203002135.GA31167@breakpoint.cc \
--to=fw@strlen.de \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--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 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.