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>
This commit is contained in:
David S. Miller
2011-03-12 00:00:52 -05:00
parent 1561747ddf
commit 78fbfd8a65
23 changed files with 204 additions and 324 deletions

View File

@@ -98,12 +98,7 @@ __ip_vs_get_out_rt(struct sk_buff *skb, struct ip_vs_dest *dest,
spin_lock(&dest->dst_lock);
if (!(rt = (struct rtable *)
__ip_vs_dst_check(dest, rtos))) {
struct flowi fl = {
.fl4_dst = dest->addr.ip,
.fl4_tos = rtos,
};
rt = ip_route_output_key(net, &fl);
rt = ip_route_output(net, dest->addr.ip, 0, rtos, 0);
if (IS_ERR(rt)) {
spin_unlock(&dest->dst_lock);
IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n",
@@ -117,12 +112,7 @@ __ip_vs_get_out_rt(struct sk_buff *skb, struct ip_vs_dest *dest,
}
spin_unlock(&dest->dst_lock);
} else {
struct flowi fl = {
.fl4_dst = daddr,
.fl4_tos = rtos,
};
rt = ip_route_output_key(net, &fl);
rt = ip_route_output(net, daddr, 0, rtos, 0);
if (IS_ERR(rt)) {
IP_VS_DBG_RL("ip_route_output error, dest: %pI4\n",
&daddr);