aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c40
1 files changed, 20 insertions, 20 deletions
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;