ipv4: L3 hash-based multipath

Replaces the per-packet multipath with a hash-based multipath using
source and destination address.

Signed-off-by: Peter Nørlund <pch@ordbogen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Peter Nørlund 2015-09-30 10:12:21 +02:00 committed by David S. Miller
parent 2472186f58
commit 0e884c78ee
3 changed files with 98 additions and 72 deletions

View file

@ -1658,8 +1658,12 @@ static int ip_mkroute_input(struct sk_buff *skb,
__be32 daddr, __be32 saddr, u32 tos)
{
#ifdef CONFIG_IP_ROUTE_MULTIPATH
if (res->fi && res->fi->fib_nhs > 1)
fib_select_multipath(res);
if (res->fi && res->fi->fib_nhs > 1) {
int h;
h = fib_multipath_hash(saddr, daddr);
fib_select_multipath(res, h);
}
#endif
/* create a routing cache entry */
@ -2189,8 +2193,12 @@ struct rtable *__ip_route_output_key(struct net *net, struct flowi4 *fl4)
}
#ifdef CONFIG_IP_ROUTE_MULTIPATH
if (res.fi->fib_nhs > 1 && fl4->flowi4_oif == 0)
fib_select_multipath(&res);
if (res.fi->fib_nhs > 1 && fl4->flowi4_oif == 0) {
int h;
h = fib_multipath_hash(fl4->saddr, fl4->daddr);
fib_select_multipath(&res, h);
}
else
#endif
if (!res.prefixlen &&