aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_diag.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r--net/ipv4/inet_diag.c27
1 files changed, 1 insertions, 26 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 3bd510941da0..1880ad8575d8 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -797,25 +797,6 @@ static void inet_diag_rcv(struct sock *sk, int len)
797 } 797 }
798} 798}
799 799
800static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
801 void *_info)
802{
803 const struct tcp_sock *tp = tcp_sk(sk);
804 struct tcp_info *info = _info;
805
806 r->idiag_rqueue = tp->rcv_nxt - tp->copied_seq;
807 r->idiag_wqueue = tp->write_seq - tp->snd_una;
808 if (info != NULL)
809 tcp_get_info(sk, info);
810}
811
812static struct inet_diag_handler tcp_diag_handler = {
813 .idiag_hashinfo = &tcp_hashinfo,
814 .idiag_get_info = tcp_diag_get_info,
815 .idiag_type = TCPDIAG_GETSOCK,
816 .idiag_info_size = sizeof(struct tcp_info),
817};
818
819static DEFINE_SPINLOCK(inet_diag_register_lock); 800static DEFINE_SPINLOCK(inet_diag_register_lock);
820 801
821int inet_diag_register(const struct inet_diag_handler *h) 802int inet_diag_register(const struct inet_diag_handler *h)
@@ -864,19 +845,13 @@ static int __init inet_diag_init(void)
864 goto out; 845 goto out;
865 846
866 memset(inet_diag_table, 0, inet_diag_table_size); 847 memset(inet_diag_table, 0, inet_diag_table_size);
867
868 idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, inet_diag_rcv, 848 idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, inet_diag_rcv,
869 THIS_MODULE); 849 THIS_MODULE);
870 if (idiagnl == NULL) 850 if (idiagnl == NULL)
871 goto out_free_table; 851 goto out_free_table;
872 852 err = 0;
873 err = inet_diag_register(&tcp_diag_handler);
874 if (err)
875 goto out_sock_release;
876out: 853out:
877 return err; 854 return err;
878out_sock_release:
879 sock_release(idiagnl->sk_socket);
880out_free_table: 855out_free_table:
881 kfree(inet_diag_table); 856 kfree(inet_diag_table);
882 goto out; 857 goto out;