-static_always_inline
-int ip6_parse(const ip6_header_t *ip6, u32 buff_len,
- u8 *l4_protocol, u16 *l4_offset, u16 *frag_hdr_offset)
-{
- if (ip6->protocol == IP_PROTOCOL_IPV6_FRAGMENTATION) {
- *l4_protocol = ((ip6_frag_hdr_t *)(ip6 + 1))->next_hdr;
- *frag_hdr_offset = sizeof(*ip6);
- *l4_offset = sizeof(*ip6) + sizeof(ip6_frag_hdr_t);
- } else {
- *l4_protocol = ip6->protocol;
- *frag_hdr_offset = 0;
- *l4_offset = sizeof(*ip6);
- }
-
- return (buff_len < (*l4_offset + 4)) ||
- (clib_net_to_host_u16(ip6->payload_length) < (*l4_offset + 4 - sizeof(*ip6)));
-}
-