diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2015-11-16 09:21:20 +0100 |
---|---|---|
committer | Daniel Mack <daniel@zonque.org> | 2015-11-16 15:20:29 +0100 |
commit | dbe81cbd2a93088236a2e4e41eeb33378940f7b9 (patch) | |
tree | 8aec120af6f424803074d35827fbfb5048d8a9cf /src/libsystemd-network/sd-dhcp-server.c | |
parent | 8dd85afe761885a9c47173cdafd1b7f9b36d08e6 (diff) |
siphash24: change result argument to uint64_t
Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which
enforce pointer alignment this fixes crashes when we previously cast an
unaligned array to uint64_t*, and on others this should at least improve
performance as the compiler now aligns these properly.
This also simplifies the code in most cases by getting rid of typecasts. The
only place which we can't change is struct duid's en.id, as that is _packed_
and public API, so we can't enforce alignment of the "id" field and have to
use memcpy instead.
Diffstat (limited to 'src/libsystemd-network/sd-dhcp-server.c')
-rw-r--r-- | src/libsystemd-network/sd-dhcp-server.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c index 8d0d9955c3..eeb59bb3da 100644 --- a/src/libsystemd-network/sd-dhcp-server.c +++ b/src/libsystemd-network/sd-dhcp-server.c @@ -753,7 +753,7 @@ int dhcp_server_handle_message(sd_dhcp_server *server, DHCPMessage *message, siphash24_init(&state, HASH_KEY.bytes); client_id_hash_func(&req->client_id, &state); - siphash24_finalize((uint8_t*)&hash, &state); + siphash24_finalize(&hash, &state); next_offer = hash % server->pool_size; for (i = 0; i < server->pool_size; i++) { |