[PATCH] ip_frag: support IPv6 reassembly with extensions

Konstantin Ananyev konstantin.ananyev at huawei.com
Tue Sep 17 19:57:59 CEST 2024


> 
> On Mon, 26 Aug 2024 13:23:28 +0200
> <vignesh.purushotham.srinivas at ericsson.com> wrote:
> 
> > diff --git a/lib/ip_frag/ip_reassembly.h b/lib/ip_frag/ip_reassembly.h
> > index 54afed5417..429e74f1b3 100644
> > --- a/lib/ip_frag/ip_reassembly.h
> > +++ b/lib/ip_frag/ip_reassembly.h
> > @@ -54,6 +54,8 @@ struct __rte_cache_aligned ip_frag_pkt {
> >  	uint32_t total_size;                   /* expected reassembled size */
> >  	uint32_t frag_size;                    /* size of fragments received */
> >  	uint32_t last_idx;                     /* index of next entry to fill */
> > +	uint32_t exts_len;                     /* length of extension hdrs for first fragment */
> > +	uint8_t *next_proto;                   /* pointer of the next_proto field */
> >  	struct ip_frag frags[IP_MAX_FRAG_NUM]; /* fragments */
> >  };
> 
> This creates a 32 bit hole in the structure.
> Better to put next_proto after the start field.

Another alternative - use offset within the mbuf instead of pointer.

> 
> > +
> > +	while (next_proto != IPPROTO_FRAGMENT &&
> > +		num_exts < MAX_NUM_IPV6_EXTS &&
> > +		(next_proto = rte_ipv6_get_next_ext(
> > +		*last_ext, next_proto, &ext_len)) >= 0) {
> 
> I would break up this loop condition for clarity.

+ 1

> Something like:
> 
> 	while (next_proto != IPPROTO_FRAGMENT && num_exts < MAX_NUM_IPV6_EXTS) {
> 		next_proto = rte_ipv6_get_next_ext(*last_ext, next_proto, &ext_len);
> 		if (next_proto < 0)
> 			break
> 
> Also, need a new test cases for this.

Agree, that would be good thing to add.


More information about the dev mailing list