aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ip6_tunnel.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-03-12 00:00:52 -0500
committerDavid S. Miller <davem@davemloft.net>2011-03-12 18:08:42 -0500
commit78fbfd8a653ca972afe479517a40661bfff6d8c3 (patch)
tree9dccc5c16bf269d53d8499064ec95a998e84c646 /net/ipv6/ip6_tunnel.c
parent1561747ddf9d28185548687b11aae7074d6129c4 (diff)
ipv4: Create and use route lookup helpers.
The idea here is this minimizes the number of places one has to edit in order to make changes to how flows are defined and used. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_tunnel.c')
-rw-r--r--net/ipv6/ip6_tunnel.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index ea8d5e8128a9..f199b8486120 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -536,7 +536,6 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
536 int err; 536 int err;
537 struct sk_buff *skb2; 537 struct sk_buff *skb2;
538 struct iphdr *eiph; 538 struct iphdr *eiph;
539 struct flowi fl;
540 struct rtable *rt; 539 struct rtable *rt;
541 540
542 err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code, 541 err = ip6_tnl_err(skb, IPPROTO_IPIP, opt, &rel_type, &rel_code,
@@ -578,11 +577,10 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
578 eiph = ip_hdr(skb2); 577 eiph = ip_hdr(skb2);
579 578
580 /* Try to guess incoming interface */ 579 /* Try to guess incoming interface */
581 memset(&fl, 0, sizeof(fl)); 580 rt = ip_route_output_ports(dev_net(skb->dev), NULL,
582 fl.fl4_dst = eiph->saddr; 581 eiph->saddr, 0,
583 fl.fl4_tos = RT_TOS(eiph->tos); 582 0, 0,
584 fl.proto = IPPROTO_IPIP; 583 IPPROTO_IPIP, RT_TOS(eiph->tos), 0);
585 rt = ip_route_output_key(dev_net(skb->dev), &fl);
586 if (IS_ERR(rt)) 584 if (IS_ERR(rt))
587 goto out; 585 goto out;
588 586
@@ -592,10 +590,11 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
592 if (rt->rt_flags & RTCF_LOCAL) { 590 if (rt->rt_flags & RTCF_LOCAL) {
593 ip_rt_put(rt); 591 ip_rt_put(rt);
594 rt = NULL; 592 rt = NULL;
595 fl.fl4_dst = eiph->daddr; 593 rt = ip_route_output_ports(dev_net(skb->dev), NULL,
596 fl.fl4_src = eiph->saddr; 594 eiph->daddr, eiph->saddr,
597 fl.fl4_tos = eiph->tos; 595 0, 0,
598 rt = ip_route_output_key(dev_net(skb->dev), &fl); 596 IPPROTO_IPIP,
597 RT_TOS(eiph->tos), 0);
599 if (IS_ERR(rt) || 598 if (IS_ERR(rt) ||
600 rt->dst.dev->type != ARPHRD_TUNNEL) { 599 rt->dst.dev->type != ARPHRD_TUNNEL) {
601 if (!IS_ERR(rt)) 600 if (!IS_ERR(rt))