void client_id_hash_func(const DHCPClientId *id, struct siphash *state) {
assert(id);
- assert(id->length);
+ assert(id->length > 0);
assert(id->data);
siphash24_compress(&id->length, sizeof(id->length), state);
int client_id_compare_func(const DHCPClientId *a, const DHCPClientId *b) {
int r;
- assert(!a->length || a->data);
- assert(!b->length || b->data);
+ assert(a->length > 0);
+ assert(a->data);
+ assert(b->length > 0);
+ assert(b->data);
r = CMP(a->length, b->length);
if (r != 0)
assert_return(server, -EINVAL);
assert_return(client_id, -EINVAL);
+ assert_return(client_id_size > 0, -EINVAL);
assert_return(!sd_dhcp_server_is_running(server), -EBUSY);
/* Static lease with an empty or omitted address is a valid entry,
*lease = (DHCPLease) {
.address = address->s_addr,
.client_id.length = client_id_size,
- .gateway = 0,
- .expiration = 0,
};
lease->client_id.data = memdup(client_id, client_id_size);
if (!lease->client_id.data)