[PATCH v3 2/6] net: fix L2TPv2 common header

Ori Kam orika at nvidia.com
Sun Jan 30 10:17:30 CET 2022



> -----Original Message-----
> From: Jie Wang <jie1x.wang at intel.com>
> Sent: Saturday, January 29, 2022 8:25 AM
> To: dev at dpdk.org
> Cc: stevex.yang at intel.com; Ori Kam <orika at nvidia.com>; aman.deep.singh at intel.com;
> ferruh.yigit at intel.com; NBU-Contact-Thomas Monjalon (EXTERNAL) <thomas at monjalon.net>;
> andrew.rybchenko at oktetlabs.ru; jingjing.wu at intel.com; beilei.xing at intel.com;
> qi.z.zhang at intel.com; olivier.matz at 6wind.com; Jie Wang <jie1x.wang at intel.com>; stable at dpdk.org
> Subject: [PATCH v3 2/6] net: fix L2TPv2 common header
> 
> The fields of L2TPv2 common header were reversed in big endian and
> little endian.
> 
> This patch fixes this error to ensure L2TPv2 can be parsed correctly.
> 
> Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Jie Wang <jie1x.wang at intel.com>
> ---
>  lib/net/rte_l2tpv2.h | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
> index 938a993b48..1f3ad3f03c 100644
> --- a/lib/net/rte_l2tpv2.h
> +++ b/lib/net/rte_l2tpv2.h
> @@ -89,16 +89,6 @@ struct rte_l2tpv2_common_hdr {
>  		__extension__
>  		struct {
>  #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
> -			uint16_t t:1;		/**< message Type */
> -			uint16_t l:1;		/**< length option bit */
> -			uint16_t res1:2;	/**< reserved */
> -			uint16_t s:1;		/**< ns/nr option bit */
> -			uint16_t res2:1;	/**< reserved */
> -			uint16_t o:1;		/**< offset option bit */
> -			uint16_t p:1;		/**< priority option bit */
> -			uint16_t res3:4;	/**< reserved */
> -			uint16_t ver:4;		/**< protocol version */
> -#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
>  			uint16_t ver:4;		/**< protocol version */
>  			uint16_t res3:4;	/**< reserved */
>  			uint16_t p:1;		/**< priority option bit */
> @@ -108,6 +98,16 @@ struct rte_l2tpv2_common_hdr {
>  			uint16_t res1:2;	/**< reserved */
>  			uint16_t l:1;		/**< length option bit */
>  			uint16_t t:1;		/**< message Type */
> +#elif RTE_BYTE_ORDER == RTE_BIG_ENDIAN
> +			uint16_t t:1;		/**< message Type */
> +			uint16_t l:1;		/**< length option bit */
> +			uint16_t res1:2;	/**< reserved */
> +			uint16_t s:1;		/**< ns/nr option bit */
> +			uint16_t res2:1;	/**< reserved */
> +			uint16_t o:1;		/**< offset option bit */
> +			uint16_t p:1;		/**< priority option bit */
> +			uint16_t res3:4;	/**< reserved */
> +			uint16_t ver:4;		/**< protocol version */
>  #endif
>  		};
>  	};
> --
> 2.25.1

Acked-by: Ori Kam <orika at nvidia.com>
Best,
Ori



More information about the stable mailing list