diff options
-rw-r--r-- | include/linux/netlink.h | 4 | ||||
-rw-r--r-- | net/dccp/diag.c | 2 | ||||
-rw-r--r-- | net/ipv4/inet_diag.c | 33 | ||||
-rw-r--r-- | net/ipv4/tcp_diag.c | 2 | ||||
-rw-r--r-- | security/selinux/hooks.c | 2 |
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 | ||
32 | struct sockaddr_nl { | 34 | struct 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); | |||
71 | MODULE_LICENSE("GPL"); | 71 | MODULE_LICENSE("GPL"); |
72 | MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>"); | 72 | MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>"); |
73 | MODULE_DESCRIPTION("DCCP inet_diag handler"); | 73 | MODULE_DESCRIPTION("DCCP inet_diag handler"); |
74 | MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_INET_DIAG, DCCPDIAG_GETSOCK); | 74 | MODULE_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 | ||
48 | static struct sock *idiagnl; | 48 | static 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 | ||
880 | static DEFINE_MUTEX(inet_diag_mutex); | 880 | static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
881 | { | ||
882 | return inet_diag_rcv_msg(skb, nlh); | ||
883 | } | ||
884 | |||
885 | static DEFINE_MUTEX(sock_diag_mutex); | ||
881 | 886 | ||
882 | static void inet_diag_rcv(struct sk_buff *skb) | 887 | static 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 | ||
889 | int inet_diag_register(const struct inet_diag_handler *h) | 894 | int 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; |
937 | out: | 942 | out: |
@@ -943,11 +948,11 @@ out_free_table: | |||
943 | 948 | ||
944 | static void __exit inet_diag_exit(void) | 949 | static 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 | ||
950 | module_init(inet_diag_init); | 955 | module_init(inet_diag_init); |
951 | module_exit(inet_diag_exit); | 956 | module_exit(inet_diag_exit); |
952 | MODULE_LICENSE("GPL"); | 957 | MODULE_LICENSE("GPL"); |
953 | MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_INET_DIAG); | 958 | MODULE_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) | |||
54 | module_init(tcp_diag_init); | 54 | module_init(tcp_diag_init); |
55 | module_exit(tcp_diag_exit); | 55 | module_exit(tcp_diag_exit); |
56 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
57 | MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_INET_DIAG, TCPDIAG_GETSOCK); | 57 | MODULE_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; |