diff options
author | Eric Dumazet <edumazet@google.com> | 2015-03-25 18:08:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-29 15:17:18 -0400 |
commit | 41d25fe0927aabb1d4b671871a99a55bcd203257 (patch) | |
tree | 745072871a02c09835f1b0ca4d8f8472eef17d52 | |
parent | 1fb7cd4ef02bea6416b5afd60617d12ceb3533c1 (diff) |
tcp: tcp_syn_flood_action() can be static
After commit 1fb6f159fd21 ("tcp: add tcp_conn_request"),
tcp_syn_flood_action() is no longer used from IPv6.
We can make it static, by moving it above tcp_conn_request()
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/tcp.h | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 29 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 29 |
3 files changed, 29 insertions, 31 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 42690daa924e..963303fb96ae 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -529,8 +529,6 @@ int tcp_write_wakeup(struct sock *); | |||
529 | void tcp_send_fin(struct sock *sk); | 529 | void tcp_send_fin(struct sock *sk); |
530 | void tcp_send_active_reset(struct sock *sk, gfp_t priority); | 530 | void tcp_send_active_reset(struct sock *sk, gfp_t priority); |
531 | int tcp_send_synack(struct sock *); | 531 | int tcp_send_synack(struct sock *); |
532 | bool tcp_syn_flood_action(struct sock *sk, const struct sk_buff *skb, | ||
533 | const char *proto); | ||
534 | void tcp_push_one(struct sock *, unsigned int mss_now); | 532 | void tcp_push_one(struct sock *, unsigned int mss_now); |
535 | void tcp_send_ack(struct sock *sk); | 533 | void tcp_send_ack(struct sock *sk); |
536 | void tcp_send_delayed_ack(struct sock *sk); | 534 | void tcp_send_delayed_ack(struct sock *sk); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 023196f7ec37..18b80e8bc533 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5987,6 +5987,35 @@ struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, | |||
5987 | } | 5987 | } |
5988 | EXPORT_SYMBOL(inet_reqsk_alloc); | 5988 | EXPORT_SYMBOL(inet_reqsk_alloc); |
5989 | 5989 | ||
5990 | /* | ||
5991 | * Return true if a syncookie should be sent | ||
5992 | */ | ||
5993 | static bool tcp_syn_flood_action(struct sock *sk, | ||
5994 | const struct sk_buff *skb, | ||
5995 | const char *proto) | ||
5996 | { | ||
5997 | const char *msg = "Dropping request"; | ||
5998 | bool want_cookie = false; | ||
5999 | struct listen_sock *lopt; | ||
6000 | |||
6001 | #ifdef CONFIG_SYN_COOKIES | ||
6002 | if (sysctl_tcp_syncookies) { | ||
6003 | msg = "Sending cookies"; | ||
6004 | want_cookie = true; | ||
6005 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDOCOOKIES); | ||
6006 | } else | ||
6007 | #endif | ||
6008 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP); | ||
6009 | |||
6010 | lopt = inet_csk(sk)->icsk_accept_queue.listen_opt; | ||
6011 | if (!lopt->synflood_warned && sysctl_tcp_syncookies != 2) { | ||
6012 | lopt->synflood_warned = 1; | ||
6013 | pr_info("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n", | ||
6014 | proto, ntohs(tcp_hdr(skb)->dest), msg); | ||
6015 | } | ||
6016 | return want_cookie; | ||
6017 | } | ||
6018 | |||
5990 | int tcp_conn_request(struct request_sock_ops *rsk_ops, | 6019 | int tcp_conn_request(struct request_sock_ops *rsk_ops, |
5991 | const struct tcp_request_sock_ops *af_ops, | 6020 | const struct tcp_request_sock_ops *af_ops, |
5992 | struct sock *sk, struct sk_buff *skb) | 6021 | struct sock *sk, struct sk_buff *skb) |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index e073517b2cc7..5aababa20a21 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -856,35 +856,6 @@ static void tcp_v4_reqsk_destructor(struct request_sock *req) | |||
856 | kfree(inet_rsk(req)->opt); | 856 | kfree(inet_rsk(req)->opt); |
857 | } | 857 | } |
858 | 858 | ||
859 | /* | ||
860 | * Return true if a syncookie should be sent | ||
861 | */ | ||
862 | bool tcp_syn_flood_action(struct sock *sk, | ||
863 | const struct sk_buff *skb, | ||
864 | const char *proto) | ||
865 | { | ||
866 | const char *msg = "Dropping request"; | ||
867 | bool want_cookie = false; | ||
868 | struct listen_sock *lopt; | ||
869 | |||
870 | #ifdef CONFIG_SYN_COOKIES | ||
871 | if (sysctl_tcp_syncookies) { | ||
872 | msg = "Sending cookies"; | ||
873 | want_cookie = true; | ||
874 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDOCOOKIES); | ||
875 | } else | ||
876 | #endif | ||
877 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPREQQFULLDROP); | ||
878 | |||
879 | lopt = inet_csk(sk)->icsk_accept_queue.listen_opt; | ||
880 | if (!lopt->synflood_warned && sysctl_tcp_syncookies != 2) { | ||
881 | lopt->synflood_warned = 1; | ||
882 | pr_info("%s: Possible SYN flooding on port %d. %s. Check SNMP counters.\n", | ||
883 | proto, ntohs(tcp_hdr(skb)->dest), msg); | ||
884 | } | ||
885 | return want_cookie; | ||
886 | } | ||
887 | EXPORT_SYMBOL(tcp_syn_flood_action); | ||
888 | 859 | ||
889 | #ifdef CONFIG_TCP_MD5SIG | 860 | #ifdef CONFIG_TCP_MD5SIG |
890 | /* | 861 | /* |