[dpdk-stable] patch 'ip_frag: fix fragmenting IPv4 fragment' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:30:09 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/8250620e98bcc548945a3879d861ad9d9ee542c3

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 8250620e98bcc548945a3879d861ad9d9ee542c3 Mon Sep 17 00:00:00 2001
From: Huichao Cai <chcchc88 at 163.com>
Date: Sat, 9 Oct 2021 15:27:04 +0800
Subject: [PATCH] ip_frag: fix fragmenting IPv4 fragment
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 567473433b7e63e12943be29926c13bd491bcca6 ]

Current implementation of rte_ipv4_fragment_packet() doesn’t take
into account offset and flag values of the given packet, but blindly
assumes they are always zero (original packet is not fragmented).
According to RFC791, fragment and flag values for new fragment
should take into account values provided in the original IPv4 packet.

Fixes: 4c38e5532a07 ("ip_frag: refactor IPv4 fragmentation into a proper library")

Signed-off-by: Huichao Cai <chcchc88 at 163.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev at intel.com>
---
 lib/librte_ip_frag/rte_ipv4_fragmentation.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c
index 2e7739d027..fead5a985a 100644
--- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c
+++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c
@@ -75,7 +75,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 	uint32_t out_pkt_pos, in_seg_data_pos;
 	uint32_t more_in_segs;
 	uint16_t fragment_offset, flag_offset, frag_size, header_len;
-	uint16_t frag_bytes_remaining;
+	uint16_t frag_bytes_remaining, not_last_frag;
 
 	/*
 	 * Formal parameter checking.
@@ -116,7 +116,9 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 	in_seg = pkt_in;
 	in_seg_data_pos = header_len;
 	out_pkt_pos = 0;
-	fragment_offset = 0;
+	fragment_offset = (uint16_t)((flag_offset &
+	    RTE_IPV4_HDR_OFFSET_MASK) << RTE_IPV4_HDR_FO_SHIFT);
+	not_last_frag = (uint16_t)(flag_offset & IPV4_HDR_MF_MASK);
 
 	more_in_segs = 1;
 	while (likely(more_in_segs)) {
@@ -186,7 +188,8 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
 
 		__fill_ipv4hdr_frag(out_hdr, in_hdr, header_len,
 		    (uint16_t)out_pkt->pkt_len,
-		    flag_offset, fragment_offset, more_in_segs);
+		    flag_offset, fragment_offset,
+		    not_last_frag || more_in_segs);
 
 		fragment_offset = (uint16_t)(fragment_offset +
 		    out_pkt->pkt_len - header_len);
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:07.516214039 +0800
+++ 0125-ip_frag-fix-fragmenting-IPv4-fragment.patch	2021-11-10 14:17:01.887412621 +0800
@@ -1 +1 @@
-From 567473433b7e63e12943be29926c13bd491bcca6 Mon Sep 17 00:00:00 2001
+From 8250620e98bcc548945a3879d861ad9d9ee542c3 Mon Sep 17 00:00:00 2001
@@ -7,0 +8,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 567473433b7e63e12943be29926c13bd491bcca6 ]
@@ -16 +18,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
- lib/ip_frag/rte_ipv4_fragmentation.c | 9 ++++++---
+ lib/librte_ip_frag/rte_ipv4_fragmentation.c | 9 ++++++---
@@ -24 +26 @@
-diff --git a/lib/ip_frag/rte_ipv4_fragmentation.c b/lib/ip_frag/rte_ipv4_fragmentation.c
+diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c
@@ -26,2 +28,2 @@
---- a/lib/ip_frag/rte_ipv4_fragmentation.c
-+++ b/lib/ip_frag/rte_ipv4_fragmentation.c
+--- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c
++++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c


More information about the stable mailing list