diff options
author | David S. Miller <davem@davemloft.net> | 2008-03-25 22:43:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-25 22:43:59 -0400 |
commit | dfe98e9214ced45cd1a6ecd19f2627819a630f77 (patch) | |
tree | 4a229937bc32c470ebb75a51bdd39572d91ac0ce | |
parent | f89e6e3834035c6e8203042f3527931aa7f52496 (diff) | |
parent | 878628fbf2589eb24357e42027d5f54b1dafd3c8 (diff) |
Merge branch 'net-2.6.26-netns-20080326' of git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev
135 files changed, 597 insertions, 487 deletions
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c index 969fe9f443c4..3d47839a0c48 100644 --- a/arch/ia64/hp/sim/simeth.c +++ b/arch/ia64/hp/sim/simeth.c | |||
@@ -294,7 +294,7 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr) | |||
294 | return NOTIFY_DONE; | 294 | return NOTIFY_DONE; |
295 | } | 295 | } |
296 | 296 | ||
297 | if (dev->nd_net != &init_net) | 297 | if (dev_net(dev) != &init_net) |
298 | return NOTIFY_DONE; | 298 | return NOTIFY_DONE; |
299 | 299 | ||
300 | if ( event != NETDEV_UP && event != NETDEV_DOWN ) return NOTIFY_DONE; | 300 | if ( event != NETDEV_UP && event != NETDEV_DOWN ) return NOTIFY_DONE; |
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index 8460ef736d56..18d243c73eee 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c | |||
@@ -115,7 +115,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, | |||
115 | struct aoe_hdr *h; | 115 | struct aoe_hdr *h; |
116 | u32 n; | 116 | u32 n; |
117 | 117 | ||
118 | if (ifp->nd_net != &init_net) | 118 | if (dev_net(ifp) != &init_net) |
119 | goto exit; | 119 | goto exit; |
120 | 120 | ||
121 | skb = skb_share_check(skb, GFP_ATOMIC); | 121 | skb = skb_share_check(skb, GFP_ATOMIC); |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index cb3c6faa7888..457d81f73e39 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2429,7 +2429,7 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac | |||
2429 | struct slave *slave = NULL; | 2429 | struct slave *slave = NULL; |
2430 | int ret = NET_RX_DROP; | 2430 | int ret = NET_RX_DROP; |
2431 | 2431 | ||
2432 | if (dev->nd_net != &init_net) | 2432 | if (dev_net(dev) != &init_net) |
2433 | goto out; | 2433 | goto out; |
2434 | 2434 | ||
2435 | if (!(dev->flags & IFF_MASTER)) | 2435 | if (!(dev->flags & IFF_MASTER)) |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index b57bc9467dbe..b986dacf5d33 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -345,7 +345,7 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct | |||
345 | struct arp_pkt *arp = (struct arp_pkt *)skb->data; | 345 | struct arp_pkt *arp = (struct arp_pkt *)skb->data; |
346 | int res = NET_RX_DROP; | 346 | int res = NET_RX_DROP; |
347 | 347 | ||
348 | if (bond_dev->nd_net != &init_net) | 348 | if (dev_net(bond_dev) != &init_net) |
349 | goto out; | 349 | goto out; |
350 | 350 | ||
351 | if (!(bond_dev->flags & IFF_MASTER)) | 351 | if (!(bond_dev->flags & IFF_MASTER)) |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 5fc9d8d58ece..ac688fcb27d7 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2629,7 +2629,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack | |||
2629 | unsigned char *arp_ptr; | 2629 | unsigned char *arp_ptr; |
2630 | __be32 sip, tip; | 2630 | __be32 sip, tip; |
2631 | 2631 | ||
2632 | if (dev->nd_net != &init_net) | 2632 | if (dev_net(dev) != &init_net) |
2633 | goto out; | 2633 | goto out; |
2634 | 2634 | ||
2635 | if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER)) | 2635 | if (!(dev->priv_flags & IFF_BONDING) || !(dev->flags & IFF_MASTER)) |
@@ -3470,7 +3470,7 @@ static int bond_netdev_event(struct notifier_block *this, unsigned long event, v | |||
3470 | { | 3470 | { |
3471 | struct net_device *event_dev = (struct net_device *)ptr; | 3471 | struct net_device *event_dev = (struct net_device *)ptr; |
3472 | 3472 | ||
3473 | if (event_dev->nd_net != &init_net) | 3473 | if (dev_net(event_dev) != &init_net) |
3474 | return NOTIFY_DONE; | 3474 | return NOTIFY_DONE; |
3475 | 3475 | ||
3476 | dprintk("event_dev: %s, event: %lx\n", | 3476 | dprintk("event_dev: %s, event: %lx\n", |
@@ -3508,7 +3508,7 @@ static int bond_inetaddr_event(struct notifier_block *this, unsigned long event, | |||
3508 | struct bonding *bond, *bond_next; | 3508 | struct bonding *bond, *bond_next; |
3509 | struct vlan_entry *vlan, *vlan_next; | 3509 | struct vlan_entry *vlan, *vlan_next; |
3510 | 3510 | ||
3511 | if (ifa->ifa_dev->dev->nd_net != &init_net) | 3511 | if (dev_net(ifa->ifa_dev->dev) != &init_net) |
3512 | return NOTIFY_DONE; | 3512 | return NOTIFY_DONE; |
3513 | 3513 | ||
3514 | list_for_each_entry_safe(bond, bond_next, &bond_dev_list, bond_list) { | 3514 | list_for_each_entry_safe(bond, bond_next, &bond_dev_list, bond_list) { |
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c index 5ddf8b0c34f9..5f4b4c6c9f76 100644 --- a/drivers/net/hamradio/bpqether.c +++ b/drivers/net/hamradio/bpqether.c | |||
@@ -172,7 +172,7 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty | |||
172 | struct ethhdr *eth; | 172 | struct ethhdr *eth; |
173 | struct bpqdev *bpq; | 173 | struct bpqdev *bpq; |
174 | 174 | ||
175 | if (dev->nd_net != &init_net) | 175 | if (dev_net(dev) != &init_net) |
176 | goto drop; | 176 | goto drop; |
177 | 177 | ||
178 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 178 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
@@ -553,7 +553,7 @@ static int bpq_device_event(struct notifier_block *this,unsigned long event, voi | |||
553 | { | 553 | { |
554 | struct net_device *dev = (struct net_device *)ptr; | 554 | struct net_device *dev = (struct net_device *)ptr; |
555 | 555 | ||
556 | if (dev->nd_net != &init_net) | 556 | if (dev_net(dev) != &init_net) |
557 | return NOTIFY_DONE; | 557 | return NOTIFY_DONE; |
558 | 558 | ||
559 | if (!dev_is_ethdev(dev)) | 559 | if (!dev_is_ethdev(dev)) |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index f2a6e7132241..41b774baac4d 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -258,7 +258,7 @@ static __net_init int loopback_net_init(struct net *net) | |||
258 | if (!dev) | 258 | if (!dev) |
259 | goto out; | 259 | goto out; |
260 | 260 | ||
261 | dev->nd_net = net; | 261 | dev_net_set(dev, net); |
262 | err = register_netdev(dev); | 262 | err = register_netdev(dev); |
263 | if (err) | 263 | if (err) |
264 | goto out_free_netdev; | 264 | goto out_free_netdev; |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index f651a816b280..2056cfc624dc 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -402,7 +402,7 @@ static int macvlan_newlink(struct net_device *dev, | |||
402 | if (!tb[IFLA_LINK]) | 402 | if (!tb[IFLA_LINK]) |
403 | return -EINVAL; | 403 | return -EINVAL; |
404 | 404 | ||
405 | lowerdev = __dev_get_by_index(dev->nd_net, nla_get_u32(tb[IFLA_LINK])); | 405 | lowerdev = __dev_get_by_index(dev_net(dev), nla_get_u32(tb[IFLA_LINK])); |
406 | if (lowerdev == NULL) | 406 | if (lowerdev == NULL) |
407 | return -ENODEV; | 407 | return -ENODEV; |
408 | 408 | ||
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c index ac0ac98b19cd..4fad4ddb3504 100644 --- a/drivers/net/pppoe.c +++ b/drivers/net/pppoe.c | |||
@@ -301,7 +301,7 @@ static int pppoe_device_event(struct notifier_block *this, | |||
301 | { | 301 | { |
302 | struct net_device *dev = (struct net_device *) ptr; | 302 | struct net_device *dev = (struct net_device *) ptr; |
303 | 303 | ||
304 | if (dev->nd_net != &init_net) | 304 | if (dev_net(dev) != &init_net) |
305 | return NOTIFY_DONE; | 305 | return NOTIFY_DONE; |
306 | 306 | ||
307 | /* Only look at sockets that are using this specific device. */ | 307 | /* Only look at sockets that are using this specific device. */ |
@@ -392,7 +392,7 @@ static int pppoe_rcv(struct sk_buff *skb, | |||
392 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) | 392 | if (!(skb = skb_share_check(skb, GFP_ATOMIC))) |
393 | goto out; | 393 | goto out; |
394 | 394 | ||
395 | if (dev->nd_net != &init_net) | 395 | if (dev_net(dev) != &init_net) |
396 | goto drop; | 396 | goto drop; |
397 | 397 | ||
398 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) | 398 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) |
@@ -424,7 +424,7 @@ static int pppoe_disc_rcv(struct sk_buff *skb, | |||
424 | struct pppoe_hdr *ph; | 424 | struct pppoe_hdr *ph; |
425 | struct pppox_sock *po; | 425 | struct pppox_sock *po; |
426 | 426 | ||
427 | if (dev->nd_net != &init_net) | 427 | if (dev_net(dev) != &init_net) |
428 | goto abort; | 428 | goto abort; |
429 | 429 | ||
430 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) | 430 | if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr))) |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index e2ad98bee6e7..31cd817f33f9 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -375,7 +375,7 @@ static int veth_newlink(struct net_device *dev, | |||
375 | else | 375 | else |
376 | snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d"); | 376 | snprintf(ifname, IFNAMSIZ, DRV_NAME "%%d"); |
377 | 377 | ||
378 | peer = rtnl_create_link(dev->nd_net, ifname, &veth_link_ops, tbp); | 378 | peer = rtnl_create_link(dev_net(dev), ifname, &veth_link_ops, tbp); |
379 | if (IS_ERR(peer)) | 379 | if (IS_ERR(peer)) |
380 | return PTR_ERR(peer); | 380 | return PTR_ERR(peer); |
381 | 381 | ||
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index 1525e8a89844..ed1afaf683a4 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -3464,7 +3464,7 @@ static int velocity_netdev_event(struct notifier_block *nb, unsigned long notifi | |||
3464 | struct velocity_info *vptr; | 3464 | struct velocity_info *vptr; |
3465 | unsigned long flags; | 3465 | unsigned long flags; |
3466 | 3466 | ||
3467 | if (dev->nd_net != &init_net) | 3467 | if (dev_net(dev) != &init_net) |
3468 | return NOTIFY_DONE; | 3468 | return NOTIFY_DONE; |
3469 | 3469 | ||
3470 | spin_lock_irqsave(&velocity_dev_list_lock, flags); | 3470 | spin_lock_irqsave(&velocity_dev_list_lock, flags); |
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c index 96b232446c0b..b14242768fad 100644 --- a/drivers/net/wan/dlci.c +++ b/drivers/net/wan/dlci.c | |||
@@ -517,7 +517,7 @@ static int dlci_dev_event(struct notifier_block *unused, | |||
517 | { | 517 | { |
518 | struct net_device *dev = (struct net_device *) ptr; | 518 | struct net_device *dev = (struct net_device *) ptr; |
519 | 519 | ||
520 | if (dev->nd_net != &init_net) | 520 | if (dev_net(dev) != &init_net) |
521 | return NOTIFY_DONE; | 521 | return NOTIFY_DONE; |
522 | 522 | ||
523 | if (event == NETDEV_UNREGISTER) { | 523 | if (event == NETDEV_UNREGISTER) { |
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 39951d0c34d6..9a83c9d5b8cf 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c | |||
@@ -68,7 +68,7 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
68 | { | 68 | { |
69 | struct hdlc_device *hdlc = dev_to_hdlc(dev); | 69 | struct hdlc_device *hdlc = dev_to_hdlc(dev); |
70 | 70 | ||
71 | if (dev->nd_net != &init_net) { | 71 | if (dev_net(dev) != &init_net) { |
72 | kfree_skb(skb); | 72 | kfree_skb(skb); |
73 | return 0; | 73 | return 0; |
74 | } | 74 | } |
@@ -105,7 +105,7 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event, | |||
105 | unsigned long flags; | 105 | unsigned long flags; |
106 | int on; | 106 | int on; |
107 | 107 | ||
108 | if (dev->nd_net != &init_net) | 108 | if (dev_net(dev) != &init_net) |
109 | return NOTIFY_DONE; | 109 | return NOTIFY_DONE; |
110 | 110 | ||
111 | if (dev->get_stats != hdlc_get_stats) | 111 | if (dev->get_stats != hdlc_get_stats) |
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c index fb37b8095231..629c909e05f9 100644 --- a/drivers/net/wan/lapbether.c +++ b/drivers/net/wan/lapbether.c | |||
@@ -91,7 +91,7 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
91 | int len, err; | 91 | int len, err; |
92 | struct lapbethdev *lapbeth; | 92 | struct lapbethdev *lapbeth; |
93 | 93 | ||
94 | if (dev->nd_net != &init_net) | 94 | if (dev_net(dev) != &init_net) |
95 | goto drop; | 95 | goto drop; |
96 | 96 | ||
97 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 97 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
@@ -393,7 +393,7 @@ static int lapbeth_device_event(struct notifier_block *this, | |||
393 | struct lapbethdev *lapbeth; | 393 | struct lapbethdev *lapbeth; |
394 | struct net_device *dev = ptr; | 394 | struct net_device *dev = ptr; |
395 | 395 | ||
396 | if (dev->nd_net != &init_net) | 396 | if (dev_net(dev) != &init_net) |
397 | return NOTIFY_DONE; | 397 | return NOTIFY_DONE; |
398 | 398 | ||
399 | if (!dev_is_ethdev(dev)) | 399 | if (!dev_is_ethdev(dev)) |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 61e24b7a45a3..29b4b94e4947 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -1444,7 +1444,7 @@ static void sppp_print_bytes (u_char *p, u16 len) | |||
1444 | 1444 | ||
1445 | static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev) | 1445 | static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev) |
1446 | { | 1446 | { |
1447 | if (dev->nd_net != &init_net) { | 1447 | if (dev_net(dev) != &init_net) { |
1448 | kfree_skb(skb); | 1448 | kfree_skb(skb); |
1449 | return 0; | 1449 | return 0; |
1450 | } | 1450 | } |
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index a856cb47fc78..21c439046b3c 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -3250,7 +3250,7 @@ static int qeth_l3_ip_event(struct notifier_block *this, | |||
3250 | struct qeth_ipaddr *addr; | 3250 | struct qeth_ipaddr *addr; |
3251 | struct qeth_card *card; | 3251 | struct qeth_card *card; |
3252 | 3252 | ||
3253 | if (dev->nd_net != &init_net) | 3253 | if (dev_net(dev) != &init_net) |
3254 | return NOTIFY_DONE; | 3254 | return NOTIFY_DONE; |
3255 | 3255 | ||
3256 | QETH_DBF_TEXT(trace, 3, "ipevent"); | 3256 | QETH_DBF_TEXT(trace, 3, "ipevent"); |
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c index 4caa5f774fb7..13cd7835d0df 100644 --- a/fs/proc/proc_net.c +++ b/fs/proc/proc_net.c | |||
@@ -44,7 +44,9 @@ int seq_open_net(struct inode *ino, struct file *f, | |||
44 | put_net(net); | 44 | put_net(net); |
45 | return -ENOMEM; | 45 | return -ENOMEM; |
46 | } | 46 | } |
47 | #ifdef CONFIG_NET_NS | ||
47 | p->net = net; | 48 | p->net = net; |
49 | #endif | ||
48 | return 0; | 50 | return 0; |
49 | } | 51 | } |
50 | EXPORT_SYMBOL_GPL(seq_open_net); | 52 | EXPORT_SYMBOL_GPL(seq_open_net); |
@@ -52,12 +54,10 @@ EXPORT_SYMBOL_GPL(seq_open_net); | |||
52 | int seq_release_net(struct inode *ino, struct file *f) | 54 | int seq_release_net(struct inode *ino, struct file *f) |
53 | { | 55 | { |
54 | struct seq_file *seq; | 56 | struct seq_file *seq; |
55 | struct seq_net_private *p; | ||
56 | 57 | ||
57 | seq = f->private_data; | 58 | seq = f->private_data; |
58 | p = seq->private; | ||
59 | 59 | ||
60 | put_net(p->net); | 60 | put_net(seq_file_net(seq)); |
61 | seq_release_private(ino, f); | 61 | seq_release_private(ino, f); |
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index da05ab47ff2f..7009b0cdd06f 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -70,13 +70,13 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
70 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) | 70 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) |
71 | 71 | ||
72 | #define IN_DEV_ANDCONF(in_dev, attr) \ | 72 | #define IN_DEV_ANDCONF(in_dev, attr) \ |
73 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \ | 73 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \ |
74 | IN_DEV_CONF_GET((in_dev), attr)) | 74 | IN_DEV_CONF_GET((in_dev), attr)) |
75 | #define IN_DEV_ORCONF(in_dev, attr) \ | 75 | #define IN_DEV_ORCONF(in_dev, attr) \ |
76 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \ | 76 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \ |
77 | IN_DEV_CONF_GET((in_dev), attr)) | 77 | IN_DEV_CONF_GET((in_dev), attr)) |
78 | #define IN_DEV_MAXCONF(in_dev, attr) \ | 78 | #define IN_DEV_MAXCONF(in_dev, attr) \ |
79 | (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \ | 79 | (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \ |
80 | IN_DEV_CONF_GET((in_dev), attr))) | 80 | IN_DEV_CONF_GET((in_dev), attr))) |
81 | 81 | ||
82 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) | 82 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index c9ba0da16ce9..b90d3d461d4e 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -481,7 +481,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) | |||
481 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | 481 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ |
482 | 482 | ||
483 | #define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ | 483 | #define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ |
484 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 484 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
485 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 485 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
486 | ((__sk)->sk_family == AF_INET6) && \ | 486 | ((__sk)->sk_family == AF_INET6) && \ |
487 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ | 487 | ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ |
@@ -489,7 +489,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk) | |||
489 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 489 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
490 | 490 | ||
491 | #define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \ | 491 | #define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \ |
492 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 492 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
493 | (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ | 493 | (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ |
494 | ((__sk)->sk_family == PF_INET6) && \ | 494 | ((__sk)->sk_family == PF_INET6) && \ |
495 | (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ | 495 | (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index ced61f87660e..d146be40f46c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -708,8 +708,10 @@ struct net_device | |||
708 | void (*poll_controller)(struct net_device *dev); | 708 | void (*poll_controller)(struct net_device *dev); |
709 | #endif | 709 | #endif |
710 | 710 | ||
711 | #ifdef CONFIG_NET_NS | ||
711 | /* Network namespace this network device is inside */ | 712 | /* Network namespace this network device is inside */ |
712 | struct net *nd_net; | 713 | struct net *nd_net; |
714 | #endif | ||
713 | 715 | ||
714 | /* bridge stuff */ | 716 | /* bridge stuff */ |
715 | struct net_bridge_port *br_port; | 717 | struct net_bridge_port *br_port; |
@@ -737,6 +739,27 @@ struct net_device | |||
737 | #define NETDEV_ALIGN 32 | 739 | #define NETDEV_ALIGN 32 |
738 | #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) | 740 | #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) |
739 | 741 | ||
742 | /* | ||
743 | * Net namespace inlines | ||
744 | */ | ||
745 | static inline | ||
746 | struct net *dev_net(const struct net_device *dev) | ||
747 | { | ||
748 | #ifdef CONFIG_NET_NS | ||
749 | return dev->nd_net; | ||
750 | #else | ||
751 | return &init_net; | ||
752 | #endif | ||
753 | } | ||
754 | |||
755 | static inline | ||
756 | void dev_net_set(struct net_device *dev, const struct net *net) | ||
757 | { | ||
758 | #ifdef CONFIG_NET_NS | ||
759 | dev->nd_dev = net; | ||
760 | #endif | ||
761 | } | ||
762 | |||
740 | /** | 763 | /** |
741 | * netdev_priv - access network device private data | 764 | * netdev_priv - access network device private data |
742 | * @dev: network device | 765 | * @dev: network device |
@@ -813,7 +836,7 @@ static inline struct net_device *next_net_device(struct net_device *dev) | |||
813 | struct list_head *lh; | 836 | struct list_head *lh; |
814 | struct net *net; | 837 | struct net *net; |
815 | 838 | ||
816 | net = dev->nd_net; | 839 | net = dev_net(dev); |
817 | lh = dev->dev_list.next; | 840 | lh = dev->dev_list.next; |
818 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); | 841 | return lh == &net->dev_base_head ? NULL : net_device_entry(lh); |
819 | } | 842 | } |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 67c2563961f3..d870a8253769 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/types.h> | 5 | #include <linux/types.h> |
6 | #include <linux/string.h> | 6 | #include <linux/string.h> |
7 | #include <linux/mutex.h> | 7 | #include <linux/mutex.h> |
8 | #include <net/net_namespace.h> | ||
8 | 9 | ||
9 | struct seq_operations; | 10 | struct seq_operations; |
10 | struct file; | 11 | struct file; |
@@ -64,7 +65,9 @@ extern struct list_head *seq_list_next(void *v, struct list_head *head, | |||
64 | 65 | ||
65 | struct net; | 66 | struct net; |
66 | struct seq_net_private { | 67 | struct seq_net_private { |
68 | #ifdef CONFIG_NET_NS | ||
67 | struct net *net; | 69 | struct net *net; |
70 | #endif | ||
68 | }; | 71 | }; |
69 | 72 | ||
70 | int seq_open_net(struct inode *, struct file *, | 73 | int seq_open_net(struct inode *, struct file *, |
@@ -72,7 +75,11 @@ int seq_open_net(struct inode *, struct file *, | |||
72 | int seq_release_net(struct inode *, struct file *); | 75 | int seq_release_net(struct inode *, struct file *); |
73 | static inline struct net *seq_file_net(struct seq_file *seq) | 76 | static inline struct net *seq_file_net(struct seq_file *seq) |
74 | { | 77 | { |
78 | #ifdef CONFIG_NET_NS | ||
75 | return ((struct seq_net_private *)seq->private)->net; | 79 | return ((struct seq_net_private *)seq->private)->net; |
80 | #else | ||
81 | return &init_net; | ||
82 | #endif | ||
76 | } | 83 | } |
77 | 84 | ||
78 | #endif | 85 | #endif |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index d99c1ba2ece0..5525227c5e92 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -314,25 +314,25 @@ typedef __u64 __bitwise __addrpair; | |||
314 | ((__force __u64)(__be32)(__saddr))); | 314 | ((__force __u64)(__be32)(__saddr))); |
315 | #endif /* __BIG_ENDIAN */ | 315 | #endif /* __BIG_ENDIAN */ |
316 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 316 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
317 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 317 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
318 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ | 318 | ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ |
319 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 319 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
320 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 320 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
321 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ | 321 | #define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ |
322 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 322 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
323 | ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ | 323 | ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ |
324 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 324 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |
325 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 325 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
326 | #else /* 32-bit arch */ | 326 | #else /* 32-bit arch */ |
327 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) | 327 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) |
328 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ | 328 | #define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ |
329 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 329 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
330 | (inet_sk(__sk)->daddr == (__saddr)) && \ | 330 | (inet_sk(__sk)->daddr == (__saddr)) && \ |
331 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ | 331 | (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ |
332 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ | 332 | ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ |
333 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) | 333 | (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) |
334 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ | 334 | #define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ |
335 | (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ | 335 | (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \ |
336 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ | 336 | (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ |
337 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ | 337 | (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ |
338 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ | 338 | ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index 296547bfb0b7..07fe0d1a4f03 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -207,4 +207,22 @@ extern void inet_twsk_schedule(struct inet_timewait_sock *tw, | |||
207 | const int timeo, const int timewait_len); | 207 | const int timeo, const int timewait_len); |
208 | extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, | 208 | extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, |
209 | struct inet_timewait_death_row *twdr); | 209 | struct inet_timewait_death_row *twdr); |
210 | |||
211 | static inline | ||
212 | struct net *twsk_net(const struct inet_timewait_sock *twsk) | ||
213 | { | ||
214 | #ifdef CONFIG_NET_NS | ||
215 | return twsk->tw_net; | ||
216 | #else | ||
217 | return &init_net; | ||
218 | #endif | ||
219 | } | ||
220 | |||
221 | static inline | ||
222 | void twsk_net_set(struct inet_timewait_sock *twsk, const struct net *net) | ||
223 | { | ||
224 | #ifdef CONFIG_NET_NS | ||
225 | twsk->tw_net = net; | ||
226 | #endif | ||
227 | } | ||
210 | #endif /* _INET_TIMEWAIT_SOCK_ */ | 228 | #endif /* _INET_TIMEWAIT_SOCK_ */ |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 062281872064..8bec0d69b270 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -38,7 +38,9 @@ struct neighbour; | |||
38 | 38 | ||
39 | struct neigh_parms | 39 | struct neigh_parms |
40 | { | 40 | { |
41 | #ifdef CONFIG_NET_NS | ||
41 | struct net *net; | 42 | struct net *net; |
43 | #endif | ||
42 | struct net_device *dev; | 44 | struct net_device *dev; |
43 | struct neigh_parms *next; | 45 | struct neigh_parms *next; |
44 | int (*neigh_setup)(struct neighbour *); | 46 | int (*neigh_setup)(struct neighbour *); |
@@ -131,7 +133,9 @@ struct neigh_ops | |||
131 | struct pneigh_entry | 133 | struct pneigh_entry |
132 | { | 134 | { |
133 | struct pneigh_entry *next; | 135 | struct pneigh_entry *next; |
136 | #ifdef CONFIG_NET_NS | ||
134 | struct net *net; | 137 | struct net *net; |
138 | #endif | ||
135 | struct net_device *dev; | 139 | struct net_device *dev; |
136 | u8 flags; | 140 | u8 flags; |
137 | u8 key[0]; | 141 | u8 key[0]; |
@@ -213,6 +217,17 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl, | |||
213 | 217 | ||
214 | extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); | 218 | extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); |
215 | extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); | 219 | extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); |
220 | |||
221 | static inline | ||
222 | struct net *neigh_parms_net(const struct neigh_parms *parms) | ||
223 | { | ||
224 | #ifdef CONFIG_NET_NS | ||
225 | return parms->net; | ||
226 | #else | ||
227 | return &init_net; | ||
228 | #endif | ||
229 | } | ||
230 | |||
216 | extern unsigned long neigh_rand_reach_time(unsigned long base); | 231 | extern unsigned long neigh_rand_reach_time(unsigned long base); |
217 | 232 | ||
218 | extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | 233 | extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, |
@@ -220,6 +235,16 @@ extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | |||
220 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat); | 235 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat); |
221 | extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); | 236 | extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); |
222 | 237 | ||
238 | static inline | ||
239 | struct net *pneigh_net(const struct pneigh_entry *pneigh) | ||
240 | { | ||
241 | #ifdef CONFIG_NET_NS | ||
242 | return pneigh->net; | ||
243 | #else | ||
244 | return &init_net; | ||
245 | #endif | ||
246 | } | ||
247 | |||
223 | extern void neigh_app_ns(struct neighbour *n); | 248 | extern void neigh_app_ns(struct neighbour *n); |
224 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); | 249 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); |
225 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); | 250 | extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 923f2b8b9096..f8f3d1a5fc35 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -118,6 +118,12 @@ static inline void release_net(struct net *net) | |||
118 | { | 118 | { |
119 | atomic_dec(&net->use_count); | 119 | atomic_dec(&net->use_count); |
120 | } | 120 | } |
121 | |||
122 | static inline | ||
123 | int net_eq(const struct net *net1, const struct net *net2) | ||
124 | { | ||
125 | return net1 == net2; | ||
126 | } | ||
121 | #else | 127 | #else |
122 | static inline struct net *get_net(struct net *net) | 128 | static inline struct net *get_net(struct net *net) |
123 | { | 129 | { |
@@ -141,6 +147,12 @@ static inline struct net *maybe_get_net(struct net *net) | |||
141 | { | 147 | { |
142 | return net; | 148 | return net; |
143 | } | 149 | } |
150 | |||
151 | static inline | ||
152 | int net_eq(const struct net *net1, const struct net *net2) | ||
153 | { | ||
154 | return 1; | ||
155 | } | ||
144 | #endif | 156 | #endif |
145 | 157 | ||
146 | #define for_each_net(VAR) \ | 158 | #define for_each_net(VAR) \ |
diff --git a/include/net/route.h b/include/net/route.h index 28dba925663c..c6338802e8f1 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -160,7 +160,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
160 | .dport = dport } } }; | 160 | .dport = dport } } }; |
161 | 161 | ||
162 | int err; | 162 | int err; |
163 | struct net *net = sk->sk_net; | 163 | struct net *net = sock_net(sk); |
164 | if (!dst || !src) { | 164 | if (!dst || !src) { |
165 | err = __ip_route_output_key(net, rp, &fl); | 165 | err = __ip_route_output_key(net, rp, &fl); |
166 | if (err) | 166 | if (err) |
@@ -188,7 +188,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
188 | ip_rt_put(*rp); | 188 | ip_rt_put(*rp); |
189 | *rp = NULL; | 189 | *rp = NULL; |
190 | security_sk_classify_flow(sk, &fl); | 190 | security_sk_classify_flow(sk, &fl); |
191 | return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0); | 191 | return ip_route_output_flow(sock_net(sk), rp, &fl, sk, 0); |
192 | } | 192 | } |
193 | return 0; | 193 | return 0; |
194 | } | 194 | } |
diff --git a/include/net/sock.h b/include/net/sock.h index b433b1ed203d..7e0d4a0c4d12 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -126,7 +126,9 @@ struct sock_common { | |||
126 | atomic_t skc_refcnt; | 126 | atomic_t skc_refcnt; |
127 | unsigned int skc_hash; | 127 | unsigned int skc_hash; |
128 | struct proto *skc_prot; | 128 | struct proto *skc_prot; |
129 | #ifdef CONFIG_NET_NS | ||
129 | struct net *skc_net; | 130 | struct net *skc_net; |
131 | #endif | ||
130 | }; | 132 | }; |
131 | 133 | ||
132 | /** | 134 | /** |
@@ -1345,6 +1347,24 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e | |||
1345 | } | 1347 | } |
1346 | #endif | 1348 | #endif |
1347 | 1349 | ||
1350 | static inline | ||
1351 | struct net *sock_net(const struct sock *sk) | ||
1352 | { | ||
1353 | #ifdef CONFIG_NET_NS | ||
1354 | return sk->sk_net; | ||
1355 | #else | ||
1356 | return &init_net; | ||
1357 | #endif | ||
1358 | } | ||
1359 | |||
1360 | static inline | ||
1361 | void sock_net_set(struct sock *sk, const struct net *net) | ||
1362 | { | ||
1363 | #ifdef CONFIG_NET_NS | ||
1364 | sk->sk_net = net; | ||
1365 | #endif | ||
1366 | } | ||
1367 | |||
1348 | /* | 1368 | /* |
1349 | * Kernel sockets, f.e. rtnl or icmp_socket, are a part of a namespace. | 1369 | * Kernel sockets, f.e. rtnl or icmp_socket, are a part of a namespace. |
1350 | * They should not hold a referrence to a namespace in order to allow | 1370 | * They should not hold a referrence to a namespace in order to allow |
@@ -1353,8 +1373,8 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e | |||
1353 | */ | 1373 | */ |
1354 | static inline void sk_change_net(struct sock *sk, struct net *net) | 1374 | static inline void sk_change_net(struct sock *sk, struct net *net) |
1355 | { | 1375 | { |
1356 | put_net(sk->sk_net); | 1376 | put_net(sock_net(sk)); |
1357 | sk->sk_net = net; | 1377 | sock_net_set(sk, net); |
1358 | } | 1378 | } |
1359 | 1379 | ||
1360 | extern void sock_enable_timestamp(struct sock *sk); | 1380 | extern void sock_enable_timestamp(struct sock *sk); |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index dbc81b965096..c35dc230365c 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -382,7 +382,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
382 | int i, flgs; | 382 | int i, flgs; |
383 | struct net_device *vlandev; | 383 | struct net_device *vlandev; |
384 | 384 | ||
385 | if (dev->nd_net != &init_net) | 385 | if (dev_net(dev) != &init_net) |
386 | return NOTIFY_DONE; | 386 | return NOTIFY_DONE; |
387 | 387 | ||
388 | if (!grp) | 388 | if (!grp) |
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 1e5c9904571d..e536162b1ebc 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -153,7 +153,7 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
153 | struct net_device_stats *stats; | 153 | struct net_device_stats *stats; |
154 | unsigned short vlan_TCI; | 154 | unsigned short vlan_TCI; |
155 | 155 | ||
156 | if (dev->nd_net != &init_net) | 156 | if (dev_net(dev) != &init_net) |
157 | goto err_free; | 157 | goto err_free; |
158 | 158 | ||
159 | skb = skb_share_check(skb, GFP_ATOMIC); | 159 | skb = skb_share_check(skb, GFP_ATOMIC); |
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c index 61166f66479f..25aa37ce9430 100644 --- a/net/appletalk/aarp.c +++ b/net/appletalk/aarp.c | |||
@@ -333,7 +333,7 @@ static int aarp_device_event(struct notifier_block *this, unsigned long event, | |||
333 | struct net_device *dev = ptr; | 333 | struct net_device *dev = ptr; |
334 | int ct; | 334 | int ct; |
335 | 335 | ||
336 | if (dev->nd_net != &init_net) | 336 | if (dev_net(dev) != &init_net) |
337 | return NOTIFY_DONE; | 337 | return NOTIFY_DONE; |
338 | 338 | ||
339 | if (event == NETDEV_DOWN) { | 339 | if (event == NETDEV_DOWN) { |
@@ -716,7 +716,7 @@ static int aarp_rcv(struct sk_buff *skb, struct net_device *dev, | |||
716 | struct atalk_addr sa, *ma, da; | 716 | struct atalk_addr sa, *ma, da; |
717 | struct atalk_iface *ifa; | 717 | struct atalk_iface *ifa; |
718 | 718 | ||
719 | if (dev->nd_net != &init_net) | 719 | if (dev_net(dev) != &init_net) |
720 | goto out0; | 720 | goto out0; |
721 | 721 | ||
722 | /* We only do Ethernet SNAP AARP. */ | 722 | /* We only do Ethernet SNAP AARP. */ |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 3be55c8ca4ef..44cd42f7786b 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -648,7 +648,7 @@ static int ddp_device_event(struct notifier_block *this, unsigned long event, | |||
648 | { | 648 | { |
649 | struct net_device *dev = ptr; | 649 | struct net_device *dev = ptr; |
650 | 650 | ||
651 | if (dev->nd_net != &init_net) | 651 | if (dev_net(dev) != &init_net) |
652 | return NOTIFY_DONE; | 652 | return NOTIFY_DONE; |
653 | 653 | ||
654 | if (event == NETDEV_DOWN) | 654 | if (event == NETDEV_DOWN) |
@@ -1405,7 +1405,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1405 | int origlen; | 1405 | int origlen; |
1406 | __u16 len_hops; | 1406 | __u16 len_hops; |
1407 | 1407 | ||
1408 | if (dev->nd_net != &init_net) | 1408 | if (dev_net(dev) != &init_net) |
1409 | goto freeit; | 1409 | goto freeit; |
1410 | 1410 | ||
1411 | /* Don't mangle buffer if shared */ | 1411 | /* Don't mangle buffer if shared */ |
@@ -1493,7 +1493,7 @@ freeit: | |||
1493 | static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, | 1493 | static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, |
1494 | struct packet_type *pt, struct net_device *orig_dev) | 1494 | struct packet_type *pt, struct net_device *orig_dev) |
1495 | { | 1495 | { |
1496 | if (dev->nd_net != &init_net) | 1496 | if (dev_net(dev) != &init_net) |
1497 | goto freeit; | 1497 | goto freeit; |
1498 | 1498 | ||
1499 | /* Expand any short form frames */ | 1499 | /* Expand any short form frames */ |
diff --git a/net/atm/clip.c b/net/atm/clip.c index e82da6746723..6f8223ebf551 100644 --- a/net/atm/clip.c +++ b/net/atm/clip.c | |||
@@ -612,7 +612,7 @@ static int clip_device_event(struct notifier_block *this, unsigned long event, | |||
612 | { | 612 | { |
613 | struct net_device *dev = arg; | 613 | struct net_device *dev = arg; |
614 | 614 | ||
615 | if (dev->nd_net != &init_net) | 615 | if (dev_net(dev) != &init_net) |
616 | return NOTIFY_DONE; | 616 | return NOTIFY_DONE; |
617 | 617 | ||
618 | if (event == NETDEV_UNREGISTER) { | 618 | if (event == NETDEV_UNREGISTER) { |
diff --git a/net/atm/mpc.c b/net/atm/mpc.c index 9c7f712fc7e9..9db332e7a6c0 100644 --- a/net/atm/mpc.c +++ b/net/atm/mpc.c | |||
@@ -964,7 +964,7 @@ static int mpoa_event_listener(struct notifier_block *mpoa_notifier, unsigned lo | |||
964 | 964 | ||
965 | dev = (struct net_device *)dev_ptr; | 965 | dev = (struct net_device *)dev_ptr; |
966 | 966 | ||
967 | if (dev->nd_net != &init_net) | 967 | if (dev_net(dev) != &init_net) |
968 | return NOTIFY_DONE; | 968 | return NOTIFY_DONE; |
969 | 969 | ||
970 | if (dev->name == NULL || strncmp(dev->name, "lec", 3)) | 970 | if (dev->name == NULL || strncmp(dev->name, "lec", 3)) |
diff --git a/net/atm/svc.c b/net/atm/svc.c index daf9a48a7db0..de1e4f2f3a43 100644 --- a/net/atm/svc.c +++ b/net/atm/svc.c | |||
@@ -326,7 +326,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags) | |||
326 | 326 | ||
327 | lock_sock(sk); | 327 | lock_sock(sk); |
328 | 328 | ||
329 | error = svc_create(sk->sk_net, newsock,0); | 329 | error = svc_create(sock_net(sk), newsock,0); |
330 | if (error) | 330 | if (error) |
331 | goto out; | 331 | goto out; |
332 | 332 | ||
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 48bfcc741f25..2712544cf0ca 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -116,7 +116,7 @@ static int ax25_device_event(struct notifier_block *this, unsigned long event, | |||
116 | { | 116 | { |
117 | struct net_device *dev = (struct net_device *)ptr; | 117 | struct net_device *dev = (struct net_device *)ptr; |
118 | 118 | ||
119 | if (dev->nd_net != &init_net) | 119 | if (dev_net(dev) != &init_net) |
120 | return NOTIFY_DONE; | 120 | return NOTIFY_DONE; |
121 | 121 | ||
122 | /* Reject non AX.25 devices */ | 122 | /* Reject non AX.25 devices */ |
@@ -869,7 +869,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
869 | struct sock *sk; | 869 | struct sock *sk; |
870 | ax25_cb *ax25, *oax25; | 870 | ax25_cb *ax25, *oax25; |
871 | 871 | ||
872 | sk = sk_alloc(osk->sk_net, PF_AX25, GFP_ATOMIC, osk->sk_prot); | 872 | sk = sk_alloc(sock_net(osk), PF_AX25, GFP_ATOMIC, osk->sk_prot); |
873 | if (sk == NULL) | 873 | if (sk == NULL) |
874 | return NULL; | 874 | return NULL; |
875 | 875 | ||
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c index d1be080dcb25..33790a8efbc8 100644 --- a/net/ax25/ax25_in.c +++ b/net/ax25/ax25_in.c | |||
@@ -451,7 +451,7 @@ int ax25_kiss_rcv(struct sk_buff *skb, struct net_device *dev, | |||
451 | skb->sk = NULL; /* Initially we don't know who it's for */ | 451 | skb->sk = NULL; /* Initially we don't know who it's for */ |
452 | skb->destructor = NULL; /* Who initializes this, dammit?! */ | 452 | skb->destructor = NULL; /* Who initializes this, dammit?! */ |
453 | 453 | ||
454 | if (dev->nd_net != &init_net) { | 454 | if (dev_net(dev) != &init_net) { |
455 | kfree_skb(skb); | 455 | kfree_skb(skb); |
456 | return 0; | 456 | return 0; |
457 | } | 457 | } |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 34f8bf98bc05..6b995ac832f5 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1499,7 +1499,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
1499 | goto response; | 1499 | goto response; |
1500 | } | 1500 | } |
1501 | 1501 | ||
1502 | sk = l2cap_sock_alloc(parent->sk_net, NULL, BTPROTO_L2CAP, GFP_ATOMIC); | 1502 | sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP, GFP_ATOMIC); |
1503 | if (!sk) | 1503 | if (!sk) |
1504 | goto response; | 1504 | goto response; |
1505 | 1505 | ||
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index c46d51035e77..c103fa02893b 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -868,7 +868,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc * | |||
868 | goto done; | 868 | goto done; |
869 | } | 869 | } |
870 | 870 | ||
871 | sk = rfcomm_sock_alloc(parent->sk_net, NULL, BTPROTO_RFCOMM, GFP_ATOMIC); | 871 | sk = rfcomm_sock_alloc(sock_net(parent), NULL, BTPROTO_RFCOMM, GFP_ATOMIC); |
872 | if (!sk) | 872 | if (!sk) |
873 | goto done; | 873 | goto done; |
874 | 874 | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index b91d3c81a73c..2a5953b4405d 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -803,7 +803,7 @@ static void sco_conn_ready(struct sco_conn *conn) | |||
803 | 803 | ||
804 | bh_lock_sock(parent); | 804 | bh_lock_sock(parent); |
805 | 805 | ||
806 | sk = sco_sock_alloc(parent->sk_net, NULL, BTPROTO_SCO, GFP_ATOMIC); | 806 | sk = sco_sock_alloc(sock_net(parent), NULL, BTPROTO_SCO, GFP_ATOMIC); |
807 | if (!sk) { | 807 | if (!sk) { |
808 | bh_unlock_sock(parent); | 808 | bh_unlock_sock(parent); |
809 | goto done; | 809 | goto done; |
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index f5d69336d97b..f155e6ce8a21 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -108,7 +108,7 @@ errout: | |||
108 | */ | 108 | */ |
109 | static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | 109 | static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) |
110 | { | 110 | { |
111 | struct net *net = skb->sk->sk_net; | 111 | struct net *net = sock_net(skb->sk); |
112 | struct net_device *dev; | 112 | struct net_device *dev; |
113 | int idx; | 113 | int idx; |
114 | 114 | ||
@@ -140,7 +140,7 @@ skip: | |||
140 | */ | 140 | */ |
141 | static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 141 | static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
142 | { | 142 | { |
143 | struct net *net = skb->sk->sk_net; | 143 | struct net *net = sock_net(skb->sk); |
144 | struct ifinfomsg *ifm; | 144 | struct ifinfomsg *ifm; |
145 | struct nlattr *protinfo; | 145 | struct nlattr *protinfo; |
146 | struct net_device *dev; | 146 | struct net_device *dev; |
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c index 07ac3ae68d8f..00644a544e3c 100644 --- a/net/bridge/br_notify.c +++ b/net/bridge/br_notify.c | |||
@@ -37,7 +37,7 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v | |||
37 | struct net_bridge_port *p = dev->br_port; | 37 | struct net_bridge_port *p = dev->br_port; |
38 | struct net_bridge *br; | 38 | struct net_bridge *br; |
39 | 39 | ||
40 | if (dev->nd_net != &init_net) | 40 | if (dev_net(dev) != &init_net) |
41 | return NOTIFY_DONE; | 41 | return NOTIFY_DONE; |
42 | 42 | ||
43 | /* not a port of a bridge */ | 43 | /* not a port of a bridge */ |
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c index 0edbd2a1c3f3..8deab645ef75 100644 --- a/net/bridge/br_stp_bpdu.c +++ b/net/bridge/br_stp_bpdu.c | |||
@@ -142,7 +142,7 @@ int br_stp_rcv(struct sk_buff *skb, struct net_device *dev, | |||
142 | struct net_bridge *br; | 142 | struct net_bridge *br; |
143 | const unsigned char *buf; | 143 | const unsigned char *buf; |
144 | 144 | ||
145 | if (dev->nd_net != &init_net) | 145 | if (dev_net(dev) != &init_net) |
146 | goto err; | 146 | goto err; |
147 | 147 | ||
148 | if (!p) | 148 | if (!p) |
diff --git a/net/can/af_can.c b/net/can/af_can.c index 36b9f22ed83a..2759b76f731c 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -599,7 +599,7 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev, | |||
599 | struct dev_rcv_lists *d; | 599 | struct dev_rcv_lists *d; |
600 | int matches; | 600 | int matches; |
601 | 601 | ||
602 | if (dev->type != ARPHRD_CAN || dev->nd_net != &init_net) { | 602 | if (dev->type != ARPHRD_CAN || dev_net(dev) != &init_net) { |
603 | kfree_skb(skb); | 603 | kfree_skb(skb); |
604 | return 0; | 604 | return 0; |
605 | } | 605 | } |
@@ -710,7 +710,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg, | |||
710 | struct net_device *dev = (struct net_device *)data; | 710 | struct net_device *dev = (struct net_device *)data; |
711 | struct dev_rcv_lists *d; | 711 | struct dev_rcv_lists *d; |
712 | 712 | ||
713 | if (dev->nd_net != &init_net) | 713 | if (dev_net(dev) != &init_net) |
714 | return NOTIFY_DONE; | 714 | return NOTIFY_DONE; |
715 | 715 | ||
716 | if (dev->type != ARPHRD_CAN) | 716 | if (dev->type != ARPHRD_CAN) |
diff --git a/net/can/bcm.c b/net/can/bcm.c index bd4282dae754..e9f99b2c6bc9 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c | |||
@@ -1285,7 +1285,7 @@ static int bcm_notifier(struct notifier_block *nb, unsigned long msg, | |||
1285 | struct bcm_op *op; | 1285 | struct bcm_op *op; |
1286 | int notify_enodev = 0; | 1286 | int notify_enodev = 0; |
1287 | 1287 | ||
1288 | if (dev->nd_net != &init_net) | 1288 | if (dev_net(dev) != &init_net) |
1289 | return NOTIFY_DONE; | 1289 | return NOTIFY_DONE; |
1290 | 1290 | ||
1291 | if (dev->type != ARPHRD_CAN) | 1291 | if (dev->type != ARPHRD_CAN) |
diff --git a/net/can/raw.c b/net/can/raw.c index 94cd7f27c444..ead50c7c0d40 100644 --- a/net/can/raw.c +++ b/net/can/raw.c | |||
@@ -210,7 +210,7 @@ static int raw_notifier(struct notifier_block *nb, | |||
210 | struct raw_sock *ro = container_of(nb, struct raw_sock, notifier); | 210 | struct raw_sock *ro = container_of(nb, struct raw_sock, notifier); |
211 | struct sock *sk = &ro->sk; | 211 | struct sock *sk = &ro->sk; |
212 | 212 | ||
213 | if (dev->nd_net != &init_net) | 213 | if (dev_net(dev) != &init_net) |
214 | return NOTIFY_DONE; | 214 | return NOTIFY_DONE; |
215 | 215 | ||
216 | if (dev->type != ARPHRD_CAN) | 216 | if (dev->type != ARPHRD_CAN) |
diff --git a/net/core/dev.c b/net/core/dev.c index aebd08606040..75c3f7f4edd5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -216,7 +216,7 @@ static inline struct hlist_head *dev_index_hash(struct net *net, int ifindex) | |||
216 | /* Device list insertion */ | 216 | /* Device list insertion */ |
217 | static int list_netdevice(struct net_device *dev) | 217 | static int list_netdevice(struct net_device *dev) |
218 | { | 218 | { |
219 | struct net *net = dev->nd_net; | 219 | struct net *net = dev_net(dev); |
220 | 220 | ||
221 | ASSERT_RTNL(); | 221 | ASSERT_RTNL(); |
222 | 222 | ||
@@ -852,8 +852,8 @@ int dev_alloc_name(struct net_device *dev, const char *name) | |||
852 | struct net *net; | 852 | struct net *net; |
853 | int ret; | 853 | int ret; |
854 | 854 | ||
855 | BUG_ON(!dev->nd_net); | 855 | BUG_ON(!dev_net(dev)); |
856 | net = dev->nd_net; | 856 | net = dev_net(dev); |
857 | ret = __dev_alloc_name(net, name, buf); | 857 | ret = __dev_alloc_name(net, name, buf); |
858 | if (ret >= 0) | 858 | if (ret >= 0) |
859 | strlcpy(dev->name, buf, IFNAMSIZ); | 859 | strlcpy(dev->name, buf, IFNAMSIZ); |
@@ -877,9 +877,9 @@ int dev_change_name(struct net_device *dev, char *newname) | |||
877 | struct net *net; | 877 | struct net *net; |
878 | 878 | ||
879 | ASSERT_RTNL(); | 879 | ASSERT_RTNL(); |
880 | BUG_ON(!dev->nd_net); | 880 | BUG_ON(!dev_net(dev)); |
881 | 881 | ||
882 | net = dev->nd_net; | 882 | net = dev_net(dev); |
883 | if (dev->flags & IFF_UP) | 883 | if (dev->flags & IFF_UP) |
884 | return -EBUSY; | 884 | return -EBUSY; |
885 | 885 | ||
@@ -2615,7 +2615,7 @@ static int ptype_seq_show(struct seq_file *seq, void *v) | |||
2615 | 2615 | ||
2616 | if (v == SEQ_START_TOKEN) | 2616 | if (v == SEQ_START_TOKEN) |
2617 | seq_puts(seq, "Type Device Function\n"); | 2617 | seq_puts(seq, "Type Device Function\n"); |
2618 | else if (pt->dev == NULL || pt->dev->nd_net == seq_file_net(seq)) { | 2618 | else if (pt->dev == NULL || dev_net(pt->dev) == seq_file_net(seq)) { |
2619 | if (pt->type == htons(ETH_P_ALL)) | 2619 | if (pt->type == htons(ETH_P_ALL)) |
2620 | seq_puts(seq, "ALL "); | 2620 | seq_puts(seq, "ALL "); |
2621 | else | 2621 | else |
@@ -3689,8 +3689,8 @@ int register_netdevice(struct net_device *dev) | |||
3689 | 3689 | ||
3690 | /* When net_device's are persistent, this will be fatal. */ | 3690 | /* When net_device's are persistent, this will be fatal. */ |
3691 | BUG_ON(dev->reg_state != NETREG_UNINITIALIZED); | 3691 | BUG_ON(dev->reg_state != NETREG_UNINITIALIZED); |
3692 | BUG_ON(!dev->nd_net); | 3692 | BUG_ON(!dev_net(dev)); |
3693 | net = dev->nd_net; | 3693 | net = dev_net(dev); |
3694 | 3694 | ||
3695 | spin_lock_init(&dev->queue_lock); | 3695 | spin_lock_init(&dev->queue_lock); |
3696 | spin_lock_init(&dev->_xmit_lock); | 3696 | spin_lock_init(&dev->_xmit_lock); |
@@ -4011,7 +4011,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, | |||
4011 | dev = (struct net_device *) | 4011 | dev = (struct net_device *) |
4012 | (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); | 4012 | (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); |
4013 | dev->padded = (char *)dev - (char *)p; | 4013 | dev->padded = (char *)dev - (char *)p; |
4014 | dev->nd_net = &init_net; | 4014 | dev_net_set(dev, &init_net); |
4015 | 4015 | ||
4016 | if (sizeof_priv) { | 4016 | if (sizeof_priv) { |
4017 | dev->priv = ((char *)dev + | 4017 | dev->priv = ((char *)dev + |
@@ -4136,7 +4136,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
4136 | 4136 | ||
4137 | /* Get out if there is nothing todo */ | 4137 | /* Get out if there is nothing todo */ |
4138 | err = 0; | 4138 | err = 0; |
4139 | if (dev->nd_net == net) | 4139 | if (net_eq(dev_net(dev), net)) |
4140 | goto out; | 4140 | goto out; |
4141 | 4141 | ||
4142 | /* Pick the destination device name, and ensure | 4142 | /* Pick the destination device name, and ensure |
@@ -4187,7 +4187,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
4187 | dev_addr_discard(dev); | 4187 | dev_addr_discard(dev); |
4188 | 4188 | ||
4189 | /* Actually switch the network namespace */ | 4189 | /* Actually switch the network namespace */ |
4190 | dev->nd_net = net; | 4190 | dev_net_set(dev, net); |
4191 | 4191 | ||
4192 | /* Assign the new device name */ | 4192 | /* Assign the new device name */ |
4193 | if (destname != dev->name) | 4193 | if (destname != dev->name) |
diff --git a/net/core/dst.c b/net/core/dst.c index 3a01a819ba47..694cd2a3f6d2 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -279,7 +279,7 @@ static inline void dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
279 | if (!unregister) { | 279 | if (!unregister) { |
280 | dst->input = dst->output = dst_discard; | 280 | dst->input = dst->output = dst_discard; |
281 | } else { | 281 | } else { |
282 | dst->dev = dst->dev->nd_net->loopback_dev; | 282 | dst->dev = dev_net(dst->dev)->loopback_dev; |
283 | dev_hold(dst->dev); | 283 | dev_hold(dst->dev); |
284 | dev_put(dev); | 284 | dev_put(dev); |
285 | if (dst->neighbour && dst->neighbour->dev == dev) { | 285 | if (dst->neighbour && dst->neighbour->dev == dev) { |
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c index 42ccaf5b8509..540c07283e31 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -214,7 +214,7 @@ errout: | |||
214 | 214 | ||
215 | static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 215 | static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) |
216 | { | 216 | { |
217 | struct net *net = skb->sk->sk_net; | 217 | struct net *net = sock_net(skb->sk); |
218 | struct fib_rule_hdr *frh = nlmsg_data(nlh); | 218 | struct fib_rule_hdr *frh = nlmsg_data(nlh); |
219 | struct fib_rules_ops *ops = NULL; | 219 | struct fib_rules_ops *ops = NULL; |
220 | struct fib_rule *rule, *r, *last = NULL; | 220 | struct fib_rule *rule, *r, *last = NULL; |
@@ -352,7 +352,7 @@ errout: | |||
352 | 352 | ||
353 | static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 353 | static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) |
354 | { | 354 | { |
355 | struct net *net = skb->sk->sk_net; | 355 | struct net *net = sock_net(skb->sk); |
356 | struct fib_rule_hdr *frh = nlmsg_data(nlh); | 356 | struct fib_rule_hdr *frh = nlmsg_data(nlh); |
357 | struct fib_rules_ops *ops = NULL; | 357 | struct fib_rules_ops *ops = NULL; |
358 | struct fib_rule *rule, *tmp; | 358 | struct fib_rule *rule, *tmp; |
@@ -534,7 +534,7 @@ skip: | |||
534 | 534 | ||
535 | static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb) | 535 | static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb) |
536 | { | 536 | { |
537 | struct net *net = skb->sk->sk_net; | 537 | struct net *net = sock_net(skb->sk); |
538 | struct fib_rules_ops *ops; | 538 | struct fib_rules_ops *ops; |
539 | int idx = 0, family; | 539 | int idx = 0, family; |
540 | 540 | ||
@@ -618,7 +618,7 @@ static int fib_rules_event(struct notifier_block *this, unsigned long event, | |||
618 | void *ptr) | 618 | void *ptr) |
619 | { | 619 | { |
620 | struct net_device *dev = ptr; | 620 | struct net_device *dev = ptr; |
621 | struct net *net = dev->nd_net; | 621 | struct net *net = dev_net(dev); |
622 | struct fib_rules_ops *ops; | 622 | struct fib_rules_ops *ops; |
623 | 623 | ||
624 | ASSERT_RTNL(); | 624 | ASSERT_RTNL(); |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 23c0a10c0c37..857915a12c15 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -388,7 +388,7 @@ struct neighbour *neigh_lookup_nodev(struct neigh_table *tbl, struct net *net, | |||
388 | hash_val = tbl->hash(pkey, NULL); | 388 | hash_val = tbl->hash(pkey, NULL); |
389 | for (n = tbl->hash_buckets[hash_val & tbl->hash_mask]; n; n = n->next) { | 389 | for (n = tbl->hash_buckets[hash_val & tbl->hash_mask]; n; n = n->next) { |
390 | if (!memcmp(n->primary_key, pkey, key_len) && | 390 | if (!memcmp(n->primary_key, pkey, key_len) && |
391 | (net == n->dev->nd_net)) { | 391 | net_eq(dev_net(n->dev), net)) { |
392 | neigh_hold(n); | 392 | neigh_hold(n); |
393 | NEIGH_CACHE_STAT_INC(tbl, hits); | 393 | NEIGH_CACHE_STAT_INC(tbl, hits); |
394 | break; | 394 | break; |
@@ -483,7 +483,7 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, | |||
483 | 483 | ||
484 | for (n = tbl->phash_buckets[hash_val]; n; n = n->next) { | 484 | for (n = tbl->phash_buckets[hash_val]; n; n = n->next) { |
485 | if (!memcmp(n->key, pkey, key_len) && | 485 | if (!memcmp(n->key, pkey, key_len) && |
486 | (n->net == net) && | 486 | net_eq(pneigh_net(n), net) && |
487 | (n->dev == dev || !n->dev)) { | 487 | (n->dev == dev || !n->dev)) { |
488 | read_unlock_bh(&tbl->lock); | 488 | read_unlock_bh(&tbl->lock); |
489 | goto out; | 489 | goto out; |
@@ -500,7 +500,9 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl, | |||
500 | if (!n) | 500 | if (!n) |
501 | goto out; | 501 | goto out; |
502 | 502 | ||
503 | #ifdef CONFIG_NET_NS | ||
503 | n->net = hold_net(net); | 504 | n->net = hold_net(net); |
505 | #endif | ||
504 | memcpy(n->key, pkey, key_len); | 506 | memcpy(n->key, pkey, key_len); |
505 | n->dev = dev; | 507 | n->dev = dev; |
506 | if (dev) | 508 | if (dev) |
@@ -540,14 +542,14 @@ int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *pkey, | |||
540 | for (np = &tbl->phash_buckets[hash_val]; (n = *np) != NULL; | 542 | for (np = &tbl->phash_buckets[hash_val]; (n = *np) != NULL; |
541 | np = &n->next) { | 543 | np = &n->next) { |
542 | if (!memcmp(n->key, pkey, key_len) && n->dev == dev && | 544 | if (!memcmp(n->key, pkey, key_len) && n->dev == dev && |
543 | (n->net == net)) { | 545 | net_eq(pneigh_net(n), net)) { |
544 | *np = n->next; | 546 | *np = n->next; |
545 | write_unlock_bh(&tbl->lock); | 547 | write_unlock_bh(&tbl->lock); |
546 | if (tbl->pdestructor) | 548 | if (tbl->pdestructor) |
547 | tbl->pdestructor(n); | 549 | tbl->pdestructor(n); |
548 | if (n->dev) | 550 | if (n->dev) |
549 | dev_put(n->dev); | 551 | dev_put(n->dev); |
550 | release_net(n->net); | 552 | release_net(pneigh_net(n)); |
551 | kfree(n); | 553 | kfree(n); |
552 | return 0; | 554 | return 0; |
553 | } | 555 | } |
@@ -570,7 +572,7 @@ static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev) | |||
570 | tbl->pdestructor(n); | 572 | tbl->pdestructor(n); |
571 | if (n->dev) | 573 | if (n->dev) |
572 | dev_put(n->dev); | 574 | dev_put(n->dev); |
573 | release_net(n->net); | 575 | release_net(pneigh_net(n)); |
574 | kfree(n); | 576 | kfree(n); |
575 | continue; | 577 | continue; |
576 | } | 578 | } |
@@ -1284,7 +1286,7 @@ static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl, | |||
1284 | struct neigh_parms *p; | 1286 | struct neigh_parms *p; |
1285 | 1287 | ||
1286 | for (p = &tbl->parms; p; p = p->next) { | 1288 | for (p = &tbl->parms; p; p = p->next) { |
1287 | if ((p->dev && p->dev->ifindex == ifindex && p->net == net) || | 1289 | if ((p->dev && p->dev->ifindex == ifindex && net_eq(neigh_parms_net(p), net)) || |
1288 | (!p->dev && !ifindex)) | 1290 | (!p->dev && !ifindex)) |
1289 | return p; | 1291 | return p; |
1290 | } | 1292 | } |
@@ -1298,7 +1300,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1298 | struct neigh_parms *p, *ref; | 1300 | struct neigh_parms *p, *ref; |
1299 | struct net *net; | 1301 | struct net *net; |
1300 | 1302 | ||
1301 | net = dev->nd_net; | 1303 | net = dev_net(dev); |
1302 | ref = lookup_neigh_params(tbl, net, 0); | 1304 | ref = lookup_neigh_params(tbl, net, 0); |
1303 | if (!ref) | 1305 | if (!ref) |
1304 | return NULL; | 1306 | return NULL; |
@@ -1318,7 +1320,9 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1318 | 1320 | ||
1319 | dev_hold(dev); | 1321 | dev_hold(dev); |
1320 | p->dev = dev; | 1322 | p->dev = dev; |
1323 | #ifdef CONFIG_NET_NS | ||
1321 | p->net = hold_net(net); | 1324 | p->net = hold_net(net); |
1325 | #endif | ||
1322 | p->sysctl_table = NULL; | 1326 | p->sysctl_table = NULL; |
1323 | write_lock_bh(&tbl->lock); | 1327 | write_lock_bh(&tbl->lock); |
1324 | p->next = tbl->parms.next; | 1328 | p->next = tbl->parms.next; |
@@ -1360,7 +1364,7 @@ void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms) | |||
1360 | 1364 | ||
1361 | static void neigh_parms_destroy(struct neigh_parms *parms) | 1365 | static void neigh_parms_destroy(struct neigh_parms *parms) |
1362 | { | 1366 | { |
1363 | release_net(parms->net); | 1367 | release_net(neigh_parms_net(parms)); |
1364 | kfree(parms); | 1368 | kfree(parms); |
1365 | } | 1369 | } |
1366 | 1370 | ||
@@ -1371,7 +1375,9 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl) | |||
1371 | unsigned long now = jiffies; | 1375 | unsigned long now = jiffies; |
1372 | unsigned long phsize; | 1376 | unsigned long phsize; |
1373 | 1377 | ||
1378 | #ifdef CONFIG_NET_NS | ||
1374 | tbl->parms.net = &init_net; | 1379 | tbl->parms.net = &init_net; |
1380 | #endif | ||
1375 | atomic_set(&tbl->parms.refcnt, 1); | 1381 | atomic_set(&tbl->parms.refcnt, 1); |
1376 | INIT_RCU_HEAD(&tbl->parms.rcu_head); | 1382 | INIT_RCU_HEAD(&tbl->parms.rcu_head); |
1377 | tbl->parms.reachable_time = | 1383 | tbl->parms.reachable_time = |
@@ -1478,7 +1484,7 @@ int neigh_table_clear(struct neigh_table *tbl) | |||
1478 | 1484 | ||
1479 | static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 1485 | static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
1480 | { | 1486 | { |
1481 | struct net *net = skb->sk->sk_net; | 1487 | struct net *net = sock_net(skb->sk); |
1482 | struct ndmsg *ndm; | 1488 | struct ndmsg *ndm; |
1483 | struct nlattr *dst_attr; | 1489 | struct nlattr *dst_attr; |
1484 | struct neigh_table *tbl; | 1490 | struct neigh_table *tbl; |
@@ -1544,7 +1550,7 @@ out: | |||
1544 | 1550 | ||
1545 | static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 1551 | static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
1546 | { | 1552 | { |
1547 | struct net *net = skb->sk->sk_net; | 1553 | struct net *net = sock_net(skb->sk); |
1548 | struct ndmsg *ndm; | 1554 | struct ndmsg *ndm; |
1549 | struct nlattr *tb[NDA_MAX+1]; | 1555 | struct nlattr *tb[NDA_MAX+1]; |
1550 | struct neigh_table *tbl; | 1556 | struct neigh_table *tbl; |
@@ -1812,7 +1818,7 @@ static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = { | |||
1812 | 1818 | ||
1813 | static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 1819 | static int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
1814 | { | 1820 | { |
1815 | struct net *net = skb->sk->sk_net; | 1821 | struct net *net = sock_net(skb->sk); |
1816 | struct neigh_table *tbl; | 1822 | struct neigh_table *tbl; |
1817 | struct ndtmsg *ndtmsg; | 1823 | struct ndtmsg *ndtmsg; |
1818 | struct nlattr *tb[NDTA_MAX+1]; | 1824 | struct nlattr *tb[NDTA_MAX+1]; |
@@ -1937,7 +1943,7 @@ errout: | |||
1937 | 1943 | ||
1938 | static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb) | 1944 | static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb) |
1939 | { | 1945 | { |
1940 | struct net *net = skb->sk->sk_net; | 1946 | struct net *net = sock_net(skb->sk); |
1941 | int family, tidx, nidx = 0; | 1947 | int family, tidx, nidx = 0; |
1942 | int tbl_skip = cb->args[0]; | 1948 | int tbl_skip = cb->args[0]; |
1943 | int neigh_skip = cb->args[1]; | 1949 | int neigh_skip = cb->args[1]; |
@@ -1958,7 +1964,7 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb) | |||
1958 | break; | 1964 | break; |
1959 | 1965 | ||
1960 | for (nidx = 0, p = tbl->parms.next; p; p = p->next) { | 1966 | for (nidx = 0, p = tbl->parms.next; p; p = p->next) { |
1961 | if (net != p->net) | 1967 | if (!net_eq(neigh_parms_net(p), net)) |
1962 | continue; | 1968 | continue; |
1963 | 1969 | ||
1964 | if (nidx++ < neigh_skip) | 1970 | if (nidx++ < neigh_skip) |
@@ -2037,7 +2043,7 @@ static void neigh_update_notify(struct neighbour *neigh) | |||
2037 | static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, | 2043 | static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, |
2038 | struct netlink_callback *cb) | 2044 | struct netlink_callback *cb) |
2039 | { | 2045 | { |
2040 | struct net * net = skb->sk->sk_net; | 2046 | struct net * net = sock_net(skb->sk); |
2041 | struct neighbour *n; | 2047 | struct neighbour *n; |
2042 | int rc, h, s_h = cb->args[1]; | 2048 | int rc, h, s_h = cb->args[1]; |
2043 | int idx, s_idx = idx = cb->args[2]; | 2049 | int idx, s_idx = idx = cb->args[2]; |
@@ -2050,7 +2056,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, | |||
2050 | s_idx = 0; | 2056 | s_idx = 0; |
2051 | for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) { | 2057 | for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) { |
2052 | int lidx; | 2058 | int lidx; |
2053 | if (n->dev->nd_net != net) | 2059 | if (dev_net(n->dev) != net) |
2054 | continue; | 2060 | continue; |
2055 | lidx = idx++; | 2061 | lidx = idx++; |
2056 | if (lidx < s_idx) | 2062 | if (lidx < s_idx) |
@@ -2145,7 +2151,7 @@ EXPORT_SYMBOL(__neigh_for_each_release); | |||
2145 | static struct neighbour *neigh_get_first(struct seq_file *seq) | 2151 | static struct neighbour *neigh_get_first(struct seq_file *seq) |
2146 | { | 2152 | { |
2147 | struct neigh_seq_state *state = seq->private; | 2153 | struct neigh_seq_state *state = seq->private; |
2148 | struct net *net = state->p.net; | 2154 | struct net *net = seq_file_net(seq); |
2149 | struct neigh_table *tbl = state->tbl; | 2155 | struct neigh_table *tbl = state->tbl; |
2150 | struct neighbour *n = NULL; | 2156 | struct neighbour *n = NULL; |
2151 | int bucket = state->bucket; | 2157 | int bucket = state->bucket; |
@@ -2155,7 +2161,7 @@ static struct neighbour *neigh_get_first(struct seq_file *seq) | |||
2155 | n = tbl->hash_buckets[bucket]; | 2161 | n = tbl->hash_buckets[bucket]; |
2156 | 2162 | ||
2157 | while (n) { | 2163 | while (n) { |
2158 | if (n->dev->nd_net != net) | 2164 | if (!net_eq(dev_net(n->dev), net)) |
2159 | goto next; | 2165 | goto next; |
2160 | if (state->neigh_sub_iter) { | 2166 | if (state->neigh_sub_iter) { |
2161 | loff_t fakep = 0; | 2167 | loff_t fakep = 0; |
@@ -2186,7 +2192,7 @@ static struct neighbour *neigh_get_next(struct seq_file *seq, | |||
2186 | loff_t *pos) | 2192 | loff_t *pos) |
2187 | { | 2193 | { |
2188 | struct neigh_seq_state *state = seq->private; | 2194 | struct neigh_seq_state *state = seq->private; |
2189 | struct net *net = state->p.net; | 2195 | struct net *net = seq_file_net(seq); |
2190 | struct neigh_table *tbl = state->tbl; | 2196 | struct neigh_table *tbl = state->tbl; |
2191 | 2197 | ||
2192 | if (state->neigh_sub_iter) { | 2198 | if (state->neigh_sub_iter) { |
@@ -2198,7 +2204,7 @@ static struct neighbour *neigh_get_next(struct seq_file *seq, | |||
2198 | 2204 | ||
2199 | while (1) { | 2205 | while (1) { |
2200 | while (n) { | 2206 | while (n) { |
2201 | if (n->dev->nd_net != net) | 2207 | if (!net_eq(dev_net(n->dev), net)) |
2202 | goto next; | 2208 | goto next; |
2203 | if (state->neigh_sub_iter) { | 2209 | if (state->neigh_sub_iter) { |
2204 | void *v = state->neigh_sub_iter(state, n, pos); | 2210 | void *v = state->neigh_sub_iter(state, n, pos); |
@@ -2246,7 +2252,7 @@ static struct neighbour *neigh_get_idx(struct seq_file *seq, loff_t *pos) | |||
2246 | static struct pneigh_entry *pneigh_get_first(struct seq_file *seq) | 2252 | static struct pneigh_entry *pneigh_get_first(struct seq_file *seq) |
2247 | { | 2253 | { |
2248 | struct neigh_seq_state *state = seq->private; | 2254 | struct neigh_seq_state *state = seq->private; |
2249 | struct net * net = state->p.net; | 2255 | struct net *net = seq_file_net(seq); |
2250 | struct neigh_table *tbl = state->tbl; | 2256 | struct neigh_table *tbl = state->tbl; |
2251 | struct pneigh_entry *pn = NULL; | 2257 | struct pneigh_entry *pn = NULL; |
2252 | int bucket = state->bucket; | 2258 | int bucket = state->bucket; |
@@ -2254,7 +2260,7 @@ static struct pneigh_entry *pneigh_get_first(struct seq_file *seq) | |||
2254 | state->flags |= NEIGH_SEQ_IS_PNEIGH; | 2260 | state->flags |= NEIGH_SEQ_IS_PNEIGH; |
2255 | for (bucket = 0; bucket <= PNEIGH_HASHMASK; bucket++) { | 2261 | for (bucket = 0; bucket <= PNEIGH_HASHMASK; bucket++) { |
2256 | pn = tbl->phash_buckets[bucket]; | 2262 | pn = tbl->phash_buckets[bucket]; |
2257 | while (pn && (pn->net != net)) | 2263 | while (pn && !net_eq(pneigh_net(pn), net)) |
2258 | pn = pn->next; | 2264 | pn = pn->next; |
2259 | if (pn) | 2265 | if (pn) |
2260 | break; | 2266 | break; |
@@ -2269,7 +2275,7 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq, | |||
2269 | loff_t *pos) | 2275 | loff_t *pos) |
2270 | { | 2276 | { |
2271 | struct neigh_seq_state *state = seq->private; | 2277 | struct neigh_seq_state *state = seq->private; |
2272 | struct net * net = state->p.net; | 2278 | struct net *net = seq_file_net(seq); |
2273 | struct neigh_table *tbl = state->tbl; | 2279 | struct neigh_table *tbl = state->tbl; |
2274 | 2280 | ||
2275 | pn = pn->next; | 2281 | pn = pn->next; |
@@ -2277,7 +2283,7 @@ static struct pneigh_entry *pneigh_get_next(struct seq_file *seq, | |||
2277 | if (++state->bucket > PNEIGH_HASHMASK) | 2283 | if (++state->bucket > PNEIGH_HASHMASK) |
2278 | break; | 2284 | break; |
2279 | pn = tbl->phash_buckets[state->bucket]; | 2285 | pn = tbl->phash_buckets[state->bucket]; |
2280 | while (pn && (pn->net != net)) | 2286 | while (pn && !net_eq(pneigh_net(pn), net)) |
2281 | pn = pn->next; | 2287 | pn = pn->next; |
2282 | if (pn) | 2288 | if (pn) |
2283 | break; | 2289 | break; |
@@ -2482,7 +2488,7 @@ static inline size_t neigh_nlmsg_size(void) | |||
2482 | 2488 | ||
2483 | static void __neigh_notify(struct neighbour *n, int type, int flags) | 2489 | static void __neigh_notify(struct neighbour *n, int type, int flags) |
2484 | { | 2490 | { |
2485 | struct net *net = n->dev->nd_net; | 2491 | struct net *net = dev_net(n->dev); |
2486 | struct sk_buff *skb; | 2492 | struct sk_buff *skb; |
2487 | int err = -ENOBUFS; | 2493 | int err = -ENOBUFS; |
2488 | 2494 | ||
@@ -2740,7 +2746,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, | |||
2740 | neigh_path[NEIGH_CTL_PATH_PROTO].ctl_name = p_id; | 2746 | neigh_path[NEIGH_CTL_PATH_PROTO].ctl_name = p_id; |
2741 | 2747 | ||
2742 | t->sysctl_header = | 2748 | t->sysctl_header = |
2743 | register_net_sysctl_table(p->net, neigh_path, t->neigh_vars); | 2749 | register_net_sysctl_table(neigh_parms_net(p), neigh_path, t->neigh_vars); |
2744 | if (!t->sysctl_header) | 2750 | if (!t->sysctl_header) |
2745 | goto free_procname; | 2751 | goto free_procname; |
2746 | 2752 | ||
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 20e63b302ba6..a803b442234c 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -1874,7 +1874,7 @@ static int pktgen_device_event(struct notifier_block *unused, | |||
1874 | { | 1874 | { |
1875 | struct net_device *dev = ptr; | 1875 | struct net_device *dev = ptr; |
1876 | 1876 | ||
1877 | if (dev->nd_net != &init_net) | 1877 | if (dev_net(dev) != &init_net) |
1878 | return NOTIFY_DONE; | 1878 | return NOTIFY_DONE; |
1879 | 1879 | ||
1880 | /* It is OK that we do not hold the group lock right now, | 1880 | /* It is OK that we do not hold the group lock right now, |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 2bd9c5f7627d..da99ac0871bf 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -662,7 +662,7 @@ nla_put_failure: | |||
662 | 662 | ||
663 | static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | 663 | static int rtnl_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) |
664 | { | 664 | { |
665 | struct net *net = skb->sk->sk_net; | 665 | struct net *net = sock_net(skb->sk); |
666 | int idx; | 666 | int idx; |
667 | int s_idx = cb->args[0]; | 667 | int s_idx = cb->args[0]; |
668 | struct net_device *dev; | 668 | struct net_device *dev; |
@@ -879,7 +879,7 @@ errout: | |||
879 | 879 | ||
880 | static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 880 | static int rtnl_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
881 | { | 881 | { |
882 | struct net *net = skb->sk->sk_net; | 882 | struct net *net = sock_net(skb->sk); |
883 | struct ifinfomsg *ifm; | 883 | struct ifinfomsg *ifm; |
884 | struct net_device *dev; | 884 | struct net_device *dev; |
885 | int err; | 885 | int err; |
@@ -921,7 +921,7 @@ errout: | |||
921 | 921 | ||
922 | static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 922 | static int rtnl_dellink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
923 | { | 923 | { |
924 | struct net *net = skb->sk->sk_net; | 924 | struct net *net = sock_net(skb->sk); |
925 | const struct rtnl_link_ops *ops; | 925 | const struct rtnl_link_ops *ops; |
926 | struct net_device *dev; | 926 | struct net_device *dev; |
927 | struct ifinfomsg *ifm; | 927 | struct ifinfomsg *ifm; |
@@ -972,7 +972,7 @@ struct net_device *rtnl_create_link(struct net *net, char *ifname, | |||
972 | goto err_free; | 972 | goto err_free; |
973 | } | 973 | } |
974 | 974 | ||
975 | dev->nd_net = net; | 975 | dev_net_set(dev, net); |
976 | dev->rtnl_link_ops = ops; | 976 | dev->rtnl_link_ops = ops; |
977 | 977 | ||
978 | if (tb[IFLA_MTU]) | 978 | if (tb[IFLA_MTU]) |
@@ -1000,7 +1000,7 @@ err: | |||
1000 | 1000 | ||
1001 | static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 1001 | static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
1002 | { | 1002 | { |
1003 | struct net *net = skb->sk->sk_net; | 1003 | struct net *net = sock_net(skb->sk); |
1004 | const struct rtnl_link_ops *ops; | 1004 | const struct rtnl_link_ops *ops; |
1005 | struct net_device *dev; | 1005 | struct net_device *dev; |
1006 | struct ifinfomsg *ifm; | 1006 | struct ifinfomsg *ifm; |
@@ -1132,7 +1132,7 @@ replay: | |||
1132 | 1132 | ||
1133 | static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 1133 | static int rtnl_getlink(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) |
1134 | { | 1134 | { |
1135 | struct net *net = skb->sk->sk_net; | 1135 | struct net *net = sock_net(skb->sk); |
1136 | struct ifinfomsg *ifm; | 1136 | struct ifinfomsg *ifm; |
1137 | struct nlattr *tb[IFLA_MAX+1]; | 1137 | struct nlattr *tb[IFLA_MAX+1]; |
1138 | struct net_device *dev = NULL; | 1138 | struct net_device *dev = NULL; |
@@ -1198,7 +1198,7 @@ static int rtnl_dump_all(struct sk_buff *skb, struct netlink_callback *cb) | |||
1198 | 1198 | ||
1199 | void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change) | 1199 | void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change) |
1200 | { | 1200 | { |
1201 | struct net *net = dev->nd_net; | 1201 | struct net *net = dev_net(dev); |
1202 | struct sk_buff *skb; | 1202 | struct sk_buff *skb; |
1203 | int err = -ENOBUFS; | 1203 | int err = -ENOBUFS; |
1204 | 1204 | ||
@@ -1227,7 +1227,7 @@ static int rtattr_max; | |||
1227 | 1227 | ||
1228 | static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) | 1228 | static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) |
1229 | { | 1229 | { |
1230 | struct net *net = skb->sk->sk_net; | 1230 | struct net *net = sock_net(skb->sk); |
1231 | rtnl_doit_func doit; | 1231 | rtnl_doit_func doit; |
1232 | int sz_idx, kind; | 1232 | int sz_idx, kind; |
1233 | int min_len; | 1233 | int min_len; |
diff --git a/net/core/sock.c b/net/core/sock.c index b1a6ed4d33c1..3ee95060dbd0 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -372,7 +372,7 @@ static int sock_bindtodevice(struct sock *sk, char __user *optval, int optlen) | |||
372 | { | 372 | { |
373 | int ret = -ENOPROTOOPT; | 373 | int ret = -ENOPROTOOPT; |
374 | #ifdef CONFIG_NETDEVICES | 374 | #ifdef CONFIG_NETDEVICES |
375 | struct net *net = sk->sk_net; | 375 | struct net *net = sock_net(sk); |
376 | char devname[IFNAMSIZ]; | 376 | char devname[IFNAMSIZ]; |
377 | int index; | 377 | int index; |
378 | 378 | ||
@@ -958,7 +958,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | |||
958 | */ | 958 | */ |
959 | sk->sk_prot = sk->sk_prot_creator = prot; | 959 | sk->sk_prot = sk->sk_prot_creator = prot; |
960 | sock_lock_init(sk); | 960 | sock_lock_init(sk); |
961 | sk->sk_net = get_net(net); | 961 | sock_net_set(sk, get_net(net)); |
962 | } | 962 | } |
963 | 963 | ||
964 | return sk; | 964 | return sk; |
@@ -983,7 +983,7 @@ void sk_free(struct sock *sk) | |||
983 | printk(KERN_DEBUG "%s: optmem leakage (%d bytes) detected.\n", | 983 | printk(KERN_DEBUG "%s: optmem leakage (%d bytes) detected.\n", |
984 | __func__, atomic_read(&sk->sk_omem_alloc)); | 984 | __func__, atomic_read(&sk->sk_omem_alloc)); |
985 | 985 | ||
986 | put_net(sk->sk_net); | 986 | put_net(sock_net(sk)); |
987 | sk_prot_free(sk->sk_prot_creator, sk); | 987 | sk_prot_free(sk->sk_prot_creator, sk); |
988 | } | 988 | } |
989 | 989 | ||
@@ -1001,7 +1001,7 @@ void sk_release_kernel(struct sock *sk) | |||
1001 | 1001 | ||
1002 | sock_hold(sk); | 1002 | sock_hold(sk); |
1003 | sock_release(sk->sk_socket); | 1003 | sock_release(sk->sk_socket); |
1004 | sk->sk_net = get_net(&init_net); | 1004 | sock_net_set(sk, get_net(&init_net)); |
1005 | sock_put(sk); | 1005 | sock_put(sk); |
1006 | } | 1006 | } |
1007 | EXPORT_SYMBOL(sk_release_kernel); | 1007 | EXPORT_SYMBOL(sk_release_kernel); |
@@ -1017,7 +1017,7 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority) | |||
1017 | sock_copy(newsk, sk); | 1017 | sock_copy(newsk, sk); |
1018 | 1018 | ||
1019 | /* SANITY */ | 1019 | /* SANITY */ |
1020 | get_net(newsk->sk_net); | 1020 | get_net(sock_net(newsk)); |
1021 | sk_node_init(&newsk->sk_node); | 1021 | sk_node_init(&newsk->sk_node); |
1022 | sock_lock_init(newsk); | 1022 | sock_lock_init(newsk); |
1023 | bh_lock_sock(newsk); | 1023 | bh_lock_sock(newsk); |
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 23fd95a7ad15..fc2efe899e91 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -1094,7 +1094,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags) | |||
1094 | 1094 | ||
1095 | cb = DN_SKB_CB(skb); | 1095 | cb = DN_SKB_CB(skb); |
1096 | sk->sk_ack_backlog--; | 1096 | sk->sk_ack_backlog--; |
1097 | newsk = dn_alloc_sock(sk->sk_net, newsock, sk->sk_allocation); | 1097 | newsk = dn_alloc_sock(sock_net(sk), newsock, sk->sk_allocation); |
1098 | if (newsk == NULL) { | 1098 | if (newsk == NULL) { |
1099 | release_sock(sk); | 1099 | release_sock(sk); |
1100 | kfree_skb(skb); | 1100 | kfree_skb(skb); |
@@ -2089,7 +2089,7 @@ static int dn_device_event(struct notifier_block *this, unsigned long event, | |||
2089 | { | 2089 | { |
2090 | struct net_device *dev = (struct net_device *)ptr; | 2090 | struct net_device *dev = (struct net_device *)ptr; |
2091 | 2091 | ||
2092 | if (dev->nd_net != &init_net) | 2092 | if (dev_net(dev) != &init_net) |
2093 | return NOTIFY_DONE; | 2093 | return NOTIFY_DONE; |
2094 | 2094 | ||
2095 | switch(event) { | 2095 | switch(event) { |
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c index 1bbfce5f7a2d..2f0ac3c3eb71 100644 --- a/net/decnet/dn_dev.c +++ b/net/decnet/dn_dev.c | |||
@@ -625,7 +625,7 @@ static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = { | |||
625 | 625 | ||
626 | static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 626 | static int dn_nl_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
627 | { | 627 | { |
628 | struct net *net = skb->sk->sk_net; | 628 | struct net *net = sock_net(skb->sk); |
629 | struct nlattr *tb[IFA_MAX+1]; | 629 | struct nlattr *tb[IFA_MAX+1]; |
630 | struct dn_dev *dn_db; | 630 | struct dn_dev *dn_db; |
631 | struct ifaddrmsg *ifm; | 631 | struct ifaddrmsg *ifm; |
@@ -663,7 +663,7 @@ errout: | |||
663 | 663 | ||
664 | static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 664 | static int dn_nl_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
665 | { | 665 | { |
666 | struct net *net = skb->sk->sk_net; | 666 | struct net *net = sock_net(skb->sk); |
667 | struct nlattr *tb[IFA_MAX+1]; | 667 | struct nlattr *tb[IFA_MAX+1]; |
668 | struct net_device *dev; | 668 | struct net_device *dev; |
669 | struct dn_dev *dn_db; | 669 | struct dn_dev *dn_db; |
@@ -779,7 +779,7 @@ errout: | |||
779 | 779 | ||
780 | static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | 780 | static int dn_nl_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) |
781 | { | 781 | { |
782 | struct net *net = skb->sk->sk_net; | 782 | struct net *net = sock_net(skb->sk); |
783 | int idx, dn_idx = 0, skip_ndevs, skip_naddr; | 783 | int idx, dn_idx = 0, skip_ndevs, skip_naddr; |
784 | struct net_device *dev; | 784 | struct net_device *dev; |
785 | struct dn_dev *dn_db; | 785 | struct dn_dev *dn_db; |
diff --git a/net/decnet/dn_fib.c b/net/decnet/dn_fib.c index 4aa9a423e606..27ea2e9b080a 100644 --- a/net/decnet/dn_fib.c +++ b/net/decnet/dn_fib.c | |||
@@ -504,7 +504,7 @@ static int dn_fib_check_attr(struct rtmsg *r, struct rtattr **rta) | |||
504 | 504 | ||
505 | static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 505 | static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
506 | { | 506 | { |
507 | struct net *net = skb->sk->sk_net; | 507 | struct net *net = sock_net(skb->sk); |
508 | struct dn_fib_table *tb; | 508 | struct dn_fib_table *tb; |
509 | struct rtattr **rta = arg; | 509 | struct rtattr **rta = arg; |
510 | struct rtmsg *r = NLMSG_DATA(nlh); | 510 | struct rtmsg *r = NLMSG_DATA(nlh); |
@@ -524,7 +524,7 @@ static int dn_fib_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh, void * | |||
524 | 524 | ||
525 | static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 525 | static int dn_fib_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
526 | { | 526 | { |
527 | struct net *net = skb->sk->sk_net; | 527 | struct net *net = sock_net(skb->sk); |
528 | struct dn_fib_table *tb; | 528 | struct dn_fib_table *tb; |
529 | struct rtattr **rta = arg; | 529 | struct rtattr **rta = arg; |
530 | struct rtmsg *r = NLMSG_DATA(nlh); | 530 | struct rtmsg *r = NLMSG_DATA(nlh); |
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 9dc0abb50eaf..2f665a516476 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -580,7 +580,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type | |||
580 | struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; | 580 | struct dn_dev *dn = (struct dn_dev *)dev->dn_ptr; |
581 | unsigned char padlen = 0; | 581 | unsigned char padlen = 0; |
582 | 582 | ||
583 | if (dev->nd_net != &init_net) | 583 | if (dev_net(dev) != &init_net) |
584 | goto dump_it; | 584 | goto dump_it; |
585 | 585 | ||
586 | if (dn == NULL) | 586 | if (dn == NULL) |
@@ -1512,7 +1512,7 @@ rtattr_failure: | |||
1512 | */ | 1512 | */ |
1513 | static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg) | 1513 | static int dn_cache_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh, void *arg) |
1514 | { | 1514 | { |
1515 | struct net *net = in_skb->sk->sk_net; | 1515 | struct net *net = sock_net(in_skb->sk); |
1516 | struct rtattr **rta = arg; | 1516 | struct rtattr **rta = arg; |
1517 | struct rtmsg *rtm = NLMSG_DATA(nlh); | 1517 | struct rtmsg *rtm = NLMSG_DATA(nlh); |
1518 | struct dn_route *rt = NULL; | 1518 | struct dn_route *rt = NULL; |
@@ -1601,7 +1601,7 @@ out_free: | |||
1601 | */ | 1601 | */ |
1602 | int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) | 1602 | int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb) |
1603 | { | 1603 | { |
1604 | struct net *net = skb->sk->sk_net; | 1604 | struct net *net = sock_net(skb->sk); |
1605 | struct dn_route *rt; | 1605 | struct dn_route *rt; |
1606 | int h, s_h; | 1606 | int h, s_h; |
1607 | int idx, s_idx; | 1607 | int idx, s_idx; |
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index e09d915dbd77..3a2830ac89c2 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -463,7 +463,7 @@ static int dn_fib_table_dump(struct dn_fib_table *tb, struct sk_buff *skb, | |||
463 | 463 | ||
464 | int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb) | 464 | int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb) |
465 | { | 465 | { |
466 | struct net *net = skb->sk->sk_net; | 466 | struct net *net = sock_net(skb->sk); |
467 | unsigned int h, s_h; | 467 | unsigned int h, s_h; |
468 | unsigned int e = 0, s_e; | 468 | unsigned int e = 0, s_e; |
469 | struct dn_fib_table *tb; | 469 | struct dn_fib_table *tb; |
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index bc0f6252613f..68d154480043 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -1064,7 +1064,7 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
1064 | struct sock *sk; | 1064 | struct sock *sk; |
1065 | struct ec_device *edev = dev->ec_ptr; | 1065 | struct ec_device *edev = dev->ec_ptr; |
1066 | 1066 | ||
1067 | if (dev->nd_net != &init_net) | 1067 | if (dev_net(dev) != &init_net) |
1068 | goto drop; | 1068 | goto drop; |
1069 | 1069 | ||
1070 | if (skb->pkt_type == PACKET_OTHERHOST) | 1070 | if (skb->pkt_type == PACKET_OTHERHOST) |
@@ -1121,7 +1121,7 @@ static int econet_notifier(struct notifier_block *this, unsigned long msg, void | |||
1121 | struct net_device *dev = (struct net_device *)data; | 1121 | struct net_device *dev = (struct net_device *)data; |
1122 | struct ec_device *edev; | 1122 | struct ec_device *edev; |
1123 | 1123 | ||
1124 | if (dev->nd_net != &init_net) | 1124 | if (dev_net(dev) != &init_net) |
1125 | return NOTIFY_DONE; | 1125 | return NOTIFY_DONE; |
1126 | 1126 | ||
1127 | switch (msg) { | 1127 | switch (msg) { |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 06cfb0bed631..5882a1316441 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -464,7 +464,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
464 | if (addr_len < sizeof(struct sockaddr_in)) | 464 | if (addr_len < sizeof(struct sockaddr_in)) |
465 | goto out; | 465 | goto out; |
466 | 466 | ||
467 | chk_addr_ret = inet_addr_type(sk->sk_net, addr->sin_addr.s_addr); | 467 | chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); |
468 | 468 | ||
469 | /* Not specified by any standard per-se, however it breaks too | 469 | /* Not specified by any standard per-se, however it breaks too |
470 | * many applications when removed. It is unfortunate since | 470 | * many applications when removed. It is unfortunate since |
@@ -802,7 +802,7 @@ int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
802 | { | 802 | { |
803 | struct sock *sk = sock->sk; | 803 | struct sock *sk = sock->sk; |
804 | int err = 0; | 804 | int err = 0; |
805 | struct net *net = sk->sk_net; | 805 | struct net *net = sock_net(sk); |
806 | 806 | ||
807 | switch (cmd) { | 807 | switch (cmd) { |
808 | case SIOCGSTAMP: | 808 | case SIOCGSTAMP: |
@@ -1132,7 +1132,7 @@ int inet_sk_rebuild_header(struct sock *sk) | |||
1132 | }; | 1132 | }; |
1133 | 1133 | ||
1134 | security_sk_classify_flow(sk, &fl); | 1134 | security_sk_classify_flow(sk, &fl); |
1135 | err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 0); | 1135 | err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 0); |
1136 | } | 1136 | } |
1137 | if (!err) | 1137 | if (!err) |
1138 | sk_setup_caps(sk, &rt->u.dst); | 1138 | sk_setup_caps(sk, &rt->u.dst); |
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index 832473e30b36..3ce2e137e7bc 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c | |||
@@ -242,7 +242,7 @@ static int arp_constructor(struct neighbour *neigh) | |||
242 | return -EINVAL; | 242 | return -EINVAL; |
243 | } | 243 | } |
244 | 244 | ||
245 | neigh->type = inet_addr_type(dev->nd_net, addr); | 245 | neigh->type = inet_addr_type(dev_net(dev), addr); |
246 | 246 | ||
247 | parms = in_dev->arp_parms; | 247 | parms = in_dev->arp_parms; |
248 | __neigh_parms_put(neigh->parms); | 248 | __neigh_parms_put(neigh->parms); |
@@ -341,14 +341,14 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
341 | switch (IN_DEV_ARP_ANNOUNCE(in_dev)) { | 341 | switch (IN_DEV_ARP_ANNOUNCE(in_dev)) { |
342 | default: | 342 | default: |
343 | case 0: /* By default announce any local IP */ | 343 | case 0: /* By default announce any local IP */ |
344 | if (skb && inet_addr_type(dev->nd_net, ip_hdr(skb)->saddr) == RTN_LOCAL) | 344 | if (skb && inet_addr_type(dev_net(dev), ip_hdr(skb)->saddr) == RTN_LOCAL) |
345 | saddr = ip_hdr(skb)->saddr; | 345 | saddr = ip_hdr(skb)->saddr; |
346 | break; | 346 | break; |
347 | case 1: /* Restrict announcements of saddr in same subnet */ | 347 | case 1: /* Restrict announcements of saddr in same subnet */ |
348 | if (!skb) | 348 | if (!skb) |
349 | break; | 349 | break; |
350 | saddr = ip_hdr(skb)->saddr; | 350 | saddr = ip_hdr(skb)->saddr; |
351 | if (inet_addr_type(dev->nd_net, saddr) == RTN_LOCAL) { | 351 | if (inet_addr_type(dev_net(dev), saddr) == RTN_LOCAL) { |
352 | /* saddr should be known to target */ | 352 | /* saddr should be known to target */ |
353 | if (inet_addr_onlink(in_dev, target, saddr)) | 353 | if (inet_addr_onlink(in_dev, target, saddr)) |
354 | break; | 354 | break; |
@@ -424,7 +424,7 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev) | |||
424 | int flag = 0; | 424 | int flag = 0; |
425 | /*unsigned long now; */ | 425 | /*unsigned long now; */ |
426 | 426 | ||
427 | if (ip_route_output_key(dev->nd_net, &rt, &fl) < 0) | 427 | if (ip_route_output_key(dev_net(dev), &rt, &fl) < 0) |
428 | return 1; | 428 | return 1; |
429 | if (rt->u.dst.dev != dev) { | 429 | if (rt->u.dst.dev != dev) { |
430 | NET_INC_STATS_BH(LINUX_MIB_ARPFILTER); | 430 | NET_INC_STATS_BH(LINUX_MIB_ARPFILTER); |
@@ -477,7 +477,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb) | |||
477 | 477 | ||
478 | paddr = skb->rtable->rt_gateway; | 478 | paddr = skb->rtable->rt_gateway; |
479 | 479 | ||
480 | if (arp_set_predefined(inet_addr_type(dev->nd_net, paddr), haddr, paddr, dev)) | 480 | if (arp_set_predefined(inet_addr_type(dev_net(dev), paddr), haddr, paddr, dev)) |
481 | return 0; | 481 | return 0; |
482 | 482 | ||
483 | n = __neigh_lookup(&arp_tbl, &paddr, dev, 1); | 483 | n = __neigh_lookup(&arp_tbl, &paddr, dev, 1); |
@@ -709,7 +709,7 @@ static int arp_process(struct sk_buff *skb) | |||
709 | u16 dev_type = dev->type; | 709 | u16 dev_type = dev->type; |
710 | int addr_type; | 710 | int addr_type; |
711 | struct neighbour *n; | 711 | struct neighbour *n; |
712 | struct net *net = dev->nd_net; | 712 | struct net *net = dev_net(dev); |
713 | 713 | ||
714 | /* arp_rcv below verifies the ARP header and verifies the device | 714 | /* arp_rcv below verifies the ARP header and verifies the device |
715 | * is ARP'able. | 715 | * is ARP'able. |
@@ -858,7 +858,7 @@ static int arp_process(struct sk_buff *skb) | |||
858 | 858 | ||
859 | n = __neigh_lookup(&arp_tbl, &sip, dev, 0); | 859 | n = __neigh_lookup(&arp_tbl, &sip, dev, 0); |
860 | 860 | ||
861 | if (IPV4_DEVCONF_ALL(dev->nd_net, ARP_ACCEPT)) { | 861 | if (IPV4_DEVCONF_ALL(dev_net(dev), ARP_ACCEPT)) { |
862 | /* Unsolicited ARP is not accepted by default. | 862 | /* Unsolicited ARP is not accepted by default. |
863 | It is possible, that this option should be enabled for some | 863 | It is possible, that this option should be enabled for some |
864 | devices (strip is candidate) | 864 | devices (strip is candidate) |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 4a10dbbbe0a1..6848e4760f34 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -165,7 +165,7 @@ static struct in_device *inetdev_init(struct net_device *dev) | |||
165 | if (!in_dev) | 165 | if (!in_dev) |
166 | goto out; | 166 | goto out; |
167 | INIT_RCU_HEAD(&in_dev->rcu_head); | 167 | INIT_RCU_HEAD(&in_dev->rcu_head); |
168 | memcpy(&in_dev->cnf, dev->nd_net->ipv4.devconf_dflt, | 168 | memcpy(&in_dev->cnf, dev_net(dev)->ipv4.devconf_dflt, |
169 | sizeof(in_dev->cnf)); | 169 | sizeof(in_dev->cnf)); |
170 | in_dev->cnf.sysctl = NULL; | 170 | in_dev->cnf.sysctl = NULL; |
171 | in_dev->dev = dev; | 171 | in_dev->dev = dev; |
@@ -437,7 +437,7 @@ struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, | |||
437 | 437 | ||
438 | static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 438 | static int inet_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
439 | { | 439 | { |
440 | struct net *net = skb->sk->sk_net; | 440 | struct net *net = sock_net(skb->sk); |
441 | struct nlattr *tb[IFA_MAX+1]; | 441 | struct nlattr *tb[IFA_MAX+1]; |
442 | struct in_device *in_dev; | 442 | struct in_device *in_dev; |
443 | struct ifaddrmsg *ifm; | 443 | struct ifaddrmsg *ifm; |
@@ -552,7 +552,7 @@ errout: | |||
552 | 552 | ||
553 | static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 553 | static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
554 | { | 554 | { |
555 | struct net *net = skb->sk->sk_net; | 555 | struct net *net = sock_net(skb->sk); |
556 | struct in_ifaddr *ifa; | 556 | struct in_ifaddr *ifa; |
557 | 557 | ||
558 | ASSERT_RTNL(); | 558 | ASSERT_RTNL(); |
@@ -872,7 +872,7 @@ __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope) | |||
872 | { | 872 | { |
873 | __be32 addr = 0; | 873 | __be32 addr = 0; |
874 | struct in_device *in_dev; | 874 | struct in_device *in_dev; |
875 | struct net *net = dev->nd_net; | 875 | struct net *net = dev_net(dev); |
876 | 876 | ||
877 | rcu_read_lock(); | 877 | rcu_read_lock(); |
878 | in_dev = __in_dev_get_rcu(dev); | 878 | in_dev = __in_dev_get_rcu(dev); |
@@ -974,7 +974,7 @@ __be32 inet_confirm_addr(struct in_device *in_dev, | |||
974 | if (scope != RT_SCOPE_LINK) | 974 | if (scope != RT_SCOPE_LINK) |
975 | return confirm_addr_indev(in_dev, dst, local, scope); | 975 | return confirm_addr_indev(in_dev, dst, local, scope); |
976 | 976 | ||
977 | net = in_dev->dev->nd_net; | 977 | net = dev_net(in_dev->dev); |
978 | read_lock(&dev_base_lock); | 978 | read_lock(&dev_base_lock); |
979 | rcu_read_lock(); | 979 | rcu_read_lock(); |
980 | for_each_netdev(net, dev) { | 980 | for_each_netdev(net, dev) { |
@@ -1158,7 +1158,7 @@ nla_put_failure: | |||
1158 | 1158 | ||
1159 | static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) | 1159 | static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) |
1160 | { | 1160 | { |
1161 | struct net *net = skb->sk->sk_net; | 1161 | struct net *net = sock_net(skb->sk); |
1162 | int idx, ip_idx; | 1162 | int idx, ip_idx; |
1163 | struct net_device *dev; | 1163 | struct net_device *dev; |
1164 | struct in_device *in_dev; | 1164 | struct in_device *in_dev; |
@@ -1203,7 +1203,7 @@ static void rtmsg_ifa(int event, struct in_ifaddr* ifa, struct nlmsghdr *nlh, | |||
1203 | int err = -ENOBUFS; | 1203 | int err = -ENOBUFS; |
1204 | struct net *net; | 1204 | struct net *net; |
1205 | 1205 | ||
1206 | net = ifa->ifa_dev->dev->nd_net; | 1206 | net = dev_net(ifa->ifa_dev->dev); |
1207 | skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); | 1207 | skb = nlmsg_new(inet_nlmsg_size(), GFP_KERNEL); |
1208 | if (skb == NULL) | 1208 | if (skb == NULL) |
1209 | goto errout; | 1209 | goto errout; |
@@ -1517,7 +1517,7 @@ static void devinet_sysctl_register(struct in_device *idev) | |||
1517 | { | 1517 | { |
1518 | neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4, | 1518 | neigh_sysctl_register(idev->dev, idev->arp_parms, NET_IPV4, |
1519 | NET_IPV4_NEIGH, "ipv4", NULL, NULL); | 1519 | NET_IPV4_NEIGH, "ipv4", NULL, NULL); |
1520 | __devinet_sysctl_register(idev->dev->nd_net, idev->dev->name, | 1520 | __devinet_sysctl_register(dev_net(idev->dev), idev->dev->name, |
1521 | idev->dev->ifindex, &idev->cnf); | 1521 | idev->dev->ifindex, &idev->cnf); |
1522 | } | 1522 | } |
1523 | 1523 | ||
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c index 86ff2711fc95..0f1557a4ac7a 100644 --- a/net/ipv4/fib_frontend.c +++ b/net/ipv4/fib_frontend.c | |||
@@ -257,7 +257,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | |||
257 | if (in_dev == NULL) | 257 | if (in_dev == NULL) |
258 | goto e_inval; | 258 | goto e_inval; |
259 | 259 | ||
260 | net = dev->nd_net; | 260 | net = dev_net(dev); |
261 | if (fib_lookup(net, &fl, &res)) | 261 | if (fib_lookup(net, &fl, &res)) |
262 | goto last_resort; | 262 | goto last_resort; |
263 | if (res.type != RTN_UNICAST) | 263 | if (res.type != RTN_UNICAST) |
@@ -583,7 +583,7 @@ errout: | |||
583 | 583 | ||
584 | static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 584 | static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) |
585 | { | 585 | { |
586 | struct net *net = skb->sk->sk_net; | 586 | struct net *net = sock_net(skb->sk); |
587 | struct fib_config cfg; | 587 | struct fib_config cfg; |
588 | struct fib_table *tb; | 588 | struct fib_table *tb; |
589 | int err; | 589 | int err; |
@@ -605,7 +605,7 @@ errout: | |||
605 | 605 | ||
606 | static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) | 606 | static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg) |
607 | { | 607 | { |
608 | struct net *net = skb->sk->sk_net; | 608 | struct net *net = sock_net(skb->sk); |
609 | struct fib_config cfg; | 609 | struct fib_config cfg; |
610 | struct fib_table *tb; | 610 | struct fib_table *tb; |
611 | int err; | 611 | int err; |
@@ -627,7 +627,7 @@ errout: | |||
627 | 627 | ||
628 | static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) | 628 | static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) |
629 | { | 629 | { |
630 | struct net *net = skb->sk->sk_net; | 630 | struct net *net = sock_net(skb->sk); |
631 | unsigned int h, s_h; | 631 | unsigned int h, s_h; |
632 | unsigned int e = 0, s_e; | 632 | unsigned int e = 0, s_e; |
633 | struct fib_table *tb; | 633 | struct fib_table *tb; |
@@ -674,7 +674,7 @@ out: | |||
674 | 674 | ||
675 | static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa) | 675 | static void fib_magic(int cmd, int type, __be32 dst, int dst_len, struct in_ifaddr *ifa) |
676 | { | 676 | { |
677 | struct net *net = ifa->ifa_dev->dev->nd_net; | 677 | struct net *net = dev_net(ifa->ifa_dev->dev); |
678 | struct fib_table *tb; | 678 | struct fib_table *tb; |
679 | struct fib_config cfg = { | 679 | struct fib_config cfg = { |
680 | .fc_protocol = RTPROT_KERNEL, | 680 | .fc_protocol = RTPROT_KERNEL, |
@@ -801,15 +801,15 @@ static void fib_del_ifaddr(struct in_ifaddr *ifa) | |||
801 | fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim); | 801 | fib_magic(RTM_DELROUTE, RTN_LOCAL, ifa->ifa_local, 32, prim); |
802 | 802 | ||
803 | /* Check, that this local address finally disappeared. */ | 803 | /* Check, that this local address finally disappeared. */ |
804 | if (inet_addr_type(dev->nd_net, ifa->ifa_local) != RTN_LOCAL) { | 804 | if (inet_addr_type(dev_net(dev), ifa->ifa_local) != RTN_LOCAL) { |
805 | /* And the last, but not the least thing. | 805 | /* And the last, but not the least thing. |
806 | We must flush stray FIB entries. | 806 | We must flush stray FIB entries. |
807 | 807 | ||
808 | First of all, we scan fib_info list searching | 808 | First of all, we scan fib_info list searching |
809 | for stray nexthop entries, then ignite fib_flush. | 809 | for stray nexthop entries, then ignite fib_flush. |
810 | */ | 810 | */ |
811 | if (fib_sync_down_addr(dev->nd_net, ifa->ifa_local)) | 811 | if (fib_sync_down_addr(dev_net(dev), ifa->ifa_local)) |
812 | fib_flush(dev->nd_net); | 812 | fib_flush(dev_net(dev)); |
813 | } | 813 | } |
814 | } | 814 | } |
815 | #undef LOCAL_OK | 815 | #undef LOCAL_OK |
@@ -857,7 +857,7 @@ static void nl_fib_input(struct sk_buff *skb) | |||
857 | struct fib_table *tb; | 857 | struct fib_table *tb; |
858 | u32 pid; | 858 | u32 pid; |
859 | 859 | ||
860 | net = skb->sk->sk_net; | 860 | net = sock_net(skb->sk); |
861 | nlh = nlmsg_hdr(skb); | 861 | nlh = nlmsg_hdr(skb); |
862 | if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || | 862 | if (skb->len < NLMSG_SPACE(0) || skb->len < nlh->nlmsg_len || |
863 | nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) | 863 | nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*frn))) |
@@ -899,7 +899,7 @@ static void nl_fib_lookup_exit(struct net *net) | |||
899 | static void fib_disable_ip(struct net_device *dev, int force) | 899 | static void fib_disable_ip(struct net_device *dev, int force) |
900 | { | 900 | { |
901 | if (fib_sync_down_dev(dev, force)) | 901 | if (fib_sync_down_dev(dev, force)) |
902 | fib_flush(dev->nd_net); | 902 | fib_flush(dev_net(dev)); |
903 | rt_cache_flush(0); | 903 | rt_cache_flush(0); |
904 | arp_ifdown(dev); | 904 | arp_ifdown(dev); |
905 | } | 905 | } |
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c index 8d58d85dfac6..02088deb0461 100644 --- a/net/ipv4/fib_hash.c +++ b/net/ipv4/fib_hash.c | |||
@@ -821,7 +821,7 @@ static struct fib_alias *fib_get_first(struct seq_file *seq) | |||
821 | struct fib_table *main_table; | 821 | struct fib_table *main_table; |
822 | struct fn_hash *table; | 822 | struct fn_hash *table; |
823 | 823 | ||
824 | main_table = fib_get_table(iter->p.net, RT_TABLE_MAIN); | 824 | main_table = fib_get_table(seq_file_net(seq), RT_TABLE_MAIN); |
825 | table = (struct fn_hash *)main_table->tb_data; | 825 | table = (struct fn_hash *)main_table->tb_data; |
826 | 826 | ||
827 | iter->bucket = 0; | 827 | iter->bucket = 0; |
@@ -959,11 +959,10 @@ static struct fib_alias *fib_get_idx(struct seq_file *seq, loff_t pos) | |||
959 | static void *fib_seq_start(struct seq_file *seq, loff_t *pos) | 959 | static void *fib_seq_start(struct seq_file *seq, loff_t *pos) |
960 | __acquires(fib_hash_lock) | 960 | __acquires(fib_hash_lock) |
961 | { | 961 | { |
962 | struct fib_iter_state *iter = seq->private; | ||
963 | void *v = NULL; | 962 | void *v = NULL; |
964 | 963 | ||
965 | read_lock(&fib_hash_lock); | 964 | read_lock(&fib_hash_lock); |
966 | if (fib_get_table(iter->p.net, RT_TABLE_MAIN)) | 965 | if (fib_get_table(seq_file_net(seq), RT_TABLE_MAIN)) |
967 | v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; | 966 | v = *pos ? fib_get_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
968 | return v; | 967 | return v; |
969 | } | 968 | } |
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c index 19274d01afa4..1fb56876be54 100644 --- a/net/ipv4/fib_rules.c +++ b/net/ipv4/fib_rules.c | |||
@@ -137,7 +137,7 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb, | |||
137 | struct nlmsghdr *nlh, struct fib_rule_hdr *frh, | 137 | struct nlmsghdr *nlh, struct fib_rule_hdr *frh, |
138 | struct nlattr **tb) | 138 | struct nlattr **tb) |
139 | { | 139 | { |
140 | struct net *net = skb->sk->sk_net; | 140 | struct net *net = sock_net(skb->sk); |
141 | int err = -EINVAL; | 141 | int err = -EINVAL; |
142 | struct fib4_rule *rule4 = (struct fib4_rule *) rule; | 142 | struct fib4_rule *rule4 = (struct fib4_rule *) rule; |
143 | 143 | ||
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index ce6cb34e28e1..9e491e70e855 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -2279,9 +2279,10 @@ static const struct file_operations fib_triestat_fops = { | |||
2279 | .release = fib_triestat_seq_release, | 2279 | .release = fib_triestat_seq_release, |
2280 | }; | 2280 | }; |
2281 | 2281 | ||
2282 | static struct node *fib_trie_get_idx(struct fib_trie_iter *iter, loff_t pos) | 2282 | static struct node *fib_trie_get_idx(struct seq_file *seq, loff_t pos) |
2283 | { | 2283 | { |
2284 | struct net *net = iter->p.net; | 2284 | struct fib_trie_iter *iter = seq->private; |
2285 | struct net *net = seq_file_net(seq); | ||
2285 | loff_t idx = 0; | 2286 | loff_t idx = 0; |
2286 | unsigned int h; | 2287 | unsigned int h; |
2287 | 2288 | ||
@@ -2309,16 +2310,14 @@ static struct node *fib_trie_get_idx(struct fib_trie_iter *iter, loff_t pos) | |||
2309 | static void *fib_trie_seq_start(struct seq_file *seq, loff_t *pos) | 2310 | static void *fib_trie_seq_start(struct seq_file *seq, loff_t *pos) |
2310 | __acquires(RCU) | 2311 | __acquires(RCU) |
2311 | { | 2312 | { |
2312 | struct fib_trie_iter *iter = seq->private; | ||
2313 | |||
2314 | rcu_read_lock(); | 2313 | rcu_read_lock(); |
2315 | return fib_trie_get_idx(iter, *pos); | 2314 | return fib_trie_get_idx(seq, *pos); |
2316 | } | 2315 | } |
2317 | 2316 | ||
2318 | static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2317 | static void *fib_trie_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
2319 | { | 2318 | { |
2320 | struct fib_trie_iter *iter = seq->private; | 2319 | struct fib_trie_iter *iter = seq->private; |
2321 | struct net *net = iter->p.net; | 2320 | struct net *net = seq_file_net(seq); |
2322 | struct fib_table *tb = iter->tb; | 2321 | struct fib_table *tb = iter->tb; |
2323 | struct hlist_node *tb_node; | 2322 | struct hlist_node *tb_node; |
2324 | unsigned int h; | 2323 | unsigned int h; |
@@ -2513,7 +2512,7 @@ static void *fib_route_seq_start(struct seq_file *seq, loff_t *pos) | |||
2513 | struct fib_table *tb; | 2512 | struct fib_table *tb; |
2514 | 2513 | ||
2515 | rcu_read_lock(); | 2514 | rcu_read_lock(); |
2516 | tb = fib_get_table(iter->p.net, RT_TABLE_MAIN); | 2515 | tb = fib_get_table(seq_file_net(seq), RT_TABLE_MAIN); |
2517 | if (!tb) | 2516 | if (!tb) |
2518 | return NULL; | 2517 | return NULL; |
2519 | 2518 | ||
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index ff9a8e643fcc..f38f093ef751 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -351,7 +351,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param, | |||
351 | struct sock *sk; | 351 | struct sock *sk; |
352 | struct sk_buff *skb; | 352 | struct sk_buff *skb; |
353 | 353 | ||
354 | sk = icmp_sk(rt->u.dst.dev->nd_net); | 354 | sk = icmp_sk(dev_net(rt->u.dst.dev)); |
355 | if (ip_append_data(sk, icmp_glue_bits, icmp_param, | 355 | if (ip_append_data(sk, icmp_glue_bits, icmp_param, |
356 | icmp_param->data_len+icmp_param->head_len, | 356 | icmp_param->data_len+icmp_param->head_len, |
357 | icmp_param->head_len, | 357 | icmp_param->head_len, |
@@ -382,7 +382,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) | |||
382 | { | 382 | { |
383 | struct ipcm_cookie ipc; | 383 | struct ipcm_cookie ipc; |
384 | struct rtable *rt = skb->rtable; | 384 | struct rtable *rt = skb->rtable; |
385 | struct net *net = rt->u.dst.dev->nd_net; | 385 | struct net *net = dev_net(rt->u.dst.dev); |
386 | struct sock *sk = icmp_sk(net); | 386 | struct sock *sk = icmp_sk(net); |
387 | struct inet_sock *inet = inet_sk(sk); | 387 | struct inet_sock *inet = inet_sk(sk); |
388 | __be32 daddr; | 388 | __be32 daddr; |
@@ -447,7 +447,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
447 | 447 | ||
448 | if (!rt) | 448 | if (!rt) |
449 | goto out; | 449 | goto out; |
450 | net = rt->u.dst.dev->nd_net; | 450 | net = dev_net(rt->u.dst.dev); |
451 | sk = icmp_sk(net); | 451 | sk = icmp_sk(net); |
452 | 452 | ||
453 | /* | 453 | /* |
@@ -677,7 +677,7 @@ static void icmp_unreach(struct sk_buff *skb) | |||
677 | u32 info = 0; | 677 | u32 info = 0; |
678 | struct net *net; | 678 | struct net *net; |
679 | 679 | ||
680 | net = skb->dst->dev->nd_net; | 680 | net = dev_net(skb->dst->dev); |
681 | 681 | ||
682 | /* | 682 | /* |
683 | * Incomplete header ? | 683 | * Incomplete header ? |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 6a4ee8da6994..6250f4239b61 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -130,12 +130,12 @@ | |||
130 | */ | 130 | */ |
131 | 131 | ||
132 | #define IGMP_V1_SEEN(in_dev) \ | 132 | #define IGMP_V1_SEEN(in_dev) \ |
133 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 1 || \ | 133 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), FORCE_IGMP_VERSION) == 1 || \ |
134 | IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \ | 134 | IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 1 || \ |
135 | ((in_dev)->mr_v1_seen && \ | 135 | ((in_dev)->mr_v1_seen && \ |
136 | time_before(jiffies, (in_dev)->mr_v1_seen))) | 136 | time_before(jiffies, (in_dev)->mr_v1_seen))) |
137 | #define IGMP_V2_SEEN(in_dev) \ | 137 | #define IGMP_V2_SEEN(in_dev) \ |
138 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, FORCE_IGMP_VERSION) == 2 || \ | 138 | (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), FORCE_IGMP_VERSION) == 2 || \ |
139 | IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \ | 139 | IN_DEV_CONF_GET((in_dev), FORCE_IGMP_VERSION) == 2 || \ |
140 | ((in_dev)->mr_v2_seen && \ | 140 | ((in_dev)->mr_v2_seen && \ |
141 | time_before(jiffies, (in_dev)->mr_v2_seen))) | 141 | time_before(jiffies, (in_dev)->mr_v2_seen))) |
@@ -1198,7 +1198,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr) | |||
1198 | 1198 | ||
1199 | ASSERT_RTNL(); | 1199 | ASSERT_RTNL(); |
1200 | 1200 | ||
1201 | if (in_dev->dev->nd_net != &init_net) | 1201 | if (dev_net(in_dev->dev) != &init_net) |
1202 | return; | 1202 | return; |
1203 | 1203 | ||
1204 | for (im=in_dev->mc_list; im; im=im->next) { | 1204 | for (im=in_dev->mc_list; im; im=im->next) { |
@@ -1280,7 +1280,7 @@ void ip_mc_dec_group(struct in_device *in_dev, __be32 addr) | |||
1280 | 1280 | ||
1281 | ASSERT_RTNL(); | 1281 | ASSERT_RTNL(); |
1282 | 1282 | ||
1283 | if (in_dev->dev->nd_net != &init_net) | 1283 | if (dev_net(in_dev->dev) != &init_net) |
1284 | return; | 1284 | return; |
1285 | 1285 | ||
1286 | for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { | 1286 | for (ip=&in_dev->mc_list; (i=*ip)!=NULL; ip=&i->next) { |
@@ -1310,7 +1310,7 @@ void ip_mc_down(struct in_device *in_dev) | |||
1310 | 1310 | ||
1311 | ASSERT_RTNL(); | 1311 | ASSERT_RTNL(); |
1312 | 1312 | ||
1313 | if (in_dev->dev->nd_net != &init_net) | 1313 | if (dev_net(in_dev->dev) != &init_net) |
1314 | return; | 1314 | return; |
1315 | 1315 | ||
1316 | for (i=in_dev->mc_list; i; i=i->next) | 1316 | for (i=in_dev->mc_list; i; i=i->next) |
@@ -1333,7 +1333,7 @@ void ip_mc_init_dev(struct in_device *in_dev) | |||
1333 | { | 1333 | { |
1334 | ASSERT_RTNL(); | 1334 | ASSERT_RTNL(); |
1335 | 1335 | ||
1336 | if (in_dev->dev->nd_net != &init_net) | 1336 | if (dev_net(in_dev->dev) != &init_net) |
1337 | return; | 1337 | return; |
1338 | 1338 | ||
1339 | in_dev->mc_tomb = NULL; | 1339 | in_dev->mc_tomb = NULL; |
@@ -1359,7 +1359,7 @@ void ip_mc_up(struct in_device *in_dev) | |||
1359 | 1359 | ||
1360 | ASSERT_RTNL(); | 1360 | ASSERT_RTNL(); |
1361 | 1361 | ||
1362 | if (in_dev->dev->nd_net != &init_net) | 1362 | if (dev_net(in_dev->dev) != &init_net) |
1363 | return; | 1363 | return; |
1364 | 1364 | ||
1365 | ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS); | 1365 | ip_mc_inc_group(in_dev, IGMP_ALL_HOSTS); |
@@ -1378,7 +1378,7 @@ void ip_mc_destroy_dev(struct in_device *in_dev) | |||
1378 | 1378 | ||
1379 | ASSERT_RTNL(); | 1379 | ASSERT_RTNL(); |
1380 | 1380 | ||
1381 | if (in_dev->dev->nd_net != &init_net) | 1381 | if (dev_net(in_dev->dev) != &init_net) |
1382 | return; | 1382 | return; |
1383 | 1383 | ||
1384 | /* Deactivate timers */ | 1384 | /* Deactivate timers */ |
@@ -1762,7 +1762,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr) | |||
1762 | if (!ipv4_is_multicast(addr)) | 1762 | if (!ipv4_is_multicast(addr)) |
1763 | return -EINVAL; | 1763 | return -EINVAL; |
1764 | 1764 | ||
1765 | if (sk->sk_net != &init_net) | 1765 | if (sock_net(sk) != &init_net) |
1766 | return -EPROTONOSUPPORT; | 1766 | return -EPROTONOSUPPORT; |
1767 | 1767 | ||
1768 | rtnl_lock(); | 1768 | rtnl_lock(); |
@@ -1833,7 +1833,7 @@ int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr) | |||
1833 | u32 ifindex; | 1833 | u32 ifindex; |
1834 | int ret = -EADDRNOTAVAIL; | 1834 | int ret = -EADDRNOTAVAIL; |
1835 | 1835 | ||
1836 | if (sk->sk_net != &init_net) | 1836 | if (sock_net(sk) != &init_net) |
1837 | return -EPROTONOSUPPORT; | 1837 | return -EPROTONOSUPPORT; |
1838 | 1838 | ||
1839 | rtnl_lock(); | 1839 | rtnl_lock(); |
@@ -1881,7 +1881,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct | |||
1881 | if (!ipv4_is_multicast(addr)) | 1881 | if (!ipv4_is_multicast(addr)) |
1882 | return -EINVAL; | 1882 | return -EINVAL; |
1883 | 1883 | ||
1884 | if (sk->sk_net != &init_net) | 1884 | if (sock_net(sk) != &init_net) |
1885 | return -EPROTONOSUPPORT; | 1885 | return -EPROTONOSUPPORT; |
1886 | 1886 | ||
1887 | rtnl_lock(); | 1887 | rtnl_lock(); |
@@ -2017,7 +2017,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex) | |||
2017 | msf->imsf_fmode != MCAST_EXCLUDE) | 2017 | msf->imsf_fmode != MCAST_EXCLUDE) |
2018 | return -EINVAL; | 2018 | return -EINVAL; |
2019 | 2019 | ||
2020 | if (sk->sk_net != &init_net) | 2020 | if (sock_net(sk) != &init_net) |
2021 | return -EPROTONOSUPPORT; | 2021 | return -EPROTONOSUPPORT; |
2022 | 2022 | ||
2023 | rtnl_lock(); | 2023 | rtnl_lock(); |
@@ -2100,7 +2100,7 @@ int ip_mc_msfget(struct sock *sk, struct ip_msfilter *msf, | |||
2100 | if (!ipv4_is_multicast(addr)) | 2100 | if (!ipv4_is_multicast(addr)) |
2101 | return -EINVAL; | 2101 | return -EINVAL; |
2102 | 2102 | ||
2103 | if (sk->sk_net != &init_net) | 2103 | if (sock_net(sk) != &init_net) |
2104 | return -EPROTONOSUPPORT; | 2104 | return -EPROTONOSUPPORT; |
2105 | 2105 | ||
2106 | rtnl_lock(); | 2106 | rtnl_lock(); |
@@ -2165,7 +2165,7 @@ int ip_mc_gsfget(struct sock *sk, struct group_filter *gsf, | |||
2165 | if (!ipv4_is_multicast(addr)) | 2165 | if (!ipv4_is_multicast(addr)) |
2166 | return -EINVAL; | 2166 | return -EINVAL; |
2167 | 2167 | ||
2168 | if (sk->sk_net != &init_net) | 2168 | if (sock_net(sk) != &init_net) |
2169 | return -EPROTONOSUPPORT; | 2169 | return -EPROTONOSUPPORT; |
2170 | 2170 | ||
2171 | rtnl_lock(); | 2171 | rtnl_lock(); |
@@ -2252,7 +2252,7 @@ void ip_mc_drop_socket(struct sock *sk) | |||
2252 | if (inet->mc_list == NULL) | 2252 | if (inet->mc_list == NULL) |
2253 | return; | 2253 | return; |
2254 | 2254 | ||
2255 | if (sk->sk_net != &init_net) | 2255 | if (sock_net(sk) != &init_net) |
2256 | return; | 2256 | return; |
2257 | 2257 | ||
2258 | rtnl_lock(); | 2258 | rtnl_lock(); |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index d13c5f12bb32..a7fcaf205644 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -85,7 +85,7 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum) | |||
85 | struct hlist_node *node; | 85 | struct hlist_node *node; |
86 | struct inet_bind_bucket *tb; | 86 | struct inet_bind_bucket *tb; |
87 | int ret; | 87 | int ret; |
88 | struct net *net = sk->sk_net; | 88 | struct net *net = sock_net(sk); |
89 | 89 | ||
90 | local_bh_disable(); | 90 | local_bh_disable(); |
91 | if (!snum) { | 91 | if (!snum) { |
@@ -333,7 +333,7 @@ struct dst_entry* inet_csk_route_req(struct sock *sk, | |||
333 | .dport = ireq->rmt_port } } }; | 333 | .dport = ireq->rmt_port } } }; |
334 | 334 | ||
335 | security_req_classify_flow(req, &fl); | 335 | security_req_classify_flow(req, &fl); |
336 | if (ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 0)) { | 336 | if (ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 0)) { |
337 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); | 337 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); |
338 | return NULL; | 338 | return NULL; |
339 | } | 339 | } |
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 8cd1ad9b9111..1b6ff513c75d 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c | |||
@@ -139,7 +139,7 @@ static struct sock *inet_lookup_listener_slow(struct net *net, | |||
139 | sk_for_each(sk, node, head) { | 139 | sk_for_each(sk, node, head) { |
140 | const struct inet_sock *inet = inet_sk(sk); | 140 | const struct inet_sock *inet = inet_sk(sk); |
141 | 141 | ||
142 | if (sk->sk_net == net && inet->num == hnum && | 142 | if (net_eq(sock_net(sk), net) && inet->num == hnum && |
143 | !ipv6_only_sock(sk)) { | 143 | !ipv6_only_sock(sk)) { |
144 | const __be32 rcv_saddr = inet->rcv_saddr; | 144 | const __be32 rcv_saddr = inet->rcv_saddr; |
145 | int score = sk->sk_family == PF_INET ? 1 : 0; | 145 | int score = sk->sk_family == PF_INET ? 1 : 0; |
@@ -182,7 +182,7 @@ struct sock *__inet_lookup_listener(struct net *net, | |||
182 | if (inet->num == hnum && !sk->sk_node.next && | 182 | if (inet->num == hnum && !sk->sk_node.next && |
183 | (!inet->rcv_saddr || inet->rcv_saddr == daddr) && | 183 | (!inet->rcv_saddr || inet->rcv_saddr == daddr) && |
184 | (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) && | 184 | (sk->sk_family == PF_INET || !ipv6_only_sock(sk)) && |
185 | !sk->sk_bound_dev_if && sk->sk_net == net) | 185 | !sk->sk_bound_dev_if && net_eq(sock_net(sk), net)) |
186 | goto sherry_cache; | 186 | goto sherry_cache; |
187 | sk = inet_lookup_listener_slow(net, head, daddr, hnum, dif); | 187 | sk = inet_lookup_listener_slow(net, head, daddr, hnum, dif); |
188 | } | 188 | } |
@@ -254,7 +254,7 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row, | |||
254 | struct sock *sk2; | 254 | struct sock *sk2; |
255 | const struct hlist_node *node; | 255 | const struct hlist_node *node; |
256 | struct inet_timewait_sock *tw; | 256 | struct inet_timewait_sock *tw; |
257 | struct net *net = sk->sk_net; | 257 | struct net *net = sock_net(sk); |
258 | 258 | ||
259 | prefetch(head->chain.first); | 259 | prefetch(head->chain.first); |
260 | write_lock(lock); | 260 | write_lock(lock); |
@@ -406,7 +406,7 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, | |||
406 | struct inet_bind_hashbucket *head; | 406 | struct inet_bind_hashbucket *head; |
407 | struct inet_bind_bucket *tb; | 407 | struct inet_bind_bucket *tb; |
408 | int ret; | 408 | int ret; |
409 | struct net *net = sk->sk_net; | 409 | struct net *net = sock_net(sk); |
410 | 410 | ||
411 | if (!snum) { | 411 | if (!snum) { |
412 | int i, remaining, low, high, port; | 412 | int i, remaining, low, high, port; |
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 717c411a5c6b..f12bc24de46f 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c | |||
@@ -124,7 +124,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat | |||
124 | tw->tw_hash = sk->sk_hash; | 124 | tw->tw_hash = sk->sk_hash; |
125 | tw->tw_ipv6only = 0; | 125 | tw->tw_ipv6only = 0; |
126 | tw->tw_prot = sk->sk_prot_creator; | 126 | tw->tw_prot = sk->sk_prot_creator; |
127 | tw->tw_net = sk->sk_net; | 127 | twsk_net_set(tw, sock_net(sk)); |
128 | atomic_set(&tw->tw_refcnt, 1); | 128 | atomic_set(&tw->tw_refcnt, 1); |
129 | inet_twsk_dead_node_init(tw); | 129 | inet_twsk_dead_node_init(tw); |
130 | __module_get(tw->tw_prot->owner); | 130 | __module_get(tw->tw_prot->owner); |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 8b448c4b9080..fcb60e76b234 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -571,7 +571,7 @@ int ip_defrag(struct sk_buff *skb, u32 user) | |||
571 | 571 | ||
572 | IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS); | 572 | IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS); |
573 | 573 | ||
574 | net = skb->dev ? skb->dev->nd_net : skb->dst->dev->nd_net; | 574 | net = skb->dev ? dev_net(skb->dev) : dev_net(skb->dst->dev); |
575 | /* Start by cleaning up the memory. */ | 575 | /* Start by cleaning up the memory. */ |
576 | if (atomic_read(&net->ipv4.frags.mem) > net->ipv4.frags.high_thresh) | 576 | if (atomic_read(&net->ipv4.frags.mem) > net->ipv4.frags.high_thresh) |
577 | ip_evictor(net); | 577 | ip_evictor(net); |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index f9ee84420cb3..50972b397a9a 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1190,7 +1190,7 @@ static int ipgre_close(struct net_device *dev) | |||
1190 | struct ip_tunnel *t = netdev_priv(dev); | 1190 | struct ip_tunnel *t = netdev_priv(dev); |
1191 | if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) { | 1191 | if (ipv4_is_multicast(t->parms.iph.daddr) && t->mlink) { |
1192 | struct in_device *in_dev; | 1192 | struct in_device *in_dev; |
1193 | in_dev = inetdev_by_index(dev->nd_net, t->mlink); | 1193 | in_dev = inetdev_by_index(dev_net(dev), t->mlink); |
1194 | if (in_dev) { | 1194 | if (in_dev) { |
1195 | ip_mc_dec_group(in_dev, t->parms.iph.daddr); | 1195 | ip_mc_dec_group(in_dev, t->parms.iph.daddr); |
1196 | in_dev_put(in_dev); | 1196 | in_dev_put(in_dev); |
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 2aeea5d15425..4be00959b748 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -172,7 +172,7 @@ int ip_call_ra_chain(struct sk_buff *skb) | |||
172 | if (sk && inet_sk(sk)->num == protocol && | 172 | if (sk && inet_sk(sk)->num == protocol && |
173 | (!sk->sk_bound_dev_if || | 173 | (!sk->sk_bound_dev_if || |
174 | sk->sk_bound_dev_if == dev->ifindex) && | 174 | sk->sk_bound_dev_if == dev->ifindex) && |
175 | sk->sk_net == dev->nd_net) { | 175 | sock_net(sk) == dev_net(dev)) { |
176 | if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { | 176 | if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) { |
177 | if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) { | 177 | if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN)) { |
178 | read_unlock(&ip_ra_lock); | 178 | read_unlock(&ip_ra_lock); |
@@ -199,7 +199,7 @@ int ip_call_ra_chain(struct sk_buff *skb) | |||
199 | 199 | ||
200 | static int ip_local_deliver_finish(struct sk_buff *skb) | 200 | static int ip_local_deliver_finish(struct sk_buff *skb) |
201 | { | 201 | { |
202 | struct net *net = skb->dev->nd_net; | 202 | struct net *net = dev_net(skb->dev); |
203 | 203 | ||
204 | __skb_pull(skb, ip_hdrlen(skb)); | 204 | __skb_pull(skb, ip_hdrlen(skb)); |
205 | 205 | ||
@@ -291,7 +291,7 @@ static inline int ip_rcv_options(struct sk_buff *skb) | |||
291 | opt = &(IPCB(skb)->opt); | 291 | opt = &(IPCB(skb)->opt); |
292 | opt->optlen = iph->ihl*4 - sizeof(struct iphdr); | 292 | opt->optlen = iph->ihl*4 - sizeof(struct iphdr); |
293 | 293 | ||
294 | if (ip_options_compile(dev->nd_net, opt, skb)) { | 294 | if (ip_options_compile(dev_net(dev), opt, skb)) { |
295 | IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); | 295 | IP_INC_STATS_BH(IPSTATS_MIB_INHDRERRORS); |
296 | goto drop; | 296 | goto drop; |
297 | } | 297 | } |
diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c index 87cc1222c600..d107543d3f81 100644 --- a/net/ipv4/ip_options.c +++ b/net/ipv4/ip_options.c | |||
@@ -145,7 +145,7 @@ int ip_options_echo(struct ip_options * dopt, struct sk_buff * skb) | |||
145 | __be32 addr; | 145 | __be32 addr; |
146 | 146 | ||
147 | memcpy(&addr, sptr+soffset-1, 4); | 147 | memcpy(&addr, sptr+soffset-1, 4); |
148 | if (inet_addr_type(skb->dst->dev->nd_net, addr) != RTN_LOCAL) { | 148 | if (inet_addr_type(dev_net(skb->dst->dev), addr) != RTN_LOCAL) { |
149 | dopt->ts_needtime = 1; | 149 | dopt->ts_needtime = 1; |
150 | soffset += 8; | 150 | soffset += 8; |
151 | } | 151 | } |
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 913266cd9902..08349267ceb4 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -351,7 +351,7 @@ int ip_queue_xmit(struct sk_buff *skb, int ipfragok) | |||
351 | * itself out. | 351 | * itself out. |
352 | */ | 352 | */ |
353 | security_sk_classify_flow(sk, &fl); | 353 | security_sk_classify_flow(sk, &fl); |
354 | if (ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 0)) | 354 | if (ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 0)) |
355 | goto no_route; | 355 | goto no_route; |
356 | } | 356 | } |
357 | sk_setup_caps(sk, &rt->u.dst); | 357 | sk_setup_caps(sk, &rt->u.dst); |
@@ -1382,7 +1382,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar | |||
1382 | .dport = tcp_hdr(skb)->source } }, | 1382 | .dport = tcp_hdr(skb)->source } }, |
1383 | .proto = sk->sk_protocol }; | 1383 | .proto = sk->sk_protocol }; |
1384 | security_skb_classify_flow(skb, &fl); | 1384 | security_skb_classify_flow(skb, &fl); |
1385 | if (ip_route_output_key(sk->sk_net, &rt, &fl)) | 1385 | if (ip_route_output_key(sock_net(sk), &rt, &fl)) |
1386 | return; | 1386 | return; |
1387 | } | 1387 | } |
1388 | 1388 | ||
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index b854431047a4..d6e76f5229cc 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -449,7 +449,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
449 | struct ip_options * opt = NULL; | 449 | struct ip_options * opt = NULL; |
450 | if (optlen > 40 || optlen < 0) | 450 | if (optlen > 40 || optlen < 0) |
451 | goto e_inval; | 451 | goto e_inval; |
452 | err = ip_options_get_from_user(sk->sk_net, &opt, | 452 | err = ip_options_get_from_user(sock_net(sk), &opt, |
453 | optval, optlen); | 453 | optval, optlen); |
454 | if (err) | 454 | if (err) |
455 | break; | 455 | break; |
@@ -590,13 +590,13 @@ static int do_ip_setsockopt(struct sock *sk, int level, | |||
590 | err = 0; | 590 | err = 0; |
591 | break; | 591 | break; |
592 | } | 592 | } |
593 | dev = ip_dev_find(sk->sk_net, mreq.imr_address.s_addr); | 593 | dev = ip_dev_find(sock_net(sk), mreq.imr_address.s_addr); |
594 | if (dev) { | 594 | if (dev) { |
595 | mreq.imr_ifindex = dev->ifindex; | 595 | mreq.imr_ifindex = dev->ifindex; |
596 | dev_put(dev); | 596 | dev_put(dev); |
597 | } | 597 | } |
598 | } else | 598 | } else |
599 | dev = __dev_get_by_index(sk->sk_net, mreq.imr_ifindex); | 599 | dev = __dev_get_by_index(sock_net(sk), mreq.imr_ifindex); |
600 | 600 | ||
601 | 601 | ||
602 | err = -EADDRNOTAVAIL; | 602 | err = -EADDRNOTAVAIL; |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 96138b128de8..08e8fb60d315 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -434,7 +434,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
434 | unsigned char *sha, *tha; /* s for "source", t for "target" */ | 434 | unsigned char *sha, *tha; /* s for "source", t for "target" */ |
435 | struct ic_device *d; | 435 | struct ic_device *d; |
436 | 436 | ||
437 | if (dev->nd_net != &init_net) | 437 | if (dev_net(dev) != &init_net) |
438 | goto drop; | 438 | goto drop; |
439 | 439 | ||
440 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 440 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
@@ -854,7 +854,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str | |||
854 | struct ic_device *d; | 854 | struct ic_device *d; |
855 | int len, ext_len; | 855 | int len, ext_len; |
856 | 856 | ||
857 | if (dev->nd_net != &init_net) | 857 | if (dev_net(dev) != &init_net) |
858 | goto drop; | 858 | goto drop; |
859 | 859 | ||
860 | /* Perform verifications before taking the lock. */ | 860 | /* Perform verifications before taking the lock. */ |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 7d63d74ef62a..11700a4dcd95 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -849,7 +849,7 @@ static void mrtsock_destruct(struct sock *sk) | |||
849 | { | 849 | { |
850 | rtnl_lock(); | 850 | rtnl_lock(); |
851 | if (sk == mroute_socket) { | 851 | if (sk == mroute_socket) { |
852 | IPV4_DEVCONF_ALL(sk->sk_net, MC_FORWARDING)--; | 852 | IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)--; |
853 | 853 | ||
854 | write_lock_bh(&mrt_lock); | 854 | write_lock_bh(&mrt_lock); |
855 | mroute_socket=NULL; | 855 | mroute_socket=NULL; |
@@ -898,7 +898,7 @@ int ip_mroute_setsockopt(struct sock *sk,int optname,char __user *optval,int opt | |||
898 | mroute_socket=sk; | 898 | mroute_socket=sk; |
899 | write_unlock_bh(&mrt_lock); | 899 | write_unlock_bh(&mrt_lock); |
900 | 900 | ||
901 | IPV4_DEVCONF_ALL(sk->sk_net, MC_FORWARDING)++; | 901 | IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)++; |
902 | } | 902 | } |
903 | rtnl_unlock(); | 903 | rtnl_unlock(); |
904 | return ret; | 904 | return ret; |
@@ -1089,7 +1089,7 @@ static int ipmr_device_event(struct notifier_block *this, unsigned long event, v | |||
1089 | struct vif_device *v; | 1089 | struct vif_device *v; |
1090 | int ct; | 1090 | int ct; |
1091 | 1091 | ||
1092 | if (dev->nd_net != &init_net) | 1092 | if (dev_net(dev) != &init_net) |
1093 | return NOTIFY_DONE; | 1093 | return NOTIFY_DONE; |
1094 | 1094 | ||
1095 | if (event != NETDEV_UNREGISTER) | 1095 | if (event != NETDEV_UNREGISTER) |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 756bc0e1a7c6..1563f29b5117 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1496,11 +1496,11 @@ static int compat_do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, | |||
1496 | 1496 | ||
1497 | switch (cmd) { | 1497 | switch (cmd) { |
1498 | case ARPT_SO_SET_REPLACE: | 1498 | case ARPT_SO_SET_REPLACE: |
1499 | ret = compat_do_replace(sk->sk_net, user, len); | 1499 | ret = compat_do_replace(sock_net(sk), user, len); |
1500 | break; | 1500 | break; |
1501 | 1501 | ||
1502 | case ARPT_SO_SET_ADD_COUNTERS: | 1502 | case ARPT_SO_SET_ADD_COUNTERS: |
1503 | ret = do_add_counters(sk->sk_net, user, len, 1); | 1503 | ret = do_add_counters(sock_net(sk), user, len, 1); |
1504 | break; | 1504 | break; |
1505 | 1505 | ||
1506 | default: | 1506 | default: |
@@ -1644,10 +1644,10 @@ static int compat_do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, | |||
1644 | 1644 | ||
1645 | switch (cmd) { | 1645 | switch (cmd) { |
1646 | case ARPT_SO_GET_INFO: | 1646 | case ARPT_SO_GET_INFO: |
1647 | ret = get_info(sk->sk_net, user, len, 1); | 1647 | ret = get_info(sock_net(sk), user, len, 1); |
1648 | break; | 1648 | break; |
1649 | case ARPT_SO_GET_ENTRIES: | 1649 | case ARPT_SO_GET_ENTRIES: |
1650 | ret = compat_get_entries(sk->sk_net, user, len); | 1650 | ret = compat_get_entries(sock_net(sk), user, len); |
1651 | break; | 1651 | break; |
1652 | default: | 1652 | default: |
1653 | ret = do_arpt_get_ctl(sk, cmd, user, len); | 1653 | ret = do_arpt_get_ctl(sk, cmd, user, len); |
@@ -1665,11 +1665,11 @@ static int do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned | |||
1665 | 1665 | ||
1666 | switch (cmd) { | 1666 | switch (cmd) { |
1667 | case ARPT_SO_SET_REPLACE: | 1667 | case ARPT_SO_SET_REPLACE: |
1668 | ret = do_replace(sk->sk_net, user, len); | 1668 | ret = do_replace(sock_net(sk), user, len); |
1669 | break; | 1669 | break; |
1670 | 1670 | ||
1671 | case ARPT_SO_SET_ADD_COUNTERS: | 1671 | case ARPT_SO_SET_ADD_COUNTERS: |
1672 | ret = do_add_counters(sk->sk_net, user, len, 0); | 1672 | ret = do_add_counters(sock_net(sk), user, len, 0); |
1673 | break; | 1673 | break; |
1674 | 1674 | ||
1675 | default: | 1675 | default: |
@@ -1689,11 +1689,11 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len | |||
1689 | 1689 | ||
1690 | switch (cmd) { | 1690 | switch (cmd) { |
1691 | case ARPT_SO_GET_INFO: | 1691 | case ARPT_SO_GET_INFO: |
1692 | ret = get_info(sk->sk_net, user, len, 0); | 1692 | ret = get_info(sock_net(sk), user, len, 0); |
1693 | break; | 1693 | break; |
1694 | 1694 | ||
1695 | case ARPT_SO_GET_ENTRIES: | 1695 | case ARPT_SO_GET_ENTRIES: |
1696 | ret = get_entries(sk->sk_net, user, len); | 1696 | ret = get_entries(sock_net(sk), user, len); |
1697 | break; | 1697 | break; |
1698 | 1698 | ||
1699 | case ARPT_SO_GET_REVISION_TARGET: { | 1699 | case ARPT_SO_GET_REVISION_TARGET: { |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index fe05da41d6ba..500998a2dec1 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -481,7 +481,7 @@ ipq_rcv_dev_event(struct notifier_block *this, | |||
481 | { | 481 | { |
482 | struct net_device *dev = ptr; | 482 | struct net_device *dev = ptr; |
483 | 483 | ||
484 | if (dev->nd_net != &init_net) | 484 | if (dev_net(dev) != &init_net) |
485 | return NOTIFY_DONE; | 485 | return NOTIFY_DONE; |
486 | 486 | ||
487 | /* Drop any packets associated with the downed device */ | 487 | /* Drop any packets associated with the downed device */ |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 85a75e186b4b..a819d191e1aa 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -1852,11 +1852,11 @@ compat_do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user, | |||
1852 | 1852 | ||
1853 | switch (cmd) { | 1853 | switch (cmd) { |
1854 | case IPT_SO_SET_REPLACE: | 1854 | case IPT_SO_SET_REPLACE: |
1855 | ret = compat_do_replace(sk->sk_net, user, len); | 1855 | ret = compat_do_replace(sock_net(sk), user, len); |
1856 | break; | 1856 | break; |
1857 | 1857 | ||
1858 | case IPT_SO_SET_ADD_COUNTERS: | 1858 | case IPT_SO_SET_ADD_COUNTERS: |
1859 | ret = do_add_counters(sk->sk_net, user, len, 1); | 1859 | ret = do_add_counters(sock_net(sk), user, len, 1); |
1860 | break; | 1860 | break; |
1861 | 1861 | ||
1862 | default: | 1862 | default: |
@@ -1963,10 +1963,10 @@ compat_do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
1963 | 1963 | ||
1964 | switch (cmd) { | 1964 | switch (cmd) { |
1965 | case IPT_SO_GET_INFO: | 1965 | case IPT_SO_GET_INFO: |
1966 | ret = get_info(sk->sk_net, user, len, 1); | 1966 | ret = get_info(sock_net(sk), user, len, 1); |
1967 | break; | 1967 | break; |
1968 | case IPT_SO_GET_ENTRIES: | 1968 | case IPT_SO_GET_ENTRIES: |
1969 | ret = compat_get_entries(sk->sk_net, user, len); | 1969 | ret = compat_get_entries(sock_net(sk), user, len); |
1970 | break; | 1970 | break; |
1971 | default: | 1971 | default: |
1972 | ret = do_ipt_get_ctl(sk, cmd, user, len); | 1972 | ret = do_ipt_get_ctl(sk, cmd, user, len); |
@@ -1985,11 +1985,11 @@ do_ipt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
1985 | 1985 | ||
1986 | switch (cmd) { | 1986 | switch (cmd) { |
1987 | case IPT_SO_SET_REPLACE: | 1987 | case IPT_SO_SET_REPLACE: |
1988 | ret = do_replace(sk->sk_net, user, len); | 1988 | ret = do_replace(sock_net(sk), user, len); |
1989 | break; | 1989 | break; |
1990 | 1990 | ||
1991 | case IPT_SO_SET_ADD_COUNTERS: | 1991 | case IPT_SO_SET_ADD_COUNTERS: |
1992 | ret = do_add_counters(sk->sk_net, user, len, 0); | 1992 | ret = do_add_counters(sock_net(sk), user, len, 0); |
1993 | break; | 1993 | break; |
1994 | 1994 | ||
1995 | default: | 1995 | default: |
@@ -2010,11 +2010,11 @@ do_ipt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2010 | 2010 | ||
2011 | switch (cmd) { | 2011 | switch (cmd) { |
2012 | case IPT_SO_GET_INFO: | 2012 | case IPT_SO_GET_INFO: |
2013 | ret = get_info(sk->sk_net, user, len, 0); | 2013 | ret = get_info(sock_net(sk), user, len, 0); |
2014 | break; | 2014 | break; |
2015 | 2015 | ||
2016 | case IPT_SO_GET_ENTRIES: | 2016 | case IPT_SO_GET_ENTRIES: |
2017 | ret = get_entries(sk->sk_net, user, len); | 2017 | ret = get_entries(sock_net(sk), user, len); |
2018 | break; | 2018 | break; |
2019 | 2019 | ||
2020 | case IPT_SO_GET_REVISION_MATCH: | 2020 | case IPT_SO_GET_REVISION_MATCH: |
diff --git a/net/ipv4/netfilter/ipt_MASQUERADE.c b/net/ipv4/netfilter/ipt_MASQUERADE.c index c6817b18366a..84c26dd27d81 100644 --- a/net/ipv4/netfilter/ipt_MASQUERADE.c +++ b/net/ipv4/netfilter/ipt_MASQUERADE.c | |||
@@ -120,7 +120,7 @@ static int masq_device_event(struct notifier_block *this, | |||
120 | { | 120 | { |
121 | const struct net_device *dev = ptr; | 121 | const struct net_device *dev = ptr; |
122 | 122 | ||
123 | if (dev->nd_net != &init_net) | 123 | if (dev_net(dev) != &init_net) |
124 | return NOTIFY_DONE; | 124 | return NOTIFY_DONE; |
125 | 125 | ||
126 | if (event == NETDEV_DOWN) { | 126 | if (event == NETDEV_DOWN) { |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 3f68a937b602..d965f0a39c84 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -117,7 +117,7 @@ static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk, | |||
117 | sk_for_each_from(sk, node) { | 117 | sk_for_each_from(sk, node) { |
118 | struct inet_sock *inet = inet_sk(sk); | 118 | struct inet_sock *inet = inet_sk(sk); |
119 | 119 | ||
120 | if (sk->sk_net == net && inet->num == num && | 120 | if (net_eq(sock_net(sk), net) && inet->num == num && |
121 | !(inet->daddr && inet->daddr != raddr) && | 121 | !(inet->daddr && inet->daddr != raddr) && |
122 | !(inet->rcv_saddr && inet->rcv_saddr != laddr) && | 122 | !(inet->rcv_saddr && inet->rcv_saddr != laddr) && |
123 | !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) | 123 | !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) |
@@ -168,7 +168,7 @@ static int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash) | |||
168 | if (hlist_empty(head)) | 168 | if (hlist_empty(head)) |
169 | goto out; | 169 | goto out; |
170 | 170 | ||
171 | net = skb->dev->nd_net; | 171 | net = dev_net(skb->dev); |
172 | sk = __raw_v4_lookup(net, __sk_head(head), iph->protocol, | 172 | sk = __raw_v4_lookup(net, __sk_head(head), iph->protocol, |
173 | iph->saddr, iph->daddr, | 173 | iph->saddr, iph->daddr, |
174 | skb->dev->ifindex); | 174 | skb->dev->ifindex); |
@@ -276,7 +276,7 @@ void raw_icmp_error(struct sk_buff *skb, int protocol, u32 info) | |||
276 | raw_sk = sk_head(&raw_v4_hashinfo.ht[hash]); | 276 | raw_sk = sk_head(&raw_v4_hashinfo.ht[hash]); |
277 | if (raw_sk != NULL) { | 277 | if (raw_sk != NULL) { |
278 | iph = (struct iphdr *)skb->data; | 278 | iph = (struct iphdr *)skb->data; |
279 | net = skb->dev->nd_net; | 279 | net = dev_net(skb->dev); |
280 | 280 | ||
281 | while ((raw_sk = __raw_v4_lookup(net, raw_sk, protocol, | 281 | while ((raw_sk = __raw_v4_lookup(net, raw_sk, protocol, |
282 | iph->daddr, iph->saddr, | 282 | iph->daddr, iph->saddr, |
@@ -499,7 +499,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
499 | ipc.oif = sk->sk_bound_dev_if; | 499 | ipc.oif = sk->sk_bound_dev_if; |
500 | 500 | ||
501 | if (msg->msg_controllen) { | 501 | if (msg->msg_controllen) { |
502 | err = ip_cmsg_send(sk->sk_net, msg, &ipc); | 502 | err = ip_cmsg_send(sock_net(sk), msg, &ipc); |
503 | if (err) | 503 | if (err) |
504 | goto out; | 504 | goto out; |
505 | if (ipc.opt) | 505 | if (ipc.opt) |
@@ -553,7 +553,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
553 | } | 553 | } |
554 | 554 | ||
555 | security_sk_classify_flow(sk, &fl); | 555 | security_sk_classify_flow(sk, &fl); |
556 | err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 1); | 556 | err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1); |
557 | } | 557 | } |
558 | if (err) | 558 | if (err) |
559 | goto done; | 559 | goto done; |
@@ -620,7 +620,7 @@ static int raw_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
620 | 620 | ||
621 | if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in)) | 621 | if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in)) |
622 | goto out; | 622 | goto out; |
623 | chk_addr_ret = inet_addr_type(sk->sk_net, addr->sin_addr.s_addr); | 623 | chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr); |
624 | ret = -EADDRNOTAVAIL; | 624 | ret = -EADDRNOTAVAIL; |
625 | if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL && | 625 | if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL && |
626 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) | 626 | chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST) |
@@ -856,7 +856,7 @@ static struct sock *raw_get_first(struct seq_file *seq) | |||
856 | struct hlist_node *node; | 856 | struct hlist_node *node; |
857 | 857 | ||
858 | sk_for_each(sk, node, &state->h->ht[state->bucket]) | 858 | sk_for_each(sk, node, &state->h->ht[state->bucket]) |
859 | if (sk->sk_net == state->p.net) | 859 | if (sock_net(sk) == seq_file_net(seq)) |
860 | goto found; | 860 | goto found; |
861 | } | 861 | } |
862 | sk = NULL; | 862 | sk = NULL; |
@@ -872,7 +872,7 @@ static struct sock *raw_get_next(struct seq_file *seq, struct sock *sk) | |||
872 | sk = sk_next(sk); | 872 | sk = sk_next(sk); |
873 | try_again: | 873 | try_again: |
874 | ; | 874 | ; |
875 | } while (sk && sk->sk_net != state->p.net); | 875 | } while (sk && sock_net(sk) != seq_file_net(seq)); |
876 | 876 | ||
877 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { | 877 | if (!sk && ++state->bucket < RAW_HTABLE_SIZE) { |
878 | sk = sk_head(&state->h->ht[state->bucket]); | 878 | sk = sk_head(&state->h->ht[state->bucket]); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2941ef21f203..230716c2dfe0 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -276,15 +276,16 @@ struct rt_cache_iter_state { | |||
276 | int genid; | 276 | int genid; |
277 | }; | 277 | }; |
278 | 278 | ||
279 | static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st) | 279 | static struct rtable *rt_cache_get_first(struct seq_file *seq) |
280 | { | 280 | { |
281 | struct rt_cache_iter_state *st = seq->private; | ||
281 | struct rtable *r = NULL; | 282 | struct rtable *r = NULL; |
282 | 283 | ||
283 | for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) { | 284 | for (st->bucket = rt_hash_mask; st->bucket >= 0; --st->bucket) { |
284 | rcu_read_lock_bh(); | 285 | rcu_read_lock_bh(); |
285 | r = rcu_dereference(rt_hash_table[st->bucket].chain); | 286 | r = rcu_dereference(rt_hash_table[st->bucket].chain); |
286 | while (r) { | 287 | while (r) { |
287 | if (r->u.dst.dev->nd_net == st->p.net && | 288 | if (dev_net(r->u.dst.dev) == seq_file_net(seq) && |
288 | r->rt_genid == st->genid) | 289 | r->rt_genid == st->genid) |
289 | return r; | 290 | return r; |
290 | r = rcu_dereference(r->u.dst.rt_next); | 291 | r = rcu_dereference(r->u.dst.rt_next); |
@@ -294,9 +295,10 @@ static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st) | |||
294 | return r; | 295 | return r; |
295 | } | 296 | } |
296 | 297 | ||
297 | static struct rtable *__rt_cache_get_next(struct rt_cache_iter_state *st, | 298 | static struct rtable *__rt_cache_get_next(struct seq_file *seq, |
298 | struct rtable *r) | 299 | struct rtable *r) |
299 | { | 300 | { |
301 | struct rt_cache_iter_state *st = seq->private; | ||
300 | r = r->u.dst.rt_next; | 302 | r = r->u.dst.rt_next; |
301 | while (!r) { | 303 | while (!r) { |
302 | rcu_read_unlock_bh(); | 304 | rcu_read_unlock_bh(); |
@@ -308,11 +310,12 @@ static struct rtable *__rt_cache_get_next(struct rt_cache_iter_state *st, | |||
308 | return rcu_dereference(r); | 310 | return rcu_dereference(r); |
309 | } | 311 | } |
310 | 312 | ||
311 | static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, | 313 | static struct rtable *rt_cache_get_next(struct seq_file *seq, |
312 | struct rtable *r) | 314 | struct rtable *r) |
313 | { | 315 | { |
314 | while ((r = __rt_cache_get_next(st, r)) != NULL) { | 316 | struct rt_cache_iter_state *st = seq->private; |
315 | if (r->u.dst.dev->nd_net != st->p.net) | 317 | while ((r = __rt_cache_get_next(seq, r)) != NULL) { |
318 | if (dev_net(r->u.dst.dev) != seq_file_net(seq)) | ||
316 | continue; | 319 | continue; |
317 | if (r->rt_genid == st->genid) | 320 | if (r->rt_genid == st->genid) |
318 | break; | 321 | break; |
@@ -320,12 +323,12 @@ static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, | |||
320 | return r; | 323 | return r; |
321 | } | 324 | } |
322 | 325 | ||
323 | static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t pos) | 326 | static struct rtable *rt_cache_get_idx(struct seq_file *seq, loff_t pos) |
324 | { | 327 | { |
325 | struct rtable *r = rt_cache_get_first(st); | 328 | struct rtable *r = rt_cache_get_first(seq); |
326 | 329 | ||
327 | if (r) | 330 | if (r) |
328 | while (pos && (r = rt_cache_get_next(st, r))) | 331 | while (pos && (r = rt_cache_get_next(seq, r))) |
329 | --pos; | 332 | --pos; |
330 | return pos ? NULL : r; | 333 | return pos ? NULL : r; |
331 | } | 334 | } |
@@ -333,9 +336,8 @@ static struct rtable *rt_cache_get_idx(struct rt_cache_iter_state *st, loff_t po | |||
333 | static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) | 336 | static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) |
334 | { | 337 | { |
335 | struct rt_cache_iter_state *st = seq->private; | 338 | struct rt_cache_iter_state *st = seq->private; |
336 | |||
337 | if (*pos) | 339 | if (*pos) |
338 | return rt_cache_get_idx(st, *pos - 1); | 340 | return rt_cache_get_idx(seq, *pos - 1); |
339 | st->genid = atomic_read(&rt_genid); | 341 | st->genid = atomic_read(&rt_genid); |
340 | return SEQ_START_TOKEN; | 342 | return SEQ_START_TOKEN; |
341 | } | 343 | } |
@@ -343,12 +345,11 @@ static void *rt_cache_seq_start(struct seq_file *seq, loff_t *pos) | |||
343 | static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 345 | static void *rt_cache_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
344 | { | 346 | { |
345 | struct rtable *r; | 347 | struct rtable *r; |
346 | struct rt_cache_iter_state *st = seq->private; | ||
347 | 348 | ||
348 | if (v == SEQ_START_TOKEN) | 349 | if (v == SEQ_START_TOKEN) |
349 | r = rt_cache_get_first(st); | 350 | r = rt_cache_get_first(seq); |
350 | else | 351 | else |
351 | r = rt_cache_get_next(st, v); | 352 | r = rt_cache_get_next(seq, v); |
352 | ++*pos; | 353 | ++*pos; |
353 | return r; | 354 | return r; |
354 | } | 355 | } |
@@ -680,7 +681,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) | |||
680 | 681 | ||
681 | static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) | 682 | static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) |
682 | { | 683 | { |
683 | return rt1->u.dst.dev->nd_net == rt2->u.dst.dev->nd_net; | 684 | return dev_net(rt1->u.dst.dev) == dev_net(rt2->u.dst.dev); |
684 | } | 685 | } |
685 | 686 | ||
686 | /* | 687 | /* |
@@ -1164,7 +1165,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1164 | if (!in_dev) | 1165 | if (!in_dev) |
1165 | return; | 1166 | return; |
1166 | 1167 | ||
1167 | net = dev->nd_net; | 1168 | net = dev_net(dev); |
1168 | if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) | 1169 | if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) |
1169 | || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) | 1170 | || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) |
1170 | || ipv4_is_zeronet(new_gw)) | 1171 | || ipv4_is_zeronet(new_gw)) |
@@ -1195,7 +1196,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1195 | rth->fl.oif != ikeys[k] || | 1196 | rth->fl.oif != ikeys[k] || |
1196 | rth->fl.iif != 0 || | 1197 | rth->fl.iif != 0 || |
1197 | rth->rt_genid != atomic_read(&rt_genid) || | 1198 | rth->rt_genid != atomic_read(&rt_genid) || |
1198 | rth->u.dst.dev->nd_net != net) { | 1199 | !net_eq(dev_net(rth->u.dst.dev), net)) { |
1199 | rthp = &rth->u.dst.rt_next; | 1200 | rthp = &rth->u.dst.rt_next; |
1200 | continue; | 1201 | continue; |
1201 | } | 1202 | } |
@@ -1454,7 +1455,7 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1454 | rth->rt_src == iph->saddr && | 1455 | rth->rt_src == iph->saddr && |
1455 | rth->fl.iif == 0 && | 1456 | rth->fl.iif == 0 && |
1456 | !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) && | 1457 | !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) && |
1457 | rth->u.dst.dev->nd_net == net && | 1458 | net_eq(dev_net(rth->u.dst.dev), net) && |
1458 | rth->rt_genid == atomic_read(&rt_genid)) { | 1459 | rth->rt_genid == atomic_read(&rt_genid)) { |
1459 | unsigned short mtu = new_mtu; | 1460 | unsigned short mtu = new_mtu; |
1460 | 1461 | ||
@@ -1530,9 +1531,9 @@ static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
1530 | { | 1531 | { |
1531 | struct rtable *rt = (struct rtable *) dst; | 1532 | struct rtable *rt = (struct rtable *) dst; |
1532 | struct in_device *idev = rt->idev; | 1533 | struct in_device *idev = rt->idev; |
1533 | if (dev != dev->nd_net->loopback_dev && idev && idev->dev == dev) { | 1534 | if (dev != dev_net(dev)->loopback_dev && idev && idev->dev == dev) { |
1534 | struct in_device *loopback_idev = | 1535 | struct in_device *loopback_idev = |
1535 | in_dev_get(dev->nd_net->loopback_dev); | 1536 | in_dev_get(dev_net(dev)->loopback_dev); |
1536 | if (loopback_idev) { | 1537 | if (loopback_idev) { |
1537 | rt->idev = loopback_idev; | 1538 | rt->idev = loopback_idev; |
1538 | in_dev_put(idev); | 1539 | in_dev_put(idev); |
@@ -1576,7 +1577,7 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt) | |||
1576 | 1577 | ||
1577 | if (rt->fl.iif == 0) | 1578 | if (rt->fl.iif == 0) |
1578 | src = rt->rt_src; | 1579 | src = rt->rt_src; |
1579 | else if (fib_lookup(rt->u.dst.dev->nd_net, &rt->fl, &res) == 0) { | 1580 | else if (fib_lookup(dev_net(rt->u.dst.dev), &rt->fl, &res) == 0) { |
1580 | src = FIB_RES_PREFSRC(res); | 1581 | src = FIB_RES_PREFSRC(res); |
1581 | fib_res_put(&res); | 1582 | fib_res_put(&res); |
1582 | } else | 1583 | } else |
@@ -1900,7 +1901,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1900 | __be32 spec_dst; | 1901 | __be32 spec_dst; |
1901 | int err = -EINVAL; | 1902 | int err = -EINVAL; |
1902 | int free_res = 0; | 1903 | int free_res = 0; |
1903 | struct net * net = dev->nd_net; | 1904 | struct net * net = dev_net(dev); |
1904 | 1905 | ||
1905 | /* IP on this device is disabled. */ | 1906 | /* IP on this device is disabled. */ |
1906 | 1907 | ||
@@ -2071,7 +2072,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2071 | int iif = dev->ifindex; | 2072 | int iif = dev->ifindex; |
2072 | struct net *net; | 2073 | struct net *net; |
2073 | 2074 | ||
2074 | net = dev->nd_net; | 2075 | net = dev_net(dev); |
2075 | tos &= IPTOS_RT_MASK; | 2076 | tos &= IPTOS_RT_MASK; |
2076 | hash = rt_hash(daddr, saddr, iif); | 2077 | hash = rt_hash(daddr, saddr, iif); |
2077 | 2078 | ||
@@ -2084,7 +2085,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2084 | rth->fl.oif == 0 && | 2085 | rth->fl.oif == 0 && |
2085 | rth->fl.mark == skb->mark && | 2086 | rth->fl.mark == skb->mark && |
2086 | rth->fl.fl4_tos == tos && | 2087 | rth->fl.fl4_tos == tos && |
2087 | rth->u.dst.dev->nd_net == net && | 2088 | net_eq(dev_net(rth->u.dst.dev), net) && |
2088 | rth->rt_genid == atomic_read(&rt_genid)) { | 2089 | rth->rt_genid == atomic_read(&rt_genid)) { |
2089 | dst_use(&rth->u.dst, jiffies); | 2090 | dst_use(&rth->u.dst, jiffies); |
2090 | RT_CACHE_STAT_INC(in_hit); | 2091 | RT_CACHE_STAT_INC(in_hit); |
@@ -2486,7 +2487,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp, | |||
2486 | rth->fl.mark == flp->mark && | 2487 | rth->fl.mark == flp->mark && |
2487 | !((rth->fl.fl4_tos ^ flp->fl4_tos) & | 2488 | !((rth->fl.fl4_tos ^ flp->fl4_tos) & |
2488 | (IPTOS_RT_MASK | RTO_ONLINK)) && | 2489 | (IPTOS_RT_MASK | RTO_ONLINK)) && |
2489 | rth->u.dst.dev->nd_net == net && | 2490 | net_eq(dev_net(rth->u.dst.dev), net) && |
2490 | rth->rt_genid == atomic_read(&rt_genid)) { | 2491 | rth->rt_genid == atomic_read(&rt_genid)) { |
2491 | dst_use(&rth->u.dst, jiffies); | 2492 | dst_use(&rth->u.dst, jiffies); |
2492 | RT_CACHE_STAT_INC(out_hit); | 2493 | RT_CACHE_STAT_INC(out_hit); |
@@ -2689,7 +2690,7 @@ nla_put_failure: | |||
2689 | 2690 | ||
2690 | static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | 2691 | static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) |
2691 | { | 2692 | { |
2692 | struct net *net = in_skb->sk->sk_net; | 2693 | struct net *net = sock_net(in_skb->sk); |
2693 | struct rtmsg *rtm; | 2694 | struct rtmsg *rtm; |
2694 | struct nlattr *tb[RTA_MAX+1]; | 2695 | struct nlattr *tb[RTA_MAX+1]; |
2695 | struct rtable *rt = NULL; | 2696 | struct rtable *rt = NULL; |
@@ -2785,7 +2786,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
2785 | int idx, s_idx; | 2786 | int idx, s_idx; |
2786 | struct net *net; | 2787 | struct net *net; |
2787 | 2788 | ||
2788 | net = skb->sk->sk_net; | 2789 | net = sock_net(skb->sk); |
2789 | 2790 | ||
2790 | s_h = cb->args[0]; | 2791 | s_h = cb->args[0]; |
2791 | if (s_h < 0) | 2792 | if (s_h < 0) |
@@ -2795,7 +2796,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
2795 | rcu_read_lock_bh(); | 2796 | rcu_read_lock_bh(); |
2796 | for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; | 2797 | for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; |
2797 | rt = rcu_dereference(rt->u.dst.rt_next), idx++) { | 2798 | rt = rcu_dereference(rt->u.dst.rt_next), idx++) { |
2798 | if (rt->u.dst.dev->nd_net != net || idx < s_idx) | 2799 | if (!net_eq(dev_net(rt->u.dst.dev), net) || idx < s_idx) |
2799 | continue; | 2800 | continue; |
2800 | if (rt->rt_genid != atomic_read(&rt_genid)) | 2801 | if (rt->rt_genid != atomic_read(&rt_genid)) |
2801 | continue; | 2802 | continue; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 649d00a50cb1..2a5881c81778 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -353,7 +353,7 @@ void tcp_v4_err(struct sk_buff *skb, u32 info) | |||
353 | return; | 353 | return; |
354 | } | 354 | } |
355 | 355 | ||
356 | sk = inet_lookup(skb->dev->nd_net, &tcp_hashinfo, iph->daddr, th->dest, | 356 | sk = inet_lookup(dev_net(skb->dev), &tcp_hashinfo, iph->daddr, th->dest, |
357 | iph->saddr, th->source, inet_iif(skb)); | 357 | iph->saddr, th->source, inet_iif(skb)); |
358 | if (!sk) { | 358 | if (!sk) { |
359 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); | 359 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); |
@@ -1486,7 +1486,7 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb) | |||
1486 | if (req) | 1486 | if (req) |
1487 | return tcp_check_req(sk, skb, req, prev); | 1487 | return tcp_check_req(sk, skb, req, prev); |
1488 | 1488 | ||
1489 | nsk = inet_lookup_established(sk->sk_net, &tcp_hashinfo, iph->saddr, | 1489 | nsk = inet_lookup_established(sock_net(sk), &tcp_hashinfo, iph->saddr, |
1490 | th->source, iph->daddr, th->dest, inet_iif(skb)); | 1490 | th->source, iph->daddr, th->dest, inet_iif(skb)); |
1491 | 1491 | ||
1492 | if (nsk) { | 1492 | if (nsk) { |
@@ -1644,7 +1644,7 @@ int tcp_v4_rcv(struct sk_buff *skb) | |||
1644 | TCP_SKB_CB(skb)->flags = iph->tos; | 1644 | TCP_SKB_CB(skb)->flags = iph->tos; |
1645 | TCP_SKB_CB(skb)->sacked = 0; | 1645 | TCP_SKB_CB(skb)->sacked = 0; |
1646 | 1646 | ||
1647 | sk = __inet_lookup(skb->dev->nd_net, &tcp_hashinfo, iph->saddr, | 1647 | sk = __inet_lookup(dev_net(skb->dev), &tcp_hashinfo, iph->saddr, |
1648 | th->source, iph->daddr, th->dest, inet_iif(skb)); | 1648 | th->source, iph->daddr, th->dest, inet_iif(skb)); |
1649 | if (!sk) | 1649 | if (!sk) |
1650 | goto no_tcp_socket; | 1650 | goto no_tcp_socket; |
@@ -1718,7 +1718,7 @@ do_time_wait: | |||
1718 | } | 1718 | } |
1719 | switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) { | 1719 | switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) { |
1720 | case TCP_TW_SYN: { | 1720 | case TCP_TW_SYN: { |
1721 | struct sock *sk2 = inet_lookup_listener(skb->dev->nd_net, | 1721 | struct sock *sk2 = inet_lookup_listener(dev_net(skb->dev), |
1722 | &tcp_hashinfo, | 1722 | &tcp_hashinfo, |
1723 | iph->daddr, th->dest, | 1723 | iph->daddr, th->dest, |
1724 | inet_iif(skb)); | 1724 | inet_iif(skb)); |
@@ -1974,7 +1974,7 @@ static void *listening_get_next(struct seq_file *seq, void *cur) | |||
1974 | while (1) { | 1974 | while (1) { |
1975 | while (req) { | 1975 | while (req) { |
1976 | if (req->rsk_ops->family == st->family && | 1976 | if (req->rsk_ops->family == st->family && |
1977 | req->sk->sk_net == net) { | 1977 | net_eq(sock_net(req->sk), net)) { |
1978 | cur = req; | 1978 | cur = req; |
1979 | goto out; | 1979 | goto out; |
1980 | } | 1980 | } |
@@ -1998,7 +1998,7 @@ get_req: | |||
1998 | } | 1998 | } |
1999 | get_sk: | 1999 | get_sk: |
2000 | sk_for_each_from(sk, node) { | 2000 | sk_for_each_from(sk, node) { |
2001 | if (sk->sk_family == st->family && sk->sk_net == net) { | 2001 | if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) { |
2002 | cur = sk; | 2002 | cur = sk; |
2003 | goto out; | 2003 | goto out; |
2004 | } | 2004 | } |
@@ -2049,7 +2049,7 @@ static void *established_get_first(struct seq_file *seq) | |||
2049 | read_lock_bh(lock); | 2049 | read_lock_bh(lock); |
2050 | sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { | 2050 | sk_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) { |
2051 | if (sk->sk_family != st->family || | 2051 | if (sk->sk_family != st->family || |
2052 | sk->sk_net != net) { | 2052 | !net_eq(sock_net(sk), net)) { |
2053 | continue; | 2053 | continue; |
2054 | } | 2054 | } |
2055 | rc = sk; | 2055 | rc = sk; |
@@ -2059,7 +2059,7 @@ static void *established_get_first(struct seq_file *seq) | |||
2059 | inet_twsk_for_each(tw, node, | 2059 | inet_twsk_for_each(tw, node, |
2060 | &tcp_hashinfo.ehash[st->bucket].twchain) { | 2060 | &tcp_hashinfo.ehash[st->bucket].twchain) { |
2061 | if (tw->tw_family != st->family || | 2061 | if (tw->tw_family != st->family || |
2062 | tw->tw_net != net) { | 2062 | !net_eq(twsk_net(tw), net)) { |
2063 | continue; | 2063 | continue; |
2064 | } | 2064 | } |
2065 | rc = tw; | 2065 | rc = tw; |
@@ -2086,7 +2086,7 @@ static void *established_get_next(struct seq_file *seq, void *cur) | |||
2086 | tw = cur; | 2086 | tw = cur; |
2087 | tw = tw_next(tw); | 2087 | tw = tw_next(tw); |
2088 | get_tw: | 2088 | get_tw: |
2089 | while (tw && (tw->tw_family != st->family || tw->tw_net != net)) { | 2089 | while (tw && (tw->tw_family != st->family || !net_eq(twsk_net(tw), net))) { |
2090 | tw = tw_next(tw); | 2090 | tw = tw_next(tw); |
2091 | } | 2091 | } |
2092 | if (tw) { | 2092 | if (tw) { |
@@ -2107,7 +2107,7 @@ get_tw: | |||
2107 | sk = sk_next(sk); | 2107 | sk = sk_next(sk); |
2108 | 2108 | ||
2109 | sk_for_each_from(sk, node) { | 2109 | sk_for_each_from(sk, node) { |
2110 | if (sk->sk_family == st->family && sk->sk_net == net) | 2110 | if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) |
2111 | goto found; | 2111 | goto found; |
2112 | } | 2112 | } |
2113 | 2113 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index b37581dfd029..80007c79f12f 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -137,7 +137,7 @@ static inline int __udp_lib_lport_inuse(struct net *net, __u16 num, | |||
137 | struct hlist_node *node; | 137 | struct hlist_node *node; |
138 | 138 | ||
139 | sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)]) | 139 | sk_for_each(sk, node, &udptable[num & (UDP_HTABLE_SIZE - 1)]) |
140 | if (sk->sk_net == net && sk->sk_hash == num) | 140 | if (net_eq(sock_net(sk), net) && sk->sk_hash == num) |
141 | return 1; | 141 | return 1; |
142 | return 0; | 142 | return 0; |
143 | } | 143 | } |
@@ -158,7 +158,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum, | |||
158 | struct hlist_head *head; | 158 | struct hlist_head *head; |
159 | struct sock *sk2; | 159 | struct sock *sk2; |
160 | int error = 1; | 160 | int error = 1; |
161 | struct net *net = sk->sk_net; | 161 | struct net *net = sock_net(sk); |
162 | 162 | ||
163 | write_lock_bh(&udp_hash_lock); | 163 | write_lock_bh(&udp_hash_lock); |
164 | 164 | ||
@@ -218,7 +218,7 @@ gotit: | |||
218 | sk_for_each(sk2, node, head) | 218 | sk_for_each(sk2, node, head) |
219 | if (sk2->sk_hash == snum && | 219 | if (sk2->sk_hash == snum && |
220 | sk2 != sk && | 220 | sk2 != sk && |
221 | sk2->sk_net == net && | 221 | net_eq(sock_net(sk2), net) && |
222 | (!sk2->sk_reuse || !sk->sk_reuse) && | 222 | (!sk2->sk_reuse || !sk->sk_reuse) && |
223 | (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if | 223 | (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if |
224 | || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && | 224 | || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && |
@@ -269,7 +269,7 @@ static struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, | |||
269 | sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { | 269 | sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { |
270 | struct inet_sock *inet = inet_sk(sk); | 270 | struct inet_sock *inet = inet_sk(sk); |
271 | 271 | ||
272 | if (sk->sk_net == net && sk->sk_hash == hnum && | 272 | if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && |
273 | !ipv6_only_sock(sk)) { | 273 | !ipv6_only_sock(sk)) { |
274 | int score = (sk->sk_family == PF_INET ? 1 : 0); | 274 | int score = (sk->sk_family == PF_INET ? 1 : 0); |
275 | if (inet->rcv_saddr) { | 275 | if (inet->rcv_saddr) { |
@@ -357,7 +357,7 @@ void __udp4_lib_err(struct sk_buff *skb, u32 info, struct hlist_head udptable[]) | |||
357 | int harderr; | 357 | int harderr; |
358 | int err; | 358 | int err; |
359 | 359 | ||
360 | sk = __udp4_lib_lookup(skb->dev->nd_net, iph->daddr, uh->dest, | 360 | sk = __udp4_lib_lookup(dev_net(skb->dev), iph->daddr, uh->dest, |
361 | iph->saddr, uh->source, skb->dev->ifindex, udptable); | 361 | iph->saddr, uh->source, skb->dev->ifindex, udptable); |
362 | if (sk == NULL) { | 362 | if (sk == NULL) { |
363 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); | 363 | ICMP_INC_STATS_BH(ICMP_MIB_INERRORS); |
@@ -607,7 +607,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
607 | 607 | ||
608 | ipc.oif = sk->sk_bound_dev_if; | 608 | ipc.oif = sk->sk_bound_dev_if; |
609 | if (msg->msg_controllen) { | 609 | if (msg->msg_controllen) { |
610 | err = ip_cmsg_send(sk->sk_net, msg, &ipc); | 610 | err = ip_cmsg_send(sock_net(sk), msg, &ipc); |
611 | if (err) | 611 | if (err) |
612 | return err; | 612 | return err; |
613 | if (ipc.opt) | 613 | if (ipc.opt) |
@@ -656,7 +656,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
656 | { .sport = inet->sport, | 656 | { .sport = inet->sport, |
657 | .dport = dport } } }; | 657 | .dport = dport } } }; |
658 | security_sk_classify_flow(sk, &fl); | 658 | security_sk_classify_flow(sk, &fl); |
659 | err = ip_route_output_flow(sk->sk_net, &rt, &fl, sk, 1); | 659 | err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1); |
660 | if (err) { | 660 | if (err) { |
661 | if (err == -ENETUNREACH) | 661 | if (err == -ENETUNREACH) |
662 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); | 662 | IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES); |
@@ -1181,7 +1181,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
1181 | if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) | 1181 | if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) |
1182 | return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); | 1182 | return __udp4_lib_mcast_deliver(skb, uh, saddr, daddr, udptable); |
1183 | 1183 | ||
1184 | sk = __udp4_lib_lookup(skb->dev->nd_net, saddr, uh->source, daddr, | 1184 | sk = __udp4_lib_lookup(dev_net(skb->dev), saddr, uh->source, daddr, |
1185 | uh->dest, inet_iif(skb), udptable); | 1185 | uh->dest, inet_iif(skb), udptable); |
1186 | 1186 | ||
1187 | if (sk != NULL) { | 1187 | if (sk != NULL) { |
@@ -1511,7 +1511,7 @@ static struct sock *udp_get_first(struct seq_file *seq) | |||
1511 | for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { | 1511 | for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) { |
1512 | struct hlist_node *node; | 1512 | struct hlist_node *node; |
1513 | sk_for_each(sk, node, state->hashtable + state->bucket) { | 1513 | sk_for_each(sk, node, state->hashtable + state->bucket) { |
1514 | if (sk->sk_net != net) | 1514 | if (!net_eq(sock_net(sk), net)) |
1515 | continue; | 1515 | continue; |
1516 | if (sk->sk_family == state->family) | 1516 | if (sk->sk_family == state->family) |
1517 | goto found; | 1517 | goto found; |
@@ -1531,7 +1531,7 @@ static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk) | |||
1531 | sk = sk_next(sk); | 1531 | sk = sk_next(sk); |
1532 | try_again: | 1532 | try_again: |
1533 | ; | 1533 | ; |
1534 | } while (sk && (sk->sk_net != net || sk->sk_family != state->family)); | 1534 | } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family)); |
1535 | 1535 | ||
1536 | if (!sk && ++state->bucket < UDP_HTABLE_SIZE) { | 1536 | if (!sk && ++state->bucket < UDP_HTABLE_SIZE) { |
1537 | sk = sk_head(state->hashtable + state->bucket); | 1537 | sk = sk_head(state->hashtable + state->bucket); |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 10ed70491434..c63de0a72aba 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -221,7 +221,7 @@ static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
221 | xdst = (struct xfrm_dst *)dst; | 221 | xdst = (struct xfrm_dst *)dst; |
222 | if (xdst->u.rt.idev->dev == dev) { | 222 | if (xdst->u.rt.idev->dev == dev) { |
223 | struct in_device *loopback_idev = | 223 | struct in_device *loopback_idev = |
224 | in_dev_get(dev->nd_net->loopback_dev); | 224 | in_dev_get(dev_net(dev)->loopback_dev); |
225 | BUG_ON(!loopback_idev); | 225 | BUG_ON(!loopback_idev); |
226 | 226 | ||
227 | do { | 227 | do { |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 89954885dee1..5ab9973571ef 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -335,7 +335,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
335 | 335 | ||
336 | rwlock_init(&ndev->lock); | 336 | rwlock_init(&ndev->lock); |
337 | ndev->dev = dev; | 337 | ndev->dev = dev; |
338 | memcpy(&ndev->cnf, dev->nd_net->ipv6.devconf_dflt, sizeof(ndev->cnf)); | 338 | memcpy(&ndev->cnf, dev_net(dev)->ipv6.devconf_dflt, sizeof(ndev->cnf)); |
339 | ndev->cnf.mtu6 = dev->mtu; | 339 | ndev->cnf.mtu6 = dev->mtu; |
340 | ndev->cnf.sysctl = NULL; | 340 | ndev->cnf.sysctl = NULL; |
341 | ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl); | 341 | ndev->nd_parms = neigh_parms_alloc(dev, &nd_tbl); |
@@ -561,7 +561,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, | |||
561 | write_lock(&addrconf_hash_lock); | 561 | write_lock(&addrconf_hash_lock); |
562 | 562 | ||
563 | /* Ignore adding duplicate addresses on an interface */ | 563 | /* Ignore adding duplicate addresses on an interface */ |
564 | if (ipv6_chk_same_addr(idev->dev->nd_net, addr, idev->dev)) { | 564 | if (ipv6_chk_same_addr(dev_net(idev->dev), addr, idev->dev)) { |
565 | ADBG(("ipv6_add_addr: already assigned\n")); | 565 | ADBG(("ipv6_add_addr: already assigned\n")); |
566 | err = -EEXIST; | 566 | err = -EEXIST; |
567 | goto out; | 567 | goto out; |
@@ -751,7 +751,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp) | |||
751 | if ((ifp->flags & IFA_F_PERMANENT) && onlink < 1) { | 751 | if ((ifp->flags & IFA_F_PERMANENT) && onlink < 1) { |
752 | struct in6_addr prefix; | 752 | struct in6_addr prefix; |
753 | struct rt6_info *rt; | 753 | struct rt6_info *rt; |
754 | struct net *net = ifp->idev->dev->nd_net; | 754 | struct net *net = dev_net(ifp->idev->dev); |
755 | ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); | 755 | ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); |
756 | rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1); | 756 | rt = rt6_lookup(net, &prefix, NULL, ifp->idev->dev->ifindex, 1); |
757 | 757 | ||
@@ -1044,7 +1044,7 @@ int ipv6_dev_get_saddr(struct net_device *dst_dev, | |||
1044 | { | 1044 | { |
1045 | struct ipv6_saddr_score scores[2], | 1045 | struct ipv6_saddr_score scores[2], |
1046 | *score = &scores[0], *hiscore = &scores[1]; | 1046 | *score = &scores[0], *hiscore = &scores[1]; |
1047 | struct net *net = dst_dev->nd_net; | 1047 | struct net *net = dev_net(dst_dev); |
1048 | struct ipv6_saddr_dst dst; | 1048 | struct ipv6_saddr_dst dst; |
1049 | struct net_device *dev; | 1049 | struct net_device *dev; |
1050 | int dst_type; | 1050 | int dst_type; |
@@ -1217,7 +1217,7 @@ int ipv6_chk_addr(struct net *net, struct in6_addr *addr, | |||
1217 | 1217 | ||
1218 | read_lock_bh(&addrconf_hash_lock); | 1218 | read_lock_bh(&addrconf_hash_lock); |
1219 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { | 1219 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { |
1220 | if (ifp->idev->dev->nd_net != net) | 1220 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
1221 | continue; | 1221 | continue; |
1222 | if (ipv6_addr_equal(&ifp->addr, addr) && | 1222 | if (ipv6_addr_equal(&ifp->addr, addr) && |
1223 | !(ifp->flags&IFA_F_TENTATIVE)) { | 1223 | !(ifp->flags&IFA_F_TENTATIVE)) { |
@@ -1239,7 +1239,7 @@ int ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr, | |||
1239 | u8 hash = ipv6_addr_hash(addr); | 1239 | u8 hash = ipv6_addr_hash(addr); |
1240 | 1240 | ||
1241 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { | 1241 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { |
1242 | if (ifp->idev->dev->nd_net != net) | 1242 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
1243 | continue; | 1243 | continue; |
1244 | if (ipv6_addr_equal(&ifp->addr, addr)) { | 1244 | if (ipv6_addr_equal(&ifp->addr, addr)) { |
1245 | if (dev == NULL || ifp->idev->dev == dev) | 1245 | if (dev == NULL || ifp->idev->dev == dev) |
@@ -1257,7 +1257,7 @@ struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, struct in6_addr *addr, | |||
1257 | 1257 | ||
1258 | read_lock_bh(&addrconf_hash_lock); | 1258 | read_lock_bh(&addrconf_hash_lock); |
1259 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { | 1259 | for(ifp = inet6_addr_lst[hash]; ifp; ifp=ifp->lst_next) { |
1260 | if (ifp->idev->dev->nd_net != net) | 1260 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
1261 | continue; | 1261 | continue; |
1262 | if (ipv6_addr_equal(&ifp->addr, addr)) { | 1262 | if (ipv6_addr_equal(&ifp->addr, addr)) { |
1263 | if (dev == NULL || ifp->idev->dev == dev || | 1263 | if (dev == NULL || ifp->idev->dev == dev || |
@@ -1559,7 +1559,7 @@ addrconf_prefix_route(struct in6_addr *pfx, int plen, struct net_device *dev, | |||
1559 | .fc_expires = expires, | 1559 | .fc_expires = expires, |
1560 | .fc_dst_len = plen, | 1560 | .fc_dst_len = plen, |
1561 | .fc_flags = RTF_UP | flags, | 1561 | .fc_flags = RTF_UP | flags, |
1562 | .fc_nlinfo.nl_net = dev->nd_net, | 1562 | .fc_nlinfo.nl_net = dev_net(dev), |
1563 | }; | 1563 | }; |
1564 | 1564 | ||
1565 | ipv6_addr_copy(&cfg.fc_dst, pfx); | 1565 | ipv6_addr_copy(&cfg.fc_dst, pfx); |
@@ -1586,7 +1586,7 @@ static void addrconf_add_mroute(struct net_device *dev) | |||
1586 | .fc_ifindex = dev->ifindex, | 1586 | .fc_ifindex = dev->ifindex, |
1587 | .fc_dst_len = 8, | 1587 | .fc_dst_len = 8, |
1588 | .fc_flags = RTF_UP, | 1588 | .fc_flags = RTF_UP, |
1589 | .fc_nlinfo.nl_net = dev->nd_net, | 1589 | .fc_nlinfo.nl_net = dev_net(dev), |
1590 | }; | 1590 | }; |
1591 | 1591 | ||
1592 | ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0); | 1592 | ipv6_addr_set(&cfg.fc_dst, htonl(0xFF000000), 0, 0, 0); |
@@ -1603,7 +1603,7 @@ static void sit_route_add(struct net_device *dev) | |||
1603 | .fc_ifindex = dev->ifindex, | 1603 | .fc_ifindex = dev->ifindex, |
1604 | .fc_dst_len = 96, | 1604 | .fc_dst_len = 96, |
1605 | .fc_flags = RTF_UP | RTF_NONEXTHOP, | 1605 | .fc_flags = RTF_UP | RTF_NONEXTHOP, |
1606 | .fc_nlinfo.nl_net = dev->nd_net, | 1606 | .fc_nlinfo.nl_net = dev_net(dev), |
1607 | }; | 1607 | }; |
1608 | 1608 | ||
1609 | /* prefix length - 96 bits "::d.d.d.d" */ | 1609 | /* prefix length - 96 bits "::d.d.d.d" */ |
@@ -1704,7 +1704,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) | |||
1704 | 1704 | ||
1705 | if (pinfo->onlink) { | 1705 | if (pinfo->onlink) { |
1706 | struct rt6_info *rt; | 1706 | struct rt6_info *rt; |
1707 | rt = rt6_lookup(dev->nd_net, &pinfo->prefix, NULL, | 1707 | rt = rt6_lookup(dev_net(dev), &pinfo->prefix, NULL, |
1708 | dev->ifindex, 1); | 1708 | dev->ifindex, 1); |
1709 | 1709 | ||
1710 | if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { | 1710 | if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { |
@@ -1748,7 +1748,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len) | |||
1748 | 1748 | ||
1749 | ok: | 1749 | ok: |
1750 | 1750 | ||
1751 | ifp = ipv6_get_ifaddr(dev->nd_net, &addr, dev, 1); | 1751 | ifp = ipv6_get_ifaddr(dev_net(dev), &addr, dev, 1); |
1752 | 1752 | ||
1753 | if (ifp == NULL && valid_lft) { | 1753 | if (ifp == NULL && valid_lft) { |
1754 | int max_addresses = in6_dev->cnf.max_addresses; | 1754 | int max_addresses = in6_dev->cnf.max_addresses; |
@@ -2071,7 +2071,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev) | |||
2071 | struct inet6_ifaddr * ifp; | 2071 | struct inet6_ifaddr * ifp; |
2072 | struct in6_addr addr; | 2072 | struct in6_addr addr; |
2073 | struct net_device *dev; | 2073 | struct net_device *dev; |
2074 | struct net *net = idev->dev->nd_net; | 2074 | struct net *net = dev_net(idev->dev); |
2075 | int scope; | 2075 | int scope; |
2076 | 2076 | ||
2077 | ASSERT_RTNL(); | 2077 | ASSERT_RTNL(); |
@@ -2261,7 +2261,7 @@ ipv6_inherit_linklocal(struct inet6_dev *idev, struct net_device *link_dev) | |||
2261 | static void ip6_tnl_add_linklocal(struct inet6_dev *idev) | 2261 | static void ip6_tnl_add_linklocal(struct inet6_dev *idev) |
2262 | { | 2262 | { |
2263 | struct net_device *link_dev; | 2263 | struct net_device *link_dev; |
2264 | struct net *net = idev->dev->nd_net; | 2264 | struct net *net = dev_net(idev->dev); |
2265 | 2265 | ||
2266 | /* first try to inherit the link-local address from the link device */ | 2266 | /* first try to inherit the link-local address from the link device */ |
2267 | if (idev->dev->iflink && | 2267 | if (idev->dev->iflink && |
@@ -2442,7 +2442,7 @@ static int addrconf_ifdown(struct net_device *dev, int how) | |||
2442 | { | 2442 | { |
2443 | struct inet6_dev *idev; | 2443 | struct inet6_dev *idev; |
2444 | struct inet6_ifaddr *ifa, **bifa; | 2444 | struct inet6_ifaddr *ifa, **bifa; |
2445 | struct net *net = dev->nd_net; | 2445 | struct net *net = dev_net(dev); |
2446 | int i; | 2446 | int i; |
2447 | 2447 | ||
2448 | ASSERT_RTNL(); | 2448 | ASSERT_RTNL(); |
@@ -2766,12 +2766,12 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq) | |||
2766 | { | 2766 | { |
2767 | struct inet6_ifaddr *ifa = NULL; | 2767 | struct inet6_ifaddr *ifa = NULL; |
2768 | struct if6_iter_state *state = seq->private; | 2768 | struct if6_iter_state *state = seq->private; |
2769 | struct net *net = state->p.net; | 2769 | struct net *net = seq_file_net(seq); |
2770 | 2770 | ||
2771 | for (state->bucket = 0; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) { | 2771 | for (state->bucket = 0; state->bucket < IN6_ADDR_HSIZE; ++state->bucket) { |
2772 | ifa = inet6_addr_lst[state->bucket]; | 2772 | ifa = inet6_addr_lst[state->bucket]; |
2773 | 2773 | ||
2774 | while (ifa && ifa->idev->dev->nd_net != net) | 2774 | while (ifa && !net_eq(dev_net(ifa->idev->dev), net)) |
2775 | ifa = ifa->lst_next; | 2775 | ifa = ifa->lst_next; |
2776 | if (ifa) | 2776 | if (ifa) |
2777 | break; | 2777 | break; |
@@ -2782,12 +2782,12 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq) | |||
2782 | static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, struct inet6_ifaddr *ifa) | 2782 | static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, struct inet6_ifaddr *ifa) |
2783 | { | 2783 | { |
2784 | struct if6_iter_state *state = seq->private; | 2784 | struct if6_iter_state *state = seq->private; |
2785 | struct net *net = state->p.net; | 2785 | struct net *net = seq_file_net(seq); |
2786 | 2786 | ||
2787 | ifa = ifa->lst_next; | 2787 | ifa = ifa->lst_next; |
2788 | try_again: | 2788 | try_again: |
2789 | if (ifa) { | 2789 | if (ifa) { |
2790 | if (ifa->idev->dev->nd_net != net) { | 2790 | if (!net_eq(dev_net(ifa->idev->dev), net)) { |
2791 | ifa = ifa->lst_next; | 2791 | ifa = ifa->lst_next; |
2792 | goto try_again; | 2792 | goto try_again; |
2793 | } | 2793 | } |
@@ -2905,7 +2905,7 @@ int ipv6_chk_home_addr(struct net *net, struct in6_addr *addr) | |||
2905 | u8 hash = ipv6_addr_hash(addr); | 2905 | u8 hash = ipv6_addr_hash(addr); |
2906 | read_lock_bh(&addrconf_hash_lock); | 2906 | read_lock_bh(&addrconf_hash_lock); |
2907 | for (ifp = inet6_addr_lst[hash]; ifp; ifp = ifp->lst_next) { | 2907 | for (ifp = inet6_addr_lst[hash]; ifp; ifp = ifp->lst_next) { |
2908 | if (ifp->idev->dev->nd_net != net) | 2908 | if (!net_eq(dev_net(ifp->idev->dev), net)) |
2909 | continue; | 2909 | continue; |
2910 | if (ipv6_addr_cmp(&ifp->addr, addr) == 0 && | 2910 | if (ipv6_addr_cmp(&ifp->addr, addr) == 0 && |
2911 | (ifp->flags & IFA_F_HOMEADDRESS)) { | 2911 | (ifp->flags & IFA_F_HOMEADDRESS)) { |
@@ -3054,7 +3054,7 @@ static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = { | |||
3054 | static int | 3054 | static int |
3055 | inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 3055 | inet6_rtm_deladdr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
3056 | { | 3056 | { |
3057 | struct net *net = skb->sk->sk_net; | 3057 | struct net *net = sock_net(skb->sk); |
3058 | struct ifaddrmsg *ifm; | 3058 | struct ifaddrmsg *ifm; |
3059 | struct nlattr *tb[IFA_MAX+1]; | 3059 | struct nlattr *tb[IFA_MAX+1]; |
3060 | struct in6_addr *pfx; | 3060 | struct in6_addr *pfx; |
@@ -3112,7 +3112,7 @@ static int inet6_addr_modify(struct inet6_ifaddr *ifp, u8 ifa_flags, | |||
3112 | static int | 3112 | static int |
3113 | inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) | 3113 | inet6_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) |
3114 | { | 3114 | { |
3115 | struct net *net = skb->sk->sk_net; | 3115 | struct net *net = sock_net(skb->sk); |
3116 | struct ifaddrmsg *ifm; | 3116 | struct ifaddrmsg *ifm; |
3117 | struct nlattr *tb[IFA_MAX+1]; | 3117 | struct nlattr *tb[IFA_MAX+1]; |
3118 | struct in6_addr *pfx; | 3118 | struct in6_addr *pfx; |
@@ -3322,7 +3322,7 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, | |||
3322 | struct inet6_ifaddr *ifa; | 3322 | struct inet6_ifaddr *ifa; |
3323 | struct ifmcaddr6 *ifmca; | 3323 | struct ifmcaddr6 *ifmca; |
3324 | struct ifacaddr6 *ifaca; | 3324 | struct ifacaddr6 *ifaca; |
3325 | struct net *net = skb->sk->sk_net; | 3325 | struct net *net = sock_net(skb->sk); |
3326 | 3326 | ||
3327 | s_idx = cb->args[0]; | 3327 | s_idx = cb->args[0]; |
3328 | s_ip_idx = ip_idx = cb->args[1]; | 3328 | s_ip_idx = ip_idx = cb->args[1]; |
@@ -3418,7 +3418,7 @@ static int inet6_dump_ifacaddr(struct sk_buff *skb, struct netlink_callback *cb) | |||
3418 | static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh, | 3418 | static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr* nlh, |
3419 | void *arg) | 3419 | void *arg) |
3420 | { | 3420 | { |
3421 | struct net *net = in_skb->sk->sk_net; | 3421 | struct net *net = sock_net(in_skb->sk); |
3422 | struct ifaddrmsg *ifm; | 3422 | struct ifaddrmsg *ifm; |
3423 | struct nlattr *tb[IFA_MAX+1]; | 3423 | struct nlattr *tb[IFA_MAX+1]; |
3424 | struct in6_addr *addr = NULL; | 3424 | struct in6_addr *addr = NULL; |
@@ -3469,7 +3469,7 @@ errout: | |||
3469 | static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) | 3469 | static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) |
3470 | { | 3470 | { |
3471 | struct sk_buff *skb; | 3471 | struct sk_buff *skb; |
3472 | struct net *net = ifa->idev->dev->nd_net; | 3472 | struct net *net = dev_net(ifa->idev->dev); |
3473 | int err = -ENOBUFS; | 3473 | int err = -ENOBUFS; |
3474 | 3474 | ||
3475 | skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC); | 3475 | skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC); |
@@ -3645,7 +3645,7 @@ nla_put_failure: | |||
3645 | 3645 | ||
3646 | static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) | 3646 | static int inet6_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) |
3647 | { | 3647 | { |
3648 | struct net *net = skb->sk->sk_net; | 3648 | struct net *net = sock_net(skb->sk); |
3649 | int idx, err; | 3649 | int idx, err; |
3650 | int s_idx = cb->args[0]; | 3650 | int s_idx = cb->args[0]; |
3651 | struct net_device *dev; | 3651 | struct net_device *dev; |
@@ -3675,7 +3675,7 @@ cont: | |||
3675 | void inet6_ifinfo_notify(int event, struct inet6_dev *idev) | 3675 | void inet6_ifinfo_notify(int event, struct inet6_dev *idev) |
3676 | { | 3676 | { |
3677 | struct sk_buff *skb; | 3677 | struct sk_buff *skb; |
3678 | struct net *net = idev->dev->nd_net; | 3678 | struct net *net = dev_net(idev->dev); |
3679 | int err = -ENOBUFS; | 3679 | int err = -ENOBUFS; |
3680 | 3680 | ||
3681 | skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC); | 3681 | skb = nlmsg_new(inet6_if_nlmsg_size(), GFP_ATOMIC); |
@@ -3745,7 +3745,7 @@ static void inet6_prefix_notify(int event, struct inet6_dev *idev, | |||
3745 | struct prefix_info *pinfo) | 3745 | struct prefix_info *pinfo) |
3746 | { | 3746 | { |
3747 | struct sk_buff *skb; | 3747 | struct sk_buff *skb; |
3748 | struct net *net = idev->dev->nd_net; | 3748 | struct net *net = dev_net(idev->dev); |
3749 | int err = -ENOBUFS; | 3749 | int err = -ENOBUFS; |
3750 | 3750 | ||
3751 | skb = nlmsg_new(inet6_prefix_nlmsg_size(), GFP_ATOMIC); | 3751 | skb = nlmsg_new(inet6_prefix_nlmsg_size(), GFP_ATOMIC); |
@@ -4157,7 +4157,7 @@ static void addrconf_sysctl_register(struct inet6_dev *idev) | |||
4157 | NET_IPV6_NEIGH, "ipv6", | 4157 | NET_IPV6_NEIGH, "ipv6", |
4158 | &ndisc_ifinfo_sysctl_change, | 4158 | &ndisc_ifinfo_sysctl_change, |
4159 | NULL); | 4159 | NULL); |
4160 | __addrconf_sysctl_register(idev->dev->nd_net, idev->dev->name, | 4160 | __addrconf_sysctl_register(dev_net(idev->dev), idev->dev->name, |
4161 | idev->dev->ifindex, idev, &idev->cnf); | 4161 | idev->dev->ifindex, idev, &idev->cnf); |
4162 | } | 4162 | } |
4163 | 4163 | ||
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c index de371b5997fe..9bfa8846f262 100644 --- a/net/ipv6/addrlabel.c +++ b/net/ipv6/addrlabel.c | |||
@@ -364,7 +364,7 @@ static const struct nla_policy ifal_policy[IFAL_MAX+1] = { | |||
364 | static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh, | 364 | static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh, |
365 | void *arg) | 365 | void *arg) |
366 | { | 366 | { |
367 | struct net *net = skb->sk->sk_net; | 367 | struct net *net = sock_net(skb->sk); |
368 | struct ifaddrlblmsg *ifal; | 368 | struct ifaddrlblmsg *ifal; |
369 | struct nlattr *tb[IFAL_MAX+1]; | 369 | struct nlattr *tb[IFAL_MAX+1]; |
370 | struct in6_addr *pfx; | 370 | struct in6_addr *pfx; |
@@ -452,7 +452,7 @@ static int ip6addrlbl_fill(struct sk_buff *skb, | |||
452 | 452 | ||
453 | static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb) | 453 | static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb) |
454 | { | 454 | { |
455 | struct net *net = skb->sk->sk_net; | 455 | struct net *net = sock_net(skb->sk); |
456 | struct ip6addrlbl_entry *p; | 456 | struct ip6addrlbl_entry *p; |
457 | struct hlist_node *pos; | 457 | struct hlist_node *pos; |
458 | int idx = 0, s_idx = cb->args[0]; | 458 | int idx = 0, s_idx = cb->args[0]; |
@@ -490,7 +490,7 @@ static inline int ip6addrlbl_msgsize(void) | |||
490 | static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh, | 490 | static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh, |
491 | void *arg) | 491 | void *arg) |
492 | { | 492 | { |
493 | struct net *net = in_skb->sk->sk_net; | 493 | struct net *net = sock_net(in_skb->sk); |
494 | struct ifaddrlblmsg *ifal; | 494 | struct ifaddrlblmsg *ifal; |
495 | struct nlattr *tb[IFAL_MAX+1]; | 495 | struct nlattr *tb[IFAL_MAX+1]; |
496 | struct in6_addr *addr; | 496 | struct in6_addr *addr; |
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index f52bdaed8a1b..12f04e9d3e88 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -245,7 +245,7 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
245 | struct sock *sk = sock->sk; | 245 | struct sock *sk = sock->sk; |
246 | struct inet_sock *inet = inet_sk(sk); | 246 | struct inet_sock *inet = inet_sk(sk); |
247 | struct ipv6_pinfo *np = inet6_sk(sk); | 247 | struct ipv6_pinfo *np = inet6_sk(sk); |
248 | struct net *net = sk->sk_net; | 248 | struct net *net = sock_net(sk); |
249 | __be32 v4addr = 0; | 249 | __be32 v4addr = 0; |
250 | unsigned short snum; | 250 | unsigned short snum; |
251 | int addr_type = 0; | 251 | int addr_type = 0; |
@@ -438,7 +438,7 @@ EXPORT_SYMBOL(inet6_getname); | |||
438 | int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 438 | int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) |
439 | { | 439 | { |
440 | struct sock *sk = sock->sk; | 440 | struct sock *sk = sock->sk; |
441 | struct net *net = sk->sk_net; | 441 | struct net *net = sock_net(sk); |
442 | 442 | ||
443 | switch(cmd) | 443 | switch(cmd) |
444 | { | 444 | { |
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index e7a7fe26cebf..cac580749ebe 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
@@ -154,7 +154,7 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb, | |||
154 | struct nlattr **tb) | 154 | struct nlattr **tb) |
155 | { | 155 | { |
156 | int err = -EINVAL; | 156 | int err = -EINVAL; |
157 | struct net *net = skb->sk->sk_net; | 157 | struct net *net = sock_net(skb->sk); |
158 | struct fib6_rule *rule6 = (struct fib6_rule *) rule; | 158 | struct fib6_rule *rule6 = (struct fib6_rule *) rule; |
159 | 159 | ||
160 | if (rule->action == FR_ACT_TO_TBL) { | 160 | if (rule->action == FR_ACT_TO_TBL) { |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 86332417b402..63309d10df3a 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -163,7 +163,7 @@ static inline int icmpv6_xrlim_allow(struct sock *sk, int type, | |||
163 | struct flowi *fl) | 163 | struct flowi *fl) |
164 | { | 164 | { |
165 | struct dst_entry *dst; | 165 | struct dst_entry *dst; |
166 | struct net *net = sk->sk_net; | 166 | struct net *net = sock_net(sk); |
167 | int res = 0; | 167 | int res = 0; |
168 | 168 | ||
169 | /* Informational messages are not limited. */ | 169 | /* Informational messages are not limited. */ |
@@ -306,7 +306,7 @@ static inline void mip6_addr_swap(struct sk_buff *skb) {} | |||
306 | void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | 306 | void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, |
307 | struct net_device *dev) | 307 | struct net_device *dev) |
308 | { | 308 | { |
309 | struct net *net = skb->dev->nd_net; | 309 | struct net *net = dev_net(skb->dev); |
310 | struct inet6_dev *idev = NULL; | 310 | struct inet6_dev *idev = NULL; |
311 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 311 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
312 | struct sock *sk; | 312 | struct sock *sk; |
@@ -507,7 +507,7 @@ EXPORT_SYMBOL(icmpv6_send); | |||
507 | 507 | ||
508 | static void icmpv6_echo_reply(struct sk_buff *skb) | 508 | static void icmpv6_echo_reply(struct sk_buff *skb) |
509 | { | 509 | { |
510 | struct net *net = skb->dev->nd_net; | 510 | struct net *net = dev_net(skb->dev); |
511 | struct sock *sk; | 511 | struct sock *sk; |
512 | struct inet6_dev *idev; | 512 | struct inet6_dev *idev; |
513 | struct ipv6_pinfo *np; | 513 | struct ipv6_pinfo *np; |
diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index c0c8d2d17682..340c7d42b83a 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c | |||
@@ -105,7 +105,7 @@ struct sock *inet6_lookup_listener(struct net *net, | |||
105 | 105 | ||
106 | read_lock(&hashinfo->lhash_lock); | 106 | read_lock(&hashinfo->lhash_lock); |
107 | sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { | 107 | sk_for_each(sk, node, &hashinfo->listening_hash[inet_lhashfn(hnum)]) { |
108 | if (sk->sk_net == net && inet_sk(sk)->num == hnum && | 108 | if (net_eq(sock_net(sk), net) && inet_sk(sk)->num == hnum && |
109 | sk->sk_family == PF_INET6) { | 109 | sk->sk_family == PF_INET6) { |
110 | const struct ipv6_pinfo *np = inet6_sk(sk); | 110 | const struct ipv6_pinfo *np = inet6_sk(sk); |
111 | 111 | ||
@@ -172,7 +172,7 @@ static int __inet6_check_established(struct inet_timewait_death_row *death_row, | |||
172 | struct sock *sk2; | 172 | struct sock *sk2; |
173 | const struct hlist_node *node; | 173 | const struct hlist_node *node; |
174 | struct inet_timewait_sock *tw; | 174 | struct inet_timewait_sock *tw; |
175 | struct net *net = sk->sk_net; | 175 | struct net *net = sock_net(sk); |
176 | 176 | ||
177 | prefetch(head->chain.first); | 177 | prefetch(head->chain.first); |
178 | write_lock(lock); | 178 | write_lock(lock); |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index b0814b0082e7..b3f6e03c454c 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -346,7 +346,7 @@ end: | |||
346 | 346 | ||
347 | static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) | 347 | static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) |
348 | { | 348 | { |
349 | struct net *net = skb->sk->sk_net; | 349 | struct net *net = sock_net(skb->sk); |
350 | unsigned int h, s_h; | 350 | unsigned int h, s_h; |
351 | unsigned int e = 0, s_e; | 351 | unsigned int e = 0, s_e; |
352 | struct rt6_rtnl_dump_arg arg; | 352 | struct rt6_rtnl_dump_arg arg; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index d34aa61353bb..a8b4da25b0a7 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -402,7 +402,7 @@ int ip6_forward(struct sk_buff *skb) | |||
402 | struct dst_entry *dst = skb->dst; | 402 | struct dst_entry *dst = skb->dst; |
403 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 403 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
404 | struct inet6_skb_parm *opt = IP6CB(skb); | 404 | struct inet6_skb_parm *opt = IP6CB(skb); |
405 | struct net *net = dst->dev->nd_net; | 405 | struct net *net = dev_net(dst->dev); |
406 | 406 | ||
407 | if (ipv6_devconf.forwarding == 0) | 407 | if (ipv6_devconf.forwarding == 0) |
408 | goto error; | 408 | goto error; |
@@ -910,7 +910,7 @@ static int ip6_dst_lookup_tail(struct sock *sk, | |||
910 | struct dst_entry **dst, struct flowi *fl) | 910 | struct dst_entry **dst, struct flowi *fl) |
911 | { | 911 | { |
912 | int err; | 912 | int err; |
913 | struct net *net = sk->sk_net; | 913 | struct net *net = sock_net(sk); |
914 | 914 | ||
915 | if (*dst == NULL) | 915 | if (*dst == NULL) |
916 | *dst = ip6_route_output(net, sk, fl); | 916 | *dst = ip6_route_output(net, sk, fl); |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index dc6695cc5767..d3d93d752e10 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -107,7 +107,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, | |||
107 | char __user *optval, int optlen) | 107 | char __user *optval, int optlen) |
108 | { | 108 | { |
109 | struct ipv6_pinfo *np = inet6_sk(sk); | 109 | struct ipv6_pinfo *np = inet6_sk(sk); |
110 | struct net *net = sk->sk_net; | 110 | struct net *net = sock_net(sk); |
111 | int val, valbool; | 111 | int val, valbool; |
112 | int retv = -ENOPROTOOPT; | 112 | int retv = -ENOPROTOOPT; |
113 | 113 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 957ac7e9e929..d810cff818cf 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -181,7 +181,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr) | |||
181 | struct net_device *dev = NULL; | 181 | struct net_device *dev = NULL; |
182 | struct ipv6_mc_socklist *mc_lst; | 182 | struct ipv6_mc_socklist *mc_lst; |
183 | struct ipv6_pinfo *np = inet6_sk(sk); | 183 | struct ipv6_pinfo *np = inet6_sk(sk); |
184 | struct net *net = sk->sk_net; | 184 | struct net *net = sock_net(sk); |
185 | int err; | 185 | int err; |
186 | 186 | ||
187 | if (!ipv6_addr_is_multicast(addr)) | 187 | if (!ipv6_addr_is_multicast(addr)) |
@@ -255,7 +255,7 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, struct in6_addr *addr) | |||
255 | { | 255 | { |
256 | struct ipv6_pinfo *np = inet6_sk(sk); | 256 | struct ipv6_pinfo *np = inet6_sk(sk); |
257 | struct ipv6_mc_socklist *mc_lst, **lnk; | 257 | struct ipv6_mc_socklist *mc_lst, **lnk; |
258 | struct net *net = sk->sk_net; | 258 | struct net *net = sock_net(sk); |
259 | 259 | ||
260 | write_lock_bh(&ipv6_sk_mc_lock); | 260 | write_lock_bh(&ipv6_sk_mc_lock); |
261 | for (lnk = &np->ipv6_mc_list; (mc_lst = *lnk) !=NULL ; lnk = &mc_lst->next) { | 261 | for (lnk = &np->ipv6_mc_list; (mc_lst = *lnk) !=NULL ; lnk = &mc_lst->next) { |
@@ -327,7 +327,7 @@ void ipv6_sock_mc_close(struct sock *sk) | |||
327 | { | 327 | { |
328 | struct ipv6_pinfo *np = inet6_sk(sk); | 328 | struct ipv6_pinfo *np = inet6_sk(sk); |
329 | struct ipv6_mc_socklist *mc_lst; | 329 | struct ipv6_mc_socklist *mc_lst; |
330 | struct net *net = sk->sk_net; | 330 | struct net *net = sock_net(sk); |
331 | 331 | ||
332 | write_lock_bh(&ipv6_sk_mc_lock); | 332 | write_lock_bh(&ipv6_sk_mc_lock); |
333 | while ((mc_lst = np->ipv6_mc_list) != NULL) { | 333 | while ((mc_lst = np->ipv6_mc_list) != NULL) { |
@@ -365,7 +365,7 @@ int ip6_mc_source(int add, int omode, struct sock *sk, | |||
365 | struct inet6_dev *idev; | 365 | struct inet6_dev *idev; |
366 | struct ipv6_pinfo *inet6 = inet6_sk(sk); | 366 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
367 | struct ip6_sf_socklist *psl; | 367 | struct ip6_sf_socklist *psl; |
368 | struct net *net = sk->sk_net; | 368 | struct net *net = sock_net(sk); |
369 | int i, j, rv; | 369 | int i, j, rv; |
370 | int leavegroup = 0; | 370 | int leavegroup = 0; |
371 | int pmclocked = 0; | 371 | int pmclocked = 0; |
@@ -505,7 +505,7 @@ int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf) | |||
505 | struct inet6_dev *idev; | 505 | struct inet6_dev *idev; |
506 | struct ipv6_pinfo *inet6 = inet6_sk(sk); | 506 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
507 | struct ip6_sf_socklist *newpsl, *psl; | 507 | struct ip6_sf_socklist *newpsl, *psl; |
508 | struct net *net = sk->sk_net; | 508 | struct net *net = sock_net(sk); |
509 | int leavegroup = 0; | 509 | int leavegroup = 0; |
510 | int i, err; | 510 | int i, err; |
511 | 511 | ||
@@ -598,7 +598,7 @@ int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, | |||
598 | struct net_device *dev; | 598 | struct net_device *dev; |
599 | struct ipv6_pinfo *inet6 = inet6_sk(sk); | 599 | struct ipv6_pinfo *inet6 = inet6_sk(sk); |
600 | struct ip6_sf_socklist *psl; | 600 | struct ip6_sf_socklist *psl; |
601 | struct net *net = sk->sk_net; | 601 | struct net *net = sock_net(sk); |
602 | 602 | ||
603 | group = &((struct sockaddr_in6 *)&gsf->gf_group)->sin6_addr; | 603 | group = &((struct sockaddr_in6 *)&gsf->gf_group)->sin6_addr; |
604 | 604 | ||
@@ -1400,7 +1400,7 @@ mld_scount(struct ifmcaddr6 *pmc, int type, int gdeleted, int sdeleted) | |||
1400 | 1400 | ||
1401 | static struct sk_buff *mld_newpack(struct net_device *dev, int size) | 1401 | static struct sk_buff *mld_newpack(struct net_device *dev, int size) |
1402 | { | 1402 | { |
1403 | struct net *net = dev->nd_net; | 1403 | struct net *net = dev_net(dev); |
1404 | struct sock *sk = net->ipv6.igmp_sk; | 1404 | struct sock *sk = net->ipv6.igmp_sk; |
1405 | struct sk_buff *skb; | 1405 | struct sk_buff *skb; |
1406 | struct mld2_report *pmr; | 1406 | struct mld2_report *pmr; |
@@ -1448,7 +1448,7 @@ static void mld_sendpack(struct sk_buff *skb) | |||
1448 | (struct mld2_report *)skb_transport_header(skb); | 1448 | (struct mld2_report *)skb_transport_header(skb); |
1449 | int payload_len, mldlen; | 1449 | int payload_len, mldlen; |
1450 | struct inet6_dev *idev = in6_dev_get(skb->dev); | 1450 | struct inet6_dev *idev = in6_dev_get(skb->dev); |
1451 | struct net *net = skb->dev->nd_net; | 1451 | struct net *net = dev_net(skb->dev); |
1452 | int err; | 1452 | int err; |
1453 | struct flowi fl; | 1453 | struct flowi fl; |
1454 | 1454 | ||
@@ -1762,7 +1762,7 @@ static void mld_send_cr(struct inet6_dev *idev) | |||
1762 | 1762 | ||
1763 | static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) | 1763 | static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) |
1764 | { | 1764 | { |
1765 | struct net *net = dev->nd_net; | 1765 | struct net *net = dev_net(dev); |
1766 | struct sock *sk = net->ipv6.igmp_sk; | 1766 | struct sock *sk = net->ipv6.igmp_sk; |
1767 | struct inet6_dev *idev; | 1767 | struct inet6_dev *idev; |
1768 | struct sk_buff *skb; | 1768 | struct sk_buff *skb; |
@@ -2355,7 +2355,7 @@ static inline struct ifmcaddr6 *igmp6_mc_get_first(struct seq_file *seq) | |||
2355 | { | 2355 | { |
2356 | struct ifmcaddr6 *im = NULL; | 2356 | struct ifmcaddr6 *im = NULL; |
2357 | struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); | 2357 | struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); |
2358 | struct net *net = state->p.net; | 2358 | struct net *net = seq_file_net(seq); |
2359 | 2359 | ||
2360 | state->idev = NULL; | 2360 | state->idev = NULL; |
2361 | for_each_netdev(net, state->dev) { | 2361 | for_each_netdev(net, state->dev) { |
@@ -2486,7 +2486,7 @@ static inline struct ip6_sf_list *igmp6_mcf_get_first(struct seq_file *seq) | |||
2486 | struct ip6_sf_list *psf = NULL; | 2486 | struct ip6_sf_list *psf = NULL; |
2487 | struct ifmcaddr6 *im = NULL; | 2487 | struct ifmcaddr6 *im = NULL; |
2488 | struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); | 2488 | struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq); |
2489 | struct net *net = state->p.net; | 2489 | struct net *net = seq_file_net(seq); |
2490 | 2490 | ||
2491 | state->idev = NULL; | 2491 | state->idev = NULL; |
2492 | state->im = NULL; | 2492 | state->im = NULL; |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 3f68a6eae7b2..79af57f586e8 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -447,7 +447,7 @@ static void __ndisc_send(struct net_device *dev, | |||
447 | { | 447 | { |
448 | struct flowi fl; | 448 | struct flowi fl; |
449 | struct dst_entry *dst; | 449 | struct dst_entry *dst; |
450 | struct net *net = dev->nd_net; | 450 | struct net *net = dev_net(dev); |
451 | struct sock *sk = net->ipv6.ndisc_sk; | 451 | struct sock *sk = net->ipv6.ndisc_sk; |
452 | struct sk_buff *skb; | 452 | struct sk_buff *skb; |
453 | struct icmp6hdr *hdr; | 453 | struct icmp6hdr *hdr; |
@@ -539,7 +539,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | |||
539 | }; | 539 | }; |
540 | 540 | ||
541 | /* for anycast or proxy, solicited_addr != src_addr */ | 541 | /* for anycast or proxy, solicited_addr != src_addr */ |
542 | ifp = ipv6_get_ifaddr(dev->nd_net, solicited_addr, dev, 1); | 542 | ifp = ipv6_get_ifaddr(dev_net(dev), solicited_addr, dev, 1); |
543 | if (ifp) { | 543 | if (ifp) { |
544 | src_addr = solicited_addr; | 544 | src_addr = solicited_addr; |
545 | if (ifp->flags & IFA_F_OPTIMISTIC) | 545 | if (ifp->flags & IFA_F_OPTIMISTIC) |
@@ -547,7 +547,7 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | |||
547 | in6_ifa_put(ifp); | 547 | in6_ifa_put(ifp); |
548 | } else { | 548 | } else { |
549 | if (ipv6_dev_get_saddr(dev, daddr, | 549 | if (ipv6_dev_get_saddr(dev, daddr, |
550 | inet6_sk(dev->nd_net->ipv6.ndisc_sk)->srcprefs, | 550 | inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs, |
551 | &tmpaddr)) | 551 | &tmpaddr)) |
552 | return; | 552 | return; |
553 | src_addr = &tmpaddr; | 553 | src_addr = &tmpaddr; |
@@ -601,7 +601,7 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, | |||
601 | * suppress the inclusion of the sllao. | 601 | * suppress the inclusion of the sllao. |
602 | */ | 602 | */ |
603 | if (send_sllao) { | 603 | if (send_sllao) { |
604 | struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev->nd_net, saddr, | 604 | struct inet6_ifaddr *ifp = ipv6_get_ifaddr(dev_net(dev), saddr, |
605 | dev, 1); | 605 | dev, 1); |
606 | if (ifp) { | 606 | if (ifp) { |
607 | if (ifp->flags & IFA_F_OPTIMISTIC) { | 607 | if (ifp->flags & IFA_F_OPTIMISTIC) { |
@@ -639,7 +639,7 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb) | |||
639 | struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; | 639 | struct in6_addr *target = (struct in6_addr *)&neigh->primary_key; |
640 | int probes = atomic_read(&neigh->probes); | 640 | int probes = atomic_read(&neigh->probes); |
641 | 641 | ||
642 | if (skb && ipv6_chk_addr(dev->nd_net, &ipv6_hdr(skb)->saddr, dev, 1)) | 642 | if (skb && ipv6_chk_addr(dev_net(dev), &ipv6_hdr(skb)->saddr, dev, 1)) |
643 | saddr = &ipv6_hdr(skb)->saddr; | 643 | saddr = &ipv6_hdr(skb)->saddr; |
644 | 644 | ||
645 | if ((probes -= neigh->parms->ucast_probes) < 0) { | 645 | if ((probes -= neigh->parms->ucast_probes) < 0) { |
@@ -727,7 +727,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
727 | 727 | ||
728 | inc = ipv6_addr_is_multicast(daddr); | 728 | inc = ipv6_addr_is_multicast(daddr); |
729 | 729 | ||
730 | ifp = ipv6_get_ifaddr(dev->nd_net, &msg->target, dev, 1); | 730 | ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1); |
731 | if (ifp) { | 731 | if (ifp) { |
732 | 732 | ||
733 | if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { | 733 | if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { |
@@ -776,7 +776,7 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
776 | if (ipv6_chk_acast_addr(dev, &msg->target) || | 776 | if (ipv6_chk_acast_addr(dev, &msg->target) || |
777 | (idev->cnf.forwarding && | 777 | (idev->cnf.forwarding && |
778 | (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) && | 778 | (ipv6_devconf.proxy_ndp || idev->cnf.proxy_ndp) && |
779 | (pneigh = pneigh_lookup(&nd_tbl, dev->nd_net, | 779 | (pneigh = pneigh_lookup(&nd_tbl, dev_net(dev), |
780 | &msg->target, dev, 0)) != NULL)) { | 780 | &msg->target, dev, 0)) != NULL)) { |
781 | if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && | 781 | if (!(NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED) && |
782 | skb->pkt_type != PACKET_HOST && | 782 | skb->pkt_type != PACKET_HOST && |
@@ -886,7 +886,7 @@ static void ndisc_recv_na(struct sk_buff *skb) | |||
886 | return; | 886 | return; |
887 | } | 887 | } |
888 | } | 888 | } |
889 | ifp = ipv6_get_ifaddr(dev->nd_net, &msg->target, dev, 1); | 889 | ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1); |
890 | if (ifp) { | 890 | if (ifp) { |
891 | if (ifp->flags & IFA_F_TENTATIVE) { | 891 | if (ifp->flags & IFA_F_TENTATIVE) { |
892 | addrconf_dad_failure(ifp); | 892 | addrconf_dad_failure(ifp); |
@@ -918,7 +918,7 @@ static void ndisc_recv_na(struct sk_buff *skb) | |||
918 | */ | 918 | */ |
919 | if (lladdr && !memcmp(lladdr, dev->dev_addr, dev->addr_len) && | 919 | if (lladdr && !memcmp(lladdr, dev->dev_addr, dev->addr_len) && |
920 | ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp && | 920 | ipv6_devconf.forwarding && ipv6_devconf.proxy_ndp && |
921 | pneigh_lookup(&nd_tbl, dev->nd_net, &msg->target, dev, 0)) { | 921 | pneigh_lookup(&nd_tbl, dev_net(dev), &msg->target, dev, 0)) { |
922 | /* XXX: idev->cnf.prixy_ndp */ | 922 | /* XXX: idev->cnf.prixy_ndp */ |
923 | goto out; | 923 | goto out; |
924 | } | 924 | } |
@@ -1008,7 +1008,7 @@ static void ndisc_ra_useropt(struct sk_buff *ra, struct nd_opt_hdr *opt) | |||
1008 | struct sk_buff *skb; | 1008 | struct sk_buff *skb; |
1009 | struct nlmsghdr *nlh; | 1009 | struct nlmsghdr *nlh; |
1010 | struct nduseroptmsg *ndmsg; | 1010 | struct nduseroptmsg *ndmsg; |
1011 | struct net *net = ra->dev->nd_net; | 1011 | struct net *net = dev_net(ra->dev); |
1012 | int err; | 1012 | int err; |
1013 | int base_size = NLMSG_ALIGN(sizeof(struct nduseroptmsg) | 1013 | int base_size = NLMSG_ALIGN(sizeof(struct nduseroptmsg) |
1014 | + (opt->nd_opt_len << 3)); | 1014 | + (opt->nd_opt_len << 3)); |
@@ -1395,7 +1395,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1395 | struct in6_addr *target) | 1395 | struct in6_addr *target) |
1396 | { | 1396 | { |
1397 | struct net_device *dev = skb->dev; | 1397 | struct net_device *dev = skb->dev; |
1398 | struct net *net = dev->nd_net; | 1398 | struct net *net = dev_net(dev); |
1399 | struct sock *sk = net->ipv6.ndisc_sk; | 1399 | struct sock *sk = net->ipv6.ndisc_sk; |
1400 | int len = sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); | 1400 | int len = sizeof(struct icmp6hdr) + 2 * sizeof(struct in6_addr); |
1401 | struct sk_buff *buff; | 1401 | struct sk_buff *buff; |
@@ -1597,7 +1597,7 @@ int ndisc_rcv(struct sk_buff *skb) | |||
1597 | static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) | 1597 | static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) |
1598 | { | 1598 | { |
1599 | struct net_device *dev = ptr; | 1599 | struct net_device *dev = ptr; |
1600 | struct net *net = dev->nd_net; | 1600 | struct net *net = dev_net(dev); |
1601 | 1601 | ||
1602 | switch (event) { | 1602 | switch (event) { |
1603 | case NETDEV_CHANGEADDR: | 1603 | case NETDEV_CHANGEADDR: |
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c index cc2f9afcf808..a6d30626b47c 100644 --- a/net/ipv6/netfilter/ip6_queue.c +++ b/net/ipv6/netfilter/ip6_queue.c | |||
@@ -484,7 +484,7 @@ ipq_rcv_dev_event(struct notifier_block *this, | |||
484 | { | 484 | { |
485 | struct net_device *dev = ptr; | 485 | struct net_device *dev = ptr; |
486 | 486 | ||
487 | if (dev->nd_net != &init_net) | 487 | if (dev_net(dev) != &init_net) |
488 | return NOTIFY_DONE; | 488 | return NOTIFY_DONE; |
489 | 489 | ||
490 | /* Drop any packets associated with the downed device */ | 490 | /* Drop any packets associated with the downed device */ |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index af1ec7ba757c..70ef0d276cc0 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1879,11 +1879,11 @@ compat_do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user, | |||
1879 | 1879 | ||
1880 | switch (cmd) { | 1880 | switch (cmd) { |
1881 | case IP6T_SO_SET_REPLACE: | 1881 | case IP6T_SO_SET_REPLACE: |
1882 | ret = compat_do_replace(sk->sk_net, user, len); | 1882 | ret = compat_do_replace(sock_net(sk), user, len); |
1883 | break; | 1883 | break; |
1884 | 1884 | ||
1885 | case IP6T_SO_SET_ADD_COUNTERS: | 1885 | case IP6T_SO_SET_ADD_COUNTERS: |
1886 | ret = do_add_counters(sk->sk_net, user, len, 1); | 1886 | ret = do_add_counters(sock_net(sk), user, len, 1); |
1887 | break; | 1887 | break; |
1888 | 1888 | ||
1889 | default: | 1889 | default: |
@@ -1990,10 +1990,10 @@ compat_do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
1990 | 1990 | ||
1991 | switch (cmd) { | 1991 | switch (cmd) { |
1992 | case IP6T_SO_GET_INFO: | 1992 | case IP6T_SO_GET_INFO: |
1993 | ret = get_info(sk->sk_net, user, len, 1); | 1993 | ret = get_info(sock_net(sk), user, len, 1); |
1994 | break; | 1994 | break; |
1995 | case IP6T_SO_GET_ENTRIES: | 1995 | case IP6T_SO_GET_ENTRIES: |
1996 | ret = compat_get_entries(sk->sk_net, user, len); | 1996 | ret = compat_get_entries(sock_net(sk), user, len); |
1997 | break; | 1997 | break; |
1998 | default: | 1998 | default: |
1999 | ret = do_ip6t_get_ctl(sk, cmd, user, len); | 1999 | ret = do_ip6t_get_ctl(sk, cmd, user, len); |
@@ -2012,11 +2012,11 @@ do_ip6t_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) | |||
2012 | 2012 | ||
2013 | switch (cmd) { | 2013 | switch (cmd) { |
2014 | case IP6T_SO_SET_REPLACE: | 2014 | case IP6T_SO_SET_REPLACE: |
2015 | ret = do_replace(sk->sk_net, user, len); | 2015 | ret = do_replace(sock_net(sk), user, len); |
2016 | break; | 2016 | break; |
2017 | 2017 | ||
2018 | case IP6T_SO_SET_ADD_COUNTERS: | 2018 | case IP6T_SO_SET_ADD_COUNTERS: |
2019 | ret = do_add_counters(sk->sk_net, user, len, 0); | 2019 | ret = do_add_counters(sock_net(sk), user, len, 0); |
2020 | break; | 2020 | break; |
2021 | 2021 | ||
2022 | default: | 2022 | default: |
@@ -2037,11 +2037,11 @@ do_ip6t_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) | |||
2037 | 2037 | ||
2038 | switch (cmd) { | 2038 | switch (cmd) { |
2039 | case IP6T_SO_GET_INFO: | 2039 | case IP6T_SO_GET_INFO: |
2040 | ret = get_info(sk->sk_net, user, len, 0); | 2040 | ret = get_info(sock_net(sk), user, len, 0); |
2041 | break; | 2041 | break; |
2042 | 2042 | ||
2043 | case IP6T_SO_GET_ENTRIES: | 2043 | case IP6T_SO_GET_ENTRIES: |
2044 | ret = get_entries(sk->sk_net, user, len); | 2044 | ret = get_entries(sock_net(sk), user, len); |
2045 | break; | 2045 | break; |
2046 | 2046 | ||
2047 | case IP6T_SO_GET_REVISION_MATCH: | 2047 | case IP6T_SO_GET_REVISION_MATCH: |
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 8a5be290c710..364dc332532c 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c | |||
@@ -214,7 +214,7 @@ int snmp6_register_dev(struct inet6_dev *idev) | |||
214 | if (!idev || !idev->dev) | 214 | if (!idev || !idev->dev) |
215 | return -EINVAL; | 215 | return -EINVAL; |
216 | 216 | ||
217 | if (idev->dev->nd_net != &init_net) | 217 | if (dev_net(idev->dev) != &init_net) |
218 | return 0; | 218 | return 0; |
219 | 219 | ||
220 | if (!proc_net_devsnmp6) | 220 | if (!proc_net_devsnmp6) |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 548d0763f4d3..830da4603697 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -76,7 +76,7 @@ static struct sock *__raw_v6_lookup(struct net *net, struct sock *sk, | |||
76 | if (inet_sk(sk)->num == num) { | 76 | if (inet_sk(sk)->num == num) { |
77 | struct ipv6_pinfo *np = inet6_sk(sk); | 77 | struct ipv6_pinfo *np = inet6_sk(sk); |
78 | 78 | ||
79 | if (sk->sk_net != net) | 79 | if (!net_eq(sock_net(sk), net)) |
80 | continue; | 80 | continue; |
81 | 81 | ||
82 | if (!ipv6_addr_any(&np->daddr) && | 82 | if (!ipv6_addr_any(&np->daddr) && |
@@ -176,7 +176,7 @@ static int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) | |||
176 | if (sk == NULL) | 176 | if (sk == NULL) |
177 | goto out; | 177 | goto out; |
178 | 178 | ||
179 | net = skb->dev->nd_net; | 179 | net = dev_net(skb->dev); |
180 | sk = __raw_v6_lookup(net, sk, nexthdr, daddr, saddr, IP6CB(skb)->iif); | 180 | sk = __raw_v6_lookup(net, sk, nexthdr, daddr, saddr, IP6CB(skb)->iif); |
181 | 181 | ||
182 | while (sk) { | 182 | while (sk) { |
@@ -280,7 +280,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
280 | if (!sk->sk_bound_dev_if) | 280 | if (!sk->sk_bound_dev_if) |
281 | goto out; | 281 | goto out; |
282 | 282 | ||
283 | dev = dev_get_by_index(sk->sk_net, sk->sk_bound_dev_if); | 283 | dev = dev_get_by_index(sock_net(sk), sk->sk_bound_dev_if); |
284 | if (!dev) { | 284 | if (!dev) { |
285 | err = -ENODEV; | 285 | err = -ENODEV; |
286 | goto out; | 286 | goto out; |
@@ -293,7 +293,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
293 | v4addr = LOOPBACK4_IPV6; | 293 | v4addr = LOOPBACK4_IPV6; |
294 | if (!(addr_type & IPV6_ADDR_MULTICAST)) { | 294 | if (!(addr_type & IPV6_ADDR_MULTICAST)) { |
295 | err = -EADDRNOTAVAIL; | 295 | err = -EADDRNOTAVAIL; |
296 | if (!ipv6_chk_addr(sk->sk_net, &addr->sin6_addr, | 296 | if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr, |
297 | dev, 0)) { | 297 | dev, 0)) { |
298 | if (dev) | 298 | if (dev) |
299 | dev_put(dev); | 299 | dev_put(dev); |
@@ -363,7 +363,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr, | |||
363 | if (sk != NULL) { | 363 | if (sk != NULL) { |
364 | saddr = &ipv6_hdr(skb)->saddr; | 364 | saddr = &ipv6_hdr(skb)->saddr; |
365 | daddr = &ipv6_hdr(skb)->daddr; | 365 | daddr = &ipv6_hdr(skb)->daddr; |
366 | net = skb->dev->nd_net; | 366 | net = dev_net(skb->dev); |
367 | 367 | ||
368 | while ((sk = __raw_v6_lookup(net, sk, nexthdr, saddr, daddr, | 368 | while ((sk = __raw_v6_lookup(net, sk, nexthdr, saddr, daddr, |
369 | IP6CB(skb)->iif))) { | 369 | IP6CB(skb)->iif))) { |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index f936d045a39d..4e1447634f36 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -600,7 +600,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb) | |||
600 | return 1; | 600 | return 1; |
601 | } | 601 | } |
602 | 602 | ||
603 | net = skb->dev->nd_net; | 603 | net = dev_net(skb->dev); |
604 | if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) | 604 | if (atomic_read(&net->ipv6.frags.mem) > net->ipv6.frags.high_thresh) |
605 | ip6_evictor(net, ip6_dst_idev(skb->dst)); | 605 | ip6_evictor(net, ip6_dst_idev(skb->dst)); |
606 | 606 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 06faa46920e1..ac4428371432 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -208,7 +208,7 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
208 | struct rt6_info *rt = (struct rt6_info *)dst; | 208 | struct rt6_info *rt = (struct rt6_info *)dst; |
209 | struct inet6_dev *idev = rt->rt6i_idev; | 209 | struct inet6_dev *idev = rt->rt6i_idev; |
210 | struct net_device *loopback_dev = | 210 | struct net_device *loopback_dev = |
211 | dev->nd_net->loopback_dev; | 211 | dev_net(dev)->loopback_dev; |
212 | 212 | ||
213 | if (dev != loopback_dev && idev != NULL && idev->dev == dev) { | 213 | if (dev != loopback_dev && idev != NULL && idev->dev == dev) { |
214 | struct inet6_dev *loopback_idev = | 214 | struct inet6_dev *loopback_idev = |
@@ -433,7 +433,7 @@ static struct rt6_info *rt6_select(struct fib6_node *fn, int oif, int strict) | |||
433 | RT6_TRACE("%s() => %p\n", | 433 | RT6_TRACE("%s() => %p\n", |
434 | __func__, match); | 434 | __func__, match); |
435 | 435 | ||
436 | net = rt0->rt6i_dev->nd_net; | 436 | net = dev_net(rt0->rt6i_dev); |
437 | return (match ? match : net->ipv6.ip6_null_entry); | 437 | return (match ? match : net->ipv6.ip6_null_entry); |
438 | } | 438 | } |
439 | 439 | ||
@@ -441,7 +441,7 @@ static struct rt6_info *rt6_select(struct fib6_node *fn, int oif, int strict) | |||
441 | int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, | 441 | int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, |
442 | struct in6_addr *gwaddr) | 442 | struct in6_addr *gwaddr) |
443 | { | 443 | { |
444 | struct net *net = dev->nd_net; | 444 | struct net *net = dev_net(dev); |
445 | struct route_info *rinfo = (struct route_info *) opt; | 445 | struct route_info *rinfo = (struct route_info *) opt; |
446 | struct in6_addr prefix_buf, *prefix; | 446 | struct in6_addr prefix_buf, *prefix; |
447 | unsigned int pref; | 447 | unsigned int pref; |
@@ -607,7 +607,7 @@ static int __ip6_ins_rt(struct rt6_info *rt, struct nl_info *info) | |||
607 | int ip6_ins_rt(struct rt6_info *rt) | 607 | int ip6_ins_rt(struct rt6_info *rt) |
608 | { | 608 | { |
609 | struct nl_info info = { | 609 | struct nl_info info = { |
610 | .nl_net = rt->rt6i_dev->nd_net, | 610 | .nl_net = dev_net(rt->rt6i_dev), |
611 | }; | 611 | }; |
612 | return __ip6_ins_rt(rt, &info); | 612 | return __ip6_ins_rt(rt, &info); |
613 | } | 613 | } |
@@ -745,7 +745,7 @@ static struct rt6_info *ip6_pol_route_input(struct net *net, struct fib6_table * | |||
745 | void ip6_route_input(struct sk_buff *skb) | 745 | void ip6_route_input(struct sk_buff *skb) |
746 | { | 746 | { |
747 | struct ipv6hdr *iph = ipv6_hdr(skb); | 747 | struct ipv6hdr *iph = ipv6_hdr(skb); |
748 | struct net *net = skb->dev->nd_net; | 748 | struct net *net = dev_net(skb->dev); |
749 | int flags = RT6_LOOKUP_F_HAS_SADDR; | 749 | int flags = RT6_LOOKUP_F_HAS_SADDR; |
750 | struct flowi fl = { | 750 | struct flowi fl = { |
751 | .iif = skb->dev->ifindex, | 751 | .iif = skb->dev->ifindex, |
@@ -928,7 +928,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, | |||
928 | { | 928 | { |
929 | struct rt6_info *rt; | 929 | struct rt6_info *rt; |
930 | struct inet6_dev *idev = in6_dev_get(dev); | 930 | struct inet6_dev *idev = in6_dev_get(dev); |
931 | struct net *net = dev->nd_net; | 931 | struct net *net = dev_net(dev); |
932 | 932 | ||
933 | if (unlikely(idev == NULL)) | 933 | if (unlikely(idev == NULL)) |
934 | return NULL; | 934 | return NULL; |
@@ -1252,7 +1252,7 @@ install_route: | |||
1252 | rt->rt6i_idev = idev; | 1252 | rt->rt6i_idev = idev; |
1253 | rt->rt6i_table = table; | 1253 | rt->rt6i_table = table; |
1254 | 1254 | ||
1255 | cfg->fc_nlinfo.nl_net = dev->nd_net; | 1255 | cfg->fc_nlinfo.nl_net = dev_net(dev); |
1256 | 1256 | ||
1257 | return __ip6_ins_rt(rt, &cfg->fc_nlinfo); | 1257 | return __ip6_ins_rt(rt, &cfg->fc_nlinfo); |
1258 | 1258 | ||
@@ -1270,7 +1270,7 @@ static int __ip6_del_rt(struct rt6_info *rt, struct nl_info *info) | |||
1270 | { | 1270 | { |
1271 | int err; | 1271 | int err; |
1272 | struct fib6_table *table; | 1272 | struct fib6_table *table; |
1273 | struct net *net = rt->rt6i_dev->nd_net; | 1273 | struct net *net = dev_net(rt->rt6i_dev); |
1274 | 1274 | ||
1275 | if (rt == net->ipv6.ip6_null_entry) | 1275 | if (rt == net->ipv6.ip6_null_entry) |
1276 | return -ENOENT; | 1276 | return -ENOENT; |
@@ -1289,7 +1289,7 @@ static int __ip6_del_rt(struct rt6_info *rt, struct nl_info *info) | |||
1289 | int ip6_del_rt(struct rt6_info *rt) | 1289 | int ip6_del_rt(struct rt6_info *rt) |
1290 | { | 1290 | { |
1291 | struct nl_info info = { | 1291 | struct nl_info info = { |
1292 | .nl_net = rt->rt6i_dev->nd_net, | 1292 | .nl_net = dev_net(rt->rt6i_dev), |
1293 | }; | 1293 | }; |
1294 | return __ip6_del_rt(rt, &info); | 1294 | return __ip6_del_rt(rt, &info); |
1295 | } | 1295 | } |
@@ -1401,7 +1401,7 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest, | |||
1401 | struct net_device *dev) | 1401 | struct net_device *dev) |
1402 | { | 1402 | { |
1403 | int flags = RT6_LOOKUP_F_HAS_SADDR; | 1403 | int flags = RT6_LOOKUP_F_HAS_SADDR; |
1404 | struct net *net = dev->nd_net; | 1404 | struct net *net = dev_net(dev); |
1405 | struct ip6rd_flowi rdfl = { | 1405 | struct ip6rd_flowi rdfl = { |
1406 | .fl = { | 1406 | .fl = { |
1407 | .oif = dev->ifindex, | 1407 | .oif = dev->ifindex, |
@@ -1428,7 +1428,7 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *src, | |||
1428 | { | 1428 | { |
1429 | struct rt6_info *rt, *nrt = NULL; | 1429 | struct rt6_info *rt, *nrt = NULL; |
1430 | struct netevent_redirect netevent; | 1430 | struct netevent_redirect netevent; |
1431 | struct net *net = neigh->dev->nd_net; | 1431 | struct net *net = dev_net(neigh->dev); |
1432 | 1432 | ||
1433 | rt = ip6_route_redirect(dest, src, saddr, neigh->dev); | 1433 | rt = ip6_route_redirect(dest, src, saddr, neigh->dev); |
1434 | 1434 | ||
@@ -1477,7 +1477,7 @@ void rt6_redirect(struct in6_addr *dest, struct in6_addr *src, | |||
1477 | nrt->rt6i_nexthop = neigh_clone(neigh); | 1477 | nrt->rt6i_nexthop = neigh_clone(neigh); |
1478 | /* Reset pmtu, it may be better */ | 1478 | /* Reset pmtu, it may be better */ |
1479 | nrt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(neigh->dev); | 1479 | nrt->u.dst.metrics[RTAX_MTU-1] = ipv6_get_mtu(neigh->dev); |
1480 | nrt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(neigh->dev->nd_net, | 1480 | nrt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(dev_net(neigh->dev), |
1481 | dst_mtu(&nrt->u.dst)); | 1481 | dst_mtu(&nrt->u.dst)); |
1482 | 1482 | ||
1483 | if (ip6_ins_rt(nrt)) | 1483 | if (ip6_ins_rt(nrt)) |
@@ -1506,7 +1506,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr, | |||
1506 | struct net_device *dev, u32 pmtu) | 1506 | struct net_device *dev, u32 pmtu) |
1507 | { | 1507 | { |
1508 | struct rt6_info *rt, *nrt; | 1508 | struct rt6_info *rt, *nrt; |
1509 | struct net *net = dev->nd_net; | 1509 | struct net *net = dev_net(dev); |
1510 | int allfrag = 0; | 1510 | int allfrag = 0; |
1511 | 1511 | ||
1512 | rt = rt6_lookup(net, daddr, saddr, dev->ifindex, 0); | 1512 | rt = rt6_lookup(net, daddr, saddr, dev->ifindex, 0); |
@@ -1583,7 +1583,7 @@ out: | |||
1583 | 1583 | ||
1584 | static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) | 1584 | static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) |
1585 | { | 1585 | { |
1586 | struct net *net = ort->rt6i_dev->nd_net; | 1586 | struct net *net = dev_net(ort->rt6i_dev); |
1587 | struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); | 1587 | struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); |
1588 | 1588 | ||
1589 | if (rt) { | 1589 | if (rt) { |
@@ -1682,7 +1682,7 @@ struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *d | |||
1682 | struct rt6_info *rt; | 1682 | struct rt6_info *rt; |
1683 | struct fib6_table *table; | 1683 | struct fib6_table *table; |
1684 | 1684 | ||
1685 | table = fib6_get_table(dev->nd_net, RT6_TABLE_DFLT); | 1685 | table = fib6_get_table(dev_net(dev), RT6_TABLE_DFLT); |
1686 | if (table == NULL) | 1686 | if (table == NULL) |
1687 | return NULL; | 1687 | return NULL; |
1688 | 1688 | ||
@@ -1713,7 +1713,7 @@ struct rt6_info *rt6_add_dflt_router(struct in6_addr *gwaddr, | |||
1713 | RTF_UP | RTF_EXPIRES | RTF_PREF(pref), | 1713 | RTF_UP | RTF_EXPIRES | RTF_PREF(pref), |
1714 | .fc_nlinfo.pid = 0, | 1714 | .fc_nlinfo.pid = 0, |
1715 | .fc_nlinfo.nlh = NULL, | 1715 | .fc_nlinfo.nlh = NULL, |
1716 | .fc_nlinfo.nl_net = dev->nd_net, | 1716 | .fc_nlinfo.nl_net = dev_net(dev), |
1717 | }; | 1717 | }; |
1718 | 1718 | ||
1719 | ipv6_addr_copy(&cfg.fc_gateway, gwaddr); | 1719 | ipv6_addr_copy(&cfg.fc_gateway, gwaddr); |
@@ -1862,7 +1862,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
1862 | const struct in6_addr *addr, | 1862 | const struct in6_addr *addr, |
1863 | int anycast) | 1863 | int anycast) |
1864 | { | 1864 | { |
1865 | struct net *net = idev->dev->nd_net; | 1865 | struct net *net = dev_net(idev->dev); |
1866 | struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); | 1866 | struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); |
1867 | 1867 | ||
1868 | if (rt == NULL) | 1868 | if (rt == NULL) |
@@ -1939,7 +1939,7 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg) | |||
1939 | { | 1939 | { |
1940 | struct rt6_mtu_change_arg *arg = (struct rt6_mtu_change_arg *) p_arg; | 1940 | struct rt6_mtu_change_arg *arg = (struct rt6_mtu_change_arg *) p_arg; |
1941 | struct inet6_dev *idev; | 1941 | struct inet6_dev *idev; |
1942 | struct net *net = arg->dev->nd_net; | 1942 | struct net *net = dev_net(arg->dev); |
1943 | 1943 | ||
1944 | /* In IPv6 pmtu discovery is not optional, | 1944 | /* In IPv6 pmtu discovery is not optional, |
1945 | so that RTAX_MTU lock cannot disable it. | 1945 | so that RTAX_MTU lock cannot disable it. |
@@ -1983,7 +1983,7 @@ void rt6_mtu_change(struct net_device *dev, unsigned mtu) | |||
1983 | .mtu = mtu, | 1983 | .mtu = mtu, |
1984 | }; | 1984 | }; |
1985 | 1985 | ||
1986 | fib6_clean_all(dev->nd_net, rt6_mtu_change_route, 0, &arg); | 1986 | fib6_clean_all(dev_net(dev), rt6_mtu_change_route, 0, &arg); |
1987 | } | 1987 | } |
1988 | 1988 | ||
1989 | static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { | 1989 | static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { |
@@ -2020,7 +2020,7 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
2020 | 2020 | ||
2021 | cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid; | 2021 | cfg->fc_nlinfo.pid = NETLINK_CB(skb).pid; |
2022 | cfg->fc_nlinfo.nlh = nlh; | 2022 | cfg->fc_nlinfo.nlh = nlh; |
2023 | cfg->fc_nlinfo.nl_net = skb->sk->sk_net; | 2023 | cfg->fc_nlinfo.nl_net = sock_net(skb->sk); |
2024 | 2024 | ||
2025 | if (tb[RTA_GATEWAY]) { | 2025 | if (tb[RTA_GATEWAY]) { |
2026 | nla_memcpy(&cfg->fc_gateway, tb[RTA_GATEWAY], 16); | 2026 | nla_memcpy(&cfg->fc_gateway, tb[RTA_GATEWAY], 16); |
@@ -2216,7 +2216,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg) | |||
2216 | 2216 | ||
2217 | static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) | 2217 | static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) |
2218 | { | 2218 | { |
2219 | struct net *net = in_skb->sk->sk_net; | 2219 | struct net *net = sock_net(in_skb->sk); |
2220 | struct nlattr *tb[RTA_MAX+1]; | 2220 | struct nlattr *tb[RTA_MAX+1]; |
2221 | struct rt6_info *rt; | 2221 | struct rt6_info *rt; |
2222 | struct sk_buff *skb; | 2222 | struct sk_buff *skb; |
@@ -2321,7 +2321,7 @@ static int ip6_route_dev_notify(struct notifier_block *this, | |||
2321 | unsigned long event, void *data) | 2321 | unsigned long event, void *data) |
2322 | { | 2322 | { |
2323 | struct net_device *dev = (struct net_device *)data; | 2323 | struct net_device *dev = (struct net_device *)data; |
2324 | struct net *net = dev->nd_net; | 2324 | struct net *net = dev_net(dev); |
2325 | 2325 | ||
2326 | if (event == NETDEV_REGISTER && (dev->flags & IFF_LOOPBACK)) { | 2326 | if (event == NETDEV_REGISTER && (dev->flags & IFF_LOOPBACK)) { |
2327 | net->ipv6.ip6_null_entry->u.dst.dev = dev; | 2327 | net->ipv6.ip6_null_entry->u.dst.dev = dev; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 8dd72966ff78..323c7e06ef43 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -321,7 +321,7 @@ static void tcp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
321 | struct tcp_sock *tp; | 321 | struct tcp_sock *tp; |
322 | __u32 seq; | 322 | __u32 seq; |
323 | 323 | ||
324 | sk = inet6_lookup(skb->dev->nd_net, &tcp_hashinfo, &hdr->daddr, | 324 | sk = inet6_lookup(dev_net(skb->dev), &tcp_hashinfo, &hdr->daddr, |
325 | th->dest, &hdr->saddr, th->source, skb->dev->ifindex); | 325 | th->dest, &hdr->saddr, th->source, skb->dev->ifindex); |
326 | 326 | ||
327 | if (sk == NULL) { | 327 | if (sk == NULL) { |
@@ -988,7 +988,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb) | |||
988 | struct tcphdr *th = tcp_hdr(skb), *t1; | 988 | struct tcphdr *th = tcp_hdr(skb), *t1; |
989 | struct sk_buff *buff; | 989 | struct sk_buff *buff; |
990 | struct flowi fl; | 990 | struct flowi fl; |
991 | struct net *net = skb->dst->dev->nd_net; | 991 | struct net *net = dev_net(skb->dst->dev); |
992 | struct sock *ctl_sk = net->ipv6.tcp_sk; | 992 | struct sock *ctl_sk = net->ipv6.tcp_sk; |
993 | unsigned int tot_len = sizeof(*th); | 993 | unsigned int tot_len = sizeof(*th); |
994 | #ifdef CONFIG_TCP_MD5SIG | 994 | #ifdef CONFIG_TCP_MD5SIG |
@@ -1093,7 +1093,7 @@ static void tcp_v6_send_ack(struct tcp_timewait_sock *tw, | |||
1093 | struct tcphdr *th = tcp_hdr(skb), *t1; | 1093 | struct tcphdr *th = tcp_hdr(skb), *t1; |
1094 | struct sk_buff *buff; | 1094 | struct sk_buff *buff; |
1095 | struct flowi fl; | 1095 | struct flowi fl; |
1096 | struct net *net = skb->dev->nd_net; | 1096 | struct net *net = dev_net(skb->dev); |
1097 | struct sock *ctl_sk = net->ipv6.tcp_sk; | 1097 | struct sock *ctl_sk = net->ipv6.tcp_sk; |
1098 | unsigned int tot_len = sizeof(struct tcphdr); | 1098 | unsigned int tot_len = sizeof(struct tcphdr); |
1099 | __be32 *topt; | 1099 | __be32 *topt; |
@@ -1218,7 +1218,7 @@ static struct sock *tcp_v6_hnd_req(struct sock *sk,struct sk_buff *skb) | |||
1218 | if (req) | 1218 | if (req) |
1219 | return tcp_check_req(sk, skb, req, prev); | 1219 | return tcp_check_req(sk, skb, req, prev); |
1220 | 1220 | ||
1221 | nsk = __inet6_lookup_established(sk->sk_net, &tcp_hashinfo, | 1221 | nsk = __inet6_lookup_established(sock_net(sk), &tcp_hashinfo, |
1222 | &ipv6_hdr(skb)->saddr, th->source, | 1222 | &ipv6_hdr(skb)->saddr, th->source, |
1223 | &ipv6_hdr(skb)->daddr, ntohs(th->dest), inet6_iif(skb)); | 1223 | &ipv6_hdr(skb)->daddr, ntohs(th->dest), inet6_iif(skb)); |
1224 | 1224 | ||
@@ -1739,7 +1739,7 @@ static int tcp_v6_rcv(struct sk_buff *skb) | |||
1739 | TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb)); | 1739 | TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb)); |
1740 | TCP_SKB_CB(skb)->sacked = 0; | 1740 | TCP_SKB_CB(skb)->sacked = 0; |
1741 | 1741 | ||
1742 | sk = __inet6_lookup(skb->dev->nd_net, &tcp_hashinfo, | 1742 | sk = __inet6_lookup(dev_net(skb->dev), &tcp_hashinfo, |
1743 | &ipv6_hdr(skb)->saddr, th->source, | 1743 | &ipv6_hdr(skb)->saddr, th->source, |
1744 | &ipv6_hdr(skb)->daddr, ntohs(th->dest), | 1744 | &ipv6_hdr(skb)->daddr, ntohs(th->dest), |
1745 | inet6_iif(skb)); | 1745 | inet6_iif(skb)); |
@@ -1822,7 +1822,7 @@ do_time_wait: | |||
1822 | { | 1822 | { |
1823 | struct sock *sk2; | 1823 | struct sock *sk2; |
1824 | 1824 | ||
1825 | sk2 = inet6_lookup_listener(skb->dev->nd_net, &tcp_hashinfo, | 1825 | sk2 = inet6_lookup_listener(dev_net(skb->dev), &tcp_hashinfo, |
1826 | &ipv6_hdr(skb)->daddr, | 1826 | &ipv6_hdr(skb)->daddr, |
1827 | ntohs(th->dest), inet6_iif(skb)); | 1827 | ntohs(th->dest), inet6_iif(skb)); |
1828 | if (sk2 != NULL) { | 1828 | if (sk2 != NULL) { |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 593d3efadaf9..aacbc82ecf0f 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -70,7 +70,7 @@ static struct sock *__udp6_lib_lookup(struct net *net, | |||
70 | sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { | 70 | sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) { |
71 | struct inet_sock *inet = inet_sk(sk); | 71 | struct inet_sock *inet = inet_sk(sk); |
72 | 72 | ||
73 | if (sk->sk_net == net && sk->sk_hash == hnum && | 73 | if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && |
74 | sk->sk_family == PF_INET6) { | 74 | sk->sk_family == PF_INET6) { |
75 | struct ipv6_pinfo *np = inet6_sk(sk); | 75 | struct ipv6_pinfo *np = inet6_sk(sk); |
76 | int score = 0; | 76 | int score = 0; |
@@ -235,7 +235,7 @@ void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
235 | struct sock *sk; | 235 | struct sock *sk; |
236 | int err; | 236 | int err; |
237 | 237 | ||
238 | sk = __udp6_lib_lookup(skb->dev->nd_net, daddr, uh->dest, | 238 | sk = __udp6_lib_lookup(dev_net(skb->dev), daddr, uh->dest, |
239 | saddr, uh->source, inet6_iif(skb), udptable); | 239 | saddr, uh->source, inet6_iif(skb), udptable); |
240 | if (sk == NULL) | 240 | if (sk == NULL) |
241 | return; | 241 | return; |
@@ -323,7 +323,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk, | |||
323 | sk_for_each_from(s, node) { | 323 | sk_for_each_from(s, node) { |
324 | struct inet_sock *inet = inet_sk(s); | 324 | struct inet_sock *inet = inet_sk(s); |
325 | 325 | ||
326 | if (s->sk_net != sk->sk_net) | 326 | if (sock_net(s) != sock_net(sk)) |
327 | continue; | 327 | continue; |
328 | 328 | ||
329 | if (s->sk_hash == num && s->sk_family == PF_INET6) { | 329 | if (s->sk_hash == num && s->sk_family == PF_INET6) { |
@@ -483,7 +483,7 @@ int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], | |||
483 | * check socket cache ... must talk to Alan about his plans | 483 | * check socket cache ... must talk to Alan about his plans |
484 | * for sock caches... i'll skip this for now. | 484 | * for sock caches... i'll skip this for now. |
485 | */ | 485 | */ |
486 | sk = __udp6_lib_lookup(skb->dev->nd_net, saddr, uh->source, | 486 | sk = __udp6_lib_lookup(dev_net(skb->dev), saddr, uh->source, |
487 | daddr, uh->dest, inet6_iif(skb), udptable); | 487 | daddr, uh->dest, inet6_iif(skb), udptable); |
488 | 488 | ||
489 | if (sk == NULL) { | 489 | if (sk == NULL) { |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index d92d1fceb8cf..8f1e0543b3c4 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -247,7 +247,7 @@ static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
247 | xdst = (struct xfrm_dst *)dst; | 247 | xdst = (struct xfrm_dst *)dst; |
248 | if (xdst->u.rt6.rt6i_idev->dev == dev) { | 248 | if (xdst->u.rt6.rt6i_idev->dev == dev) { |
249 | struct inet6_dev *loopback_idev = | 249 | struct inet6_dev *loopback_idev = |
250 | in6_dev_get(dev->nd_net->loopback_dev); | 250 | in6_dev_get(dev_net(dev)->loopback_dev); |
251 | BUG_ON(!loopback_idev); | 251 | BUG_ON(!loopback_idev); |
252 | 252 | ||
253 | do { | 253 | do { |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index c76a9523091b..81ae8735f5e3 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -335,7 +335,7 @@ static int ipxitf_device_event(struct notifier_block *notifier, | |||
335 | struct net_device *dev = ptr; | 335 | struct net_device *dev = ptr; |
336 | struct ipx_interface *i, *tmp; | 336 | struct ipx_interface *i, *tmp; |
337 | 337 | ||
338 | if (dev->nd_net != &init_net) | 338 | if (dev_net(dev) != &init_net) |
339 | return NOTIFY_DONE; | 339 | return NOTIFY_DONE; |
340 | 340 | ||
341 | if (event != NETDEV_DOWN && event != NETDEV_UP) | 341 | if (event != NETDEV_DOWN && event != NETDEV_UP) |
@@ -1636,7 +1636,7 @@ static int ipx_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty | |||
1636 | u16 ipx_pktsize; | 1636 | u16 ipx_pktsize; |
1637 | int rc = 0; | 1637 | int rc = 0; |
1638 | 1638 | ||
1639 | if (dev->nd_net != &init_net) | 1639 | if (dev_net(dev) != &init_net) |
1640 | goto drop; | 1640 | goto drop; |
1641 | 1641 | ||
1642 | /* Not ours */ | 1642 | /* Not ours */ |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 6f21a53cb3e7..ae54b20d0470 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -837,7 +837,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
837 | 837 | ||
838 | IRDA_DEBUG(2, "%s()\n", __func__); | 838 | IRDA_DEBUG(2, "%s()\n", __func__); |
839 | 839 | ||
840 | err = irda_create(sk->sk_net, newsock, sk->sk_protocol); | 840 | err = irda_create(sock_net(sk), newsock, sk->sk_protocol); |
841 | if (err) | 841 | if (err) |
842 | return err; | 842 | return err; |
843 | 843 | ||
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index a38b231c8689..90894534f3cc 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c | |||
@@ -1326,7 +1326,7 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1326 | int command; | 1326 | int command; |
1327 | __u8 control; | 1327 | __u8 control; |
1328 | 1328 | ||
1329 | if (dev->nd_net != &init_net) | 1329 | if (dev_net(dev) != &init_net) |
1330 | goto out; | 1330 | goto out; |
1331 | 1331 | ||
1332 | /* FIXME: should we get our own field? */ | 1332 | /* FIXME: should we get our own field? */ |
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index 5ebfd93ff5e7..5c6d89c6d51d 100644 --- a/net/llc/llc_conn.c +++ b/net/llc/llc_conn.c | |||
@@ -700,7 +700,7 @@ static struct sock *llc_create_incoming_sock(struct sock *sk, | |||
700 | struct llc_addr *saddr, | 700 | struct llc_addr *saddr, |
701 | struct llc_addr *daddr) | 701 | struct llc_addr *daddr) |
702 | { | 702 | { |
703 | struct sock *newsk = llc_sk_alloc(sk->sk_net, sk->sk_family, GFP_ATOMIC, | 703 | struct sock *newsk = llc_sk_alloc(sock_net(sk), sk->sk_family, GFP_ATOMIC, |
704 | sk->sk_prot); | 704 | sk->sk_prot); |
705 | struct llc_sock *newllc, *llc = llc_sk(sk); | 705 | struct llc_sock *newllc, *llc = llc_sk(sk); |
706 | 706 | ||
diff --git a/net/llc/llc_input.c b/net/llc/llc_input.c index b9143d2a04e1..a69c5c427fe3 100644 --- a/net/llc/llc_input.c +++ b/net/llc/llc_input.c | |||
@@ -146,7 +146,7 @@ int llc_rcv(struct sk_buff *skb, struct net_device *dev, | |||
146 | int (*rcv)(struct sk_buff *, struct net_device *, | 146 | int (*rcv)(struct sk_buff *, struct net_device *, |
147 | struct packet_type *, struct net_device *); | 147 | struct packet_type *, struct net_device *); |
148 | 148 | ||
149 | if (dev->nd_net != &init_net) | 149 | if (dev_net(dev) != &init_net) |
150 | goto drop; | 150 | goto drop; |
151 | 151 | ||
152 | /* | 152 | /* |
diff --git a/net/netfilter/core.c b/net/netfilter/core.c index ec05684c56d7..292fa28146fb 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c | |||
@@ -168,7 +168,7 @@ int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, | |||
168 | #ifdef CONFIG_NET_NS | 168 | #ifdef CONFIG_NET_NS |
169 | struct net *net; | 169 | struct net *net; |
170 | 170 | ||
171 | net = indev == NULL ? outdev->nd_net : indev->nd_net; | 171 | net = indev == NULL ? dev_net(outdev) : dev_net(indev); |
172 | if (net != &init_net) | 172 | if (net != &init_net) |
173 | return 1; | 173 | return 1; |
174 | #endif | 174 | #endif |
diff --git a/net/netfilter/nf_sockopt.c b/net/netfilter/nf_sockopt.c index 3dd4b3c76d81..69d699f95f4c 100644 --- a/net/netfilter/nf_sockopt.c +++ b/net/netfilter/nf_sockopt.c | |||
@@ -65,7 +65,7 @@ static struct nf_sockopt_ops *nf_sockopt_find(struct sock *sk, int pf, | |||
65 | { | 65 | { |
66 | struct nf_sockopt_ops *ops; | 66 | struct nf_sockopt_ops *ops; |
67 | 67 | ||
68 | if (sk->sk_net != &init_net) | 68 | if (sock_net(sk) != &init_net) |
69 | return ERR_PTR(-ENOPROTOOPT); | 69 | return ERR_PTR(-ENOPROTOOPT); |
70 | 70 | ||
71 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) | 71 | if (mutex_lock_interruptible(&nf_sockopt_mutex) != 0) |
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c index 012cb6910820..81fb048add88 100644 --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c | |||
@@ -557,7 +557,7 @@ nfqnl_rcv_dev_event(struct notifier_block *this, | |||
557 | { | 557 | { |
558 | struct net_device *dev = ptr; | 558 | struct net_device *dev = ptr; |
559 | 559 | ||
560 | if (dev->nd_net != &init_net) | 560 | if (dev_net(dev) != &init_net) |
561 | return NOTIFY_DONE; | 561 | return NOTIFY_DONE; |
562 | 562 | ||
563 | /* Drop any packets associated with the downed device */ | 563 | /* Drop any packets associated with the downed device */ |
diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index a6792089fcf9..0bd95680a494 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c | |||
@@ -727,7 +727,7 @@ struct xt_names_priv { | |||
727 | static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos) | 727 | static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos) |
728 | { | 728 | { |
729 | struct xt_names_priv *priv = seq->private; | 729 | struct xt_names_priv *priv = seq->private; |
730 | struct net *net = priv->p.net; | 730 | struct net *net = seq_file_net(seq); |
731 | int af = priv->af; | 731 | int af = priv->af; |
732 | 732 | ||
733 | mutex_lock(&xt[af].mutex); | 733 | mutex_lock(&xt[af].mutex); |
@@ -737,7 +737,7 @@ static void *xt_table_seq_start(struct seq_file *seq, loff_t *pos) | |||
737 | static void *xt_table_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 737 | static void *xt_table_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
738 | { | 738 | { |
739 | struct xt_names_priv *priv = seq->private; | 739 | struct xt_names_priv *priv = seq->private; |
740 | struct net *net = priv->p.net; | 740 | struct net *net = seq_file_net(seq); |
741 | int af = priv->af; | 741 | int af = priv->af; |
742 | 742 | ||
743 | return seq_list_next(v, &net->xt.tables[af], pos); | 743 | return seq_list_next(v, &net->xt.tables[af], pos); |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 4478f2f6079d..a547c6320eb3 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -954,7 +954,7 @@ static int netlbl_unlhsh_netdev_handler(struct notifier_block *this, | |||
954 | struct net_device *dev = ptr; | 954 | struct net_device *dev = ptr; |
955 | struct netlbl_unlhsh_iface *iface = NULL; | 955 | struct netlbl_unlhsh_iface *iface = NULL; |
956 | 956 | ||
957 | if (dev->nd_net != &init_net) | 957 | if (dev_net(dev) != &init_net) |
958 | return NOTIFY_DONE; | 958 | return NOTIFY_DONE; |
959 | 959 | ||
960 | /* XXX - should this be a check for NETDEV_DOWN or _UNREGISTER? */ | 960 | /* XXX - should this be a check for NETDEV_DOWN or _UNREGISTER? */ |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 86bd8660a8f2..36f75d873898 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -228,7 +228,7 @@ static inline struct sock *netlink_lookup(struct net *net, int protocol, | |||
228 | read_lock(&nl_table_lock); | 228 | read_lock(&nl_table_lock); |
229 | head = nl_pid_hashfn(hash, pid); | 229 | head = nl_pid_hashfn(hash, pid); |
230 | sk_for_each(sk, node, head) { | 230 | sk_for_each(sk, node, head) { |
231 | if ((sk->sk_net == net) && (nlk_sk(sk)->pid == pid)) { | 231 | if (net_eq(sock_net(sk), net) && (nlk_sk(sk)->pid == pid)) { |
232 | sock_hold(sk); | 232 | sock_hold(sk); |
233 | goto found; | 233 | goto found; |
234 | } | 234 | } |
@@ -348,7 +348,7 @@ static int netlink_insert(struct sock *sk, struct net *net, u32 pid) | |||
348 | head = nl_pid_hashfn(hash, pid); | 348 | head = nl_pid_hashfn(hash, pid); |
349 | len = 0; | 349 | len = 0; |
350 | sk_for_each(osk, node, head) { | 350 | sk_for_each(osk, node, head) { |
351 | if ((osk->sk_net == net) && (nlk_sk(osk)->pid == pid)) | 351 | if (net_eq(sock_net(osk), net) && (nlk_sk(osk)->pid == pid)) |
352 | break; | 352 | break; |
353 | len++; | 353 | len++; |
354 | } | 354 | } |
@@ -486,7 +486,7 @@ static int netlink_release(struct socket *sock) | |||
486 | 486 | ||
487 | if (nlk->pid && !nlk->subscriptions) { | 487 | if (nlk->pid && !nlk->subscriptions) { |
488 | struct netlink_notify n = { | 488 | struct netlink_notify n = { |
489 | .net = sk->sk_net, | 489 | .net = sock_net(sk), |
490 | .protocol = sk->sk_protocol, | 490 | .protocol = sk->sk_protocol, |
491 | .pid = nlk->pid, | 491 | .pid = nlk->pid, |
492 | }; | 492 | }; |
@@ -518,7 +518,7 @@ static int netlink_release(struct socket *sock) | |||
518 | static int netlink_autobind(struct socket *sock) | 518 | static int netlink_autobind(struct socket *sock) |
519 | { | 519 | { |
520 | struct sock *sk = sock->sk; | 520 | struct sock *sk = sock->sk; |
521 | struct net *net = sk->sk_net; | 521 | struct net *net = sock_net(sk); |
522 | struct nl_pid_hash *hash = &nl_table[sk->sk_protocol].hash; | 522 | struct nl_pid_hash *hash = &nl_table[sk->sk_protocol].hash; |
523 | struct hlist_head *head; | 523 | struct hlist_head *head; |
524 | struct sock *osk; | 524 | struct sock *osk; |
@@ -532,7 +532,7 @@ retry: | |||
532 | netlink_table_grab(); | 532 | netlink_table_grab(); |
533 | head = nl_pid_hashfn(hash, pid); | 533 | head = nl_pid_hashfn(hash, pid); |
534 | sk_for_each(osk, node, head) { | 534 | sk_for_each(osk, node, head) { |
535 | if ((osk->sk_net != net)) | 535 | if (!net_eq(sock_net(osk), net)) |
536 | continue; | 536 | continue; |
537 | if (nlk_sk(osk)->pid == pid) { | 537 | if (nlk_sk(osk)->pid == pid) { |
538 | /* Bind collision, search negative pid values. */ | 538 | /* Bind collision, search negative pid values. */ |
@@ -611,7 +611,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, | |||
611 | int addr_len) | 611 | int addr_len) |
612 | { | 612 | { |
613 | struct sock *sk = sock->sk; | 613 | struct sock *sk = sock->sk; |
614 | struct net *net = sk->sk_net; | 614 | struct net *net = sock_net(sk); |
615 | struct netlink_sock *nlk = nlk_sk(sk); | 615 | struct netlink_sock *nlk = nlk_sk(sk); |
616 | struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; | 616 | struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; |
617 | int err; | 617 | int err; |
@@ -720,7 +720,7 @@ static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid) | |||
720 | struct sock *sock; | 720 | struct sock *sock; |
721 | struct netlink_sock *nlk; | 721 | struct netlink_sock *nlk; |
722 | 722 | ||
723 | sock = netlink_lookup(ssk->sk_net, ssk->sk_protocol, pid); | 723 | sock = netlink_lookup(sock_net(ssk), ssk->sk_protocol, pid); |
724 | if (!sock) | 724 | if (!sock) |
725 | return ERR_PTR(-ECONNREFUSED); | 725 | return ERR_PTR(-ECONNREFUSED); |
726 | 726 | ||
@@ -962,7 +962,7 @@ static inline int do_one_broadcast(struct sock *sk, | |||
962 | !test_bit(p->group - 1, nlk->groups)) | 962 | !test_bit(p->group - 1, nlk->groups)) |
963 | goto out; | 963 | goto out; |
964 | 964 | ||
965 | if ((sk->sk_net != p->net)) | 965 | if (!net_eq(sock_net(sk), p->net)) |
966 | goto out; | 966 | goto out; |
967 | 967 | ||
968 | if (p->failure) { | 968 | if (p->failure) { |
@@ -1006,7 +1006,7 @@ out: | |||
1006 | int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid, | 1006 | int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid, |
1007 | u32 group, gfp_t allocation) | 1007 | u32 group, gfp_t allocation) |
1008 | { | 1008 | { |
1009 | struct net *net = ssk->sk_net; | 1009 | struct net *net = sock_net(ssk); |
1010 | struct netlink_broadcast_data info; | 1010 | struct netlink_broadcast_data info; |
1011 | struct hlist_node *node; | 1011 | struct hlist_node *node; |
1012 | struct sock *sk; | 1012 | struct sock *sk; |
@@ -1064,7 +1064,7 @@ static inline int do_one_set_err(struct sock *sk, | |||
1064 | if (sk == p->exclude_sk) | 1064 | if (sk == p->exclude_sk) |
1065 | goto out; | 1065 | goto out; |
1066 | 1066 | ||
1067 | if (sk->sk_net != p->exclude_sk->sk_net) | 1067 | if (sock_net(sk) != sock_net(p->exclude_sk)) |
1068 | goto out; | 1068 | goto out; |
1069 | 1069 | ||
1070 | if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups || | 1070 | if (nlk->pid == p->pid || p->group - 1 >= nlk->ngroups || |
@@ -1601,7 +1601,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | |||
1601 | atomic_inc(&skb->users); | 1601 | atomic_inc(&skb->users); |
1602 | cb->skb = skb; | 1602 | cb->skb = skb; |
1603 | 1603 | ||
1604 | sk = netlink_lookup(ssk->sk_net, ssk->sk_protocol, NETLINK_CB(skb).pid); | 1604 | sk = netlink_lookup(sock_net(ssk), ssk->sk_protocol, NETLINK_CB(skb).pid); |
1605 | if (sk == NULL) { | 1605 | if (sk == NULL) { |
1606 | netlink_destroy_callback(cb); | 1606 | netlink_destroy_callback(cb); |
1607 | return -ECONNREFUSED; | 1607 | return -ECONNREFUSED; |
@@ -1643,7 +1643,7 @@ void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err) | |||
1643 | if (!skb) { | 1643 | if (!skb) { |
1644 | struct sock *sk; | 1644 | struct sock *sk; |
1645 | 1645 | ||
1646 | sk = netlink_lookup(in_skb->sk->sk_net, | 1646 | sk = netlink_lookup(sock_net(in_skb->sk), |
1647 | in_skb->sk->sk_protocol, | 1647 | in_skb->sk->sk_protocol, |
1648 | NETLINK_CB(in_skb).pid); | 1648 | NETLINK_CB(in_skb).pid); |
1649 | if (sk) { | 1649 | if (sk) { |
@@ -1758,7 +1758,7 @@ static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos) | |||
1758 | 1758 | ||
1759 | for (j = 0; j <= hash->mask; j++) { | 1759 | for (j = 0; j <= hash->mask; j++) { |
1760 | sk_for_each(s, node, &hash->table[j]) { | 1760 | sk_for_each(s, node, &hash->table[j]) { |
1761 | if (iter->p.net != s->sk_net) | 1761 | if (sock_net(s) != seq_file_net(seq)) |
1762 | continue; | 1762 | continue; |
1763 | if (off == pos) { | 1763 | if (off == pos) { |
1764 | iter->link = i; | 1764 | iter->link = i; |
@@ -1794,7 +1794,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1794 | s = v; | 1794 | s = v; |
1795 | do { | 1795 | do { |
1796 | s = sk_next(s); | 1796 | s = sk_next(s); |
1797 | } while (s && (iter->p.net != s->sk_net)); | 1797 | } while (s && sock_net(s) != seq_file_net(seq)); |
1798 | if (s) | 1798 | if (s) |
1799 | return s; | 1799 | return s; |
1800 | 1800 | ||
@@ -1806,7 +1806,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1806 | 1806 | ||
1807 | for (; j <= hash->mask; j++) { | 1807 | for (; j <= hash->mask; j++) { |
1808 | s = sk_head(&hash->table[j]); | 1808 | s = sk_head(&hash->table[j]); |
1809 | while (s && (iter->p.net != s->sk_net)) | 1809 | while (s && sock_net(s) != seq_file_net(seq)) |
1810 | s = sk_next(s); | 1810 | s = sk_next(s); |
1811 | if (s) { | 1811 | if (s) { |
1812 | iter->link = i; | 1812 | iter->link = i; |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 972250c974f1..4bae8b998cab 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -106,7 +106,7 @@ static int nr_device_event(struct notifier_block *this, unsigned long event, voi | |||
106 | { | 106 | { |
107 | struct net_device *dev = (struct net_device *)ptr; | 107 | struct net_device *dev = (struct net_device *)ptr; |
108 | 108 | ||
109 | if (dev->nd_net != &init_net) | 109 | if (dev_net(dev) != &init_net) |
110 | return NOTIFY_DONE; | 110 | return NOTIFY_DONE; |
111 | 111 | ||
112 | if (event != NETDEV_DOWN) | 112 | if (event != NETDEV_DOWN) |
@@ -466,7 +466,7 @@ static struct sock *nr_make_new(struct sock *osk) | |||
466 | if (osk->sk_type != SOCK_SEQPACKET) | 466 | if (osk->sk_type != SOCK_SEQPACKET) |
467 | return NULL; | 467 | return NULL; |
468 | 468 | ||
469 | sk = sk_alloc(osk->sk_net, PF_NETROM, GFP_ATOMIC, osk->sk_prot); | 469 | sk = sk_alloc(sock_net(osk), PF_NETROM, GFP_ATOMIC, osk->sk_prot); |
470 | if (sk == NULL) | 470 | if (sk == NULL) |
471 | return NULL; | 471 | return NULL; |
472 | 472 | ||
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index a56ed2120e07..25070240d4ae 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -263,7 +263,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct | |||
263 | if (skb->pkt_type == PACKET_LOOPBACK) | 263 | if (skb->pkt_type == PACKET_LOOPBACK) |
264 | goto out; | 264 | goto out; |
265 | 265 | ||
266 | if (dev->nd_net != sk->sk_net) | 266 | if (dev_net(dev) != sock_net(sk)) |
267 | goto out; | 267 | goto out; |
268 | 268 | ||
269 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 269 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) |
@@ -337,7 +337,7 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, | |||
337 | */ | 337 | */ |
338 | 338 | ||
339 | saddr->spkt_device[13] = 0; | 339 | saddr->spkt_device[13] = 0; |
340 | dev = dev_get_by_name(sk->sk_net, saddr->spkt_device); | 340 | dev = dev_get_by_name(sock_net(sk), saddr->spkt_device); |
341 | err = -ENODEV; | 341 | err = -ENODEV; |
342 | if (dev == NULL) | 342 | if (dev == NULL) |
343 | goto out_unlock; | 343 | goto out_unlock; |
@@ -451,7 +451,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
451 | sk = pt->af_packet_priv; | 451 | sk = pt->af_packet_priv; |
452 | po = pkt_sk(sk); | 452 | po = pkt_sk(sk); |
453 | 453 | ||
454 | if (dev->nd_net != sk->sk_net) | 454 | if (dev_net(dev) != sock_net(sk)) |
455 | goto drop; | 455 | goto drop; |
456 | 456 | ||
457 | skb->dev = dev; | 457 | skb->dev = dev; |
@@ -568,7 +568,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
568 | sk = pt->af_packet_priv; | 568 | sk = pt->af_packet_priv; |
569 | po = pkt_sk(sk); | 569 | po = pkt_sk(sk); |
570 | 570 | ||
571 | if (dev->nd_net != sk->sk_net) | 571 | if (dev_net(dev) != sock_net(sk)) |
572 | goto drop; | 572 | goto drop; |
573 | 573 | ||
574 | if (dev->header_ops) { | 574 | if (dev->header_ops) { |
@@ -728,7 +728,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
728 | } | 728 | } |
729 | 729 | ||
730 | 730 | ||
731 | dev = dev_get_by_index(sk->sk_net, ifindex); | 731 | dev = dev_get_by_index(sock_net(sk), ifindex); |
732 | err = -ENXIO; | 732 | err = -ENXIO; |
733 | if (dev == NULL) | 733 | if (dev == NULL) |
734 | goto out_unlock; | 734 | goto out_unlock; |
@@ -800,7 +800,7 @@ static int packet_release(struct socket *sock) | |||
800 | if (!sk) | 800 | if (!sk) |
801 | return 0; | 801 | return 0; |
802 | 802 | ||
803 | net = sk->sk_net; | 803 | net = sock_net(sk); |
804 | po = pkt_sk(sk); | 804 | po = pkt_sk(sk); |
805 | 805 | ||
806 | write_lock_bh(&net->packet.sklist_lock); | 806 | write_lock_bh(&net->packet.sklist_lock); |
@@ -914,7 +914,7 @@ static int packet_bind_spkt(struct socket *sock, struct sockaddr *uaddr, int add | |||
914 | return -EINVAL; | 914 | return -EINVAL; |
915 | strlcpy(name,uaddr->sa_data,sizeof(name)); | 915 | strlcpy(name,uaddr->sa_data,sizeof(name)); |
916 | 916 | ||
917 | dev = dev_get_by_name(sk->sk_net, name); | 917 | dev = dev_get_by_name(sock_net(sk), name); |
918 | if (dev) { | 918 | if (dev) { |
919 | err = packet_do_bind(sk, dev, pkt_sk(sk)->num); | 919 | err = packet_do_bind(sk, dev, pkt_sk(sk)->num); |
920 | dev_put(dev); | 920 | dev_put(dev); |
@@ -941,7 +941,7 @@ static int packet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len | |||
941 | 941 | ||
942 | if (sll->sll_ifindex) { | 942 | if (sll->sll_ifindex) { |
943 | err = -ENODEV; | 943 | err = -ENODEV; |
944 | dev = dev_get_by_index(sk->sk_net, sll->sll_ifindex); | 944 | dev = dev_get_by_index(sock_net(sk), sll->sll_ifindex); |
945 | if (dev == NULL) | 945 | if (dev == NULL) |
946 | goto out; | 946 | goto out; |
947 | } | 947 | } |
@@ -1135,7 +1135,7 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, | |||
1135 | return -EOPNOTSUPP; | 1135 | return -EOPNOTSUPP; |
1136 | 1136 | ||
1137 | uaddr->sa_family = AF_PACKET; | 1137 | uaddr->sa_family = AF_PACKET; |
1138 | dev = dev_get_by_index(sk->sk_net, pkt_sk(sk)->ifindex); | 1138 | dev = dev_get_by_index(sock_net(sk), pkt_sk(sk)->ifindex); |
1139 | if (dev) { | 1139 | if (dev) { |
1140 | strlcpy(uaddr->sa_data, dev->name, 15); | 1140 | strlcpy(uaddr->sa_data, dev->name, 15); |
1141 | dev_put(dev); | 1141 | dev_put(dev); |
@@ -1160,7 +1160,7 @@ static int packet_getname(struct socket *sock, struct sockaddr *uaddr, | |||
1160 | sll->sll_family = AF_PACKET; | 1160 | sll->sll_family = AF_PACKET; |
1161 | sll->sll_ifindex = po->ifindex; | 1161 | sll->sll_ifindex = po->ifindex; |
1162 | sll->sll_protocol = po->num; | 1162 | sll->sll_protocol = po->num; |
1163 | dev = dev_get_by_index(sk->sk_net, po->ifindex); | 1163 | dev = dev_get_by_index(sock_net(sk), po->ifindex); |
1164 | if (dev) { | 1164 | if (dev) { |
1165 | sll->sll_hatype = dev->type; | 1165 | sll->sll_hatype = dev->type; |
1166 | sll->sll_halen = dev->addr_len; | 1166 | sll->sll_halen = dev->addr_len; |
@@ -1212,7 +1212,7 @@ static int packet_mc_add(struct sock *sk, struct packet_mreq_max *mreq) | |||
1212 | rtnl_lock(); | 1212 | rtnl_lock(); |
1213 | 1213 | ||
1214 | err = -ENODEV; | 1214 | err = -ENODEV; |
1215 | dev = __dev_get_by_index(sk->sk_net, mreq->mr_ifindex); | 1215 | dev = __dev_get_by_index(sock_net(sk), mreq->mr_ifindex); |
1216 | if (!dev) | 1216 | if (!dev) |
1217 | goto done; | 1217 | goto done; |
1218 | 1218 | ||
@@ -1266,7 +1266,7 @@ static int packet_mc_drop(struct sock *sk, struct packet_mreq_max *mreq) | |||
1266 | if (--ml->count == 0) { | 1266 | if (--ml->count == 0) { |
1267 | struct net_device *dev; | 1267 | struct net_device *dev; |
1268 | *mlp = ml->next; | 1268 | *mlp = ml->next; |
1269 | dev = dev_get_by_index(sk->sk_net, ml->ifindex); | 1269 | dev = dev_get_by_index(sock_net(sk), ml->ifindex); |
1270 | if (dev) { | 1270 | if (dev) { |
1271 | packet_dev_mc(dev, ml, -1); | 1271 | packet_dev_mc(dev, ml, -1); |
1272 | dev_put(dev); | 1272 | dev_put(dev); |
@@ -1294,7 +1294,7 @@ static void packet_flush_mclist(struct sock *sk) | |||
1294 | struct net_device *dev; | 1294 | struct net_device *dev; |
1295 | 1295 | ||
1296 | po->mclist = ml->next; | 1296 | po->mclist = ml->next; |
1297 | if ((dev = dev_get_by_index(sk->sk_net, ml->ifindex)) != NULL) { | 1297 | if ((dev = dev_get_by_index(sock_net(sk), ml->ifindex)) != NULL) { |
1298 | packet_dev_mc(dev, ml, -1); | 1298 | packet_dev_mc(dev, ml, -1); |
1299 | dev_put(dev); | 1299 | dev_put(dev); |
1300 | } | 1300 | } |
@@ -1450,7 +1450,7 @@ static int packet_notifier(struct notifier_block *this, unsigned long msg, void | |||
1450 | struct sock *sk; | 1450 | struct sock *sk; |
1451 | struct hlist_node *node; | 1451 | struct hlist_node *node; |
1452 | struct net_device *dev = data; | 1452 | struct net_device *dev = data; |
1453 | struct net *net = dev->nd_net; | 1453 | struct net *net = dev_net(dev); |
1454 | 1454 | ||
1455 | read_lock(&net->packet.sklist_lock); | 1455 | read_lock(&net->packet.sklist_lock); |
1456 | sk_for_each(sk, node, &net->packet.sklist) { | 1456 | sk_for_each(sk, node, &net->packet.sklist) { |
@@ -1540,7 +1540,7 @@ static int packet_ioctl(struct socket *sock, unsigned int cmd, | |||
1540 | case SIOCGIFDSTADDR: | 1540 | case SIOCGIFDSTADDR: |
1541 | case SIOCSIFDSTADDR: | 1541 | case SIOCSIFDSTADDR: |
1542 | case SIOCSIFFLAGS: | 1542 | case SIOCSIFFLAGS: |
1543 | if (sk->sk_net != &init_net) | 1543 | if (sock_net(sk) != &init_net) |
1544 | return -ENOIOCTLCMD; | 1544 | return -ENOIOCTLCMD; |
1545 | return inet_dgram_ops.ioctl(sock, cmd, arg); | 1545 | return inet_dgram_ops.ioctl(sock, cmd, arg); |
1546 | #endif | 1546 | #endif |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 4a31a81059ab..92d85c38e4d2 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -197,7 +197,7 @@ static int rose_device_event(struct notifier_block *this, unsigned long event, | |||
197 | { | 197 | { |
198 | struct net_device *dev = (struct net_device *)ptr; | 198 | struct net_device *dev = (struct net_device *)ptr; |
199 | 199 | ||
200 | if (dev->nd_net != &init_net) | 200 | if (dev_net(dev) != &init_net) |
201 | return NOTIFY_DONE; | 201 | return NOTIFY_DONE; |
202 | 202 | ||
203 | if (event != NETDEV_DOWN) | 203 | if (event != NETDEV_DOWN) |
@@ -551,7 +551,7 @@ static struct sock *rose_make_new(struct sock *osk) | |||
551 | if (osk->sk_type != SOCK_SEQPACKET) | 551 | if (osk->sk_type != SOCK_SEQPACKET) |
552 | return NULL; | 552 | return NULL; |
553 | 553 | ||
554 | sk = sk_alloc(osk->sk_net, PF_ROSE, GFP_ATOMIC, &rose_proto); | 554 | sk = sk_alloc(sock_net(osk), PF_ROSE, GFP_ATOMIC, &rose_proto); |
555 | if (sk == NULL) | 555 | if (sk == NULL) |
556 | return NULL; | 556 | return NULL; |
557 | 557 | ||
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 0b8eb235bc13..74e662cbb2c5 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -951,7 +951,7 @@ done: | |||
951 | 951 | ||
952 | static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | 952 | static int tc_ctl_action(struct sk_buff *skb, struct nlmsghdr *n, void *arg) |
953 | { | 953 | { |
954 | struct net *net = skb->sk->sk_net; | 954 | struct net *net = sock_net(skb->sk); |
955 | struct nlattr *tca[TCA_ACT_MAX + 1]; | 955 | struct nlattr *tca[TCA_ACT_MAX + 1]; |
956 | u32 pid = skb ? NETLINK_CB(skb).pid : 0; | 956 | u32 pid = skb ? NETLINK_CB(skb).pid : 0; |
957 | int ret = 0, ovr = 0; | 957 | int ret = 0, ovr = 0; |
@@ -1029,7 +1029,7 @@ find_dump_kind(struct nlmsghdr *n) | |||
1029 | static int | 1029 | static int |
1030 | tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) | 1030 | tc_dump_action(struct sk_buff *skb, struct netlink_callback *cb) |
1031 | { | 1031 | { |
1032 | struct net *net = skb->sk->sk_net; | 1032 | struct net *net = sock_net(skb->sk); |
1033 | struct nlmsghdr *nlh; | 1033 | struct nlmsghdr *nlh; |
1034 | unsigned char *b = skb_tail_pointer(skb); | 1034 | unsigned char *b = skb_tail_pointer(skb); |
1035 | struct nlattr *nest; | 1035 | struct nlattr *nest; |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 0fbedcabf111..1086df7478bc 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -118,7 +118,7 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp) | |||
118 | 118 | ||
119 | static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | 119 | static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg) |
120 | { | 120 | { |
121 | struct net *net = skb->sk->sk_net; | 121 | struct net *net = sock_net(skb->sk); |
122 | struct nlattr *tca[TCA_MAX + 1]; | 122 | struct nlattr *tca[TCA_MAX + 1]; |
123 | struct tcmsg *t; | 123 | struct tcmsg *t; |
124 | u32 protocol; | 124 | u32 protocol; |
@@ -389,7 +389,7 @@ static int tcf_node_dump(struct tcf_proto *tp, unsigned long n, | |||
389 | 389 | ||
390 | static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) | 390 | static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb) |
391 | { | 391 | { |
392 | struct net *net = skb->sk->sk_net; | 392 | struct net *net = sock_net(skb->sk); |
393 | int t; | 393 | int t; |
394 | int s_t; | 394 | int s_t; |
395 | struct net_device *dev; | 395 | struct net_device *dev; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 7e3c048ba9b1..15b91a9ee8e8 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -605,7 +605,7 @@ check_loop_fn(struct Qdisc *q, unsigned long cl, struct qdisc_walker *w) | |||
605 | 605 | ||
606 | static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | 606 | static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) |
607 | { | 607 | { |
608 | struct net *net = skb->sk->sk_net; | 608 | struct net *net = sock_net(skb->sk); |
609 | struct tcmsg *tcm = NLMSG_DATA(n); | 609 | struct tcmsg *tcm = NLMSG_DATA(n); |
610 | struct nlattr *tca[TCA_MAX + 1]; | 610 | struct nlattr *tca[TCA_MAX + 1]; |
611 | struct net_device *dev; | 611 | struct net_device *dev; |
@@ -674,7 +674,7 @@ static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | |||
674 | 674 | ||
675 | static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | 675 | static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, void *arg) |
676 | { | 676 | { |
677 | struct net *net = skb->sk->sk_net; | 677 | struct net *net = sock_net(skb->sk); |
678 | struct tcmsg *tcm; | 678 | struct tcmsg *tcm; |
679 | struct nlattr *tca[TCA_MAX + 1]; | 679 | struct nlattr *tca[TCA_MAX + 1]; |
680 | struct net_device *dev; | 680 | struct net_device *dev; |
@@ -893,7 +893,7 @@ err_out: | |||
893 | 893 | ||
894 | static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) | 894 | static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) |
895 | { | 895 | { |
896 | struct net *net = skb->sk->sk_net; | 896 | struct net *net = sock_net(skb->sk); |
897 | int idx, q_idx; | 897 | int idx, q_idx; |
898 | int s_idx, s_q_idx; | 898 | int s_idx, s_q_idx; |
899 | struct net_device *dev; | 899 | struct net_device *dev; |
@@ -945,7 +945,7 @@ done: | |||
945 | 945 | ||
946 | static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) | 946 | static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg) |
947 | { | 947 | { |
948 | struct net *net = skb->sk->sk_net; | 948 | struct net *net = sock_net(skb->sk); |
949 | struct tcmsg *tcm = NLMSG_DATA(n); | 949 | struct tcmsg *tcm = NLMSG_DATA(n); |
950 | struct nlattr *tca[TCA_MAX + 1]; | 950 | struct nlattr *tca[TCA_MAX + 1]; |
951 | struct net_device *dev; | 951 | struct net_device *dev; |
@@ -1139,7 +1139,7 @@ static int qdisc_class_dump(struct Qdisc *q, unsigned long cl, struct qdisc_walk | |||
1139 | 1139 | ||
1140 | static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) | 1140 | static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb) |
1141 | { | 1141 | { |
1142 | struct net *net = skb->sk->sk_net; | 1142 | struct net *net = sock_net(skb->sk); |
1143 | int t; | 1143 | int t; |
1144 | int s_t; | 1144 | int s_t; |
1145 | struct net_device *dev; | 1145 | struct net_device *dev; |
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index dc71d0d83753..036bfcc8d15b 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -636,7 +636,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
636 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); | 636 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); |
637 | struct sctp6_sock *newsctp6sk; | 637 | struct sctp6_sock *newsctp6sk; |
638 | 638 | ||
639 | newsk = sk_alloc(sk->sk_net, PF_INET6, GFP_KERNEL, sk->sk_prot); | 639 | newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot); |
640 | if (!newsk) | 640 | if (!newsk) |
641 | goto out; | 641 | goto out; |
642 | 642 | ||
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index beea2fb18b15..5aea91137fbb 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -554,7 +554,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk, | |||
554 | { | 554 | { |
555 | struct inet_sock *inet = inet_sk(sk); | 555 | struct inet_sock *inet = inet_sk(sk); |
556 | struct inet_sock *newinet; | 556 | struct inet_sock *newinet; |
557 | struct sock *newsk = sk_alloc(sk->sk_net, PF_INET, GFP_KERNEL, | 557 | struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL, |
558 | sk->sk_prot); | 558 | sk->sk_prot); |
559 | 559 | ||
560 | if (!newsk) | 560 | if (!newsk) |
@@ -630,7 +630,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, | |||
630 | struct sctp_sockaddr_entry *temp; | 630 | struct sctp_sockaddr_entry *temp; |
631 | int found = 0; | 631 | int found = 0; |
632 | 632 | ||
633 | if (ifa->ifa_dev->dev->nd_net != &init_net) | 633 | if (dev_net(ifa->ifa_dev->dev) != &init_net) |
634 | return NOTIFY_DONE; | 634 | return NOTIFY_DONE; |
635 | 635 | ||
636 | switch (ev) { | 636 | switch (ev) { |
diff --git a/net/socket.c b/net/socket.c index 9d3fbfbc8535..79e5382fd110 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -857,7 +857,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
857 | 857 | ||
858 | sock = file->private_data; | 858 | sock = file->private_data; |
859 | sk = sock->sk; | 859 | sk = sock->sk; |
860 | net = sk->sk_net; | 860 | net = sock_net(sk); |
861 | if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { | 861 | if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { |
862 | err = dev_ioctl(net, cmd, argp); | 862 | err = dev_ioctl(net, cmd, argp); |
863 | } else | 863 | } else |
@@ -1375,7 +1375,7 @@ asmlinkage long sys_listen(int fd, int backlog) | |||
1375 | 1375 | ||
1376 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1376 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
1377 | if (sock) { | 1377 | if (sock) { |
1378 | somaxconn = sock->sk->sk_net->sysctl_somaxconn; | 1378 | somaxconn = sock_net(sock->sk)->sysctl_somaxconn; |
1379 | if ((unsigned)backlog > somaxconn) | 1379 | if ((unsigned)backlog > somaxconn) |
1380 | backlog = somaxconn; | 1380 | backlog = somaxconn; |
1381 | 1381 | ||
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 3bbef2ab22ae..9cd35eec3e7f 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c | |||
@@ -101,7 +101,7 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, | |||
101 | struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; | 101 | struct eth_bearer *eb_ptr = (struct eth_bearer *)pt->af_packet_priv; |
102 | u32 size; | 102 | u32 size; |
103 | 103 | ||
104 | if (dev->nd_net != &init_net) { | 104 | if (dev_net(dev) != &init_net) { |
105 | kfree_skb(buf); | 105 | kfree_skb(buf); |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
@@ -198,7 +198,7 @@ static int recv_notification(struct notifier_block *nb, unsigned long evt, | |||
198 | struct eth_bearer *eb_ptr = ð_bearers[0]; | 198 | struct eth_bearer *eb_ptr = ð_bearers[0]; |
199 | struct eth_bearer *stop = ð_bearers[MAX_ETH_BEARERS]; | 199 | struct eth_bearer *stop = ð_bearers[MAX_ETH_BEARERS]; |
200 | 200 | ||
201 | if (dev->nd_net != &init_net) | 201 | if (dev_net(dev) != &init_net) |
202 | return NOTIFY_DONE; | 202 | return NOTIFY_DONE; |
203 | 203 | ||
204 | while ((eb_ptr->dev != dev)) { | 204 | while ((eb_ptr->dev != dev)) { |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 3220d5cb5b5d..ae45df060e3a 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1375,7 +1375,7 @@ static int accept(struct socket *sock, struct socket *newsock, int flags) | |||
1375 | } | 1375 | } |
1376 | buf = skb_peek(&sock->sk->sk_receive_queue); | 1376 | buf = skb_peek(&sock->sk->sk_receive_queue); |
1377 | 1377 | ||
1378 | res = tipc_create(sock->sk->sk_net, newsock, 0); | 1378 | res = tipc_create(sock_net(sock->sk), newsock, 0); |
1379 | if (!res) { | 1379 | if (!res) { |
1380 | struct tipc_sock *new_tsock = tipc_sk(newsock->sk); | 1380 | struct tipc_sock *new_tsock = tipc_sk(newsock->sk); |
1381 | struct tipc_portid id; | 1381 | struct tipc_portid id; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index ae584356852c..50bbf6bb1a22 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -252,7 +252,7 @@ static struct sock *__unix_find_socket_byname(struct net *net, | |||
252 | sk_for_each(s, node, &unix_socket_table[hash ^ type]) { | 252 | sk_for_each(s, node, &unix_socket_table[hash ^ type]) { |
253 | struct unix_sock *u = unix_sk(s); | 253 | struct unix_sock *u = unix_sk(s); |
254 | 254 | ||
255 | if (s->sk_net != net) | 255 | if (!net_eq(sock_net(s), net)) |
256 | continue; | 256 | continue; |
257 | 257 | ||
258 | if (u->addr->len == len && | 258 | if (u->addr->len == len && |
@@ -289,7 +289,7 @@ static struct sock *unix_find_socket_byinode(struct net *net, struct inode *i) | |||
289 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { | 289 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { |
290 | struct dentry *dentry = unix_sk(s)->dentry; | 290 | struct dentry *dentry = unix_sk(s)->dentry; |
291 | 291 | ||
292 | if (s->sk_net != net) | 292 | if (!net_eq(sock_net(s), net)) |
293 | continue; | 293 | continue; |
294 | 294 | ||
295 | if(dentry && dentry->d_inode == i) | 295 | if(dentry && dentry->d_inode == i) |
@@ -654,7 +654,7 @@ static int unix_release(struct socket *sock) | |||
654 | static int unix_autobind(struct socket *sock) | 654 | static int unix_autobind(struct socket *sock) |
655 | { | 655 | { |
656 | struct sock *sk = sock->sk; | 656 | struct sock *sk = sock->sk; |
657 | struct net *net = sk->sk_net; | 657 | struct net *net = sock_net(sk); |
658 | struct unix_sock *u = unix_sk(sk); | 658 | struct unix_sock *u = unix_sk(sk); |
659 | static u32 ordernum = 1; | 659 | static u32 ordernum = 1; |
660 | struct unix_address * addr; | 660 | struct unix_address * addr; |
@@ -758,7 +758,7 @@ fail: | |||
758 | static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | 758 | static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) |
759 | { | 759 | { |
760 | struct sock *sk = sock->sk; | 760 | struct sock *sk = sock->sk; |
761 | struct net *net = sk->sk_net; | 761 | struct net *net = sock_net(sk); |
762 | struct unix_sock *u = unix_sk(sk); | 762 | struct unix_sock *u = unix_sk(sk); |
763 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; | 763 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; |
764 | struct dentry * dentry = NULL; | 764 | struct dentry * dentry = NULL; |
@@ -899,7 +899,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, | |||
899 | int alen, int flags) | 899 | int alen, int flags) |
900 | { | 900 | { |
901 | struct sock *sk = sock->sk; | 901 | struct sock *sk = sock->sk; |
902 | struct net *net = sk->sk_net; | 902 | struct net *net = sock_net(sk); |
903 | struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr; | 903 | struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr; |
904 | struct sock *other; | 904 | struct sock *other; |
905 | unsigned hash; | 905 | unsigned hash; |
@@ -996,7 +996,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, | |||
996 | { | 996 | { |
997 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; | 997 | struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; |
998 | struct sock *sk = sock->sk; | 998 | struct sock *sk = sock->sk; |
999 | struct net *net = sk->sk_net; | 999 | struct net *net = sock_net(sk); |
1000 | struct unix_sock *u = unix_sk(sk), *newu, *otheru; | 1000 | struct unix_sock *u = unix_sk(sk), *newu, *otheru; |
1001 | struct sock *newsk = NULL; | 1001 | struct sock *newsk = NULL; |
1002 | struct sock *other = NULL; | 1002 | struct sock *other = NULL; |
@@ -1025,7 +1025,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, | |||
1025 | err = -ENOMEM; | 1025 | err = -ENOMEM; |
1026 | 1026 | ||
1027 | /* create new sock for complete connection */ | 1027 | /* create new sock for complete connection */ |
1028 | newsk = unix_create1(sk->sk_net, NULL); | 1028 | newsk = unix_create1(sock_net(sk), NULL); |
1029 | if (newsk == NULL) | 1029 | if (newsk == NULL) |
1030 | goto out; | 1030 | goto out; |
1031 | 1031 | ||
@@ -1312,7 +1312,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1312 | { | 1312 | { |
1313 | struct sock_iocb *siocb = kiocb_to_siocb(kiocb); | 1313 | struct sock_iocb *siocb = kiocb_to_siocb(kiocb); |
1314 | struct sock *sk = sock->sk; | 1314 | struct sock *sk = sock->sk; |
1315 | struct net *net = sk->sk_net; | 1315 | struct net *net = sock_net(sk); |
1316 | struct unix_sock *u = unix_sk(sk); | 1316 | struct unix_sock *u = unix_sk(sk); |
1317 | struct sockaddr_un *sunaddr=msg->msg_name; | 1317 | struct sockaddr_un *sunaddr=msg->msg_name; |
1318 | struct sock *other = NULL; | 1318 | struct sock *other = NULL; |
@@ -2016,13 +2016,14 @@ struct unix_iter_state { | |||
2016 | struct seq_net_private p; | 2016 | struct seq_net_private p; |
2017 | int i; | 2017 | int i; |
2018 | }; | 2018 | }; |
2019 | static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos) | 2019 | static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos) |
2020 | { | 2020 | { |
2021 | struct unix_iter_state *iter = seq->private; | ||
2021 | loff_t off = 0; | 2022 | loff_t off = 0; |
2022 | struct sock *s; | 2023 | struct sock *s; |
2023 | 2024 | ||
2024 | for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) { | 2025 | for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) { |
2025 | if (s->sk_net != iter->p.net) | 2026 | if (sock_net(s) != seq_file_net(seq)) |
2026 | continue; | 2027 | continue; |
2027 | if (off == pos) | 2028 | if (off == pos) |
2028 | return s; | 2029 | return s; |
@@ -2035,9 +2036,8 @@ static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos) | |||
2035 | static void *unix_seq_start(struct seq_file *seq, loff_t *pos) | 2036 | static void *unix_seq_start(struct seq_file *seq, loff_t *pos) |
2036 | __acquires(unix_table_lock) | 2037 | __acquires(unix_table_lock) |
2037 | { | 2038 | { |
2038 | struct unix_iter_state *iter = seq->private; | ||
2039 | spin_lock(&unix_table_lock); | 2039 | spin_lock(&unix_table_lock); |
2040 | return *pos ? unix_seq_idx(iter, *pos - 1) : ((void *) 1); | 2040 | return *pos ? unix_seq_idx(seq, *pos - 1) : ((void *) 1); |
2041 | } | 2041 | } |
2042 | 2042 | ||
2043 | static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2043 | static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
@@ -2050,7 +2050,7 @@ static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
2050 | sk = first_unix_socket(&iter->i); | 2050 | sk = first_unix_socket(&iter->i); |
2051 | else | 2051 | else |
2052 | sk = next_unix_socket(&iter->i, sk); | 2052 | sk = next_unix_socket(&iter->i, sk); |
2053 | while (sk && (sk->sk_net != iter->p.net)) | 2053 | while (sk && (sock_net(sk) != seq_file_net(seq))) |
2054 | sk = next_unix_socket(&iter->i, sk); | 2054 | sk = next_unix_socket(&iter->i, sk); |
2055 | return sk; | 2055 | return sk; |
2056 | } | 2056 | } |
diff --git a/net/wireless/wext.c b/net/wireless/wext.c index 2c569b63e7d8..947188a5b937 100644 --- a/net/wireless/wext.c +++ b/net/wireless/wext.c | |||
@@ -1157,7 +1157,7 @@ static void rtmsg_iwinfo(struct net_device *dev, char *event, int event_len) | |||
1157 | struct sk_buff *skb; | 1157 | struct sk_buff *skb; |
1158 | int err; | 1158 | int err; |
1159 | 1159 | ||
1160 | if (dev->nd_net != &init_net) | 1160 | if (dev_net(dev) != &init_net) |
1161 | return; | 1161 | return; |
1162 | 1162 | ||
1163 | skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); | 1163 | skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 339ca4a8e89e..6ba67c523c16 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -191,7 +191,7 @@ static int x25_device_event(struct notifier_block *this, unsigned long event, | |||
191 | struct net_device *dev = ptr; | 191 | struct net_device *dev = ptr; |
192 | struct x25_neigh *nb; | 192 | struct x25_neigh *nb; |
193 | 193 | ||
194 | if (dev->nd_net != &init_net) | 194 | if (dev_net(dev) != &init_net) |
195 | return NOTIFY_DONE; | 195 | return NOTIFY_DONE; |
196 | 196 | ||
197 | if (dev->type == ARPHRD_X25 | 197 | if (dev->type == ARPHRD_X25 |
@@ -549,7 +549,7 @@ static struct sock *x25_make_new(struct sock *osk) | |||
549 | if (osk->sk_type != SOCK_SEQPACKET) | 549 | if (osk->sk_type != SOCK_SEQPACKET) |
550 | goto out; | 550 | goto out; |
551 | 551 | ||
552 | if ((sk = x25_alloc_socket(osk->sk_net)) == NULL) | 552 | if ((sk = x25_alloc_socket(sock_net(osk))) == NULL) |
553 | goto out; | 553 | goto out; |
554 | 554 | ||
555 | x25 = x25_sk(sk); | 555 | x25 = x25_sk(sk); |
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c index f0679d283110..3ff206c0ae94 100644 --- a/net/x25/x25_dev.c +++ b/net/x25/x25_dev.c | |||
@@ -95,7 +95,7 @@ int x25_lapb_receive_frame(struct sk_buff *skb, struct net_device *dev, | |||
95 | struct sk_buff *nskb; | 95 | struct sk_buff *nskb; |
96 | struct x25_neigh *nb; | 96 | struct x25_neigh *nb; |
97 | 97 | ||
98 | if (dev->nd_net != &init_net) | 98 | if (dev_net(dev) != &init_net) |
99 | goto drop; | 99 | goto drop; |
100 | 100 | ||
101 | nskb = skb_copy(skb, GFP_ATOMIC); | 101 | nskb = skb_copy(skb, GFP_ATOMIC); |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 8e588f20c60c..15d73e47cc2c 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2079,7 +2079,7 @@ static int stale_bundle(struct dst_entry *dst) | |||
2079 | void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev) | 2079 | void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev) |
2080 | { | 2080 | { |
2081 | while ((dst = dst->child) && dst->xfrm && dst->dev == dev) { | 2081 | while ((dst = dst->child) && dst->xfrm && dst->dev == dev) { |
2082 | dst->dev = dev->nd_net->loopback_dev; | 2082 | dst->dev = dev_net(dev)->loopback_dev; |
2083 | dev_hold(dst->dev); | 2083 | dev_hold(dst->dev); |
2084 | dev_put(dev); | 2084 | dev_put(dev); |
2085 | } | 2085 | } |
@@ -2350,7 +2350,7 @@ static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void | |||
2350 | { | 2350 | { |
2351 | struct net_device *dev = ptr; | 2351 | struct net_device *dev = ptr; |
2352 | 2352 | ||
2353 | if (dev->nd_net != &init_net) | 2353 | if (dev_net(dev) != &init_net) |
2354 | return NOTIFY_DONE; | 2354 | return NOTIFY_DONE; |
2355 | 2355 | ||
2356 | switch (event) { | 2356 | switch (event) { |
diff --git a/security/selinux/netif.c b/security/selinux/netif.c index 013d3117a86b..9c8a82aa8baf 100644 --- a/security/selinux/netif.c +++ b/security/selinux/netif.c | |||
@@ -281,7 +281,7 @@ static int sel_netif_netdev_notifier_handler(struct notifier_block *this, | |||
281 | { | 281 | { |
282 | struct net_device *dev = ptr; | 282 | struct net_device *dev = ptr; |
283 | 283 | ||
284 | if (dev->nd_net != &init_net) | 284 | if (dev_net(dev) != &init_net) |
285 | return NOTIFY_DONE; | 285 | return NOTIFY_DONE; |
286 | 286 | ||
287 | if (event == NETDEV_DOWN) | 287 | if (event == NETDEV_DOWN) |