aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/syncookies.c
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-01-05 11:10:48 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-07 00:09:56 -0500
commit5d134f1c1f36166e8a738de92c4d2f4c262ff91b (patch)
tree6d1504359c7f1ade1c79da0e468a2a409af5c56c /net/ipv4/syncookies.c
parent71bcdba06db91ceaaffe019b6c958b5faf06012a (diff)
tcp: make sysctl_tcp_ecn namespace aware
As per suggestion from Eric Dumazet this patch makes tcp_ecn sysctl namespace aware. The reason behind this patch is to ease the testing of ecn problems on the internet and allows applications to tune their own use of ecn. Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: David Miller <davem@davemloft.net> Cc: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/syncookies.c')
-rw-r--r--net/ipv4/syncookies.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index b236ef04914f..ef54377fb11c 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -232,7 +232,8 @@ static inline struct sock *get_cookie_sock(struct sock *sk, struct sk_buff *skb,
232 * 232 *
233 * return false if we decode an option that should not be. 233 * return false if we decode an option that should not be.
234 */ 234 */
235bool cookie_check_timestamp(struct tcp_options_received *tcp_opt, bool *ecn_ok) 235bool cookie_check_timestamp(struct tcp_options_received *tcp_opt,
236 struct net *net, bool *ecn_ok)
236{ 237{
237 /* echoed timestamp, lowest bits contain options */ 238 /* echoed timestamp, lowest bits contain options */
238 u32 options = tcp_opt->rcv_tsecr & TSMASK; 239 u32 options = tcp_opt->rcv_tsecr & TSMASK;
@@ -247,7 +248,7 @@ bool cookie_check_timestamp(struct tcp_options_received *tcp_opt, bool *ecn_ok)
247 248
248 tcp_opt->sack_ok = (options & (1 << 4)) ? TCP_SACK_SEEN : 0; 249 tcp_opt->sack_ok = (options & (1 << 4)) ? TCP_SACK_SEEN : 0;
249 *ecn_ok = (options >> 5) & 1; 250 *ecn_ok = (options >> 5) & 1;
250 if (*ecn_ok && !sysctl_tcp_ecn) 251 if (*ecn_ok && !net->ipv4.sysctl_tcp_ecn)
251 return false; 252 return false;
252 253
253 if (tcp_opt->sack_ok && !sysctl_tcp_sack) 254 if (tcp_opt->sack_ok && !sysctl_tcp_sack)
@@ -295,7 +296,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
295 memset(&tcp_opt, 0, sizeof(tcp_opt)); 296 memset(&tcp_opt, 0, sizeof(tcp_opt));
296 tcp_parse_options(skb, &tcp_opt, &hash_location, 0, NULL); 297 tcp_parse_options(skb, &tcp_opt, &hash_location, 0, NULL);
297 298
298 if (!cookie_check_timestamp(&tcp_opt, &ecn_ok)) 299 if (!cookie_check_timestamp(&tcp_opt, sock_net(sk), &ecn_ok))
299 goto out; 300 goto out;
300 301
301 ret = NULL; 302 ret = NULL;