summaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorTom Herbert <tom@herbertland.com>2015-09-23 14:13:35 -0700
committerDavid S. Miller <davem@davemloft.net>2015-09-23 14:21:09 -0700
commit644d0e6569582872e448b1d39b9338d5e4021faa (patch)
treeae104f0b8cfc26deaa35f81501561f56e5211327 /net/ipv6
parent227b9e8708b14a8a26ef67bbbe19b13626df4a35 (diff)
downloadlinux-644d0e6569582872e448b1d39b9338d5e4021faa.tar.gz
linux-644d0e6569582872e448b1d39b9338d5e4021faa.tar.bz2
linux-644d0e6569582872e448b1d39b9338d5e4021faa.zip
ipv6 Use get_hash_from_flowi6 for rt6 hash
In rt6_info_hash_nhsfn replace the custom hashing over flowi6 that is using xor with a call to common function get_hash_from_flowi6. Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/route.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 53617d715188..111deadc1c06 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -421,31 +421,7 @@ static bool rt6_check_expired(const struct rt6_info *rt)
static int rt6_info_hash_nhsfn(unsigned int candidate_count,
const struct flowi6 *fl6)
{
- unsigned int val = fl6->flowi6_proto;
-
- val ^= ipv6_addr_hash(&fl6->daddr);
- val ^= ipv6_addr_hash(&fl6->saddr);
-
- /* Work only if this not encapsulated */
- switch (fl6->flowi6_proto) {
- case IPPROTO_UDP:
- case IPPROTO_TCP:
- case IPPROTO_SCTP:
- val ^= (__force u16)fl6->fl6_sport;
- val ^= (__force u16)fl6->fl6_dport;
- break;
-
- case IPPROTO_ICMPV6:
- val ^= (__force u16)fl6->fl6_icmp_type;
- val ^= (__force u16)fl6->fl6_icmp_code;
- break;
- }
- /* RFC6438 recommands to use flowlabel */
- val ^= (__force u32)fl6->flowlabel;
-
- /* Perhaps, we need to tune, this function? */
- val = val ^ (val >> 7) ^ (val >> 12);
- return val % candidate_count;
+ return get_hash_from_flowi6(fl6) % candidate_count;
}
static struct rt6_info *rt6_multipath_select(struct rt6_info *match,