diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-04-16 04:10:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-16 04:10:44 -0400 |
commit | 96635522f7930025b8a56a7075db82c48a454a30 (patch) | |
tree | 17b8d7e0d79b94d2dc1cc25e1b8e51b5598f02b1 | |
parent | eb8ce741a3c4d4ba5f345ff19689c7d2e4555668 (diff) |
[GRE]: Use proper net in routing calls.
As for the IPIP tunnel, there are some ip_route_output_key()
calls in there that require a proper net so give one to them.
And a proper net for the __get_dev_by_index hanging around.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/ip_gre.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 74d4c515772e..aa973812edc1 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -493,7 +493,7 @@ out: | |||
493 | fl.fl4_dst = eiph->saddr; | 493 | fl.fl4_dst = eiph->saddr; |
494 | fl.fl4_tos = RT_TOS(eiph->tos); | 494 | fl.fl4_tos = RT_TOS(eiph->tos); |
495 | fl.proto = IPPROTO_GRE; | 495 | fl.proto = IPPROTO_GRE; |
496 | if (ip_route_output_key(&init_net, &rt, &fl)) { | 496 | if (ip_route_output_key(dev_net(skb->dev), &rt, &fl)) { |
497 | kfree_skb(skb2); | 497 | kfree_skb(skb2); |
498 | return; | 498 | return; |
499 | } | 499 | } |
@@ -506,7 +506,7 @@ out: | |||
506 | fl.fl4_dst = eiph->daddr; | 506 | fl.fl4_dst = eiph->daddr; |
507 | fl.fl4_src = eiph->saddr; | 507 | fl.fl4_src = eiph->saddr; |
508 | fl.fl4_tos = eiph->tos; | 508 | fl.fl4_tos = eiph->tos; |
509 | if (ip_route_output_key(&init_net, &rt, &fl) || | 509 | if (ip_route_output_key(dev_net(skb->dev), &rt, &fl) || |
510 | rt->u.dst.dev->type != ARPHRD_IPGRE) { | 510 | rt->u.dst.dev->type != ARPHRD_IPGRE) { |
511 | ip_rt_put(rt); | 511 | ip_rt_put(rt); |
512 | kfree_skb(skb2); | 512 | kfree_skb(skb2); |
@@ -762,7 +762,7 @@ static int ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
762 | .saddr = tiph->saddr, | 762 | .saddr = tiph->saddr, |
763 | .tos = RT_TOS(tos) } }, | 763 | .tos = RT_TOS(tos) } }, |
764 | .proto = IPPROTO_GRE }; | 764 | .proto = IPPROTO_GRE }; |
765 | if (ip_route_output_key(&init_net, &rt, &fl)) { | 765 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { |
766 | tunnel->stat.tx_carrier_errors++; | 766 | tunnel->stat.tx_carrier_errors++; |
767 | goto tx_error; | 767 | goto tx_error; |
768 | } | 768 | } |
@@ -935,7 +935,7 @@ static void ipgre_tunnel_bind_dev(struct net_device *dev) | |||
935 | .tos = RT_TOS(iph->tos) } }, | 935 | .tos = RT_TOS(iph->tos) } }, |
936 | .proto = IPPROTO_GRE }; | 936 | .proto = IPPROTO_GRE }; |
937 | struct rtable *rt; | 937 | struct rtable *rt; |
938 | if (!ip_route_output_key(&init_net, &rt, &fl)) { | 938 | if (!ip_route_output_key(dev_net(dev), &rt, &fl)) { |
939 | tdev = rt->u.dst.dev; | 939 | tdev = rt->u.dst.dev; |
940 | ip_rt_put(rt); | 940 | ip_rt_put(rt); |
941 | } | 941 | } |
@@ -943,7 +943,7 @@ static void ipgre_tunnel_bind_dev(struct net_device *dev) | |||
943 | } | 943 | } |
944 | 944 | ||
945 | if (!tdev && tunnel->parms.link) | 945 | if (!tdev && tunnel->parms.link) |
946 | tdev = __dev_get_by_index(&init_net, tunnel->parms.link); | 946 | tdev = __dev_get_by_index(dev_net(dev), tunnel->parms.link); |
947 | 947 | ||
948 | if (tdev) { | 948 | if (tdev) { |
949 | hlen = tdev->hard_header_len; | 949 | hlen = tdev->hard_header_len; |
@@ -1193,7 +1193,7 @@ static int ipgre_open(struct net_device *dev) | |||
1193 | .tos = RT_TOS(t->parms.iph.tos) } }, | 1193 | .tos = RT_TOS(t->parms.iph.tos) } }, |
1194 | .proto = IPPROTO_GRE }; | 1194 | .proto = IPPROTO_GRE }; |
1195 | struct rtable *rt; | 1195 | struct rtable *rt; |
1196 | if (ip_route_output_key(&init_net, &rt, &fl)) | 1196 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) |
1197 | return -EADDRNOTAVAIL; | 1197 | return -EADDRNOTAVAIL; |
1198 | dev = rt->u.dst.dev; | 1198 | dev = rt->u.dst.dev; |
1199 | ip_rt_put(rt); | 1199 | ip_rt_put(rt); |