diff options
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r-- | net/ipv6/addrconf.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index ed9938014cf9..b17fafc56241 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -541,6 +541,25 @@ ipv6_link_dev_addr(struct inet6_dev *idev, struct inet6_ifaddr *ifp) | |||
541 | *ifap = ifp; | 541 | *ifap = ifp; |
542 | } | 542 | } |
543 | 543 | ||
544 | /* | ||
545 | * Hash function taken from net_alias.c | ||
546 | */ | ||
547 | static u8 ipv6_addr_hash(const struct in6_addr *addr) | ||
548 | { | ||
549 | __u32 word; | ||
550 | |||
551 | /* | ||
552 | * We perform the hash function over the last 64 bits of the address | ||
553 | * This will include the IEEE address token on links that support it. | ||
554 | */ | ||
555 | |||
556 | word = (__force u32)(addr->s6_addr32[2] ^ addr->s6_addr32[3]); | ||
557 | word ^= (word >> 16); | ||
558 | word ^= (word >> 8); | ||
559 | |||
560 | return ((word ^ (word >> 4)) & 0x0f); | ||
561 | } | ||
562 | |||
544 | /* On success it returns ifp with increased reference count */ | 563 | /* On success it returns ifp with increased reference count */ |
545 | 564 | ||
546 | static struct inet6_ifaddr * | 565 | static struct inet6_ifaddr * |