aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2008-03-04 16:45:59 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-04 16:45:59 -0500
commit606a2b4862d4be31fa55cad89871fe52a422d511 (patch)
tree4968038a439ba1ff2a255ead01228fc81dec97ee
parentcdb1876192dbe680b3ac955717fdf7f863c1762d (diff)
[NETNS][IPV6] route6 - Pass the network namespace parameter to rt6_lookup
Add a network namespace parameter to rt6_lookup(). 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>
-rw-r--r--include/net/ip6_route.h3
-rw-r--r--net/ipv6/addrconf.c4
-rw-r--r--net/ipv6/anycast.c2
-rw-r--r--net/ipv6/ip6_tunnel.c4
-rw-r--r--net/ipv6/mcast.c4
-rw-r--r--net/ipv6/route.c10
-rw-r--r--net/ipv6/sit.c4
7 files changed, 16 insertions, 15 deletions
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 79dce496f4d4..92004c5160c7 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -69,7 +69,8 @@ extern void rt6_sndmsg(int type, struct in6_addr *dst,
69 int dstlen, int srclen, 69 int dstlen, int srclen,
70 int metric, __u32 flags); 70 int metric, __u32 flags);
71 71
72extern struct rt6_info *rt6_lookup(struct in6_addr *daddr, 72extern struct rt6_info *rt6_lookup(struct net *net,
73 struct in6_addr *daddr,
73 struct in6_addr *saddr, 74 struct in6_addr *saddr,
74 int oif, int flags); 75 int oif, int flags);
75 76
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index a1d872dacad6..9d894e8c7b72 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -753,7 +753,7 @@ static void ipv6_del_addr(struct inet6_ifaddr *ifp)
753 struct rt6_info *rt; 753 struct rt6_info *rt;
754 754
755 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len); 755 ipv6_addr_prefix(&prefix, &ifp->addr, ifp->prefix_len);
756 rt = rt6_lookup(&prefix, NULL, ifp->idev->dev->ifindex, 1); 756 rt = rt6_lookup(&init_net, &prefix, NULL, ifp->idev->dev->ifindex, 1);
757 757
758 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 758 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
759 if (onlink == 0) { 759 if (onlink == 0) {
@@ -1700,7 +1700,7 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len)
1700 1700
1701 if (pinfo->onlink) { 1701 if (pinfo->onlink) {
1702 struct rt6_info *rt; 1702 struct rt6_info *rt;
1703 rt = rt6_lookup(&pinfo->prefix, NULL, dev->ifindex, 1); 1703 rt = rt6_lookup(&init_net, &pinfo->prefix, NULL, dev->ifindex, 1);
1704 1704
1705 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) { 1705 if (rt && ((rt->rt6i_flags & (RTF_GATEWAY | RTF_DEFAULT)) == 0)) {
1706 if (rt->rt6i_flags&RTF_EXPIRES) { 1706 if (rt->rt6i_flags&RTF_EXPIRES) {
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 9c7f83fbc3a1..96868b994b37 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -101,7 +101,7 @@ int ipv6_sock_ac_join(struct sock *sk, int ifindex, struct in6_addr *addr)
101 if (ifindex == 0) { 101 if (ifindex == 0) {
102 struct rt6_info *rt; 102 struct rt6_info *rt;
103 103
104 rt = rt6_lookup(addr, NULL, 0, 0); 104 rt = rt6_lookup(&init_net, addr, NULL, 0, 0);
105 if (rt) { 105 if (rt) {
106 dev = rt->rt6i_dev; 106 dev = rt->rt6i_dev;
107 dev_hold(dev); 107 dev_hold(dev);
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 78f438880923..4e1981660b3c 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -602,7 +602,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
602 skb_reset_network_header(skb2); 602 skb_reset_network_header(skb2);
603 603
604 /* Try to guess incoming interface */ 604 /* Try to guess incoming interface */
605 rt = rt6_lookup(&ipv6_hdr(skb2)->saddr, NULL, 0, 0); 605 rt = rt6_lookup(&init_net, &ipv6_hdr(skb2)->saddr, NULL, 0, 0);
606 606
607 if (rt && rt->rt6i_dev) 607 if (rt && rt->rt6i_dev)
608 skb2->dev = rt->rt6i_dev; 608 skb2->dev = rt->rt6i_dev;
@@ -1112,7 +1112,7 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
1112 int strict = (ipv6_addr_type(&p->raddr) & 1112 int strict = (ipv6_addr_type(&p->raddr) &
1113 (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL)); 1113 (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL));
1114 1114
1115 struct rt6_info *rt = rt6_lookup(&p->raddr, &p->laddr, 1115 struct rt6_info *rt = rt6_lookup(&init_net, &p->raddr, &p->laddr,
1116 p->link, strict); 1116 p->link, strict);
1117 1117
1118 if (rt == NULL) 1118 if (rt == NULL)
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index a373b8e7f241..197ca390a15d 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -208,7 +208,7 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
208 208
209 if (ifindex == 0) { 209 if (ifindex == 0) {
210 struct rt6_info *rt; 210 struct rt6_info *rt;
211 rt = rt6_lookup(addr, NULL, 0, 0); 211 rt = rt6_lookup(&init_net, addr, NULL, 0, 0);
212 if (rt) { 212 if (rt) {
213 dev = rt->rt6i_dev; 213 dev = rt->rt6i_dev;
214 dev_hold(dev); 214 dev_hold(dev);
@@ -294,7 +294,7 @@ static struct inet6_dev *ip6_mc_find_dev(struct in6_addr *group, int ifindex)
294 if (ifindex == 0) { 294 if (ifindex == 0) {
295 struct rt6_info *rt; 295 struct rt6_info *rt;
296 296
297 rt = rt6_lookup(group, NULL, 0, 0); 297 rt = rt6_lookup(&init_net, group, NULL, 0, 0);
298 if (rt) { 298 if (rt) {
299 dev = rt->rt6i_dev; 299 dev = rt->rt6i_dev;
300 dev_hold(dev); 300 dev_hold(dev);
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 5d9d293156cd..d9d840ced1c6 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -553,8 +553,8 @@ out:
553 553
554} 554}
555 555
556struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr, 556struct rt6_info *rt6_lookup(struct net *net, struct in6_addr *daddr,
557 int oif, int strict) 557 struct in6_addr *saddr, int oif, int strict)
558{ 558{
559 struct flowi fl = { 559 struct flowi fl = {
560 .oif = oif, 560 .oif = oif,
@@ -572,7 +572,7 @@ struct rt6_info *rt6_lookup(struct in6_addr *daddr, struct in6_addr *saddr,
572 flags |= RT6_LOOKUP_F_HAS_SADDR; 572 flags |= RT6_LOOKUP_F_HAS_SADDR;
573 } 573 }
574 574
575 dst = fib6_rule_lookup(&init_net, &fl, flags, ip6_pol_route_lookup); 575 dst = fib6_rule_lookup(net, &fl, flags, ip6_pol_route_lookup);
576 if (dst->error == 0) 576 if (dst->error == 0)
577 return (struct rt6_info *) dst; 577 return (struct rt6_info *) dst;
578 578
@@ -1159,7 +1159,7 @@ int ip6_route_add(struct fib6_config *cfg)
1159 if (!(gwa_type&IPV6_ADDR_UNICAST)) 1159 if (!(gwa_type&IPV6_ADDR_UNICAST))
1160 goto out; 1160 goto out;
1161 1161
1162 grt = rt6_lookup(gw_addr, NULL, cfg->fc_ifindex, 1); 1162 grt = rt6_lookup(&init_net, gw_addr, NULL, cfg->fc_ifindex, 1);
1163 1163
1164 err = -EHOSTUNREACH; 1164 err = -EHOSTUNREACH;
1165 if (grt == NULL) 1165 if (grt == NULL)
@@ -1483,7 +1483,7 @@ void rt6_pmtu_discovery(struct in6_addr *daddr, struct in6_addr *saddr,
1483 struct rt6_info *rt, *nrt; 1483 struct rt6_info *rt, *nrt;
1484 int allfrag = 0; 1484 int allfrag = 0;
1485 1485
1486 rt = rt6_lookup(daddr, saddr, dev->ifindex, 0); 1486 rt = rt6_lookup(dev->nd_net, daddr, saddr, dev->ifindex, 0);
1487 if (rt == NULL) 1487 if (rt == NULL)
1488 return; 1488 return;
1489 1489
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 1656c003b989..68720aa63f96 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -339,11 +339,11 @@ out:
339 skb_reset_network_header(skb2); 339 skb_reset_network_header(skb2);
340 340
341 /* Try to guess incoming interface */ 341 /* Try to guess incoming interface */
342 rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0); 342 rt6i = rt6_lookup(&init_net, &iph6->saddr, NULL, NULL, 0);
343 if (rt6i && rt6i->rt6i_dev) { 343 if (rt6i && rt6i->rt6i_dev) {
344 skb2->dev = rt6i->rt6i_dev; 344 skb2->dev = rt6i->rt6i_dev;
345 345
346 rt6i = rt6_lookup(&iph6->daddr, &iph6->saddr, NULL, 0); 346 rt6i = rt6_lookup(&init_net, &iph6->daddr, &iph6->saddr, NULL, 0);
347 347
348 if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) { 348 if (rt6i && rt6i->rt6i_dev && rt6i->rt6i_dev->type == ARPHRD_SIT) {
349 struct ip_tunnel *t = netdev_priv(rt6i->rt6i_dev); 349 struct ip_tunnel *t = netdev_priv(rt6i->rt6i_dev);