ip_frag: ensure minimum v6 fragmentation length

In addition, do a formal parameter check.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
This commit is contained in:
Aaron Conole 2020-04-20 15:25:22 -04:00 committed by Thomas Monjalon
parent c2cad3f6bc
commit cf5a605da6
2 changed files with 11 additions and 0 deletions

View file

@ -79,6 +79,15 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
uint16_t fragment_offset, frag_size;
uint64_t frag_bytes_remaining;
/*
* Formal parameter checking.
*/
if (unlikely(pkt_in == NULL) || unlikely(pkts_out == NULL) ||
unlikely(nb_pkts_out == 0) ||
unlikely(pool_direct == NULL) || unlikely(pool_indirect == NULL) ||
unlikely(mtu_size < RTE_IPV6_MIN_MTU))
return -EINVAL;
/*
* Ensure the IP payload length of all fragments (except the
* the last fragment) are a multiple of 8 bytes per RFC2460.

View file

@ -371,6 +371,8 @@ struct rte_ipv6_hdr {
#define RTE_IPV6_HDR_ECN_MASK (0x03 << RTE_IPV6_HDR_TC_SHIFT)
#define RTE_IPV6_HDR_ECN_CE RTE_IPV6_HDR_ECN_MASK
#define RTE_IPV6_MIN_MTU 1280 /**< Minimum MTU for IPv6, see RFC 8200. */
/**
* Process the pseudo-header checksum of an IPv6 header.
*