Skip to content

Commit 7f1fb60

Browse files
xemuldavem330
authored andcommitted
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>
1 parent d5f43c1 commit 7f1fb60

5 files changed

Lines changed: 25 additions & 18 deletions

File tree

‎include/linux/netlink.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define NETLINK_UNUSED 1 /* Unused number */
99
#define NETLINK_USERSOCK 2 /* Reserved for user mode socket protocols */
1010
#define NETLINK_FIREWALL 3 /* Firewalling hook */
11-
#define NETLINK_INET_DIAG 4 /* INET socket monitoring */
11+
#define NETLINK_SOCK_DIAG 4 /* socket monitoring */
1212
#define NETLINK_NFLOG 5 /* netfilter/iptables ULOG */
1313
#define NETLINK_XFRM 6 /* ipsec */
1414
#define NETLINK_SELINUX 7 /* SELinux event notifications */
@@ -27,6 +27,8 @@
2727
#define NETLINK_RDMA 20
2828
#define NETLINK_CRYPTO 21 /* Crypto layer */
2929

30+
#define NETLINK_INET_DIAG NETLINK_SOCK_DIAG
31+
3032
#define MAX_LINKS 32
3133

3234
struct sockaddr_nl {

‎net/dccp/diag.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ module_exit(dccp_diag_fini);
7171
MODULE_LICENSE("GPL");
7272
MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>");
7373
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);

‎net/ipv4/inet_diag.c‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct inet_diag_entry {
4545
u16 userlocks;
4646
};
4747

48-
static struct sock *idiagnl;
48+
static struct sock *sdiagnl;
4949

5050
#define INET_DIAG_PUT(skb, attrtype, attrlen) \
5151
RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))
@@ -56,7 +56,7 @@ static const struct inet_diag_handler *inet_diag_lock_handler(int type)
5656
{
5757
if (!inet_diag_table[type])
5858
request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
59-
NETLINK_INET_DIAG, type);
59+
NETLINK_SOCK_DIAG, type);
6060

6161
mutex_lock(&inet_diag_table_mutex);
6262
if (!inet_diag_table[type])
@@ -312,7 +312,7 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
312312
kfree_skb(rep);
313313
goto out;
314314
}
315-
err = netlink_unicast(idiagnl, rep, NETLINK_CB(in_skb).pid,
315+
err = netlink_unicast(sdiagnl, rep, NETLINK_CB(in_skb).pid,
316316
MSG_DONTWAIT);
317317
if (err > 0)
318318
err = 0;
@@ -870,20 +870,25 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
870870
return -EINVAL;
871871
}
872872

873-
return netlink_dump_start(idiagnl, skb, nlh,
873+
return netlink_dump_start(sdiagnl, skb, nlh,
874874
inet_diag_dump, NULL, 0);
875875
}
876876

877877
return inet_diag_get_exact(skb, nlh);
878878
}
879879

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);
881886

882-
static void inet_diag_rcv(struct sk_buff *skb)
887+
static void sock_diag_rcv(struct sk_buff *skb)
883888
{
884-
mutex_lock(&inet_diag_mutex);
885-
netlink_rcv_skb(skb, &inet_diag_rcv_msg);
886-
mutex_unlock(&inet_diag_mutex);
889+
mutex_lock(&sock_diag_mutex);
890+
netlink_rcv_skb(skb, &sock_diag_rcv_msg);
891+
mutex_unlock(&sock_diag_mutex);
887892
}
888893

889894
int inet_diag_register(const struct inet_diag_handler *h)
@@ -929,9 +934,9 @@ static int __init inet_diag_init(void)
929934
if (!inet_diag_table)
930935
goto out;
931936

932-
idiagnl = netlink_kernel_create(&init_net, NETLINK_INET_DIAG, 0,
933-
inet_diag_rcv, NULL, THIS_MODULE);
934-
if (idiagnl == NULL)
937+
sdiagnl = netlink_kernel_create(&init_net, NETLINK_SOCK_DIAG, 0,
938+
sock_diag_rcv, NULL, THIS_MODULE);
939+
if (sdiagnl == NULL)
935940
goto out_free_table;
936941
err = 0;
937942
out:
@@ -943,11 +948,11 @@ static int __init inet_diag_init(void)
943948

944949
static void __exit inet_diag_exit(void)
945950
{
946-
netlink_kernel_release(idiagnl);
951+
netlink_kernel_release(sdiagnl);
947952
kfree(inet_diag_table);
948953
}
949954

950955
module_init(inet_diag_init);
951956
module_exit(inet_diag_exit);
952957
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);

‎net/ipv4/tcp_diag.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ static void __exit tcp_diag_exit(void)
5454
module_init(tcp_diag_init);
5555
module_exit(tcp_diag_exit);
5656
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);

‎security/selinux/hooks.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
10901090
return SECCLASS_NETLINK_ROUTE_SOCKET;
10911091
case NETLINK_FIREWALL:
10921092
return SECCLASS_NETLINK_FIREWALL_SOCKET;
1093-
case NETLINK_INET_DIAG:
1093+
case NETLINK_SOCK_DIAG:
10941094
return SECCLASS_NETLINK_TCPDIAG_SOCKET;
10951095
case NETLINK_NFLOG:
10961096
return SECCLASS_NETLINK_NFLOG_SOCKET;

0 commit comments

Comments
 (0)