ipv4: Make output route lookup return rtable directly.
Instead of on the stack.
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
index e0e77e2..44ba906 100644
--- a/net/ipv4/igmp.c
+++ b/net/ipv4/igmp.c
@@ -325,7 +325,8 @@
struct flowi fl = { .oif = dev->ifindex,
.fl4_dst = IGMPV3_ALL_MCR,
.proto = IPPROTO_IGMP };
- if (ip_route_output_key(net, &rt, &fl)) {
+ rt = ip_route_output_key(net, &fl);
+ if (IS_ERR(rt)) {
kfree_skb(skb);
return NULL;
}
@@ -670,7 +671,8 @@
struct flowi fl = { .oif = dev->ifindex,
.fl4_dst = dst,
.proto = IPPROTO_IGMP };
- if (ip_route_output_key(net, &rt, &fl))
+ rt = ip_route_output_key(net, &fl);
+ if (IS_ERR(rt))
return -1;
}
if (rt->rt_src == 0) {
@@ -1440,7 +1442,6 @@
static struct in_device *ip_mc_find_dev(struct net *net, struct ip_mreqn *imr)
{
struct flowi fl = { .fl4_dst = imr->imr_multiaddr.s_addr };
- struct rtable *rt;
struct net_device *dev = NULL;
struct in_device *idev = NULL;
@@ -1454,9 +1455,12 @@
return NULL;
}
- if (!dev && !ip_route_output_key(net, &rt, &fl)) {
- dev = rt->dst.dev;
- ip_rt_put(rt);
+ if (!dev) {
+ struct rtable *rt = ip_route_output_key(net, &fl);
+ if (!IS_ERR(rt)) {
+ dev = rt->dst.dev;
+ ip_rt_put(rt);
+ }
}
if (dev) {
imr->imr_ifindex = dev->ifindex;