Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Pavel Emelyanov and committed by
David S. Miller
7f1fb60c d5f43c1e

+26 -19
+3 -1
include/linux/netlink.h
··· 8 8 #define NETLINK_UNUSED 1 /* Unused number */ 9 9 #define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */ 10 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 12 #define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */ 13 13 #define NETLINK_XFRM 6 /* ipsec */ 14 14 #define NETLINK_SELINUX 7 /* SELinux event notifications */ ··· 26 26 #define NETLINK_ECRYPTFS 19 27 27 #define NETLINK_RDMA 20 28 28 #define NETLINK_CRYPTO 21 /* Crypto layer */ 29 + 30 + #define NETLINK_INET_DIAG NETLINK_SOCK_DIAG 29 31 30 32 #define MAX_LINKS 32 31 33
+1 -1
net/dccp/diag.c
··· 71 71 MODULE_LICENSE("GPL"); 72 72 MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>"); 73 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);
+20 -15
net/ipv4/inet_diag.c
··· 45 45 u16 userlocks; 46 46 }; 47 47 48 - static struct sock *idiagnl; 48 + static struct sock *sdiagnl; 49 49 50 50 #define INET_DIAG_PUT(skb, attrtype, attrlen) \ 51 51 RTA_DATA(__RTA_PUT(skb, attrtype, attrlen)) ··· 56 56 { 57 57 if (!inet_diag_table[type]) 58 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 61 mutex_lock(&inet_diag_table_mutex); 62 62 if (!inet_diag_table[type]) ··· 312 312 kfree_skb(rep); 313 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 316 MSG_DONTWAIT); 317 317 if (err > 0) 318 318 err = 0; ··· 870 870 return -EINVAL; 871 871 } 872 872 873 - return netlink_dump_start(idiagnl, skb, nlh, 873 + return netlink_dump_start(sdiagnl, skb, nlh, 874 874 inet_diag_dump, NULL, 0); 875 875 } 876 876 877 877 return inet_diag_get_exact(skb, nlh); 878 878 } 879 879 880 - static DEFINE_MUTEX(inet_diag_mutex); 881 - 882 - static void inet_diag_rcv(struct sk_buff *skb) 880 + static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 883 881 { 884 - mutex_lock(&inet_diag_mutex); 885 - netlink_rcv_skb(skb, &inet_diag_rcv_msg); 886 - mutex_unlock(&inet_diag_mutex); 882 + return inet_diag_rcv_msg(skb, nlh); 883 + } 884 + 885 + static DEFINE_MUTEX(sock_diag_mutex); 886 + 887 + static void sock_diag_rcv(struct sk_buff *skb) 888 + { 889 + mutex_lock(&sock_diag_mutex); 890 + netlink_rcv_skb(skb, &sock_diag_rcv_msg); 891 + mutex_unlock(&sock_diag_mutex); 887 892 } 888 893 889 894 int inet_diag_register(const struct inet_diag_handler *h) ··· 934 929 if (!inet_diag_table) 935 930 goto out; 936 931 937 - idiagnl = netlink_kernel_create(&init_net, NETLINK_INET_DIAG, 0, 938 - inet_diag_rcv, NULL, THIS_MODULE); 939 - if (idiagnl == NULL) 932 + sdiagnl = netlink_kernel_create(&init_net, NETLINK_SOCK_DIAG, 0, 933 + sock_diag_rcv, NULL, THIS_MODULE); 934 + if (sdiagnl == NULL) 940 935 goto out_free_table; 941 936 err = 0; 942 937 out: ··· 948 943 949 944 static void __exit inet_diag_exit(void) 950 945 { 951 - netlink_kernel_release(idiagnl); 946 + netlink_kernel_release(sdiagnl); 952 947 kfree(inet_diag_table); 953 948 } 954 949 955 950 module_init(inet_diag_init); 956 951 module_exit(inet_diag_exit); 957 952 MODULE_LICENSE("GPL"); 958 - MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_INET_DIAG); 953 + MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_SOCK_DIAG);
+1 -1
net/ipv4/tcp_diag.c
··· 54 54 module_init(tcp_diag_init); 55 55 module_exit(tcp_diag_exit); 56 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);
+1 -1
security/selinux/hooks.c
··· 1090 1090 return SECCLASS_NETLINK_ROUTE_SOCKET; 1091 1091 case NETLINK_FIREWALL: 1092 1092 return SECCLASS_NETLINK_FIREWALL_SOCKET; 1093 - case NETLINK_INET_DIAG: 1093 + case NETLINK_SOCK_DIAG: 1094 1094 return SECCLASS_NETLINK_TCPDIAG_SOCKET; 1095 1095 case NETLINK_NFLOG: 1096 1096 return SECCLASS_NETLINK_NFLOG_SOCKET;