[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210125113231.3fac0e10@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Mon, 25 Jan 2021 11:32:31 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: David Ahern <dsahern@...il.com>
Cc: Justin Iurman <justin.iurman@...ege.be>, netdev@...r.kernel.org,
davem@...emloft.net, alex aring <alex.aring@...il.com>
Subject: Re: [PATCH net 1/1] uapi: fix big endian definition of
ipv6_rpl_sr_hdr
On Sun, 24 Jan 2021 11:57:03 -0700 David Ahern wrote:
> On 1/24/21 2:57 AM, Justin Iurman wrote:
> >> De: "Jakub Kicinski" <kuba@...nel.org>
> >> À: "Justin Iurman" <justin.iurman@...ege.be>
> >> Cc: netdev@...r.kernel.org, davem@...emloft.net, "alex aring" <alex.aring@...il.com>
> >> Envoyé: Dimanche 24 Janvier 2021 05:54:44
> >> Objet: Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
> >
> >> On Thu, 21 Jan 2021 23:00:44 +0100 Justin Iurman wrote:
> >>> Following RFC 6554 [1], the current order of fields is wrong for big
> >>> endian definition. Indeed, here is how the header looks like:
> >>>
> >>> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> >>> | Next Header | Hdr Ext Len | Routing Type | Segments Left |
> >>> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> >>> | CmprI | CmprE | Pad | Reserved |
> >>> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> >>>
> >>> This patch reorders fields so that big endian definition is now correct.
> >>>
> >>> [1] https://tools.ietf.org/html/rfc6554#section-3
> >>>
> >>> Signed-off-by: Justin Iurman <justin.iurman@...ege.be>
> >>
> >> Are you sure? This looks right to me.
> >
> > AFAIK, yes. Did you mean the old (current) one looks right, or the new one?
Old one / existing is correct.
> > If you meant the old/current one, well, I don't understand why the big endian definition would look like this:
> >
> > #elif defined(__BIG_ENDIAN_BITFIELD)
> > __u32 reserved:20,
> > pad:4,
> > cmpri:4,
> > cmpre:4;
> >
> > When the RFC defines the header as follows:
> >
> > +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> > | CmprI | CmprE | Pad | Reserved |
> > +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> >
> > The little endian definition looks fine. But, when it comes to big endian, you define fields as you see them on the wire with the same order, right? So the current big endian definition makes no sense. It looks like it was a wrong mix with the little endian conversion.
Well, you don't list the bit positions in the quote from the RFC, and
I'm not familiar with the IETF parlor. I'm only comparing the LE
definition with the BE. If you claim the BE is wrong, then the LE is
wrong, too.
> >>> diff --git a/include/uapi/linux/rpl.h b/include/uapi/linux/rpl.h
> >>> index 1dccb55cf8c6..708adddf9f13 100644
> >>> --- a/include/uapi/linux/rpl.h
> >>> +++ b/include/uapi/linux/rpl.h
> >>> @@ -28,10 +28,10 @@ struct ipv6_rpl_sr_hdr {
> >>> pad:4,
> >>> reserved1:16;
> >>> #elif defined(__BIG_ENDIAN_BITFIELD)
> >>> - __u32 reserved:20,
> >>> + __u32 cmpri:4,
> >>> + cmpre:4,
> >>> pad:4,
> >>> - cmpri:4,
> >>> - cmpre:4;
> >>> + reserved:20;
> >>> #else
> >>> #error "Please fix <asm/byteorder.h>"
> >>> #endif
>
> cross-checking with other headers - tcp and vxlan-gpe - this patch looks
> correct.
What are you cross-checking?
Powered by blists - more mailing lists