aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/netlink.h4
-rw-r--r--net/dccp/diag.c2
-rw-r--r--net/ipv4/inet_diag.c33
-rw-r--r--net/ipv4/tcp_diag.c2
-rw-r--r--security/selinux/hooks.c2
5 files changed, 25 insertions, 18 deletions
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 8374d2967362..52e48959cfa1 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -8,7 +8,7 @@
8#define NETLINK_UNUSED 1 /* Unused number */ 8#define NETLINK_UNUSED 1 /* Unused number */
9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 9#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
10#define NETLINK_FIREWALL 3 /* Firewalling hook */ 10#define NETLINK_FIREWALL 3 /* Firewalling hook */
11#define NETLINK_INET_DIAG 4 /* INET socket monitoring */ 11#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 12#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
13#define NETLINK_XFRM 6 /* ipsec */ 13#define NETLINK_XFRM 6 /* ipsec */
14#define NETLINK_SELINUX 7 /* SELinux event notifications */ 14#define NETLINK_SELINUX 7 /* SELinux event notifications */
@@ -27,6 +27,8 @@
27#define NETLINK_RDMA 20 27#define NETLINK_RDMA 20
28#define NETLINK_CRYPTO 21 /* Crypto layer */ 28#define NETLINK_CRYPTO 21 /* Crypto layer */
29 29
30#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
31
30#define MAX_LINKS 32 32#define MAX_LINKS 32
31 33
32struct sockaddr_nl { 34struct sockaddr_nl {
diff --git a/net/dccp/diag.c b/net/dccp/diag.c
index b21f261da75e..d92ba7d1c351 100644
--- a/net/dccp/diag.c
+++ b/net/dccp/diag.c
@@ -71,4 +71,4 @@ module_exit(dccp_diag_fini);
71MODULE_LICENSE("GPL"); 71MODULE_LICENSE("GPL");
72MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>"); 72MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>");
73MODULE_DESCRIPTION("DCCP inet_diag handler"); 73MODULE_DESCRIPTION("DCCP inet_diag handler");
74MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_INET_DIAG, DCCPDIAG_GETSOCK); 74MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_SOCK_DIAG, DCCPDIAG_GETSOCK);
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);
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 939edb3b8e4d..9e276b868ce8 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -54,4 +54,4 @@ static void __exit tcp_diag_exit(void)
54module_init(tcp_diag_init); 54module_init(tcp_diag_init);
55module_exit(tcp_diag_exit); 55module_exit(tcp_diag_exit);
56MODULE_LICENSE("GPL"); 56MODULE_LICENSE("GPL");
57MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_INET_DIAG, TCPDIAG_GETSOCK); 57MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_SOCK_DIAG, TCPDIAG_GETSOCK);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index cca09bb46502..86305c2f555a 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1090,7 +1090,7 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1090 return SECCLASS_NETLINK_ROUTE_SOCKET; 1090 return SECCLASS_NETLINK_ROUTE_SOCKET;
1091 case NETLINK_FIREWALL: 1091 case NETLINK_FIREWALL:
1092 return SECCLASS_NETLINK_FIREWALL_SOCKET; 1092 return SECCLASS_NETLINK_FIREWALL_SOCKET;
1093 case NETLINK_INET_DIAG: 1093 case NETLINK_SOCK_DIAG:
1094 return SECCLASS_NETLINK_TCPDIAG_SOCKET; 1094 return SECCLASS_NETLINK_TCPDIAG_SOCKET;
1095 case NETLINK_NFLOG: 1095 case NETLINK_NFLOG:
1096 return SECCLASS_NETLINK_NFLOG_SOCKET; 1096 return SECCLASS_NETLINK_NFLOG_SOCKET;