syncookies: fix inclusion of tcp options in syn-ack

Previous thread: libertas: free sk_buff with kfree_skb by Linux Kernel Mailing List on Monday, October 27, 2008 - 10:59 am. (1 message)

Next thread: ALSA: ASoC: Blackfin: update SPORT0 port selector (v2) by Linux Kernel Mailing List on Monday, October 27, 2008 - 10:59 am. (1 message)
From: Linux Kernel Mailing List
Date: Monday, October 27, 2008 - 10:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8b5f12...
Commit:     8b5f12d04b2e93842f3dda01f029842047bf3f81
Parent:     b700a98c70401c2a48e509b91b47f58a883806bc
Author:     Florian Westphal <fw@strlen.de>
AuthorDate: Sun Oct 26 23:10:12 2008 -0700
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Sun Oct 26 23:10:12 2008 -0700

    syncookies: fix inclusion of tcp options in syn-ack
    
    David Miller noticed that commit
    33ad798c924b4a1afad3593f2796d465040aadd5 '(tcp: options clean up')
    did not move the req->cookie_ts check.
    This essentially disabled commit 4dfc2817025965a2fc78a18c50f540736a6b5c24
    '[Syncookies]: Add support for TCP options via timestamps.'.
    
    This restores the original logic.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/tcp_output.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index e4c5ac9..ba85d88 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2279,6 +2279,11 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
 	}
 
 	memset(&opts, 0, sizeof(opts));
+#ifdef CONFIG_SYN_COOKIES
+	if (unlikely(req->cookie_ts))
+		TCP_SKB_CB(skb)->when = cookie_init_timestamp(req);
+	else
+#endif
 	TCP_SKB_CB(skb)->when = tcp_time_stamp;
 	tcp_header_size = tcp_synack_options(sk, req, mss,
 					     skb, &opts, &md5) +
@@ -2304,11 +2309,6 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
 
 	/* RFC1323: The window in SYN & SYN/ACK segments is never scaled. */
 	th->window = htons(min(req->rcv_wnd, 65535U));
-#ifdef CONFIG_SYN_COOKIES
-	if (unlikely(req->cookie_ts))
-		TCP_SKB_CB(skb)->when = cookie_init_timestamp(req);
-	else
-#endif
 	tcp_options_write((__be32 *)(th + 1), tp, &opts, &md5_hash_location);
 	th->doff = ...
Previous thread: libertas: free sk_buff with kfree_skb by Linux Kernel Mailing List on Monday, October 27, 2008 - 10:59 am. (1 message)

Next thread: ALSA: ASoC: Blackfin: update SPORT0 port selector (v2) by Linux Kernel Mailing List on Monday, October 27, 2008 - 10:59 am. (1 message)