net: add rte prefix to ether structures
[dpdk.git] / lib / librte_gro / gro_tcp4.c
index 2c0f35c..2842195 100644 (file)
@@ -194,11 +194,12 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
                struct gro_tcp4_tbl *tbl,
                uint64_t start_time)
 {
-       struct ether_hdr *eth_hdr;
+       struct rte_ether_hdr *eth_hdr;
        struct ipv4_hdr *ipv4_hdr;
        struct tcp_hdr *tcp_hdr;
        uint32_t sent_seq;
-       uint16_t tcp_dl, ip_id, hdr_len, frag_off;
+       int32_t tcp_dl;
+       uint16_t ip_id, hdr_len, frag_off;
        uint8_t is_atomic;
 
        struct tcp4_flow_key key;
@@ -207,7 +208,14 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
        int cmp;
        uint8_t find;
 
-       eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
+       /*
+        * Don't process the packet whose TCP header length is greater
+        * than 60 bytes or less than 20 bytes.
+        */
+       if (unlikely(INVALID_TCP_HDRLEN(pkt->l4_len)))
+               return -1;
+
+       eth_hdr = rte_pktmbuf_mtod(pkt, struct rte_ether_hdr *);
        ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len);
        tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len);
        hdr_len = pkt->l2_len + pkt->l3_len + pkt->l4_len;