aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_diag.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_diag.c')
-rw-r--r--net/ipv4/tcp_diag.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index b31604086edd..4d610934fb39 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -10,6 +10,8 @@
10 */ 10 */
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/net.h>
14#include <linux/sock_diag.h>
13#include <linux/inet_diag.h> 15#include <linux/inet_diag.h>
14 16
15#include <linux/tcp.h> 17#include <linux/tcp.h>
@@ -46,12 +48,29 @@ static int tcp_diag_dump_one(struct sk_buff *in_skb, const struct nlmsghdr *nlh,
46 return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req); 48 return inet_diag_dump_one_icsk(&tcp_hashinfo, in_skb, nlh, req);
47} 49}
48 50
51#ifdef CONFIG_INET_DIAG_DESTROY
52static int tcp_diag_destroy(struct sk_buff *in_skb,
53 const struct inet_diag_req_v2 *req)
54{
55 struct net *net = sock_net(in_skb->sk);
56 struct sock *sk = inet_diag_find_one_icsk(net, &tcp_hashinfo, req);
57
58 if (IS_ERR(sk))
59 return PTR_ERR(sk);
60
61 return sock_diag_destroy(sk, ECONNABORTED);
62}
63#endif
64
49static const struct inet_diag_handler tcp_diag_handler = { 65static const struct inet_diag_handler tcp_diag_handler = {
50 .dump = tcp_diag_dump, 66 .dump = tcp_diag_dump,
51 .dump_one = tcp_diag_dump_one, 67 .dump_one = tcp_diag_dump_one,
52 .idiag_get_info = tcp_diag_get_info, 68 .idiag_get_info = tcp_diag_get_info,
53 .idiag_type = IPPROTO_TCP, 69 .idiag_type = IPPROTO_TCP,
54 .idiag_info_size = sizeof(struct tcp_info), 70 .idiag_info_size = sizeof(struct tcp_info),
71#ifdef CONFIG_INET_DIAG_DESTROY
72 .destroy = tcp_diag_destroy,
73#endif
55}; 74};
56 75
57static int __init tcp_diag_init(void) 76static int __init tcp_diag_init(void)