diff options
author | Peter Nørlund <pch@ordbogen.com> | 2015-09-30 11:12:21 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-10-05 12:59:21 +0300 |
commit | 0e884c78ee19e902f300ed147083c28a0c6302f0 (patch) | |
tree | 4a60b19eed14b18e7f5473cfd0df6cb6434a57c4 /net/ipv4/route.c | |
parent | 2472186f58ee1e4b9ca194245fef03931f6de90a (diff) | |
download | linux-0e884c78ee19e902f300ed147083c28a0c6302f0.tar.xz |
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>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 76ca4e75f785..0cca44476b1e 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -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 && |