From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6154042DE6; Thu, 6 Jul 2023 11:08:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4B88F40F16; Thu, 6 Jul 2023 11:08:35 +0200 (CEST) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id A246440A79 for ; Thu, 6 Jul 2023 11:08:33 +0200 (CEST) Received: from frapeml100006.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QxVx932jkz67kN5; Thu, 6 Jul 2023 17:05:33 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml100006.china.huawei.com (7.182.85.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 6 Jul 2023 11:08:32 +0200 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.027; Thu, 6 Jul 2023 11:08:32 +0200 From: Konstantin Ananyev To: Akhil Goyal , Xiao Liang , Konstantin Ananyev , Vladimir Medvedkin , "radu.nicolau@intel.com" CC: "dev@dpdk.org" Subject: RE: [EXT] [PATCH] ipsec: fix NAT-T length calculation Thread-Topic: [EXT] [PATCH] ipsec: fix NAT-T length calculation Thread-Index: AQHZcdJbU289XHpGckCTjP62GarLfq+rif+AgAFkS5A= Date: Thu, 6 Jul 2023 09:08:32 +0000 Message-ID: References: <20230418084613.52740-1-shaw.leon@gmail.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Hi Akhil, >=20 > Hi Konstantin, > Can you review this patch? >=20 > > UDP header length is included in sa->hdr_len. Take care of that in > > L3 header and pakcet length calculation. > > > > Fixes: 01eef5907fc3 ("ipsec: support NAT-T") > > > > Signed-off-by: Xiao Liang > > --- > > lib/ipsec/esp_outb.c | 2 +- > > lib/ipsec/sa.c | 2 +- > > 2 files changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/lib/ipsec/esp_outb.c b/lib/ipsec/esp_outb.c > > index 9cbd9202f6..ec87b1dce2 100644 > > --- a/lib/ipsec/esp_outb.c > > +++ b/lib/ipsec/esp_outb.c > > @@ -198,7 +198,7 @@ outb_tun_pkt_prepare(struct rte_ipsec_sa *sa, > > rte_be64_t sqc, > > struct rte_udp_hdr *udph =3D (struct rte_udp_hdr *) > > (ph + sa->hdr_len - sizeof(struct rte_udp_hdr)); > > udph->dgram_len =3D rte_cpu_to_be_16(mb->pkt_len - sqh_len - > > - sa->hdr_l3_off - sa->hdr_len); > > + sa->hdr_len + sizeof(struct rte_udp_hdr)); To be honest, it is not clear to me why we shouldn't take into account sa->= hdr_l3_off any more. Probably the author can explain. Also would like author of NAT-T support to chime in. Radu, any comments on that patch? Thanks Konstantin > > } > > > > /* update original and new ip header fields */ > > diff --git a/lib/ipsec/sa.c b/lib/ipsec/sa.c > > index 59a547637d..2297bd6d72 100644 > > --- a/lib/ipsec/sa.c > > +++ b/lib/ipsec/sa.c > > @@ -371,7 +371,7 @@ esp_outb_tun_init(struct rte_ipsec_sa *sa, const st= ruct > > rte_ipsec_sa_prm *prm) > > > > /* update l2_len and l3_len fields for outbound mbuf */ > > sa->tx_offload.val =3D rte_mbuf_tx_offload(sa->hdr_l3_off, > > - sa->hdr_len - sa->hdr_l3_off, 0, 0, 0, 0, 0); > > + prm->tun.hdr_len - sa->hdr_l3_off, 0, 0, 0, 0, 0); > > > > esp_outb_init(sa, sa->hdr_len, prm->ipsec_xform.esn.value); > > } > > -- > > 2.40.0