ip_frag: fix the buf of fragmenting IPv4 fragment

Message ID 1635148553-50086-1-git-send-email-chcchc88@163.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series ip_frag: fix the buf of fragmenting IPv4 fragment |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/github-robot: build success github build: passed
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Huichao Cai Oct. 25, 2021, 7:55 a.m. UTC
The patch ("ip_frag: fix fragmenting IPv4 fragment") introduces
a bug and needs to be rolled back. This is because the patch
and variables "flag_offset" conflict with each other.

Bugzilla ID: 835
Fixes: 567473433b7e ("ip_frag: fix fragmenting IPv4 fragment")
Cc: stable@dpdk.org
Signed-off-by: huichao cai <chcchc88@163.com>
---
 lib/ip_frag/rte_ipv4_fragmentation.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
  

Comments

Ananyev, Konstantin Oct. 28, 2021, 12:24 p.m. UTC | #1
> Bugzilla ID: 835
> Fixes: 567473433b7e ("ip_frag: fix fragmenting IPv4 fragment")
> Cc: stable@dpdk.org
> Signed-off-by: huichao cai <chcchc88@163.com>
> ---
>  lib/ip_frag/rte_ipv4_fragmentation.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/lib/ip_frag/rte_ipv4_fragmentation.c b/lib/ip_frag/rte_ipv4_fragmentation.c
> index fead5a9..2e7739d 100644
> --- a/lib/ip_frag/rte_ipv4_fragmentation.c
> +++ b/lib/ip_frag/rte_ipv4_fragmentation.c
> @@ -75,7 +75,7 @@ static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
>  	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, not_last_frag;
> +	uint16_t frag_bytes_remaining;
> 
>  	/*
>  	 * Formal parameter checking.
> @@ -116,9 +116,7 @@ static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
>  	in_seg = pkt_in;
>  	in_seg_data_pos = header_len;
>  	out_pkt_pos = 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);
> +	fragment_offset = 0;
> 
>  	more_in_segs = 1;
>  	while (likely(more_in_segs)) {
> @@ -188,8 +186,7 @@ static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
> 
>  		__fill_ipv4hdr_frag(out_hdr, in_hdr, header_len,
>  		    (uint16_t)out_pkt->pkt_len,
> -		    flag_offset, fragment_offset,
> -		    not_last_frag || more_in_segs);
> +		    flag_offset, fragment_offset, more_in_segs);
> 
>  		fragment_offset = (uint16_t)(fragment_offset +
>  		    out_pkt->pkt_len - header_len);
> --
> 1.8.3.1

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
  
Thomas Monjalon Nov. 8, 2021, 10:54 p.m. UTC | #2
> > Bugzilla ID: 835
> > Fixes: 567473433b7e ("ip_frag: fix fragmenting IPv4 fragment")
> > Cc: stable@dpdk.org
> > Signed-off-by: huichao cai <chcchc88@163.com>
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

Revert applied, thanks.
  

Patch

diff --git a/lib/ip_frag/rte_ipv4_fragmentation.c b/lib/ip_frag/rte_ipv4_fragmentation.c
index fead5a9..2e7739d 100644
--- a/lib/ip_frag/rte_ipv4_fragmentation.c
+++ b/lib/ip_frag/rte_ipv4_fragmentation.c
@@ -75,7 +75,7 @@  static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
 	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, not_last_frag;
+	uint16_t frag_bytes_remaining;
 
 	/*
 	 * Formal parameter checking.
@@ -116,9 +116,7 @@  static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
 	in_seg = pkt_in;
 	in_seg_data_pos = header_len;
 	out_pkt_pos = 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);
+	fragment_offset = 0;
 
 	more_in_segs = 1;
 	while (likely(more_in_segs)) {
@@ -188,8 +186,7 @@  static inline void __free_fragments(struct rte_mbuf *mb[], uint32_t num)
 
 		__fill_ipv4hdr_frag(out_hdr, in_hdr, header_len,
 		    (uint16_t)out_pkt->pkt_len,
-		    flag_offset, fragment_offset,
-		    not_last_frag || more_in_segs);
+		    flag_offset, fragment_offset, more_in_segs);
 
 		fragment_offset = (uint16_t)(fragment_offset +
 		    out_pkt->pkt_len - header_len);