All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/1] Fix big endian definition of ipv6_rpl_sr_hdr
@ 2021-01-21 22:00 Justin Iurman
  2021-01-21 22:00 ` [PATCH net 1/1] uapi: fix " Justin Iurman
  2021-01-25 23:30 ` [PATCH net 0/1] Fix " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 11+ messages in thread
From: Justin Iurman @ 2021-01-21 22:00 UTC (permalink / raw)
  To: netdev; +Cc: davem, alex.aring, Justin Iurman

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


Justin Iurman (1):
  uapi: fix big endian definition of ipv6_rpl_sr_hdr

 include/uapi/linux/rpl.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-21 22:00 [PATCH net 0/1] Fix big endian definition of ipv6_rpl_sr_hdr Justin Iurman
@ 2021-01-21 22:00 ` Justin Iurman
  2021-01-24  4:54   ` Jakub Kicinski
  2021-01-25 23:30 ` [PATCH net 0/1] Fix " patchwork-bot+netdevbpf
  1 sibling, 1 reply; 11+ messages in thread
From: Justin Iurman @ 2021-01-21 22:00 UTC (permalink / raw)
  To: netdev; +Cc: davem, alex.aring, Justin Iurman

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@uliege.be>
---
 include/uapi/linux/rpl.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-21 22:00 ` [PATCH net 1/1] uapi: fix " Justin Iurman
@ 2021-01-24  4:54   ` Jakub Kicinski
  2021-01-24  9:57     ` Justin Iurman
  0 siblings, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2021-01-24  4:54 UTC (permalink / raw)
  To: Justin Iurman; +Cc: netdev, davem, alex.aring

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@uliege.be>

Are you sure? This looks right to me.

> 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-24  4:54   ` Jakub Kicinski
@ 2021-01-24  9:57     ` Justin Iurman
  2021-01-24 18:57       ` David Ahern
  0 siblings, 1 reply; 11+ messages in thread
From: Justin Iurman @ 2021-01-24  9:57 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, davem, alex aring

> De: "Jakub Kicinski" <kuba@kernel.org>
> À: "Justin Iurman" <justin.iurman@uliege.be>
> Cc: netdev@vger.kernel.org, davem@davemloft.net, "alex aring" <alex.aring@gmail.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@uliege.be>
> 
> Are you sure? This looks right to me.

AFAIK, yes. Did you mean the old (current) one looks right, or the new one? 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.

>> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-24  9:57     ` Justin Iurman
@ 2021-01-24 18:57       ` David Ahern
  2021-01-25 19:32         ` Jakub Kicinski
  0 siblings, 1 reply; 11+ messages in thread
From: David Ahern @ 2021-01-24 18:57 UTC (permalink / raw)
  To: Justin Iurman, Jakub Kicinski; +Cc: netdev, davem, alex aring

On 1/24/21 2:57 AM, Justin Iurman wrote:
>> De: "Jakub Kicinski" <kuba@kernel.org>
>> À: "Justin Iurman" <justin.iurman@uliege.be>
>> Cc: netdev@vger.kernel.org, davem@davemloft.net, "alex aring" <alex.aring@gmail.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@uliege.be>
>>
>> Are you sure? This looks right to me.
> 
> AFAIK, yes. Did you mean the old (current) one looks right, or the new one? 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.
> 
>>> 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-24 18:57       ` David Ahern
@ 2021-01-25 19:32         ` Jakub Kicinski
  2021-01-25 20:12           ` David Ahern
  2021-01-25 21:11           ` Justin Iurman
  0 siblings, 2 replies; 11+ messages in thread
From: Jakub Kicinski @ 2021-01-25 19:32 UTC (permalink / raw)
  To: David Ahern; +Cc: Justin Iurman, netdev, davem, alex aring

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@kernel.org>
> >> À: "Justin Iurman" <justin.iurman@uliege.be>
> >> Cc: netdev@vger.kernel.org, davem@davemloft.net, "alex aring" <alex.aring@gmail.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@uliege.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?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-25 19:32         ` Jakub Kicinski
@ 2021-01-25 20:12           ` David Ahern
  2021-01-25 20:25             ` Jakub Kicinski
  2021-01-25 21:11           ` Justin Iurman
  1 sibling, 1 reply; 11+ messages in thread
From: David Ahern @ 2021-01-25 20:12 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: Justin Iurman, netdev, davem, alex aring

On 1/25/21 12:32 PM, Jakub Kicinski wrote:
>>>>> 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?
> 

https://tools.ietf.org/html/draft-ietf-nvo3-vxlan-gpe-10, Section 3.1
header definition and vxlanhdr_gpe in include/net/vxlan.h. The
__BIG_ENDIAN_BITFIELD part follows the definition in the spec.

