diff options
author | ae <ae@FreeBSD.org> | 2012-12-15 20:04:24 +0000 |
---|---|---|
committer | ae <ae@FreeBSD.org> | 2012-12-15 20:04:24 +0000 |
commit | 6ae87790328612368a591aafd4b04c0db7aefec6 (patch) | |
tree | a876b80e0b1608681ce1ada20d3bdd4662ad9f5e /sys/netinet6/ip6_input.c | |
parent | fa6bd7906ae46bac5811a3dd6b67bd1d3ddb908d (diff) | |
download | FreeBSD-src-6ae87790328612368a591aafd4b04c0db7aefec6.zip FreeBSD-src-6ae87790328612368a591aafd4b04c0db7aefec6.tar.gz |
In additional to the tailq of IPv6 addresses add the hash table.
For now use 256 buckets and fnv_hash function. Use xor'ed 32-bit
s6_addr32 parts of in6_addr structure as a hash key. Update
in6_localip and in6_is_addr_deprecated to use hash table for fastest
lookup.
Sponsored by: Yandex LLC
Discussed with: dwmalone, glebius, bz
Diffstat (limited to 'sys/netinet6/ip6_input.c')
-rw-r--r-- | sys/netinet6/ip6_input.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index f75a11f..45c4ff6 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -126,6 +126,8 @@ extern struct domain inet6domain; u_char ip6_protox[IPPROTO_MAX]; VNET_DEFINE(struct in6_ifaddrhead, in6_ifaddrhead); +VNET_DEFINE(struct in6_ifaddrlisthead *, in6_ifaddrhashtbl); +VNET_DEFINE(u_long, in6_ifaddrhmask); static struct netisr_handler ip6_nh = { .nh_name = "ip6", @@ -170,6 +172,8 @@ ip6_init(void) TUNABLE_INT_FETCH("net.inet6.ip6.no_radr", &V_ip6_no_radr); TAILQ_INIT(&V_in6_ifaddrhead); + V_in6_ifaddrhashtbl = hashinit(IN6ADDR_NHASH, M_IFADDR, + &V_in6_ifaddrhmask); /* Initialize packet filter hooks. */ V_inet6_pfil_hook.ph_type = PFIL_TYPE_AF; @@ -297,6 +301,7 @@ void ip6_destroy() { + hashdestroy(V_in6_ifaddrhashtbl, M_IFADDR, V_in6_ifaddrhmask); nd6_destroy(); callout_drain(&V_in6_tmpaddrtimer_ch); } |