From b713a99b1a04507412b387214a26e43a2916bd01 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 11 Aug 2021 16:18:45 +0900 Subject: sd-dhcp-server: support static lease outside of address pool Closes #20341. --- src/libsystemd-network/fuzz-dhcp-server.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/libsystemd-network/fuzz-dhcp-server.c') diff --git a/src/libsystemd-network/fuzz-dhcp-server.c b/src/libsystemd-network/fuzz-dhcp-server.c index 94a8faaa39..e90284f6f2 100644 --- a/src/libsystemd-network/fuzz-dhcp-server.c +++ b/src/libsystemd-network/fuzz-dhcp-server.c @@ -23,7 +23,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { static const uint8_t chaddr[] = {3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3}; uint8_t *client_id; DHCPLease *lease; - int pool_offset; if (size < sizeof(DHCPMessage)) return 0; @@ -46,9 +45,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { lease->gateway = htobe32(UINT32_C(10) << 24 | UINT32_C(1)); lease->expiration = UINT64_MAX; memcpy(lease->chaddr, chaddr, 16); - pool_offset = get_pool_offset(server, lease->address); - server->bound_leases[pool_offset] = lease; - assert_se(hashmap_ensure_put(&server->leases_by_client_id, &dhcp_lease_hash_ops, &lease->client_id, lease) >= 0); + assert_se(hashmap_ensure_put(&server->bound_leases_by_client_id, &dhcp_lease_hash_ops, &lease->client_id, lease) >= 0); + assert_se(hashmap_ensure_put(&server->bound_leases_by_address, NULL, UINT32_TO_PTR(lease->address), lease) >= 0); + lease->server = server; (void) dhcp_server_handle_message(server, (DHCPMessage*)data, size); -- cgit v1.2.3