Patchwork [3.5.y.z,extended,stable] Patch "tcp: refine SYN handling in tcp_validate_incoming" has been added to staging queue

mail settings
Submitter Herton Ronaldo Krzesinski
Date Jan. 14, 2013, 8:58 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/211925/
State New
Headers show


Herton Ronaldo Krzesinski - Jan. 14, 2013, 8:58 p.m.
This is a note to let you know that I have just added a patch titled

    tcp: refine SYN handling in tcp_validate_incoming

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From 4077d72bcd6e39f715b95a126db7d82e97171e82 Mon Sep 17 00:00:00 2001
From: Eric Dumazet <>
Date: Tue, 17 Jul 2012 12:29:30 +0000
Subject: [PATCH] tcp: refine SYN handling in tcp_validate_incoming

commit e371589917011efe6ff8c7dfb4e9e81934ac5855 upstream.

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

This permits the ratelimiting to work as intended, and to increase
correct SNMP counters.

Suggested-by: Vijay Subramanian <>
Signed-off-by: Eric Dumazet <>
Acked-by: Vijay Subramanian <>
Cc: Kiran Kumar Kella <>
Signed-off-by: David S. Miller <>
Signed-off-by: Herton Ronaldo Krzesinski <>
 net/ipv4/tcp_input.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)



diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index e859775..afb436d 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5477,8 +5477,11 @@  static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
 		 * an acknowledgment should be sent in reply (unless the RST
 		 * bit is set, if so drop the segment and return)".
-		if (!th->rst)
+		if (!th->rst) {
+			if (th->syn)
+				goto syn_challenge;
 			tcp_send_dupack(sk, skb);
+		}
 		goto discard;

@@ -5508,6 +5511,7 @@  static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
 	 * RFC 5691 4.2 : Send a challenge ack
 	if (th->syn) {
 		if (syn_inerr)
 			TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS);