aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-09-29 10:42:51 -0400
committerDavid S. Miller <davem@davemloft.net>2015-09-29 19:53:10 -0400
commit2985aaac010ebd5e562ce1a22cc61acbb0e40cf2 (patch)
tree43f34a8d12365c7ee0e5101bb30332e8fbcc0827 /net/ipv4/tcp_input.c
parentf964629e3338d9e5a78c9b354380d5a1e2fa4617 (diff)
tcp: constify tcp_syn_flood_action() socket argument
tcp_syn_flood_action() will soon be called with unlocked socket. In order to avoid SYN flood warning being emitted multiple times, use xchg(). Extend max_qlen_log and synflood_warned fields in struct listen_sock to u32 Signed-off-by: Eric Dumazet <edumazet@google.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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 67b27aee8d28..e58cbcd2f07e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -6064,7 +6064,7 @@ EXPORT_SYMBOL(inet_reqsk_alloc);
6064/* 6064/*
6065 * Return true if a syncookie should be sent 6065 * Return true if a syncookie should be sent
6066 */ 6066 */
6067static bool tcp_syn_flood_action(struct sock *sk, 6067static bool tcp_syn_flood_action(const struct sock *sk,
6068 const struct sk_buff *skb, 6068 const struct sk_buff *skb,
6069 const char *proto) 6069 const char *proto)
6070{ 6070{
@@ -6082,11 +6082,12 @@ static bool tcp_syn_flood_action(struct sock *sk,
6082 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP); 6082 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP);
6083 6083
6084 lopt = inet_csk(sk)->icsk_accept_queue.listen_opt; 6084 lopt = inet_csk(sk)->icsk_accept_queue.listen_opt;
6085 if (!lopt->synflood_warned && sysctl_tcp_syncookies != 2) { 6085 if (!lopt->synflood_warned &&
6086 lopt->synflood_warned = 1; 6086 sysctl_tcp_syncookies != 2 &&
6087 xchg(&lopt->synflood_warned, 1) == 0)
6087 pr_info("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n", 6088 pr_info("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n",
6088 proto, ntohs(tcp_hdr(skb)->dest), msg); 6089 proto, ntohs(tcp_hdr(skb)->dest), msg);
6089 } 6090
6090 return want_cookie; 6091 return want_cookie;
6091} 6092}
6092 6093