Skip to content

Commit

Permalink
tcp: move synflood_warned into struct request_sock_queue
Browse files Browse the repository at this point in the history
long term plan is to remove struct listen_sock when its hash
table is no longer there.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 3, 2015
1 parent aac065c commit 8d2675f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/net/request_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ extern int sysctl_max_syn_backlog;
*/
struct listen_sock {
u32 max_qlen_log;
u32 synflood_warned;
u32 hash_rnd;
u32 nr_table_entries;
struct request_sock *syn_table[0];
Expand Down Expand Up @@ -171,6 +170,7 @@ struct fastopen_queue {
struct request_sock_queue {
spinlock_t rskq_lock;
u8 rskq_defer_accept;
u32 synflood_warned;

atomic_t qlen;
atomic_t young;
Expand Down
7 changes: 3 additions & 4 deletions net/ipv4/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -6068,9 +6068,9 @@ static bool tcp_syn_flood_action(const struct sock *sk,
const struct sk_buff *skb,
const char *proto)
{
struct request_sock_queue *queue = &inet_csk(sk)->icsk_accept_queue;
const char *msg = "Dropping request";
bool want_cookie = false;
struct listen_sock *lopt;

#ifdef CONFIG_SYN_COOKIES
if (sysctl_tcp_syncookies) {
Expand All @@ -6081,10 +6081,9 @@ static bool tcp_syn_flood_action(const struct sock *sk,
#endif
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP);

lopt = inet_csk(sk)->icsk_accept_queue.listen_opt;
if (!lopt->synflood_warned &&
if (!queue->synflood_warned &&
sysctl_tcp_syncookies != 2 &&
xchg(&lopt->synflood_warned, 1) == 0)
xchg(&queue->synflood_warned, 1) == 0)
pr_info("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n",
proto, ntohs(tcp_hdr(skb)->dest), msg);

Expand Down

0 comments on commit 8d2675f

Please sign in to comment.