diff options
author | David S. Miller <davem@davemloft.net> | 2011-03-02 17:31:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-02 17:31:35 -0500 |
commit | b23dd4fe42b455af5c6e20966b7d6959fa8352ea (patch) | |
tree | bf97323eae9a8d084170e573ff2c0c40bc72c3cd /net/ipv4/ip_gre.c | |
parent | 452edd598f60522c11f7f88fdbab27eb36509d1a (diff) |
ipv4: Make output route lookup return rtable directly.
Instead of on the stack.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_gre.c')
-rw-r--r-- | net/ipv4/ip_gre.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 6613edfac28c..f9af98dd7561 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -778,7 +778,8 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
778 | .proto = IPPROTO_GRE, | 778 | .proto = IPPROTO_GRE, |
779 | .fl_gre_key = tunnel->parms.o_key | 779 | .fl_gre_key = tunnel->parms.o_key |
780 | }; | 780 | }; |
781 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) { | 781 | rt = ip_route_output_key(dev_net(dev), &fl); |
782 | if (IS_ERR(rt)) { | ||
782 | dev->stats.tx_carrier_errors++; | 783 | dev->stats.tx_carrier_errors++; |
783 | goto tx_error; | 784 | goto tx_error; |
784 | } | 785 | } |
@@ -953,9 +954,9 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev) | |||
953 | .proto = IPPROTO_GRE, | 954 | .proto = IPPROTO_GRE, |
954 | .fl_gre_key = tunnel->parms.o_key | 955 | .fl_gre_key = tunnel->parms.o_key |
955 | }; | 956 | }; |
956 | struct rtable *rt; | 957 | struct rtable *rt = ip_route_output_key(dev_net(dev), &fl); |
957 | 958 | ||
958 | if (!ip_route_output_key(dev_net(dev), &rt, &fl)) { | 959 | if (!IS_ERR(rt)) { |
959 | tdev = rt->dst.dev; | 960 | tdev = rt->dst.dev; |
960 | ip_rt_put(rt); | 961 | ip_rt_put(rt); |
961 | } | 962 | } |
@@ -1215,9 +1216,9 @@ static int ipgre_open(struct net_device *dev) | |||
1215 | .proto = IPPROTO_GRE, | 1216 | .proto = IPPROTO_GRE, |
1216 | .fl_gre_key = t->parms.o_key | 1217 | .fl_gre_key = t->parms.o_key |
1217 | }; | 1218 | }; |
1218 | struct rtable *rt; | 1219 | struct rtable *rt = ip_route_output_key(dev_net(dev), &fl); |
1219 | 1220 | ||
1220 | if (ip_route_output_key(dev_net(dev), &rt, &fl)) | 1221 | if (IS_ERR(rt)) |
1221 | return -EADDRNOTAVAIL; | 1222 | return -EADDRNOTAVAIL; |
1222 | dev = rt->dst.dev; | 1223 | dev = rt->dst.dev; |
1223 | ip_rt_put(rt); | 1224 | ip_rt_put(rt); |