aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-04 02:25:27 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-04 02:25:27 -0500
commit58f09b78b730cf0d936597272bf35b3d615e967c (patch)
tree6c7fb907dd7da48384087944c81368c216b841f1 /net/ipv6/route.c
parente0b85590bc1b50c9bbef4dd4738d9995fb1d1f64 (diff)
[NETNS][IPV6] ip6_fib - make it per network namespace
The fib table for ipv6 are moved to the network namespace structure. All references to them are made relatively to the network namespace. All external calls to the ip6_fib functions taking the network namespace parameter are made using the init_net variable, so the ip6_fib engine is ready for the namespaces but the callers not yet. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index cd717450fb10..09206f7ba525 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -571,7 +571,7 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
571 flags |= RT6_LOOKUP_F_HAS_SADDR; 571 flags |= RT6_LOOKUP_F_HAS_SADDR;
572 } 572 }
573 573
574 dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_lookup); 574 dst = fib6_rule_lookup(&init_net, &fl, flags, ip6_pol_route_lookup);
575 if (dst->error == 0) 575 if (dst->error == 0)
576 return (struct rt6_info *) dst; 576 return (struct rt6_info *) dst;
577 577
@@ -758,7 +758,7 @@ void ip6_route_input(struct sk_buff *skb)
758 if (rt6_need_strict(&iph->daddr)) 758 if (rt6_need_strict(&iph->daddr))
759 flags |= RT6_LOOKUP_F_IFACE; 759 flags |= RT6_LOOKUP_F_IFACE;
760 760
761 skb->dst = fib6_rule_lookup(&fl, flags, ip6_pol_route_input); 761 skb->dst = fib6_rule_lookup(&init_net, &fl, flags, ip6_pol_route_input);
762} 762}
763 763
764static struct rt6_info *ip6_pol_route_output(struct fib6_table *table, 764static struct rt6_info *ip6_pol_route_output(struct fib6_table *table,
@@ -777,7 +777,7 @@ struct dst_entry * ip6_route_output(struct sock *sk, struct flowi *fl)
777 if (!ipv6_addr_any(&fl->fl6_src)) 777 if (!ipv6_addr_any(&fl->fl6_src))
778 flags |= RT6_LOOKUP_F_HAS_SADDR; 778 flags |= RT6_LOOKUP_F_HAS_SADDR;
779 779
780 return fib6_rule_lookup(fl, flags, ip6_pol_route_output); 780 return fib6_rule_lookup(&init_net, fl, flags, ip6_pol_route_output);
781} 781}
782 782
783EXPORT_SYMBOL(ip6_route_output); 783EXPORT_SYMBOL(ip6_route_output);
@@ -1069,7 +1069,7 @@ int ip6_route_add(struct fib6_config *cfg)
1069 if (cfg->fc_metric == 0) 1069 if (cfg->fc_metric == 0)
1070 cfg->fc_metric = IP6_RT_PRIO_USER; 1070 cfg->fc_metric = IP6_RT_PRIO_USER;
1071 1071
1072 table = fib6_new_table(cfg->fc_table); 1072 table = fib6_new_table(&init_net, cfg->fc_table);
1073 if (table == NULL) { 1073 if (table == NULL) {
1074 err = -ENOBUFS; 1074 err = -ENOBUFS;
1075 goto out; 1075 goto out;
@@ -1275,7 +1275,7 @@ static int ip6_route_del(struct fib6_config *cfg)
1275 struct rt6_info *rt; 1275 struct rt6_info *rt;
1276 int err = -ESRCH; 1276 int err = -ESRCH;
1277 1277
1278 table = fib6_get_table(cfg->fc_table); 1278 table = fib6_get_table(&init_net, cfg->fc_table);
1279 if (table == NULL) 1279 if (table == NULL)
1280 return err; 1280 return err;
1281 1281
@@ -1390,7 +1390,9 @@ static struct rt6_info *ip6_route_redirect(struct in6_addr *dest,
1390 if (rt6_need_strict(dest)) 1390 if (rt6_need_strict(dest))
1391 flags |= RT6_LOOKUP_F_IFACE; 1391 flags |= RT6_LOOKUP_F_IFACE;
1392 1392
1393 return (struct rt6_info *)fib6_rule_lookup((struct flowi *)&rdfl, flags, __ip6_route_redirect); 1393 return (struct rt6_info *)fib6_rule_lookup(&init_net,
1394 (struct flowi *)&rdfl,
1395 flags, __ip6_route_redirect);
1394} 1396}
1395 1397
1396void rt6_redirect(struct in6_addr *dest, struct in6_addr *src, 1398void rt6_redirect(struct in6_addr *dest, struct in6_addr *src,
@@ -1589,7 +1591,7 @@ static struct rt6_info *rt6_get_route_info(struct in6_addr *prefix, int prefixle
1589 struct rt6_info *rt = NULL; 1591 struct rt6_info *rt = NULL;
1590 struct fib6_table *table; 1592 struct fib6_table *table;
1591 1593
1592 table = fib6_get_table(RT6_TABLE_INFO); 1594 table = fib6_get_table(&init_net, RT6_TABLE_INFO);
1593 if (table == NULL) 1595 if (table == NULL)
1594 return NULL; 1596 return NULL;
1595 1597
@@ -1644,7 +1646,7 @@ struct rt6_info *rt6_get_dflt_router(struct in6_addr *addr, struct net_device *d
1644 struct rt6_info *rt; 1646 struct rt6_info *rt;
1645 struct fib6_table *table; 1647 struct fib6_table *table;
1646 1648
1647 table = fib6_get_table(RT6_TABLE_DFLT); 1649 table = fib6_get_table(&init_net, RT6_TABLE_DFLT);
1648 if (table == NULL) 1650 if (table == NULL)
1649 return NULL; 1651 return NULL;
1650 1652
@@ -1688,7 +1690,7 @@ void rt6_purge_dflt_routers(void)
1688 struct fib6_table *table; 1690 struct fib6_table *table;
1689 1691
1690 /* NOTE: Keep consistent with rt6_get_dflt_router */ 1692 /* NOTE: Keep consistent with rt6_get_dflt_router */
1691 table = fib6_get_table(RT6_TABLE_DFLT); 1693 table = fib6_get_table(&init_net, RT6_TABLE_DFLT);
1692 if (table == NULL) 1694 if (table == NULL)
1693 return; 1695 return;
1694 1696
@@ -1851,7 +1853,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
1851 1853
1852 ipv6_addr_copy(&rt->rt6i_dst.addr, addr); 1854 ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
1853 rt->rt6i_dst.plen = 128; 1855 rt->rt6i_dst.plen = 128;
1854 rt->rt6i_table = fib6_get_table(RT6_TABLE_LOCAL); 1856 rt->rt6i_table = fib6_get_table(&init_net, RT6_TABLE_LOCAL);
1855 1857
1856 atomic_set(&rt->u.dst.__refcnt, 1); 1858 atomic_set(&rt->u.dst.__refcnt, 1);
1857 1859