- eth_hdr = rte_pktmbuf_mtod(pkt, struct ether_hdr *);
- ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len);
+ /*
+ * 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 rte_ipv4_hdr *)((char *)eth_hdr + pkt->l2_len);