ipv4: Make output route lookup return rtable directly.

Instead of on the stack.

Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
David S. Miller 2011-03-02 14:31:35 -08:00
commit b23dd4fe42
36 changed files with 267 additions and 224 deletions

View file

@ -193,10 +193,11 @@ static int addr4_resolve(struct sockaddr_in *src_in,
fl.nl_u.ip4_u.saddr = src_ip;
fl.oif = addr->bound_dev_if;
ret = ip_route_output_key(&init_net, &rt, &fl);
if (ret)
rt = ip_route_output_key(&init_net, &fl);
if (IS_ERR(rt)) {
ret = PTR_ERR(rt);
goto out;
}
src_in->sin_family = AF_INET;
src_in->sin_addr.s_addr = rt->rt_src;

View file

@ -354,7 +354,8 @@ static struct rtable *find_route(struct t3cdev *dev, __be32 local_ip,
}
};
if (ip_route_output_flow(&init_net, &rt, &fl, NULL))
rt = ip_route_output_flow(&init_net, &fl, NULL);
if (IS_ERR(rt))
return NULL;
return rt;
}

View file

@ -331,7 +331,8 @@ static struct rtable *find_route(struct c4iw_dev *dev, __be32 local_ip,
}
};
if (ip_route_output_flow(&init_net, &rt, &fl, NULL))
rt = ip_route_output_flow(&init_net, &fl, NULL);
if (IS_ERR(rt))
return NULL;
return rt;
}

View file

@ -1112,7 +1112,8 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
memset(&fl, 0, sizeof fl);
fl.nl_u.ip4_u.daddr = htonl(dst_ip);
if (ip_route_output_key(&init_net, &rt, &fl)) {
rt = ip_route_output_key(&init_net, &fl);
if (IS_ERR(rt)) {
printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
__func__, dst_ip);
return rc;