aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/rtnetlink.h8
-rw-r--r--include/net/net_namespace.h3
-rw-r--r--net/bridge/br_netlink.c4
-rw-r--r--net/core/fib_rules.c4
-rw-r--r--net/core/neighbour.c4
-rw-r--r--net/core/rtnetlink.c63
-rw-r--r--net/decnet/dn_dev.c4
-rw-r--r--net/decnet/dn_route.c2
-rw-r--r--net/decnet/dn_table.c4
-rw-r--r--net/ipv4/devinet.c4
-rw-r--r--net/ipv4/fib_semantics.c4
-rw-r--r--net/ipv4/ipmr.c4
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv6/addrconf.c14
-rw-r--r--net/ipv6/addrlabel.c2
-rw-r--r--net/ipv6/ndisc.c5
-rw-r--r--net/ipv6/route.c6
-rw-r--r--net/sched/act_api.c8
-rw-r--r--net/sched/cls_api.c2
-rw-r--r--net/sched/sch_api.c4
-rw-r--r--net/wireless/wext.c5
21 files changed, 102 insertions, 54 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index e20dcc89a836..b014f6b7fe29 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -620,11 +620,11 @@ extern int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
620({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ 620({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \
621 __rtattr_parse_nested_compat(tb, max, rta, len); }) 621 __rtattr_parse_nested_compat(tb, max, rta, len); })
622 622
623extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); 623extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
624extern int rtnl_unicast(struct sk_buff *skb, u32 pid); 624extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid);
625extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, 625extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
626 struct nlmsghdr *nlh, gfp_t flags); 626 struct nlmsghdr *nlh, gfp_t flags);
627extern void rtnl_set_sk_err(u32 group, int error); 627extern void rtnl_set_sk_err(struct net *net, u32 group, int error);
628extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); 628extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics);
629extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, 629extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst,
630 u32 id, u32 ts, u32 tsage, long expires, 630 u32 id, u32 ts, u32 tsage, long expires,
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 5dd6d90b37eb..90802a668c23 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -10,6 +10,7 @@
10 10
11struct proc_dir_entry; 11struct proc_dir_entry;
12struct net_device; 12struct net_device;
13struct sock;
13struct net { 14struct net {
14 atomic_t count; /* To decided when the network 15 atomic_t count; /* To decided when the network
15 * namespace should be freed. 16 * namespace should be freed.
@@ -29,6 +30,8 @@ struct net {
29 struct list_head dev_base_head; 30 struct list_head dev_base_head;
30 struct hlist_head *dev_name_head; 31 struct hlist_head *dev_name_head;
31 struct hlist_head *dev_index_head; 32 struct hlist_head *dev_index_head;
33
34 struct sock *rtnl; /* rtnetlink socket */
32}; 35};
33 36
34#ifdef CONFIG_NET 37#ifdef CONFIG_NET
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index a4ffa2b63cd5..f5d69336d97b 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -97,10 +97,10 @@ void br_ifinfo_notify(int event, struct net_bridge_port *port)
97 kfree_skb(skb); 97 kfree_skb(skb);
98 goto errout; 98 goto errout;
99 } 99 }
100 err = rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); 100 err = rtnl_notify(skb, &init_net,0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
101errout: 101errout:
102 if (err < 0) 102 if (err < 0)
103 rtnl_set_sk_err(RTNLGRP_LINK, err); 103 rtnl_set_sk_err(&init_net, RTNLGRP_LINK, err);
104} 104}
105 105
106/* 106/*
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
index 3b20b6f0982e..0af0538343da 100644
--- a/net/core/fib_rules.c
+++ b/net/core/fib_rules.c
@@ -599,10 +599,10 @@ static void notify_rule_change(int event, struct fib_rule *rule,
599 kfree_skb(skb); 599 kfree_skb(skb);
600 goto errout; 600 goto errout;
601 } 601 }
602 err = rtnl_notify(skb, pid, ops->nlgroup, nlh, GFP_KERNEL); 602 err = rtnl_notify(skb, &init_net, pid, ops->nlgroup, nlh, GFP_KERNEL);
603errout: 603errout:
604 if (err < 0) 604 if (err < 0)
605 rtnl_set_sk_err(ops->nlgroup, err); 605 rtnl_set_sk_err(&init_net, ops->nlgroup, err);
606} 606}
607 607
608static void attach_rules(struct list_head *rules, struct net_device *dev) 608static void attach_rules(struct list_head *rules, struct net_device *dev)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 29f0a4d2008f..a8b72c1c7c8a 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -2467,10 +2467,10 @@ static void __neigh_notify(struct neighbour *n, int type, int flags)
2467 kfree_skb(skb); 2467 kfree_skb(skb);
2468 goto errout; 2468 goto errout;
2469 } 2469 }
2470 err = rtnl_notify(skb, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC); 2470 err = rtnl_notify(skb, &init_net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC);
2471errout: 2471errout:
2472 if (err < 0) 2472 if (err < 0)
2473 rtnl_set_sk_err(RTNLGRP_NEIGH, err); 2473 rtnl_set_sk_err(&init_net, RTNLGRP_NEIGH, err);
2474} 2474}
2475 2475
2476#ifdef CONFIG_ARPD 2476#ifdef CONFIG_ARPD
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 4edc3dac4ccd..9efaf35934f4 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -60,7 +60,6 @@ struct rtnl_link
60}; 60};
61 61
62static DEFINE_MUTEX(rtnl_mutex); 62static DEFINE_MUTEX(rtnl_mutex);
63static struct sock *rtnl;
64 63
65void rtnl_lock(void) 64void rtnl_lock(void)
66{ 65{
@@ -458,8 +457,9 @@ size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size)
458 return ret; 457 return ret;
459} 458}
460 459
461int rtnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo) 460int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned group, int echo)
462{ 461{
462 struct sock *rtnl = net->rtnl;
463 int err = 0; 463 int err = 0;
464 464
465 NETLINK_CB(skb).dst_group = group; 465 NETLINK_CB(skb).dst_group = group;
@@ -471,14 +471,17 @@ int rtnetlink_send(struct sk_buff *skb, u32 pid, unsigned group, int echo)
471 return err; 471 return err;
472} 472}
473 473
474int rtnl_unicast(struct sk_buff *skb, u32 pid) 474int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid)
475{ 475{
476 struct sock *rtnl = net->rtnl;
477
476 return nlmsg_unicast(rtnl, skb, pid); 478 return nlmsg_unicast(rtnl, skb, pid);
477} 479}
478 480
479int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, 481int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group,
480 struct nlmsghdr *nlh, gfp_t flags) 482 struct nlmsghdr *nlh, gfp_t flags)
481{ 483{
484 struct sock *rtnl = net->rtnl;
482 int report = 0; 485 int report = 0;
483 486
484 if (nlh) 487 if (nlh)
@@ -487,8 +490,10 @@ int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group,
487 return nlmsg_notify(rtnl, skb, pid, group, report, flags); 490 return nlmsg_notify(rtnl, skb, pid, group, report, flags);
488} 491}
489 492
490void rtnl_set_sk_err(u32 group, int error) 493void rtnl_set_sk_err(struct net *net, u32 group, int error)
491{ 494{
495 struct sock *rtnl = net->rtnl;
496
492 netlink_set_err(rtnl, 0, group, error); 497 netlink_set_err(rtnl, 0, group, error);
493} 498}
494 499
@@ -1201,7 +1206,7 @@ static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
1201 kfree_skb(nskb); 1206 kfree_skb(nskb);
1202 goto errout; 1207 goto errout;
1203 } 1208 }
1204 err = rtnl_unicast(nskb, NETLINK_CB(skb).pid); 1209 err = rtnl_unicast(nskb, net, NETLINK_CB(skb).pid);
1205errout: 1210errout:
1206 dev_put(dev); 1211 dev_put(dev);
1207 1212
@@ -1252,10 +1257,10 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change)
1252 kfree_skb(skb); 1257 kfree_skb(skb);
1253 goto errout; 1258 goto errout;
1254 } 1259 }
1255 err = rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_KERNEL); 1260 err = rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_KERNEL);
1256errout: 1261errout:
1257 if (err < 0) 1262 if (err < 0)
1258 rtnl_set_sk_err(RTNLGRP_LINK, err); 1263 rtnl_set_sk_err(&init_net, RTNLGRP_LINK, err);
1259} 1264}
1260 1265
1261/* Protected by RTNL sempahore. */ 1266/* Protected by RTNL sempahore. */
@@ -1266,6 +1271,7 @@ static int rtattr_max;
1266 1271
1267static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) 1272static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1268{ 1273{
1274 struct net *net = skb->sk->sk_net;
1269 rtnl_doit_func doit; 1275 rtnl_doit_func doit;
1270 int sz_idx, kind; 1276 int sz_idx, kind;
1271 int min_len; 1277 int min_len;
@@ -1294,6 +1300,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1294 return -EPERM; 1300 return -EPERM;
1295 1301
1296 if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) { 1302 if (kind == 2 && nlh->nlmsg_flags&NLM_F_DUMP) {
1303 struct sock *rtnl;
1297 rtnl_dumpit_func dumpit; 1304 rtnl_dumpit_func dumpit;
1298 1305
1299 dumpit = rtnl_get_dumpit(family, type); 1306 dumpit = rtnl_get_dumpit(family, type);
@@ -1301,6 +1308,7 @@ static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1301 return -EOPNOTSUPP; 1308 return -EOPNOTSUPP;
1302 1309
1303 __rtnl_unlock(); 1310 __rtnl_unlock();
1311 rtnl = net->rtnl;
1304 err = netlink_dump_start(rtnl, skb, nlh, dumpit, NULL); 1312 err = netlink_dump_start(rtnl, skb, nlh, dumpit, NULL);
1305 rtnl_lock(); 1313 rtnl_lock();
1306 return err; 1314 return err;
@@ -1373,6 +1381,40 @@ static struct notifier_block rtnetlink_dev_notifier = {
1373 .notifier_call = rtnetlink_event, 1381 .notifier_call = rtnetlink_event,
1374}; 1382};
1375 1383
1384
1385static int rtnetlink_net_init(struct net *net)
1386{
1387 struct sock *sk;
1388 sk = netlink_kernel_create(net, NETLINK_ROUTE, RTNLGRP_MAX,
1389 rtnetlink_rcv, &rtnl_mutex, THIS_MODULE);
1390 if (!sk)
1391 return -ENOMEM;
1392
1393 /* Don't hold an extra reference on the namespace */
1394 put_net(sk->sk_net);
1395 net->rtnl = sk;
1396 return 0;
1397}
1398
1399static void rtnetlink_net_exit(struct net *net)
1400{
1401 struct sock *sk = net->rtnl;
1402 if (sk) {
1403 /* At the last minute lie and say this is a socket for the
1404 * initial network namespace. So the socket will be safe to
1405 * free.
1406 */
1407 sk->sk_net = get_net(&init_net);
1408 sock_put(sk);
1409 net->rtnl = NULL;
1410 }
1411}
1412
1413static struct pernet_operations rtnetlink_net_ops = {
1414 .init = rtnetlink_net_init,
1415 .exit = rtnetlink_net_exit,
1416};
1417
1376void __init rtnetlink_init(void) 1418void __init rtnetlink_init(void)
1377{ 1419{
1378 int i; 1420 int i;
@@ -1385,10 +1427,9 @@ void __init rtnetlink_init(void)
1385 if (!rta_buf) 1427 if (!rta_buf)
1386 panic("rtnetlink_init: cannot allocate rta_buf\n"); 1428 panic("rtnetlink_init: cannot allocate rta_buf\n");
1387 1429
1388 rtnl = netlink_kernel_create(&init_net, NETLINK_ROUTE, RTNLGRP_MAX, 1430 if (register_pernet_subsys(&rtnetlink_net_ops))
1389 rtnetlink_rcv, &rtnl_mutex, THIS_MODULE);
1390 if (rtnl == NULL)
1391 panic("rtnetlink_init: cannot initialize rtnetlink\n"); 1431 panic("rtnetlink_init: cannot initialize rtnetlink\n");
1432
1392 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV); 1433 netlink_set_nonroot(NETLINK_ROUTE, NL_NONROOT_RECV);
1393 register_netdevice_notifier(&rtnetlink_dev_notifier); 1434 register_netdevice_notifier(&rtnetlink_dev_notifier);
1394 1435
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 94256845a057..39c89c682047 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -793,10 +793,10 @@ static void dn_ifaddr_notify(int event, struct dn_ifaddr *ifa)
793 kfree_skb(skb); 793 kfree_skb(skb);
794 goto errout; 794 goto errout;
795 } 795 }
796 err = rtnl_notify(skb, 0, RTNLGRP_DECnet_IFADDR, NULL, GFP_KERNEL); 796 err = rtnl_notify(skb, &init_net, 0, RTNLGRP_DECnet_IFADDR, NULL, GFP_KERNEL);
797errout: 797errout:
798 if (err < 0) 798 if (err < 0)
799 rtnl_set_sk_err(RTNLGRP_DECnet_IFADDR, err); 799 rtnl_set_sk_err(&init_net, RTNLGRP_DECnet_IFADDR, err);
800} 800}
801 801
802static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) 802static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 28aeba15cf12..5d742f1420d9 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -1587,7 +1587,7 @@ static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void
1587 goto out_free; 1587 goto out_free;
1588 } 1588 }
1589 1589
1590 return rtnl_unicast(skb, NETLINK_CB(in_skb).pid); 1590 return rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).pid);
1591 1591
1592out_free: 1592out_free:
1593 kfree_skb(skb); 1593 kfree_skb(skb);
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index a3bdb8dd1fb2..e09d915dbd77 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -375,10 +375,10 @@ static void dn_rtmsg_fib(int event, struct dn_fib_node *f, int z, u32 tb_id,
375 kfree_skb(skb); 375 kfree_skb(skb);
376 goto errout; 376 goto errout;
377 } 377 }
378 err = rtnl_notify(skb, pid, RTNLGRP_DECnet_ROUTE, nlh, GFP_KERNEL); 378 err = rtnl_notify(skb, &init_net, pid, RTNLGRP_DECnet_ROUTE, nlh, GFP_KERNEL);
379errout: 379errout:
380 if (err < 0) 380 if (err < 0)
381 rtnl_set_sk_err(RTNLGRP_DECnet_ROUTE, err); 381 rtnl_set_sk_err(&init_net, RTNLGRP_DECnet_ROUTE, err);
382} 382}
383 383
384static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb, 384static __inline__ int dn_hash_dump_bucket(struct sk_buff *skb,
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index c0eb26a0d0bc..6e75c884e1af 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1240,10 +1240,10 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh,
1240 kfree_skb(skb); 1240 kfree_skb(skb);
1241 goto errout; 1241 goto errout;
1242 } 1242 }
1243 err = rtnl_notify(skb, pid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL); 1243 err = rtnl_notify(skb, &init_net, pid, RTNLGRP_IPV4_IFADDR, nlh, GFP_KERNEL);
1244errout: 1244errout:
1245 if (err < 0) 1245 if (err < 0)
1246 rtnl_set_sk_err(RTNLGRP_IPV4_IFADDR, err); 1246 rtnl_set_sk_err(&init_net, RTNLGRP_IPV4_IFADDR, err);
1247} 1247}
1248 1248
1249#ifdef CONFIG_SYSCTL 1249#ifdef CONFIG_SYSCTL
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 1351a2617dce..33ec96001d90 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -320,11 +320,11 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
320 kfree_skb(skb); 320 kfree_skb(skb);
321 goto errout; 321 goto errout;
322 } 322 }
323 err = rtnl_notify(skb, info->pid, RTNLGRP_IPV4_ROUTE, 323 err = rtnl_notify(skb, &init_net, info->pid, RTNLGRP_IPV4_ROUTE,
324 info->nlh, GFP_KERNEL); 324 info->nlh, GFP_KERNEL);
325errout: 325errout:
326 if (err < 0) 326 if (err < 0)
327 rtnl_set_sk_err(RTNLGRP_IPV4_ROUTE, err); 327 rtnl_set_sk_err(&init_net, RTNLGRP_IPV4_ROUTE, err);
328} 328}
329 329
330/* Return the first fib alias matching TOS with 330/* Return the first fib alias matching TOS with
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index 8e5d47a60602..11879283ad52 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -321,7 +321,7 @@ static void ipmr_destroy_unres(struct mfc_cache *c)
321 e->error = -ETIMEDOUT; 321 e->error = -ETIMEDOUT;
322 memset(&e->msg, 0, sizeof(e->msg)); 322 memset(&e->msg, 0, sizeof(e->msg));
323 323
324 rtnl_unicast(skb, NETLINK_CB(skb).pid); 324 rtnl_unicast(skb, &init_net, NETLINK_CB(skb).pid);
325 } else 325 } else
326 kfree_skb(skb); 326 kfree_skb(skb);
327 } 327 }
@@ -533,7 +533,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
533 memset(&e->msg, 0, sizeof(e->msg)); 533 memset(&e->msg, 0, sizeof(e->msg));
534 } 534 }
535 535
536 rtnl_unicast(skb, NETLINK_CB(skb).pid); 536 rtnl_unicast(skb, &init_net, NETLINK_CB(skb).pid);
537 } else 537 } else
538 ip_mr_forward(skb, c, 0); 538 ip_mr_forward(skb, c, 0);
539 } 539 }
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1d2839571d2f..e4b6fb4b1f4f 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2610,7 +2610,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2610 if (err <= 0) 2610 if (err <= 0)
2611 goto errout_free; 2611 goto errout_free;
2612 2612
2613 err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid); 2613 err = rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).pid);
2614errout: 2614errout:
2615 return err; 2615 return err;
2616 2616
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 26de8ee5095b..6c8b193474ba 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3397,7 +3397,7 @@ static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh,
3397 kfree_skb(skb); 3397 kfree_skb(skb);
3398 goto errout_ifa; 3398 goto errout_ifa;
3399 } 3399 }
3400 err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid); 3400 err = rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).pid);
3401errout_ifa: 3401errout_ifa:
3402 in6_ifa_put(ifa); 3402 in6_ifa_put(ifa);
3403errout: 3403errout:
@@ -3420,10 +3420,10 @@ static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa)
3420 kfree_skb(skb); 3420 kfree_skb(skb);
3421 goto errout; 3421 goto errout;
3422 } 3422 }
3423 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC); 3423 err = rtnl_notify(skb, &init_net, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC);
3424errout: 3424errout:
3425 if (err < 0) 3425 if (err < 0)
3426 rtnl_set_sk_err(RTNLGRP_IPV6_IFADDR, err); 3426 rtnl_set_sk_err(&init_net, RTNLGRP_IPV6_IFADDR, err);
3427} 3427}
3428 3428
3429static inline void ipv6_store_devconf(struct ipv6_devconf *cnf, 3429static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
@@ -3628,10 +3628,10 @@ void inet6_ifinfo_notify(int event, struct inet6_dev *idev)
3628 kfree_skb(skb); 3628 kfree_skb(skb);
3629 goto errout; 3629 goto errout;
3630 } 3630 }
3631 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC); 3631 err = rtnl_notify(skb, &init_net, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC);
3632errout: 3632errout:
3633 if (err < 0) 3633 if (err < 0)
3634 rtnl_set_sk_err(RTNLGRP_IPV6_IFADDR, err); 3634 rtnl_set_sk_err(&init_net, RTNLGRP_IPV6_IFADDR, err);
3635} 3635}
3636 3636
3637static inline size_t inet6_prefix_nlmsg_size(void) 3637static inline size_t inet6_prefix_nlmsg_size(void)
@@ -3697,10 +3697,10 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev,
3697 kfree_skb(skb); 3697 kfree_skb(skb);
3698 goto errout; 3698 goto errout;
3699 } 3699 }
3700 err = rtnl_notify(skb, 0, RTNLGRP_IPV6_PREFIX, NULL, GFP_ATOMIC); 3700 err = rtnl_notify(skb, &init_net, 0, RTNLGRP_IPV6_PREFIX, NULL, GFP_ATOMIC);
3701errout: 3701errout:
3702 if (err < 0) 3702 if (err < 0)
3703 rtnl_set_sk_err(RTNLGRP_IPV6_PREFIX, err); 3703 rtnl_set_sk_err(&init_net, RTNLGRP_IPV6_PREFIX, err);
3704} 3704}
3705 3705
3706static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp) 3706static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index b9b5d5707142..6f1ca607edda 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -549,7 +549,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh,
549 goto out; 549 goto out;
550 } 550 }
551 551
552 err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid); 552 err = rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).pid);
553out: 553out:
554 return err; 554 return err;
555} 555}
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index b2531f80317e..b87f9d245e2e 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1049,7 +1049,8 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt)
1049 &ipv6_hdr(ra)->saddr); 1049 &ipv6_hdr(ra)->saddr);
1050 nlmsg_end(skb, nlh); 1050 nlmsg_end(skb, nlh);
1051 1051
1052 err = rtnl_notify(skb, 0, RTNLGRP_ND_USEROPT, NULL, GFP_ATOMIC); 1052 err = rtnl_notify(skb, &init_net, 0, RTNLGRP_ND_USEROPT, NULL,
1053 GFP_ATOMIC);
1053 if (err < 0) 1054 if (err < 0)
1054 goto errout; 1055 goto errout;
1055 1056
@@ -1059,7 +1060,7 @@ nla_put_failure:
1059 nlmsg_free(skb); 1060 nlmsg_free(skb);
1060 err = -EMSGSIZE; 1061 err = -EMSGSIZE;
1061errout: 1062errout:
1062 rtnl_set_sk_err(RTNLGRP_ND_USEROPT, err); 1063 rtnl_set_sk_err(&init_net, RTNLGRP_ND_USEROPT, err);
1063} 1064}
1064 1065
1065static void ndisc_router_discovery(struct sk_buff *skb) 1066static void ndisc_router_discovery(struct sk_buff *skb)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 5e1c5796761b..d7ec4c9ffc4b 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2230,7 +2230,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
2230 goto errout; 2230 goto errout;
2231 } 2231 }
2232 2232
2233 err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid); 2233 err = rtnl_unicast(skb, &init_net, NETLINK_CB(in_skb).pid);
2234errout: 2234errout:
2235 return err; 2235 return err;
2236} 2236}
@@ -2260,10 +2260,10 @@ void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info)
2260 kfree_skb(skb); 2260 kfree_skb(skb);
2261 goto errout; 2261 goto errout;
2262 } 2262 }
2263 err = rtnl_notify(skb, pid, RTNLGRP_IPV6_ROUTE, nlh, gfp_any()); 2263 err = rtnl_notify(skb, &init_net, pid, RTNLGRP_IPV6_ROUTE, nlh, gfp_any());
2264errout: 2264errout:
2265 if (err < 0) 2265 if (err < 0)
2266 rtnl_set_sk_err(RTNLGRP_IPV6_ROUTE, err); 2266 rtnl_set_sk_err(&init_net, RTNLGRP_IPV6_ROUTE, err);
2267} 2267}
2268 2268
2269/* 2269/*
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 852829139c67..81506474a4f7 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -660,7 +660,7 @@ act_get_notify(u32 pid, struct nlmsghdr *n, struct tc_action *a, int event)
660 return -EINVAL; 660 return -EINVAL;
661 } 661 }
662 662
663 return rtnl_unicast(skb, pid); 663 return rtnl_unicast(skb, &init_net, pid);
664} 664}
665 665
666static struct tc_action * 666static struct tc_action *
@@ -781,7 +781,7 @@ static int tca_action_flush(struct rtattr *rta, struct nlmsghdr *n, u32 pid)
781 nlh->nlmsg_flags |= NLM_F_ROOT; 781 nlh->nlmsg_flags |= NLM_F_ROOT;
782 module_put(a->ops->owner); 782 module_put(a->ops->owner);
783 kfree(a); 783 kfree(a);
784 err = rtnetlink_send(skb, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); 784 err = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO);
785 if (err > 0) 785 if (err > 0)
786 return 0; 786 return 0;
787 787
@@ -844,7 +844,7 @@ tca_action_gd(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int event)
844 844
845 /* now do the delete */ 845 /* now do the delete */
846 tcf_action_destroy(head, 0); 846 tcf_action_destroy(head, 0);
847 ret = rtnetlink_send(skb, pid, RTNLGRP_TC, 847 ret = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC,
848 n->nlmsg_flags&NLM_F_ECHO); 848 n->nlmsg_flags&NLM_F_ECHO);
849 if (ret > 0) 849 if (ret > 0)
850 return 0; 850 return 0;
@@ -888,7 +888,7 @@ static int tcf_add_notify(struct tc_action *a, u32 pid, u32 seq, int event,
888 nlh->nlmsg_len = skb_tail_pointer(skb) - b; 888 nlh->nlmsg_len = skb_tail_pointer(skb) - b;
889 NETLINK_CB(skb).dst_group = RTNLGRP_TC; 889 NETLINK_CB(skb).dst_group = RTNLGRP_TC;
890 890
891 err = rtnetlink_send(skb, pid, RTNLGRP_TC, flags&NLM_F_ECHO); 891 err = rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, flags&NLM_F_ECHO);
892 if (err > 0) 892 if (err > 0)
893 err = 0; 893 err = 0;
894 return err; 894 return err;
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index fdab6a530bba..80dccac769d0 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -361,7 +361,7 @@ static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n,
361 return -EINVAL; 361 return -EINVAL;
362 } 362 }
363 363
364 return rtnetlink_send(skb, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); 364 return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO);
365} 365}
366 366
367struct tcf_dump_args 367struct tcf_dump_args
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index f30e3f7ad885..273c628be054 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -872,7 +872,7 @@ static int qdisc_notify(struct sk_buff *oskb, struct nlmsghdr *n,
872 } 872 }
873 873
874 if (skb->len) 874 if (skb->len)
875 return rtnetlink_send(skb, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); 875 return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO);
876 876
877err_out: 877err_out:
878 kfree_skb(skb); 878 kfree_skb(skb);
@@ -1103,7 +1103,7 @@ static int tclass_notify(struct sk_buff *oskb, struct nlmsghdr *n,
1103 return -EINVAL; 1103 return -EINVAL;
1104 } 1104 }
1105 1105
1106 return rtnetlink_send(skb, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO); 1106 return rtnetlink_send(skb, &init_net, pid, RTNLGRP_TC, n->nlmsg_flags&NLM_F_ECHO);
1107} 1107}
1108 1108
1109struct qdisc_dump_args 1109struct qdisc_dump_args
diff --git a/net/wireless/wext.c b/net/wireless/wext.c
index 47e80cc2077c..db03ed5ce055 100644
--- a/net/wireless/wext.c
+++ b/net/wireless/wext.c
@@ -1137,7 +1137,7 @@ static void wireless_nlevent_process(unsigned long data)
1137 struct sk_buff *skb; 1137 struct sk_buff *skb;
1138 1138
1139 while ((skb = skb_dequeue(&wireless_nlevent_queue))) 1139 while ((skb = skb_dequeue(&wireless_nlevent_queue)))
1140 rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); 1140 rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
1141} 1141}
1142 1142
1143static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0); 1143static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0);
@@ -1189,6 +1189,9 @@ static void rtmsg_iwinfo(struct net_device *dev, char *event, int event_len)
1189 struct sk_buff *skb; 1189 struct sk_buff *skb;
1190 int err; 1190 int err;
1191 1191
1192 if (dev->nd_net != &init_net)
1193 return;
1194
1192 skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); 1195 skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC);
1193 if (!skb) 1196 if (!skb)
1194 return; 1197 return;