src/dpdk/lib/librte_net/rte_net.c
int
rte_net_skip_ip6_ext(uint16_t proto, const struct rte_mbuf *m, uint32_t *off,
	int *frag)
{
	struct ext_hdr {
		uint8_t next_hdr;
		uint8_t len;
	};
	const struct ext_hdr *xh;
	struct ext_hdr xh_copy;
	unsigned int i;

	*frag = 0;

#define MAX_EXT_HDRS 5
	for (i = 0; i < MAX_EXT_HDRS; i++) {
		switch (proto) {
		case IPPROTO_HOPOPTS:
		case IPPROTO_ROUTING:
		case IPPROTO_DSTOPTS:
			xh = rte_pktmbuf_read(m, *off, sizeof(*xh),
				&xh_copy);
			if (xh == NULL)
				return -1;
			*off += (xh->len + 1) * 8;
			proto = xh->next_hdr;
			break;
		case IPPROTO_FRAGMENT:
			xh = rte_pktmbuf_read(m, *off, sizeof(*xh),
				&xh_copy);
			if (xh == NULL)
				return -1;
			*off += 8;
			proto = xh->next_hdr;
			*frag = 1;
			return proto; /* this is always the last ext hdr */
		case IPPROTO_NONE:
			return 0;
		default:
			return proto;
		}
	}
	return -1;
}
/* parse ipv6 extended headers, update offset and return next proto */
parse ipv6 extended headers, update offset and return next proto
parse ipv6 extended headers update offset and return next proto
int
rte_net_skip_ip6_ext(uint16_t proto, const struct rte_mbuf *m, uint32_t *off,
	int *frag)
{
	struct ext_hdr {
		uint8_t next_hdr;
		uint8_t len;
	};
	const struct ext_hdr *xh;
	struct ext_hdr xh_copy;
	unsigned int i;
	*frag = 0;
#define MAX_EXT_HDRS 5
	for (i = 0; i < MAX_EXT_HDRS; i++) {
		switch (proto) {
		case IPPROTO_HOPOPTS:
		case IPPROTO_ROUTING:
		case IPPROTO_DSTOPTS:
			xh = rte_pktmbuf_read(m, *off, sizeof(*xh),
				&xh_copy);
			if (xh == NULL)
				return -1;
			*off += (xh->len + 1) * 8;
			proto = xh->next_hdr;
			break;
		case IPPROTO_FRAGMENT:
			xh = rte_pktmbuf_read(m, *off, sizeof(*xh),
				&xh_copy);
			if (xh == NULL)
				return -1;
			*off += 8;
			proto = xh->next_hdr;
			*frag = 1;
			return proto; 
		case IPPROTO_NONE:
			return 0;
		default:
			return proto;
		}
	}
	return -1;
}
int rte_net_skip_ip6_ext ( uint16_t proto , const struct rte_mbuf * m , uint32_t * off , int * frag ) { struct ext_hdr { uint8_t next_hdr ; uint8_t len ; } ; const struct ext_hdr * xh ; struct ext_hdr xh_copy ; unsigned int i ; * frag = 0 ; #define MAX_EXT_HDRS  5 for ( i = 0 ; i < MAX_EXT_HDRS ; i ++ ) { switch ( proto ) { case IPPROTO_HOPOPTS : case IPPROTO_ROUTING : case IPPROTO_DSTOPTS : xh = rte_pktmbuf_read ( m , * off , sizeof ( * xh ) , & xh_copy ) ; if ( xh == NULL ) return -1 ; * off += ( xh -> len + 1 ) * 8 ; proto = xh -> next_hdr ; break ; case IPPROTO_FRAGMENT : xh = rte_pktmbuf_read ( m , * off , sizeof ( * xh ) , & xh_copy ) ; if ( xh == NULL ) return -1 ; * off += 8 ; proto = xh -> next_hdr ; * frag = 1 ; return proto ; case IPPROTO_NONE : return 0 ; default : return proto ; } } return -1 ; }
parse ipv6 extended headers, update offset and return next proto
parse ipv6 extended headers update offset and return next proto
/* this is always the last ext hdr */