aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/sit.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/sit.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/sit.c')
-rw-r--r--net/ipv6/sit.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 3534ceaa4fba..43b33373adb2 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -732,17 +732,14 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
732 dst = addr6->s6_addr32[3]; 732 dst = addr6->s6_addr32[3];
733 } 733 }
734 734
735 { 735 rt = ip_route_output_ports(dev_net(dev), NULL,
736 struct flowi fl = { .fl4_dst = dst, 736 dst, tiph->saddr,
737 .fl4_src = tiph->saddr, 737 0, 0,
738 .fl4_tos = RT_TOS(tos), 738 IPPROTO_IPV6, RT_TOS(tos),
739 .oif = tunnel->parms.link, 739 tunnel->parms.link);
740 .proto = IPPROTO_IPV6 }; 740 if (IS_ERR(rt)) {
741 rt = ip_route_output_key(dev_net(dev), &fl); 741 dev->stats.tx_carrier_errors++;
742 if (IS_ERR(rt)) { 742 goto tx_error_icmp;
743 dev->stats.tx_carrier_errors++;
744 goto tx_error_icmp;
745 }
746 } 743 }
747 if (rt->rt_type != RTN_UNICAST) { 744 if (rt->rt_type != RTN_UNICAST) {
748 ip_rt_put(rt); 745 ip_rt_put(rt);
@@ -858,12 +855,12 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev)
858 iph = &tunnel->parms.iph; 855 iph = &tunnel->parms.iph;
859 856
860 if (iph->daddr) { 857 if (iph->daddr) {
861 struct flowi fl = { .fl4_dst = iph->daddr, 858 struct rtable *rt = ip_route_output_ports(dev_net(dev), NULL,
862 .fl4_src = iph->saddr, 859 iph->daddr, iph->saddr,
863 .fl4_tos = RT_TOS(iph->tos), 860 0, 0,
864 .oif = tunnel->parms.link, 861 IPPROTO_IPV6,
865 .proto = IPPROTO_IPV6 }; 862 RT_TOS(iph->tos),
866 struct rtable *rt = ip_route_output_key(dev_net(dev), &fl); 863 tunnel->parms.link);
867 864
868 if (!IS_ERR(rt)) { 865 if (!IS_ERR(rt)) {
869 tdev = rt->dst.dev; 866 tdev = rt->dst.dev;