aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_diag.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@parallels.com>2011-12-06 02:56:43 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-06 13:57:36 -0500
commit7f1fb60c4fc9fb29fbb406ac8c4cfb4e59e168d6 (patch)
treec099fd6899f382c439e29aed54c912ee95453324 /net/ipv4/inet_diag.c
parentd5f43c1ea4260807a894150b680fa0a0dd386259 (diff)
inet_diag: Partly rename inet_ to sock_
The ultimate goal is to get the sock_diag module, that works in family+protocol terms. Currently this is suitable to do on the inet_diag basis, so rename parts of the code. It will be moved to sock_diag.c later. Signed-off-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_diag.c')
-rw-r--r--net/ipv4/inet_diag.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 0a46c541b477..a5f3c40ac3c5 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -45,7 +45,7 @@ struct inet_diag_entry {
45 u16 userlocks; 45 u16 userlocks;
46}; 46};
47 47
48static struct sock *idiagnl; 48static struct sock *sdiagnl;
49 49
50#define INET_DIAG_PUT(skb, attrtype, attrlen) \ 50#define INET_DIAG_PUT(skb, attrtype, attrlen) \
51 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen)) 51 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))
@@ -56,7 +56,7 @@ static const struct inet_diag_handler *inet_diag_lock_handler(int type)
56{ 56{
57 if (!inet_diag_table[type]) 57 if (!inet_diag_table[type])
58 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK, 58 request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
59 NETLINK_INET_DIAG, type); 59 NETLINK_SOCK_DIAG, type);
60 60
61 mutex_lock(&inet_diag_table_mutex); 61 mutex_lock(&inet_diag_table_mutex);
62 if (!inet_diag_table[type]) 62 if (!inet_diag_table[type])
@@ -312,7 +312,7 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
312 kfree_skb(rep); 312 kfree_skb(rep);
313 goto out; 313 goto out;
314 } 314 }
315 err = netlink_unicast(idiagnl, rep, NETLINK_CB(in_skb).pid, 315 err = netlink_unicast(sdiagnl, rep, NETLINK_CB(in_skb).pid,
316 MSG_DONTWAIT); 316 MSG_DONTWAIT);
317 if (err > 0) 317 if (err > 0)
318 err = 0; 318 err = 0;
@@ -870,20 +870,25 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
870 return -EINVAL; 870 return -EINVAL;
871 } 871 }
872 872
873 return netlink_dump_start(idiagnl, skb, nlh, 873 return netlink_dump_start(sdiagnl, skb, nlh,
874 inet_diag_dump, NULL, 0); 874 inet_diag_dump, NULL, 0);
875 } 875 }
876 876
877 return inet_diag_get_exact(skb, nlh); 877 return inet_diag_get_exact(skb, nlh);
878} 878}
879 879
880static DEFINE_MUTEX(inet_diag_mutex); 880static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
881{
882 return inet_diag_rcv_msg(skb, nlh);
883}
884
885static DEFINE_MUTEX(sock_diag_mutex);
881 886
882static void inet_diag_rcv(struct sk_buff *skb) 887static void sock_diag_rcv(struct sk_buff *skb)
883{ 888{
884 mutex_lock(&inet_diag_mutex); 889 mutex_lock(&sock_diag_mutex);
885 netlink_rcv_skb(skb, &inet_diag_rcv_msg); 890 netlink_rcv_skb(skb, &sock_diag_rcv_msg);
886 mutex_unlock(&inet_diag_mutex); 891 mutex_unlock(&sock_diag_mutex);
887} 892}
888 893
889int inet_diag_register(const struct inet_diag_handler *h) 894int inet_diag_register(const struct inet_diag_handler *h)
@@ -929,9 +934,9 @@ static int __init inet_diag_init(void)
929 if (!inet_diag_table) 934 if (!inet_diag_table)
930 goto out; 935 goto out;
931 936
932 idiagnl = netlink_kernel_create(&init_net, NETLINK_INET_DIAG, 0, 937 sdiagnl = netlink_kernel_create(&init_net, NETLINK_SOCK_DIAG, 0,
933 inet_diag_rcv, NULL, THIS_MODULE); 938 sock_diag_rcv, NULL, THIS_MODULE);
934 if (idiagnl == NULL) 939 if (sdiagnl == NULL)
935 goto out_free_table; 940 goto out_free_table;
936 err = 0; 941 err = 0;
937out: 942out:
@@ -943,11 +948,11 @@ out_free_table:
943 948
944static void __exit inet_diag_exit(void) 949static void __exit inet_diag_exit(void)
945{ 950{
946 netlink_kernel_release(idiagnl); 951 netlink_kernel_release(sdiagnl);
947 kfree(inet_diag_table); 952 kfree(inet_diag_table);
948} 953}
949 954
950module_init(inet_diag_init); 955module_init(inet_diag_init);
951module_exit(inet_diag_exit); 956module_exit(inet_diag_exit);
952MODULE_LICENSE("GPL"); 957MODULE_LICENSE("GPL");
953MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_INET_DIAG); 958MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_SOCK_DIAG);