summaryrefslogtreecommitdiff
path: root/src/libsystemd-network/sd-dhcp-server.c
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-10-06 18:12:25 +0200
committerDaniel Mack <github@zonque.org>2015-10-06 18:12:25 +0200
commitac773fd8d56cafe29e9fedecb02655d86bd3fe30 (patch)
tree975b63290cb0075a64e319a572a5086ba0ada268 /src/libsystemd-network/sd-dhcp-server.c
parent8c60d978bd3453659bfa7f4d90a17ba5fa3e0774 (diff)
parent17010c230edf9933176948934276cf18007ccadb (diff)
Merge pull request #1474 from teg/siphash24
siphash: style fixes
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-server.c')
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index d941e6c0de..d27bb561ca 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -741,15 +741,17 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message,
address = existing_lease->address;
else {
struct siphash state;
+ uint64_t hash;
uint32_t next_offer;
/* even with no persistence of leases, we try to offer the same client
the same IP address. we do this by using the hash of the client id
as the offset into the pool of leases when finding the next free one */
- siphash_init(&state, HASH_KEY.bytes);
+ siphash24_init(&state, HASH_KEY.bytes);
client_id_hash_func(&req->client_id, &state);
- next_offer = siphash24_finalize(&state) % server->pool_size;
+ siphash24_finalize((uint8_t*)&hash, &state);
+ next_offer = hash % server->pool_size;
for (i = 0; i < server->pool_size; i++) {
if (!server->bound_leases[next_offer]) {