X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_ip_frag%2Frte_ipv4_fragmentation.c;h=e9de335ae20109ceaadff903d7eb346d12fc990a;hb=ae9000ada946b54d29b33e84dc7d06cd2ab221c4;hp=221d74e1d23549edb0f7e2bb0919ae9bd54e37ed;hpb=24ac604ef7469eb5773c2504b313dd00257f8df3;p=dpdk.git diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c index 221d74e1d2..e9de335ae2 100644 --- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c +++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "ip_frag_common.h" @@ -76,6 +77,15 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, uint16_t fragment_offset, flag_offset, frag_size; uint16_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_ETHER_MIN_MTU)) + return -EINVAL; + /* * Ensure the IP payload length of all fragments is aligned to a * multiple of 8 bytes as per RFC791 section 2.3. @@ -173,7 +183,6 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in, fragment_offset = (uint16_t)(fragment_offset + out_pkt->pkt_len - sizeof(struct rte_ipv4_hdr)); - out_pkt->ol_flags |= PKT_TX_IP_CKSUM; out_pkt->l3_len = sizeof(struct rte_ipv4_hdr); /* Write the fragment to the output list */