From 845e259ac7dacc4d768af87f06bd8f50b30d566d Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Thu, 22 Jul 2021 17:01:46 +0800 Subject: [PATCH] net/tcp: d_appdata should remove the tcp specific option field applicate data field should not touch data of IP layer Signed-off-by: chao.an --- net/tcp/tcp_input.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index afe4d3cc9e..b48e40b250 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -629,6 +629,17 @@ found: dev->d_len -= (len + iplen); + /* d_appdata should remove the tcp specific option field. */ + + if ((tcp->tcpoffset & 0xf0) > 0x50) + { + len = ((tcp->tcpoffset >> 4) - 5) << 2; + if (dev->d_len >= len) + { + dev->d_appdata += len; + } + } + /* Check if the sequence number of the incoming packet is what we are * expecting next. If not, we send out an ACK with the correct numbers * in, unless we are in the SYN_RCVD state and receive a SYN, in which