]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_net/rte_ether.h
maintainers: remove documentation maintainers
[dpdk.git] / lib / librte_net / rte_ether.h
index 42f2c3288ca157a2f3819fe7688c4372837b24b1..060b63fc9bff9e441eb25ce059ed4c2a6d757422 100644 (file)
@@ -353,6 +353,10 @@ static inline int rte_vlan_insert(struct rte_mbuf **m)
        if (!RTE_MBUF_DIRECT(*m) || rte_mbuf_refcnt_read(*m) > 1)
                return -EINVAL;
 
+       /* Can't insert header if the first segment is too short */
+       if (rte_pktmbuf_data_len(*m) < 2 * RTE_ETHER_ADDR_LEN)
+               return -EINVAL;
+
        oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *);
        nh = (struct rte_ether_hdr *)
                rte_pktmbuf_prepend(*m, sizeof(struct rte_vlan_hdr));