aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_tunnel.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-04-16 04:23:44 -0400
committerDavid S. Miller <davem@davemloft.net>2008-04-16 04:23:44 -0400
commit2f7f54b725f1a93f0a4daace1a924bee382b33b6 (patch)
tree462d68d932cfa06eb2917cbb27b376d258f67d2c /net/ipv6/ip6_tunnel.c
parent3e6c9fb5f5a4cab0d2342b69d4e46e8f5a08b04e (diff)
[IP6TUNNEL]: Use proper net instead of init_net stubs.
All the ip_route_output_key(), dev_get_by_...() and ipv6_chk_addr() calls are now stubbed with init_net. Fortunately, all the places already have where to get the proper net from. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_tunnel.c')
-rw-r--r--net/ipv6/ip6_tunnel.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index 7d2aa6e772ac..d9b272159097 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -543,7 +543,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
543 fl.fl4_dst = eiph->saddr; 543 fl.fl4_dst = eiph->saddr;
544 fl.fl4_tos = RT_TOS(eiph->tos); 544 fl.fl4_tos = RT_TOS(eiph->tos);
545 fl.proto = IPPROTO_IPIP; 545 fl.proto = IPPROTO_IPIP;
546 if (ip_route_output_key(&init_net, &rt, &fl)) 546 if (ip_route_output_key(dev_net(skb->dev), &rt, &fl))
547 goto out; 547 goto out;
548 548
549 skb2->dev = rt->u.dst.dev; 549 skb2->dev = rt->u.dst.dev;
@@ -555,7 +555,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
555 fl.fl4_dst = eiph->daddr; 555 fl.fl4_dst = eiph->daddr;
556 fl.fl4_src = eiph->saddr; 556 fl.fl4_src = eiph->saddr;
557 fl.fl4_tos = eiph->tos; 557 fl.fl4_tos = eiph->tos;
558 if (ip_route_output_key(&init_net, &rt, &fl) || 558 if (ip_route_output_key(dev_net(skb->dev), &rt, &fl) ||
559 rt->u.dst.dev->type != ARPHRD_TUNNEL) { 559 rt->u.dst.dev->type != ARPHRD_TUNNEL) {
560 ip_rt_put(rt); 560 ip_rt_put(rt);
561 goto out; 561 goto out;
@@ -612,7 +612,8 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
612 skb_reset_network_header(skb2); 612 skb_reset_network_header(skb2);
613 613
614 /* Try to guess incoming interface */ 614 /* Try to guess incoming interface */
615 rt = rt6_lookup(&init_net, &ipv6_hdr(skb2)->saddr, NULL, 0, 0); 615 rt = rt6_lookup(dev_net(skb->dev), &ipv6_hdr(skb2)->saddr,
616 NULL, 0, 0);
616 617
617 if (rt && rt->rt6i_dev) 618 if (rt && rt->rt6i_dev)
618 skb2->dev = rt->rt6i_dev; 619 skb2->dev = rt->rt6i_dev;
@@ -656,16 +657,17 @@ static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
656{ 657{
657 struct ip6_tnl_parm *p = &t->parms; 658 struct ip6_tnl_parm *p = &t->parms;
658 int ret = 0; 659 int ret = 0;
660 struct net *net = dev_net(t->dev);
659 661
660 if (p->flags & IP6_TNL_F_CAP_RCV) { 662 if (p->flags & IP6_TNL_F_CAP_RCV) {
661 struct net_device *ldev = NULL; 663 struct net_device *ldev = NULL;
662 664
663 if (p->link) 665 if (p->link)
664 ldev = dev_get_by_index(&init_net, p->link); 666 ldev = dev_get_by_index(net, p->link);
665 667
666 if ((ipv6_addr_is_multicast(&p->laddr) || 668 if ((ipv6_addr_is_multicast(&p->laddr) ||
667 likely(ipv6_chk_addr(&init_net, &p->laddr, ldev, 0))) && 669 likely(ipv6_chk_addr(net, &p->laddr, ldev, 0))) &&
668 likely(!ipv6_chk_addr(&init_net, &p->raddr, NULL, 0))) 670 likely(!ipv6_chk_addr(net, &p->raddr, NULL, 0)))
669 ret = 1; 671 ret = 1;
670 672
671 if (ldev) 673 if (ldev)
@@ -793,19 +795,20 @@ static inline int ip6_tnl_xmit_ctl(struct ip6_tnl *t)
793{ 795{
794 struct ip6_tnl_parm *p = &t->parms; 796 struct ip6_tnl_parm *p = &t->parms;
795 int ret = 0; 797 int ret = 0;
798 struct net *net = dev_net(t->dev);
796 799
797 if (p->flags & IP6_TNL_F_CAP_XMIT) { 800 if (p->flags & IP6_TNL_F_CAP_XMIT) {
798 struct net_device *ldev = NULL; 801 struct net_device *ldev = NULL;
799 802
800 if (p->link) 803 if (p->link)
801 ldev = dev_get_by_index(&init_net, p->link); 804 ldev = dev_get_by_index(net, p->link);
802 805
803 if (unlikely(!ipv6_chk_addr(&init_net, &p->laddr, ldev, 0))) 806 if (unlikely(!ipv6_chk_addr(net, &p->laddr, ldev, 0)))
804 printk(KERN_WARNING 807 printk(KERN_WARNING
805 "%s xmit: Local address not yet configured!\n", 808 "%s xmit: Local address not yet configured!\n",
806 p->name); 809 p->name);
807 else if (!ipv6_addr_is_multicast(&p->raddr) && 810 else if (!ipv6_addr_is_multicast(&p->raddr) &&
808 unlikely(ipv6_chk_addr(&init_net, &p->raddr, NULL, 0))) 811 unlikely(ipv6_chk_addr(net, &p->raddr, NULL, 0)))
809 printk(KERN_WARNING 812 printk(KERN_WARNING
810 "%s xmit: Routing loop! " 813 "%s xmit: Routing loop! "
811 "Remote address found on this node!\n", 814 "Remote address found on this node!\n",
@@ -858,7 +861,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
858 if ((dst = ip6_tnl_dst_check(t)) != NULL) 861 if ((dst = ip6_tnl_dst_check(t)) != NULL)
859 dst_hold(dst); 862 dst_hold(dst);
860 else { 863 else {
861 dst = ip6_route_output(&init_net, NULL, fl); 864 dst = ip6_route_output(dev_net(dev), NULL, fl);
862 865
863 if (dst->error || xfrm_lookup(&dst, fl, NULL, 0) < 0) 866 if (dst->error || xfrm_lookup(&dst, fl, NULL, 0) < 0)
864 goto tx_err_link_failure; 867 goto tx_err_link_failure;
@@ -1123,7 +1126,8 @@ static void ip6_tnl_link_config(struct ip6_tnl *t)
1123 int strict = (ipv6_addr_type(&p->raddr) & 1126 int strict = (ipv6_addr_type(&p->raddr) &
1124 (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL)); 1127 (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL));
1125 1128
1126 struct rt6_info *rt = rt6_lookup(&init_net, &p->raddr, &p->laddr, 1129 struct rt6_info *rt = rt6_lookup(dev_net(dev),
1130 &p->raddr, &p->laddr,
1127 p->link, strict); 1131 p->link, strict);
1128 1132
1129 if (rt == NULL) 1133 if (rt == NULL)