aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2005-08-15 15:33:26 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 19:01:11 -0400
commit066286071d3542243baa68166acb779187c848b3 (patch)
treeef6604f16ceb13842a30311654e6a64aac716c48
parent9a4595bc7e67962f13232ee55a64e063062c3a99 (diff)
[NETLINK]: Add "groups" argument to netlink_kernel_create
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/w1/w1_int.c2
-rw-r--r--include/linux/netlink.h2
-rw-r--r--kernel/audit.c2
-rw-r--r--lib/kobject_uevent.c2
-rw-r--r--net/bridge/netfilter/ebt_ulog.c3
-rw-r--r--net/core/rtnetlink.c3
-rw-r--r--net/decnet/netfilter/dn_rtmsg.c4
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/inet_diag.c2
-rw-r--r--net/ipv4/netfilter/ip_queue.c2
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c3
-rw-r--r--net/ipv6/netfilter/ip6_queue.c3
-rw-r--r--net/netfilter/nfnetlink.c4
-rw-r--r--net/netlink/af_netlink.c6
-rw-r--r--net/xfrm/xfrm_user.c4
-rw-r--r--security/selinux/netlink.c3
16 files changed, 27 insertions, 20 deletions
diff --git a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
index f3f339d057f9..498ad505fa5f 100644
--- a/drivers/w1/w1_int.c
+++ b/drivers/w1/w1_int.c
@@ -88,7 +88,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
88 88
89 dev->groups = 1; 89 dev->groups = 1;
90 dev->seq = 1; 90 dev->seq = 1;
91 dev->nls = netlink_kernel_create(NETLINK_W1, NULL, THIS_MODULE); 91 dev->nls = netlink_kernel_create(NETLINK_W1, 1, NULL, THIS_MODULE);
92 if (!dev->nls) { 92 if (!dev->nls) {
93 printk(KERN_ERR "Failed to create new netlink socket(%u) for w1 master %s.\n", 93 printk(KERN_ERR "Failed to create new netlink socket(%u) for w1 master %s.\n",
94 NETLINK_NFLOG, dev->dev.bus_id); 94 NETLINK_NFLOG, dev->dev.bus_id);
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 36a40449f9f1..7d1d9683b246 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -125,7 +125,7 @@ struct netlink_skb_parms
125#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds) 125#define NETLINK_CREDS(skb) (&NETLINK_CB((skb)).creds)
126 126
127 127
128extern struct sock *netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len), struct module *module); 128extern struct sock *netlink_kernel_create(int unit, unsigned int groups, void (*input)(struct sock *sk, int len), struct module *module);
129extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 129extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
130extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 130extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
131extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid, 131extern int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, __u32 pid,
diff --git a/kernel/audit.c b/kernel/audit.c
index ed4019563d56..7f0699790d46 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -514,7 +514,7 @@ static int __init audit_init(void)
514{ 514{
515 printk(KERN_INFO "audit: initializing netlink socket (%s)\n", 515 printk(KERN_INFO "audit: initializing netlink socket (%s)\n",
516 audit_default ? "enabled" : "disabled"); 516 audit_default ? "enabled" : "disabled");
517 audit_sock = netlink_kernel_create(NETLINK_AUDIT, audit_receive, 517 audit_sock = netlink_kernel_create(NETLINK_AUDIT, 0, audit_receive,
518 THIS_MODULE); 518 THIS_MODULE);
519 if (!audit_sock) 519 if (!audit_sock)
520 audit_panic("cannot initialize netlink socket"); 520 audit_panic("cannot initialize netlink socket");
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 1ebd735d6439..04ca4429ddfa 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -154,7 +154,7 @@ EXPORT_SYMBOL_GPL(kobject_uevent_atomic);
154 154
155static int __init kobject_uevent_init(void) 155static int __init kobject_uevent_init(void)
156{ 156{
157 uevent_sock = netlink_kernel_create(NETLINK_KOBJECT_UEVENT, NULL, 157 uevent_sock = netlink_kernel_create(NETLINK_KOBJECT_UEVENT, 1, NULL,
158 THIS_MODULE); 158 THIS_MODULE);
159 159
160 if (!uevent_sock) { 160 if (!uevent_sock) {
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index 6845b5dd6d77..aae26ae2e61f 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -258,7 +258,8 @@ static int __init init(void)
258 spin_lock_init(&ulog_buffers[i].lock); 258 spin_lock_init(&ulog_buffers[i].lock);
259 } 259 }
260 260
261 ebtulognl = netlink_kernel_create(NETLINK_NFLOG, NULL, THIS_MODULE); 261 ebtulognl = netlink_kernel_create(NETLINK_NFLOG, EBT_ULOG_MAXNLGROUPS,
262 NULL, THIS_MODULE);
262 if (!ebtulognl) 263 if (!ebtulognl)
263 ret = -ENOMEM; 264 ret = -ENOMEM;
264 else if ((ret = ebt_register_watcher(&ulog))) 265 else if ((ret = ebt_register_watcher(&ulog)))
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5f3f95b5585d..9bed7569ce3f 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -708,7 +708,8 @@ void __init rtnetlink_init(void)
708 if (!rta_buf) 708 if (!rta_buf)
709 panic("rtnetlink_init: cannot allocate rta_buf\n"); 709 panic("rtnetlink_init: cannot allocate rta_buf\n");
710 710
711 rtnl = netlink_kernel_create(NETLINK_ROUTE, rtnetlink_rcv, THIS_MODULE); 711 rtnl = netlink_kernel_create(NETLINK_ROUTE, RTNLGRP_MAX, rtnetlink_rcv,
712 THIS_MODULE);
712 if (rtnl == NULL) 713 if (rtnl == NULL)
713 panic("rtnetlink_init: cannot initialize rtnetlink\n"); 714 panic("rtnetlink_init: cannot initialize rtnetlink\n");
714 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV); 715 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV);
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c
index 353fed6888f9..afb33a25ea55 100644
--- a/net/decnet/netfilter/dn_rtmsg.c
+++ b/net/decnet/netfilter/dn_rtmsg.c
@@ -138,8 +138,8 @@ static int __init init(void)
138{ 138{
139 int rv = 0; 139 int rv = 0;
140 140
141 dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, dnrmg_receive_user_sk, 141 dnrmg = netlink_kernel_create(NETLINK_DNRTMSG, DNRNG_NLGRP_MAX,
142 THIS_MODULE); 142 dnrmg_receive_user_sk, THIS_MODULE);
143 if (dnrmg == NULL) { 143 if (dnrmg == NULL) {
144 printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket"); 144 printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket");
145 return -ENOMEM; 145 return -ENOMEM;
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index d4e7b578a25d..4e1379f71269 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -566,7 +566,7 @@ static void nl_fib_input(struct sock *sk, int len)
566 566
567static void nl_fib_lookup_init(void) 567static void nl_fib_lookup_init(void)
568{ 568{
569 netlink_kernel_create(NETLINK_FIB_LOOKUP, nl_fib_input, THIS_MODULE); 569 netlink_kernel_create(NETLINK_FIB_LOOKUP, 0, nl_fib_input, THIS_MODULE);
570} 570}
571 571
572static void fib_disable_ip(struct net_device *dev, int force) 572static void fib_disable_ip(struct net_device *dev, int force)
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 1880ad8575d8..71f3c7350c6e 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -845,7 +845,7 @@ static int __init inet_diag_init(void)
845 goto out; 845 goto out;
846 846
847 memset(inet_diag_table, 0, inet_diag_table_size); 847 memset(inet_diag_table, 0, inet_diag_table_size);
848 idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, inet_diag_rcv, 848 idiagnl = netlink_kernel_create(NETLINK_INET_DIAG, 0, inet_diag_rcv,
849 THIS_MODULE); 849 THIS_MODULE);
850 if (idiagnl == NULL) 850 if (idiagnl == NULL)
851 goto out_free_table; 851 goto out_free_table;
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index 7f2bcc7198fa..d54f14d926f6 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -671,7 +671,7 @@ init_or_cleanup(int init)
671 goto cleanup; 671 goto cleanup;
672 672
673 netlink_register_notifier(&ipq_nl_notifier); 673 netlink_register_notifier(&ipq_nl_notifier);
674 ipqnl = netlink_kernel_create(NETLINK_FIREWALL, ipq_rcv_sk, 674 ipqnl = netlink_kernel_create(NETLINK_FIREWALL, 0, ipq_rcv_sk,
675 THIS_MODULE); 675 THIS_MODULE);
676 if (ipqnl == NULL) { 676 if (ipqnl == NULL) {
677 printk(KERN_ERR "ip_queue: failed to create netlink socket\n"); 677 printk(KERN_ERR "ip_queue: failed to create netlink socket\n");
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 89816b83455e..e2c14f3cb2fc 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -388,7 +388,8 @@ static int __init init(void)
388 ulog_buffers[i].timer.data = i; 388 ulog_buffers[i].timer.data = i;
389 } 389 }
390 390
391 nflognl = netlink_kernel_create(NETLINK_NFLOG, NULL, THIS_MODULE); 391 nflognl = netlink_kernel_create(NETLINK_NFLOG, ULOG_MAXNLGROUPS, NULL,
392 THIS_MODULE);
392 if (!nflognl) 393 if (!nflognl)
393 return -ENOMEM; 394 return -ENOMEM;
394 395
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
index 446764545b10..aa11cf366efa 100644
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -667,7 +667,8 @@ init_or_cleanup(int init)
667 goto cleanup; 667 goto cleanup;
668 668
669 netlink_register_notifier(&ipq_nl_notifier); 669 netlink_register_notifier(&ipq_nl_notifier);
670 ipqnl = netlink_kernel_create(NETLINK_IP6_FW, ipq_rcv_sk, THIS_MODULE); 670 ipqnl = netlink_kernel_create(NETLINK_IP6_FW, 0, ipq_rcv_sk,
671 THIS_MODULE);
671 if (ipqnl == NULL) { 672 if (ipqnl == NULL) {
672 printk(KERN_ERR "ip6_queue: failed to create netlink socket\n"); 673 printk(KERN_ERR "ip6_queue: failed to create netlink socket\n");
673 goto cleanup_netlink_notifier; 674 goto cleanup_netlink_notifier;
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 36a4c5fbb7d7..e089f17bb803 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -355,8 +355,8 @@ int __init nfnetlink_init(void)
355{ 355{
356 printk("Netfilter messages via NETLINK v%s.\n", nfversion); 356 printk("Netfilter messages via NETLINK v%s.\n", nfversion);
357 357
358 nfnl = netlink_kernel_create(NETLINK_NETFILTER, nfnetlink_rcv, 358 nfnl = netlink_kernel_create(NETLINK_NETFILTER, NFNLGRP_MAX,
359 THIS_MODULE); 359 nfnetlink_rcv, THIS_MODULE);
360 if (!nfnl) { 360 if (!nfnl) {
361 printk(KERN_ERR "cannot initialize nfnetlink!\n"); 361 printk(KERN_ERR "cannot initialize nfnetlink!\n");
362 return -1; 362 return -1;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 47e791738014..e259f46e26f7 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1204,7 +1204,9 @@ static void netlink_data_ready(struct sock *sk, int len)
1204 */ 1204 */
1205 1205
1206struct sock * 1206struct sock *
1207netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len), struct module *module) 1207netlink_kernel_create(int unit, unsigned int groups,
1208 void (*input)(struct sock *sk, int len),
1209 struct module *module)
1208{ 1210{
1209 struct socket *sock; 1211 struct socket *sock;
1210 struct sock *sk; 1212 struct sock *sk;
@@ -1234,7 +1236,7 @@ netlink_kernel_create(int unit, void (*input)(struct sock *sk, int len), struct
1234 nlk->flags |= NETLINK_KERNEL_SOCKET; 1236 nlk->flags |= NETLINK_KERNEL_SOCKET;
1235 1237
1236 netlink_table_grab(); 1238 netlink_table_grab();
1237 nl_table[unit].groups = 32; 1239 nl_table[unit].groups = groups < 32 ? 32 : groups;
1238 nl_table[unit].module = module; 1240 nl_table[unit].module = module;
1239 nl_table[unit].registered = 1; 1241 nl_table[unit].registered = 1;
1240 netlink_table_ungrab(); 1242 netlink_table_ungrab();
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 0579d209af27..c35336a0f71b 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1520,8 +1520,8 @@ static int __init xfrm_user_init(void)
1520{ 1520{
1521 printk(KERN_INFO "Initializing IPsec netlink socket\n"); 1521 printk(KERN_INFO "Initializing IPsec netlink socket\n");
1522 1522
1523 xfrm_nl = netlink_kernel_create(NETLINK_XFRM, xfrm_netlink_rcv, 1523 xfrm_nl = netlink_kernel_create(NETLINK_XFRM, XFRMNLGRP_MAX,
1524 THIS_MODULE); 1524 xfrm_netlink_rcv, THIS_MODULE);
1525 if (xfrm_nl == NULL) 1525 if (xfrm_nl == NULL)
1526 return -ENOMEM; 1526 return -ENOMEM;
1527 1527
diff --git a/security/selinux/netlink.c b/security/selinux/netlink.c
index 20f481015db4..e203883406dd 100644
--- a/security/selinux/netlink.c
+++ b/security/selinux/netlink.c
@@ -104,7 +104,8 @@ void selnl_notify_policyload(u32 seqno)
104 104
105static int __init selnl_init(void) 105static int __init selnl_init(void)
106{ 106{
107 selnl = netlink_kernel_create(NETLINK_SELINUX, NULL, THIS_MODULE); 107 selnl = netlink_kernel_create(NETLINK_SELINUX, SELNLGRP_MAX, NULL,
108 THIS_MODULE);
108 if (selnl == NULL) 109 if (selnl == NULL)
109 panic("SELinux: Cannot create netlink socket."); 110 panic("SELinux: Cannot create netlink socket.");
110 netlink_set_nonroot(NETLINK_SELINUX, NL_NONROOT_RECV); 111 netlink_set_nonroot(NETLINK_SELINUX, NL_NONROOT_RECV);