diff options
87 files changed, 251 insertions, 228 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/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/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/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/ax25/af_ax25.c b/net/ax25/af_ax25.c index 48bfcc741f25..ee9dd83e7561 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 */ |
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/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..812534828914 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 (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..942be93a2eb0 100644 --- a/net/core/fib_rules.c +++ b/net/core/fib_rules.c | |||
@@ -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..c978bd1cd659 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 | 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; |
@@ -1298,7 +1298,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev, | |||
1298 | struct neigh_parms *p, *ref; | 1298 | struct neigh_parms *p, *ref; |
1299 | struct net *net; | 1299 | struct net *net; |
1300 | 1300 | ||
1301 | net = dev->nd_net; | 1301 | net = dev_net(dev); |
1302 | ref = lookup_neigh_params(tbl, net, 0); | 1302 | ref = lookup_neigh_params(tbl, net, 0); |
1303 | if (!ref) | 1303 | if (!ref) |
1304 | return NULL; | 1304 | return NULL; |
@@ -2050,7 +2050,7 @@ static int neigh_dump_table(struct neigh_table *tbl, struct sk_buff *skb, | |||
2050 | s_idx = 0; | 2050 | s_idx = 0; |
2051 | for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) { | 2051 | for (n = tbl->hash_buckets[h], idx = 0; n; n = n->next) { |
2052 | int lidx; | 2052 | int lidx; |
2053 | if (n->dev->nd_net != net) | 2053 | if (dev_net(n->dev) != net) |
2054 | continue; | 2054 | continue; |
2055 | lidx = idx++; | 2055 | lidx = idx++; |
2056 | if (lidx < s_idx) | 2056 | if (lidx < s_idx) |
@@ -2155,7 +2155,7 @@ static struct neighbour *neigh_get_first(struct seq_file *seq) | |||
2155 | n = tbl->hash_buckets[bucket]; | 2155 | n = tbl->hash_buckets[bucket]; |
2156 | 2156 | ||
2157 | while (n) { | 2157 | while (n) { |
2158 | if (n->dev->nd_net != net) | 2158 | if (dev_net(n->dev) != net) |
2159 | goto next; | 2159 | goto next; |
2160 | if (state->neigh_sub_iter) { | 2160 | if (state->neigh_sub_iter) { |
2161 | loff_t fakep = 0; | 2161 | loff_t fakep = 0; |
@@ -2198,7 +2198,7 @@ static struct neighbour *neigh_get_next(struct seq_file *seq, | |||
2198 | 2198 | ||
2199 | while (1) { | 2199 | while (1) { |
2200 | while (n) { | 2200 | while (n) { |
2201 | if (n->dev->nd_net != net) | 2201 | if (dev_net(n->dev) != net) |
2202 | goto next; | 2202 | goto next; |
2203 | if (state->neigh_sub_iter) { | 2203 | if (state->neigh_sub_iter) { |
2204 | void *v = state->neigh_sub_iter(state, n, pos); | 2204 | void *v = state->neigh_sub_iter(state, n, pos); |
@@ -2482,7 +2482,7 @@ static inline size_t neigh_nlmsg_size(void) | |||
2482 | 2482 | ||
2483 | static void __neigh_notify(struct neighbour *n, int type, int flags) | 2483 | static void __neigh_notify(struct neighbour *n, int type, int flags) |
2484 | { | 2484 | { |
2485 | struct net *net = n->dev->nd_net; | 2485 | struct net *net = dev_net(n->dev); |
2486 | struct sk_buff *skb; | 2486 | struct sk_buff *skb; |
2487 | int err = -ENOBUFS; | 2487 | int err = -ENOBUFS; |
2488 | 2488 | ||
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..09250a0800f6 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -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]) |
@@ -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 | ||
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 23fd95a7ad15..3554fb3d251c 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -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_route.c b/net/decnet/dn_route.c index 9dc0abb50eaf..0a46b6c10e51 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) |
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/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..823c724a8593 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; |
@@ -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) { |
@@ -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..0e4b34b07cb5 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) |
@@ -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 |
@@ -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/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..682f632bfb77 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 */ |
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..26685c83a146 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 | sk->sk_net == 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/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..e54bc1364473 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -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/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/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..8756d502a47f 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -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, |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2941ef21f203..7768d718e199 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -284,7 +284,7 @@ static struct rtable *rt_cache_get_first(struct rt_cache_iter_state *st) | |||
284 | rcu_read_lock_bh(); | 284 | rcu_read_lock_bh(); |
285 | r = rcu_dereference(rt_hash_table[st->bucket].chain); | 285 | r = rcu_dereference(rt_hash_table[st->bucket].chain); |
286 | while (r) { | 286 | while (r) { |
287 | if (r->u.dst.dev->nd_net == st->p.net && | 287 | if (dev_net(r->u.dst.dev) == st->p.net && |
288 | r->rt_genid == st->genid) | 288 | r->rt_genid == st->genid) |
289 | return r; | 289 | return r; |
290 | r = rcu_dereference(r->u.dst.rt_next); | 290 | r = rcu_dereference(r->u.dst.rt_next); |
@@ -312,7 +312,7 @@ static struct rtable *rt_cache_get_next(struct rt_cache_iter_state *st, | |||
312 | struct rtable *r) | 312 | struct rtable *r) |
313 | { | 313 | { |
314 | while ((r = __rt_cache_get_next(st, r)) != NULL) { | 314 | while ((r = __rt_cache_get_next(st, r)) != NULL) { |
315 | if (r->u.dst.dev->nd_net != st->p.net) | 315 | if (dev_net(r->u.dst.dev) != st->p.net) |
316 | continue; | 316 | continue; |
317 | if (r->rt_genid == st->genid) | 317 | if (r->rt_genid == st->genid) |
318 | break; | 318 | break; |
@@ -680,7 +680,7 @@ static inline int compare_keys(struct flowi *fl1, struct flowi *fl2) | |||
680 | 680 | ||
681 | static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) | 681 | static inline int compare_netns(struct rtable *rt1, struct rtable *rt2) |
682 | { | 682 | { |
683 | return rt1->u.dst.dev->nd_net == rt2->u.dst.dev->nd_net; | 683 | return dev_net(rt1->u.dst.dev) == dev_net(rt2->u.dst.dev); |
684 | } | 684 | } |
685 | 685 | ||
686 | /* | 686 | /* |
@@ -1164,7 +1164,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1164 | if (!in_dev) | 1164 | if (!in_dev) |
1165 | return; | 1165 | return; |
1166 | 1166 | ||
1167 | net = dev->nd_net; | 1167 | net = dev_net(dev); |
1168 | if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) | 1168 | if (new_gw == old_gw || !IN_DEV_RX_REDIRECTS(in_dev) |
1169 | || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) | 1169 | || ipv4_is_multicast(new_gw) || ipv4_is_lbcast(new_gw) |
1170 | || ipv4_is_zeronet(new_gw)) | 1170 | || ipv4_is_zeronet(new_gw)) |
@@ -1195,7 +1195,7 @@ void ip_rt_redirect(__be32 old_gw, __be32 daddr, __be32 new_gw, | |||
1195 | rth->fl.oif != ikeys[k] || | 1195 | rth->fl.oif != ikeys[k] || |
1196 | rth->fl.iif != 0 || | 1196 | rth->fl.iif != 0 || |
1197 | rth->rt_genid != atomic_read(&rt_genid) || | 1197 | rth->rt_genid != atomic_read(&rt_genid) || |
1198 | rth->u.dst.dev->nd_net != net) { | 1198 | dev_net(rth->u.dst.dev) != net) { |
1199 | rthp = &rth->u.dst.rt_next; | 1199 | rthp = &rth->u.dst.rt_next; |
1200 | continue; | 1200 | continue; |
1201 | } | 1201 | } |
@@ -1454,7 +1454,7 @@ unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, | |||
1454 | rth->rt_src == iph->saddr && | 1454 | rth->rt_src == iph->saddr && |
1455 | rth->fl.iif == 0 && | 1455 | rth->fl.iif == 0 && |
1456 | !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) && | 1456 | !(dst_metric_locked(&rth->u.dst, RTAX_MTU)) && |
1457 | rth->u.dst.dev->nd_net == net && | 1457 | dev_net(rth->u.dst.dev) == net && |
1458 | rth->rt_genid == atomic_read(&rt_genid)) { | 1458 | rth->rt_genid == atomic_read(&rt_genid)) { |
1459 | unsigned short mtu = new_mtu; | 1459 | unsigned short mtu = new_mtu; |
1460 | 1460 | ||
@@ -1530,9 +1530,9 @@ static void ipv4_dst_ifdown(struct dst_entry *dst, struct net_device *dev, | |||
1530 | { | 1530 | { |
1531 | struct rtable *rt = (struct rtable *) dst; | 1531 | struct rtable *rt = (struct rtable *) dst; |
1532 | struct in_device *idev = rt->idev; | 1532 | struct in_device *idev = rt->idev; |
1533 | if (dev != dev->nd_net->loopback_dev && idev && idev->dev == dev) { | 1533 | if (dev != dev_net(dev)->loopback_dev && idev && idev->dev == dev) { |
1534 | struct in_device *loopback_idev = | 1534 | struct in_device *loopback_idev = |
1535 | in_dev_get(dev->nd_net->loopback_dev); | 1535 | in_dev_get(dev_net(dev)->loopback_dev); |
1536 | if (loopback_idev) { | 1536 | if (loopback_idev) { |
1537 | rt->idev = loopback_idev; | 1537 | rt->idev = loopback_idev; |
1538 | in_dev_put(idev); | 1538 | in_dev_put(idev); |
@@ -1576,7 +1576,7 @@ void ip_rt_get_source(u8 *addr, struct rtable *rt) | |||
1576 | 1576 | ||
1577 | if (rt->fl.iif == 0) | 1577 | if (rt->fl.iif == 0) |
1578 | src = rt->rt_src; | 1578 | src = rt->rt_src; |
1579 | else if (fib_lookup(rt->u.dst.dev->nd_net, &rt->fl, &res) == 0) { | 1579 | else if (fib_lookup(dev_net(rt->u.dst.dev), &rt->fl, &res) == 0) { |
1580 | src = FIB_RES_PREFSRC(res); | 1580 | src = FIB_RES_PREFSRC(res); |
1581 | fib_res_put(&res); | 1581 | fib_res_put(&res); |
1582 | } else | 1582 | } else |
@@ -1900,7 +1900,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
1900 | __be32 spec_dst; | 1900 | __be32 spec_dst; |
1901 | int err = -EINVAL; | 1901 | int err = -EINVAL; |
1902 | int free_res = 0; | 1902 | int free_res = 0; |
1903 | struct net * net = dev->nd_net; | 1903 | struct net * net = dev_net(dev); |
1904 | 1904 | ||
1905 | /* IP on this device is disabled. */ | 1905 | /* IP on this device is disabled. */ |
1906 | 1906 | ||
@@ -2071,7 +2071,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2071 | int iif = dev->ifindex; | 2071 | int iif = dev->ifindex; |
2072 | struct net *net; | 2072 | struct net *net; |
2073 | 2073 | ||
2074 | net = dev->nd_net; | 2074 | net = dev_net(dev); |
2075 | tos &= IPTOS_RT_MASK; | 2075 | tos &= IPTOS_RT_MASK; |
2076 | hash = rt_hash(daddr, saddr, iif); | 2076 | hash = rt_hash(daddr, saddr, iif); |
2077 | 2077 | ||
@@ -2084,7 +2084,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, | |||
2084 | rth->fl.oif == 0 && | 2084 | rth->fl.oif == 0 && |
2085 | rth->fl.mark == skb->mark && | 2085 | rth->fl.mark == skb->mark && |
2086 | rth->fl.fl4_tos == tos && | 2086 | rth->fl.fl4_tos == tos && |
2087 | rth->u.dst.dev->nd_net == net && | 2087 | dev_net(rth->u.dst.dev) == net && |
2088 | rth->rt_genid == atomic_read(&rt_genid)) { | 2088 | rth->rt_genid == atomic_read(&rt_genid)) { |
2089 | dst_use(&rth->u.dst, jiffies); | 2089 | dst_use(&rth->u.dst, jiffies); |
2090 | RT_CACHE_STAT_INC(in_hit); | 2090 | RT_CACHE_STAT_INC(in_hit); |
@@ -2486,7 +2486,7 @@ int __ip_route_output_key(struct net *net, struct rtable **rp, | |||
2486 | rth->fl.mark == flp->mark && | 2486 | rth->fl.mark == flp->mark && |
2487 | !((rth->fl.fl4_tos ^ flp->fl4_tos) & | 2487 | !((rth->fl.fl4_tos ^ flp->fl4_tos) & |
2488 | (IPTOS_RT_MASK | RTO_ONLINK)) && | 2488 | (IPTOS_RT_MASK | RTO_ONLINK)) && |
2489 | rth->u.dst.dev->nd_net == net && | 2489 | dev_net(rth->u.dst.dev) == net && |
2490 | rth->rt_genid == atomic_read(&rt_genid)) { | 2490 | rth->rt_genid == atomic_read(&rt_genid)) { |
2491 | dst_use(&rth->u.dst, jiffies); | 2491 | dst_use(&rth->u.dst, jiffies); |
2492 | RT_CACHE_STAT_INC(out_hit); | 2492 | RT_CACHE_STAT_INC(out_hit); |
@@ -2795,7 +2795,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
2795 | rcu_read_lock_bh(); | 2795 | rcu_read_lock_bh(); |
2796 | for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; | 2796 | for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt; |
2797 | rt = rcu_dereference(rt->u.dst.rt_next), idx++) { | 2797 | rt = rcu_dereference(rt->u.dst.rt_next), idx++) { |
2798 | if (rt->u.dst.dev->nd_net != net || idx < s_idx) | 2798 | if (dev_net(rt->u.dst.dev) != net || idx < s_idx) |
2799 | continue; | 2799 | continue; |
2800 | if (rt->rt_genid != atomic_read(&rt_genid)) | 2800 | if (rt->rt_genid != atomic_read(&rt_genid)) |
2801 | continue; | 2801 | continue; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 649d00a50cb1..28bece6f281b 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); |
@@ -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)); |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index b37581dfd029..e2cd93481359 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -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); |
@@ -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) { |
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..d1de9ec74261 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 (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 (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 (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(); |
@@ -2771,7 +2771,7 @@ static struct inet6_ifaddr *if6_get_first(struct seq_file *seq) | |||
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 && 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; |
@@ -2787,7 +2787,7 @@ static struct inet6_ifaddr *if6_get_next(struct seq_file *seq, struct inet6_ifad | |||
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 (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 (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)) { |
@@ -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); |
@@ -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/icmp.c b/net/ipv6/icmp.c index 86332417b402..50857662e6b7 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -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/ip6_output.c b/net/ipv6/ip6_output.c index d34aa61353bb..556300f0eba5 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; |
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 957ac7e9e929..0357de8e78c8 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -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; |
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/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..efb0047f6880 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -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) { |
@@ -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..65053fba8c1a 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] = { |
@@ -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..086deffff9c9 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; |
@@ -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..6683c04b427e 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -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; |
@@ -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/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_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/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/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/netrom/af_netrom.c b/net/netrom/af_netrom.c index 972250c974f1..a270ebf9f765 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) |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index a56ed2120e07..baa290d3444a 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) != sk->sk_net) |
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) |
@@ -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) != sk->sk_net) |
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) != sk->sk_net) |
572 | goto drop; | 572 | goto drop; |
573 | 573 | ||
574 | if (dev->header_ops) { | 574 | if (dev->header_ops) { |
@@ -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) { |
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 4a31a81059ab..1a7f143cf741 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) |
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index beea2fb18b15..2faa0d8839eb 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -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/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/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..7a46ea73fe2d 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 |
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) |