diff options
author | Jakub Sitnicki <jkbs@redhat.com> | 2017-08-23 09:58:31 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-24 18:21:17 -0700 |
commit | b673d6cceae2b3e106addd27b79d321cc739bd43 (patch) | |
tree | ea5bbed24d20e64820fe6f5d50e3eabaed660caa /net/ipv6 | |
parent | 956b45318a27cefa5e99fbbbe703ea8a2a3aee13 (diff) | |
download | linux-b673d6cceae2b3e106addd27b79d321cc739bd43.tar.bz2 |
ipv6: Use multipath hash from flow info if available
Allow our callers to influence the choice of ECMP link by honoring the
hash passed together with the flow info. This allows for special
treatment of ICMP errors which we would like to route over the same path
as the IPv6 datagram that triggered the error.
Also go through rt6_multipath_hash(), in the usual case when we aren't
dealing with an ICMP error, so that there is one central place where
multipath hash is computed.
Signed-off-by: Jakub Sitnicki <jkbs@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/route.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 246e7d7d30a4..4d0273459d49 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -452,7 +452,13 @@ static struct rt6_info *rt6_multipath_select(struct rt6_info *match, struct rt6_info *sibling, *next_sibling; int route_choosen; - route_choosen = get_hash_from_flowi6(fl6) % (match->rt6i_nsiblings + 1); + /* We might have already computed the hash for ICMPv6 errors. In such + * case it will always be non-zero. Otherwise now is the time to do it. + */ + if (!fl6->mp_hash) + fl6->mp_hash = rt6_multipath_hash(fl6, NULL); + + route_choosen = fl6->mp_hash % (match->rt6i_nsiblings + 1); /* Don't change the route, if route_choosen == 0 * (siblings does not include ourself) */ |