Similarly for the TCP header - RFC header definition and tcphdr in
include/uapi/linux/tcp.h. TCP header shows doff + res1 order which is
comparable to cmpri + cpmre in this header as both sets are 4-bits and
start a word.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-25 20:12           ` David Ahern
@ 2021-01-25 20:25             ` Jakub Kicinski
  0 siblings, 0 replies; 11+ messages in thread
From: Jakub Kicinski @ 2021-01-25 20:25 UTC (permalink / raw)
  To: David Ahern; +Cc: Justin Iurman, netdev, davem, alex aring

On Mon, 25 Jan 2021 13:12:42 -0700 David Ahern wrote:
> On 1/25/21 12:32 PM, Jakub Kicinski wrote:
> >>>>> 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?
> >   
> 
> https://tools.ietf.org/html/draft-ietf-nvo3-vxlan-gpe-10, Section 3.1
> header definition and vxlanhdr_gpe in include/net/vxlan.h. The
> __BIG_ENDIAN_BITFIELD part follows the definition in the spec.
> 
> Similarly for the TCP header - RFC header definition and tcphdr in
> include/uapi/linux/tcp.h. TCP header shows doff + res1 order which is
> comparable to cmpri + cpmre in this header as both sets are 4-bits and
> start a word.

Ack, thanks for the pointers. The LE definition is broken as well,
then, right?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-25 19:32         ` Jakub Kicinski
  2021-01-25 20:12           ` David Ahern
@ 2021-01-25 21:11           ` Justin Iurman
  2021-01-25 21:47             ` Jakub Kicinski
  1 sibling, 1 reply; 11+ messages in thread
From: Justin Iurman @ 2021-01-25 21:11 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: David Ahern, netdev, davem, alex aring



> Le 25 janv. 2021 à 20:32, Jakub Kicinski <kuba@kernel.org> a écrit :
> 
>> 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@kernel.org>
>>>> À: "Justin Iurman" <justin.iurman@uliege.be>
>>>> Cc: netdev@vger.kernel.org, davem@davemloft.net, "alex aring" <alex.aring@gmail.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@uliege.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

Indeed, sorry for that. Bit positions are available if you follow the link to the RFC I referenced in the patch. It is always defined as network byte order by default (=BE).

> comparing the LE
> definition with the BE. If you claim the BE is wrong, then the LE is
> wrong, too.

Actually, no, it’s not. If you have a look at the header definition from the RFC, you can see that the LE is correct (valid translation from BE, the *new* BE in this patch).

>>>>> 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?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net 1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-25 21:11           ` Justin Iurman
@ 2021-01-25 21:47             ` Jakub Kicinski
  0 siblings, 0 replies; 11+ messages in thread
From: Jakub Kicinski @ 2021-01-25 21:47 UTC (permalink / raw)
  To: Justin Iurman; +Cc: David Ahern, netdev, davem, alex aring

On Mon, 25 Jan 2021 22:11:35 +0100 (CET) Justin Iurman wrote:
> >>> 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  
> 
> Indeed, sorry for that. Bit positions are available if you follow the link to the RFC I referenced in the patch. It is always defined as network byte order by default (=BE).
> 
> > comparing the LE
> > definition with the BE. If you claim the BE is wrong, then the LE is
> > wrong, too.  
> 
> Actually, no, it’s not. If you have a look at the header definition from the RFC, you can see that the LE is correct (valid translation from BE, the *new* BE in this patch).

Sigh, I see it now. Thanks!

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH net 0/1] Fix big endian definition of ipv6_rpl_sr_hdr
  2021-01-21 22:00 [PATCH net 0/1] Fix big endian definition of ipv6_rpl_sr_hdr Justin Iurman
  2021-01-21 22:00 ` [PATCH net 1/1] uapi: fix " Justin Iurman
@ 2021-01-25 23:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 11+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-25 23:30 UTC (permalink / raw)
  To: Justin Iurman; +Cc: netdev, davem, alex.aring

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu, 21 Jan 2021 23:00:43 +0100 you 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                |
> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> 
> [...]

Here is the summary with links:
  - [net,1/1] uapi: fix big endian definition of ipv6_rpl_sr_hdr
    https://git.kernel.org/netdev/net/c/07d46d93c9ac

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-01-26 19:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 22:00 [PATCH net 0/1] Fix big endian definition of ipv6_rpl_sr_hdr Justin Iurman
2021-01-21 22:00 ` [PATCH net 1/1] uapi: fix " Justin Iurman
2021-01-24  4:54   ` Jakub Kicinski
2021-01-24  9:57     ` Justin Iurman
2021-01-24 18:57       ` David Ahern
2021-01-25 19:32         ` Jakub Kicinski
2021-01-25 20:12           ` David Ahern
2021-01-25 20:25             ` Jakub Kicinski
2021-01-25 21:11           ` Justin Iurman
2021-01-25 21:47             ` Jakub Kicinski
2021-01-25 23:30 ` [PATCH net 0/1] Fix " patchwork-bot+netdevbpf

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.