diff options
author | Eric Dumazet <edumazet@google.com> | 2012-07-17 08:29:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-18 12:31:25 -0400 |
commit | e371589917011efe6ff8c7dfb4e9e81934ac5855 (patch) | |
tree | a4b9d5c0a863eb7e7dd2cd63421841d6349b8baf /net/ipv4/tcp_input.c | |
parent | b6fe83e9525a03b3141e5857eb7d8af219db94e5 (diff) |
tcp: refine SYN handling in tcp_validate_incoming
Followup of commit 0c24604b68fc (tcp: implement RFC 5961 4.2)
As reported by Vijay Subramanian, we should send a challenge ACK
instead of a dup ack if a SYN flag is set on a packet received out of
window.
This permits the ratelimiting to work as intended, and to increase
correct SNMP counters.
Suggested-by: Vijay Subramanian <subramanian.vijay@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Vijay Subramanian <subramanian.vijay@gmail.com>
Cc: Kiran Kumar Kella <kkiran@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 8aaec5536111..fdd49f1b7a52 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5296,8 +5296,11 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, | |||
5296 | * an acknowledgment should be sent in reply (unless the RST | 5296 | * an acknowledgment should be sent in reply (unless the RST |
5297 | * bit is set, if so drop the segment and return)". | 5297 | * bit is set, if so drop the segment and return)". |
5298 | */ | 5298 | */ |
5299 | if (!th->rst) | 5299 | if (!th->rst) { |
5300 | if (th->syn) | ||
5301 | goto syn_challenge; | ||
5300 | tcp_send_dupack(sk, skb); | 5302 | tcp_send_dupack(sk, skb); |
5303 | } | ||
5301 | goto discard; | 5304 | goto discard; |
5302 | } | 5305 | } |
5303 | 5306 | ||
@@ -5327,6 +5330,7 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, | |||
5327 | * RFC 5691 4.2 : Send a challenge ack | 5330 | * RFC 5691 4.2 : Send a challenge ack |
5328 | */ | 5331 | */ |
5329 | if (th->syn) { | 5332 | if (th->syn) { |
5333 | syn_challenge: | ||
5330 | if (syn_inerr) | 5334 | if (syn_inerr) |
5331 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS); | 5335 | TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS); |
5332 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSYNCHALLENGE); | 5336 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPSYNCHALLENGE); |