aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_ipv4.c
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-07-26 11:43:23 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-30 19:15:18 -0400
commit5ad37d5deee1ff7150a2d0602370101de158ad86 (patch)
tree602cac8fe98e0911753b7ff0485756962c2d232a /net/ipv4/tcp_ipv4.c
parentdcfd8d5830f8cc9062eb7040f455c034e8d160e6 (diff)
tcp: add tcp_syncookies mode to allow unconditionally generation of syncookies
| If you want to test which effects syncookies have to your | network connections you can set this knob to 2 to enable | unconditionally generation of syncookies. Original idea and first implementation by Eric Dumazet. Cc: Florian Westphal <fw@strlen.de> Cc: David Miller <davem@davemloft.net> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
-rw-r--r--net/ipv4/tcp_ipv4.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 2a5d5c469d17..280efe5f19c1 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -890,7 +890,7 @@ bool tcp_syn_flood_action(struct sock *sk,
890 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP); 890 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP);
891 891
892 lopt = inet_csk(sk)->icsk_accept_queue.listen_opt; 892 lopt = inet_csk(sk)->icsk_accept_queue.listen_opt;
893 if (!lopt->synflood_warned) { 893 if (!lopt->synflood_warned && sysctl_tcp_syncookies != 2) {
894 lopt->synflood_warned = 1; 894 lopt->synflood_warned = 1;
895 pr_info("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n", 895 pr_info("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n",
896 proto, ntohs(tcp_hdr(skb)->dest), msg); 896 proto, ntohs(tcp_hdr(skb)->dest), msg);
@@ -1462,7 +1462,8 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
1462 * limitations, they conserve resources and peer is 1462 * limitations, they conserve resources and peer is
1463 * evidently real one. 1463 * evidently real one.
1464 */ 1464 */
1465 if (inet_csk_reqsk_queue_is_full(sk) && !isn) { 1465 if ((sysctl_tcp_syncookies == 2 ||
1466 inet_csk_reqsk_queue_is_full(sk)) && !isn) {
1466 want_cookie = tcp_syn_flood_action(sk, skb, "TCP"); 1467 want_cookie = tcp_syn_flood_action(sk, skb, "TCP");
1467 if (!want_cookie) 1468 if (!want_cookie)
1468 goto drop; 1469 goto drop;