aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_gro/gro_tcp4.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/librte_gro/gro_tcp4.c')
-rw-r--r--lib/librte_gro/gro_tcp4.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/librte_gro/gro_tcp4.c b/lib/librte_gro/gro_tcp4.c
index 2c0f35c6..7d128a43 100644
--- a/lib/librte_gro/gro_tcp4.c
+++ b/lib/librte_gro/gro_tcp4.c
@@ -198,7 +198,8 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
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,6 +208,13 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt,
int cmp;
uint8_t find;
+ /*
+ * 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 ether_hdr *);
ipv4_hdr = (struct ipv4_hdr *)((char *)eth_hdr + pkt->l2_len);
tcp_hdr = (struct tcp_hdr *)((char *)ipv4_hdr + pkt->l3_len);