diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-06 14:02:10 +0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-06 14:02:10 +0300 |
commit | 20d2f7851ac44bd6845d060a952461f5a10e9c87 (patch) | |
tree | 8fd714c7ffa680e3811361d6e5aa7d08f226247d /src/resolve/resolved-dns-server.c | |
parent | c48eb61fa72205615e3a2bec9fb6576a5973fc6b (diff) | |
parent | 1e2527a6fede996a429bd44b30a15e76ee293437 (diff) |
Merge pull request #1465 from teg/siphash24
hashmap/siphash24: refactor hash functions
Diffstat (limited to 'src/resolve/resolved-dns-server.c')
-rw-r--r-- | src/resolve/resolved-dns-server.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/resolve/resolved-dns-server.c b/src/resolve/resolved-dns-server.c index 2ff5b192df..8693911e65 100644 --- a/src/resolve/resolved-dns-server.c +++ b/src/resolve/resolved-dns-server.c @@ -137,14 +137,13 @@ void dns_server_packet_lost(DnsServer *s, usec_t usec) { s->resend_timeout = MIN(s->resend_timeout * 2, DNS_TIMEOUT_MAX_USEC); } -static unsigned long dns_server_hash_func(const void *p, const uint8_t hash_key[HASH_KEY_SIZE]) { +static void dns_server_hash_func(const void *p, struct siphash *state) { const DnsServer *s = p; - uint64_t u; - siphash24((uint8_t*) &u, &s->address, FAMILY_ADDRESS_SIZE(s->family), hash_key); - u = u * hash_key[0] + u + s->family; + assert(s); - return u; + siphash24_compress(&s->family, sizeof(s->family), state); + siphash24_compress(&s->address, FAMILY_ADDRESS_SIZE(s->family), state); } static int dns_server_compare_func(const void *a, const void *b) { |