[v2,2/6] net: fix L2TPv2 common header
Checks
Commit Message
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")
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
---
lib/net/rte_l2tpv2.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
Comments
On 1/26/2022 6:30 AM, Jie Wang wrote:
> 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.
>
Just for reference, checked from RFC:
https://datatracker.ietf.org/doc/html/rfc2661#section-3.1
Change looks good to me. Cc'ed Olivier.
> Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")
>
Is it candidate for Cc: stable@dpdk.org backport?
> Signed-off-by: Jie Wang <jie1x.wang@intel.com>
<...>
> -----Original Message-----
> From: Yigit, Ferruh <ferruh.yigit@intel.com>
> Sent: Saturday, January 29, 2022 12:12 AM
> To: 20220124065613.2197436-1-jie1x.wang@intel.com; dev@dpdk.org; Olivier
> Matz <olivier.matz@6wind.com>
> Cc: Yang, SteveX <stevex.yang@intel.com>; orika@nvidia.com; Singh, Aman
> Deep <aman.deep.singh@intel.com>; thomas@monjalon.net;
> andrew.rybchenko@oktetlabs.ru; Wu, Jingjing <jingjing.wu@intel.com>; Xing,
> Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>; Wang,
> Jie1X <jie1x.wang@intel.com>
> Subject: Re: [PATCH v2 2/6] net: fix L2TPv2 common header
>
> On 1/26/2022 6:30 AM, Jie Wang wrote:
> > 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.
> >
>
> Just for reference, checked from RFC:
> https://datatracker.ietf.org/doc/html/rfc2661#section-3.1
>
> Change looks good to me. Cc'ed Olivier.
>
Thanks, I'll cc Olivier in v3.
> > Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")
> >
>
> Is it candidate for Cc: stable@dpdk.org backport?
>
Yes, thanks for your reminder.
> > Signed-off-by: Jie Wang <jie1x.wang@intel.com>
>
> <...>
@@ -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
};
};