From: Patrick McHardy <kaber@trash.net>
To: Florian Westphal <fw@strlen.de>
Cc: pablo@netfilter.org, netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] proto: fix VLAN header definition
Date: Fri, 27 Nov 2015 11:00:30 +0000 [thread overview]
Message-ID: <20151127110029.GI4263@macbook.localdomain> (raw)
In-Reply-To: <20151127105417.GE15392@breakpoint.cc>
On 27.11, Florian Westphal wrote:
> Patrick McHardy <kaber@trash.net> wrote:
> > Yes, I also did that and it looks correct. I think we probably have a
> > discrepancy with bit numbering:
> >
> > Looking at an older patch of you:
> >
> > - [IPHDR_VERSION] = HDR_BITFIELD("version", &integer_type, 0, 4),
> > - [IPHDR_HDRLENGTH] = HDR_BITFIELD("hdrlength", &integer_type, 4, 4),
> > + [IPHDR_VERSION] = HDR_BITFIELD("version", &integer_type, 4, 4),
> > + [IPHDR_HDRLENGTH] = HDR_BITFIELD("hdrlength", &integer_type, 0, 4),
> >
> > So you seem to assume a numbering which corresponds to how you would express
> > it in C. My patch assumes numbering as used in the RFCs/IEEE standards, which
> > is basically the opposite direction.
>
> Right, there is a general problem with all sub-byte fields.
>
> I just noticed that decoding of ip version/hdrlen doesn't work either.
> (ip hdrlength 4 ip version 5).
>
> I am sure that I tested matching on ip version/hdrlen on both
> x86-64 and a MSB machine (don't recall architecture, ppc i think).
Yeah, the actual variant chosen doesn't matter, I guess we just need to make
sure it is handled consistently. I chose the other way because you can simply
use the offsets defined in the standards. That's how I (think I) expressed
all the protocol definitions, so if we're using the other way around, we'll
possibly have some more bitfields which are not correct with the current code.
I'll do a audit of the code and the other definitions and see which way would
be easier to fix.
next prev parent reply other threads:[~2015-11-27 11:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 9:13 [PATCH nft] proto: fix VLAN header definition Patrick McHardy
2015-11-27 9:49 ` Florian Westphal
2015-11-27 9:54 ` Patrick McHardy
2015-11-27 10:34 ` Florian Westphal
2015-11-27 10:42 ` Florian Westphal
2015-11-27 10:49 ` Patrick McHardy
2015-11-27 10:54 ` Florian Westphal
2015-11-27 11:00 ` Patrick McHardy [this message]
2015-11-28 23:32 ` Pablo Neira Ayuso
2015-11-29 0:09 ` Florian Westphal
2015-11-29 22:00 ` Pablo Neira Ayuso
2015-11-29 22:37 ` Florian Westphal
2015-11-30 12:31 ` Pablo Neira Ayuso
2015-11-30 13:53 ` Florian Westphal
2015-11-30 13:57 ` 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=20151127110029.GI4263@macbook.localdomain \
--to=kaber@trash.net \
--cc=fw@strlen.de \
--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 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).