aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c44
-rw-r--r--net/ipv6/icmp.c4
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/mcast.c6
-rw-r--r--net/ipv6/ndisc.c24
-rw-r--r--net/ipv6/netfilter/ip6_queue.c2
-rw-r--r--net/ipv6/proc.c2
-rw-r--r--net/ipv6/raw.c4
-rw-r--r--net/ipv6/reassembly.c2
-rw-r--r--net/ipv6/route.c40
-rw-r--r--net/ipv6/tcp_ipv6.c10
-rw-r--r--net/ipv6/udp.c4
-rw-r--r--net/ipv6/xfrm6_policy.c2
13 files changed, 73 insertions, 73 deletions
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
1749ok: 1749ok:
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)
2261static void ip6_tnl_add_linklocal(struct inet6_dev *idev) 2261static 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;
2788try_again: 2788try_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:
3469static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) 3469static 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:
3675void inet6_ifinfo_notify(int event, struct inet6_dev *idev) 3675void 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) {}
306void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, 306void 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
508static void icmpv6_echo_reply(struct sk_buff *skb) 508static 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
1401static struct sk_buff *mld_newpack(struct net_device *dev, int size) 1401static 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
1763static void igmp6_send(struct in6_addr *addr, struct net_device *dev, int type) 1763static 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)
1597static int ndisc_netdev_event(struct notifier_block *this, unsigned long event, void *ptr) 1597static 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)
441int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, 441int 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)
607int ip6_ins_rt(struct rt6_info *rt) 607int 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 *
745void ip6_route_input(struct sk_buff *skb) 745void 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)
1289int ip6_del_rt(struct rt6_info *rt) 1289int 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
1584static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) 1584static 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
1989static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = { 1989static 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 {