patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v2] ipsec: fix NAT-T header length calculation
       [not found] <20230418084613.52740-1-shaw.leon@gmail.com>
@ 2023-07-11  2:13 ` Xiao Liang
  2023-07-11  2:18 ` Xiao Liang
  1 sibling, 0 replies; 3+ messages in thread
From: Xiao Liang @ 2023-07-11  2:13 UTC (permalink / raw)
  To: dev; +Cc: stable, Konstantin Ananyev, Vladimir Medvedkin, Radu Nicolau

UDP header and L2 header (if any) length is included in sa->hdr_len.
Take care of that in L3 header and pakcet length caculation.

Fixes: 01eef5907fc3 ("ipsec: support NAT-T")
Cc: stable@dpdk.org

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
---
 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 = (struct rte_udp_hdr *)
 			(ph + sa->hdr_len - sizeof(struct rte_udp_hdr));
 		udph->dgram_len = 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));
 	}
 
 	/* 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 struct rte_ipsec_sa_prm *prm)
 
 	/* update l2_len and l3_len fields for outbound mbuf */
 	sa->tx_offload.val = 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.41.0


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

* [PATCH v2] ipsec: fix NAT-T header length calculation
       [not found] <20230418084613.52740-1-shaw.leon@gmail.com>
  2023-07-11  2:13 ` [PATCH v2] ipsec: fix NAT-T header length calculation Xiao Liang
@ 2023-07-11  2:18 ` Xiao Liang
  2023-07-11  8:48   ` [EXT] " Akhil Goyal
  1 sibling, 1 reply; 3+ messages in thread
From: Xiao Liang @ 2023-07-11  2:18 UTC (permalink / raw)
  To: dev; +Cc: stable, Konstantin Ananyev, Vladimir Medvedkin, Radu Nicolau

UDP header and L2 header (if any) length is included in sa->hdr_len.
Take care of that in L3 header and pakcet length calculation.

Fixes: 01eef5907fc3 ("ipsec: support NAT-T")
Cc: stable@dpdk.org

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
---
 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 = (struct rte_udp_hdr *)
 			(ph + sa->hdr_len - sizeof(struct rte_udp_hdr));
 		udph->dgram_len = 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));
 	}
 
 	/* 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 struct rte_ipsec_sa_prm *prm)
 
 	/* update l2_len and l3_len fields for outbound mbuf */
 	sa->tx_offload.val = 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.41.0


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

* RE: [EXT] [PATCH v2] ipsec: fix NAT-T header length calculation
  2023-07-11  2:18 ` Xiao Liang
@ 2023-07-11  8:48   ` Akhil Goyal
  0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2023-07-11  8:48 UTC (permalink / raw)
  To: Xiao Liang, dev
  Cc: stable, Konstantin Ananyev, Vladimir Medvedkin, Radu Nicolau

> UDP header and L2 header (if any) length is included in sa->hdr_len.
> Take care of that in L3 header and pakcet length calculation.
> 
> Fixes: 01eef5907fc3 ("ipsec: support NAT-T")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
> Acked-by: Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
> Acked-by: Radu Nicolau <radu.nicolau@intel.com>

You should supersede the previous versions in patchworks while sending the next version.

Applied to dpdk-next-crypto
Thanks

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

end of thread, other threads:[~2023-07-11  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230418084613.52740-1-shaw.leon@gmail.com>
2023-07-11  2:13 ` [PATCH v2] ipsec: fix NAT-T header length calculation Xiao Liang
2023-07-11  2:18 ` Xiao Liang
2023-07-11  8:48   ` [EXT] " Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).