diff options
author | des <des@FreeBSD.org> | 2014-10-18 22:15:11 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2014-10-18 22:15:11 +0000 |
commit | 325f19fddb5797a423025f8aca991a83ea419d87 (patch) | |
tree | aa13f053d13bd078b46dd640e041ab6d63d35d63 /sys/netpfil/pf/pf.c | |
parent | 5165eb29732afe97f688263f6b85d672c8c00f12 (diff) | |
download | FreeBSD-src-325f19fddb5797a423025f8aca991a83ea419d87.zip FreeBSD-src-325f19fddb5797a423025f8aca991a83ea419d87.tar.gz |
Add a complete implementation of MurmurHash3. Tweak both implementations
so they match the established idiom. Document them in hash(9).
MFC after: 1 month
MFC with: r272906
Diffstat (limited to 'sys/netpfil/pf/pf.c')
-rw-r--r-- | sys/netpfil/pf/pf.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index ac4a154..16cd7fb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -374,9 +374,9 @@ pf_hashkey(struct pf_state_key *sk) { uint32_t h; - h = murmur3_aligned_32((uint32_t *)sk, - sizeof(struct pf_state_key_cmp), - V_pf_hashseed); + h = murmur3_32_hash32((uint32_t *)sk, + sizeof(struct pf_state_key_cmp)/sizeof(uint32_t), + V_pf_hashseed); return (h & pf_hashmask); } @@ -388,12 +388,12 @@ pf_hashsrc(struct pf_addr *addr, sa_family_t af) switch (af) { case AF_INET: - h = murmur3_aligned_32((uint32_t *)&addr->v4, - sizeof(addr->v4), V_pf_hashseed); + h = murmur3_32_hash32((uint32_t *)&addr->v4, + sizeof(addr->v4)/sizeof(uint32_t), V_pf_hashseed); break; case AF_INET6: - h = murmur3_aligned_32((uint32_t *)&addr->v6, - sizeof(addr->v6), V_pf_hashseed); + h = murmur3_32_hash32((uint32_t *)&addr->v6, + sizeof(addr->v6)/sizeof(uint32_t), V_pf_hashseed); break; default: panic("%s: unknown address family %u", __func__, af); |