diff options
Diffstat (limited to 'net/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 71465955520b..da5941f18c3c 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -769,20 +769,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
769 | tos = ipv6_get_dsfield((struct ipv6hdr *)old_iph); | 769 | tos = ipv6_get_dsfield((struct ipv6hdr *)old_iph); |
770 | } | 770 | } |
771 | 771 | ||
772 | { | 772 | rt = ip_route_output_gre(dev_net(dev), dst, tiph->saddr, |
773 | struct flowi fl = { | 773 | tunnel->parms.o_key, RT_TOS(tos), |
774 | .oif = tunnel->parms.link, | 774 | tunnel->parms.link); |
775 | .fl4_dst = dst, | 775 | if (IS_ERR(rt)) { |
776 | .fl4_src = tiph->saddr, | 776 | dev->stats.tx_carrier_errors++; |
777 | .fl4_tos = RT_TOS(tos), | 777 | goto tx_error; |
778 | .proto = IPPROTO_GRE, | ||
779 | .fl_gre_key = tunnel->parms.o_key | ||
780 | }; | ||
781 | rt = ip_route_output_key(dev_net(dev), &fl); | ||
782 | if (IS_ERR(rt)) { | ||
783 | dev->stats.tx_carrier_errors++; | ||
784 | goto tx_error; | ||
785 | } | ||
786 | } | 778 | } |
787 | tdev = rt->dst.dev; | 779 | tdev = rt->dst.dev; |
788 | 780 | ||
@@ -946,15 +938,11 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev) | |||
946 | /* Guess output device to choose reasonable mtu and needed_headroom */ | 938 | /* Guess output device to choose reasonable mtu and needed_headroom */ |
947 | 939 | ||
948 | if (iph->daddr) { | 940 | if (iph->daddr) { |
949 | struct flowi fl = { | 941 | struct rtable *rt = ip_route_output_gre(dev_net(dev), |
950 | .oif = tunnel->parms.link, | 942 | iph->daddr, iph->saddr, |
951 | .fl4_dst = iph->daddr, | 943 | tunnel->parms.o_key, |
952 | .fl4_src = iph->saddr, | 944 | RT_TOS(iph->tos), |
953 | .fl4_tos = RT_TOS(iph->tos), | 945 | tunnel->parms.link); |
954 | .proto = IPPROTO_GRE, | ||
955 | .fl_gre_key = tunnel->parms.o_key | ||
956 | }; | ||
957 | struct rtable *rt = ip_route_output_key(dev_net(dev), &fl); | ||
958 | 946 | ||
959 | if (!IS_ERR(rt)) { | 947 | if (!IS_ERR(rt)) { |
960 | tdev = rt->dst.dev; | 948 | tdev = rt->dst.dev; |
@@ -1208,15 +1196,12 @@ static int ipgre_open(struct net_device *dev) | |||
1208 | struct ip_tunnel *t = netdev_priv(dev); | 1196 | struct ip_tunnel *t = netdev_priv(dev); |
1209 | 1197 | ||
1210 | if (ipv4_is_multicast(t->parms.iph.daddr)) { | 1198 | if (ipv4_is_multicast(t->parms.iph.daddr)) { |
1211 | struct flowi fl = { | 1199 | struct rtable *rt = ip_route_output_gre(dev_net(dev), |
1212 | .oif = t->parms.link, | 1200 | t->parms.iph.daddr, |
1213 | .fl4_dst = t->parms.iph.daddr, | 1201 | t->parms.iph.saddr, |
1214 | .fl4_src = t->parms.iph.saddr, | 1202 | t->parms.o_key, |
1215 | .fl4_tos = RT_TOS(t->parms.iph.tos), | 1203 | RT_TOS(t->parms.iph.tos), |
1216 | .proto = IPPROTO_GRE, | 1204 | t->parms.link); |
1217 | .fl_gre_key = t->parms.o_key | ||
1218 | }; | ||
1219 | struct rtable *rt = ip_route_output_key(dev_net(dev), &fl); | ||
1220 | 1205 | ||
1221 | if (IS_ERR(rt)) | 1206 | if (IS_ERR(rt)) |
1222 | return -EADDRNOTAVAIL; | 1207 | return -EADDRNOTAVAIL; |