diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-01-02 22:06:45 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2024-01-03 07:20:31 +0100 |
commit | dd8ab4a2060ed1dd0ccf1044f221750bd193cd85 (patch) | |
tree | 799fed9841098ec8fa8663c85262b65dd8d24f85 /src/libsystemd-network/fuzz-dhcp-server.c | |
parent | sd-dhcp-server: use sd_dhcp_client_id (diff) | |
download | systemd-dd8ab4a2060ed1dd0ccf1044f221750bd193cd85.tar.xz systemd-dd8ab4a2060ed1dd0ccf1044f221750bd193cd85.zip |
sd-dhcp-server: rename DHCPLease -> sd_dhcp_server_lease
Then, move basic functions for the object to sd-dhcp-server-lease.[ch].
No effective funcional changes.
Diffstat (limited to 'src/libsystemd-network/fuzz-dhcp-server.c')
-rw-r--r-- | src/libsystemd-network/fuzz-dhcp-server.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/libsystemd-network/fuzz-dhcp-server.c b/src/libsystemd-network/fuzz-dhcp-server.c index 3929a2a4d7..3e1efcf7fe 100644 --- a/src/libsystemd-network/fuzz-dhcp-server.c +++ b/src/libsystemd-network/fuzz-dhcp-server.c @@ -18,16 +18,17 @@ ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags) { } static int add_lease(sd_dhcp_server *server, const struct in_addr *server_address, uint8_t i) { - _cleanup_(dhcp_lease_freep) DHCPLease *lease = NULL; + _cleanup_(sd_dhcp_server_lease_unrefp) sd_dhcp_server_lease *lease = NULL; int r; assert(server); - lease = new(DHCPLease, 1); + lease = new(sd_dhcp_server_lease, 1); if (!lease) return -ENOMEM; - *lease = (DHCPLease) { + *lease = (sd_dhcp_server_lease) { + .n_ref = 1, .address = htobe32(UINT32_C(10) << 24 | i), .chaddr = { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, .expiration = UINT64_MAX, @@ -41,13 +42,7 @@ static int add_lease(sd_dhcp_server *server, const struct in_addr *server_addres lease->client_id.raw[0] = 2; lease->client_id.raw[1] = i; - lease->server = server; /* This must be set just before hashmap_put(). */ - - r = hashmap_ensure_put(&server->bound_leases_by_client_id, &dhcp_lease_hash_ops, &lease->client_id, lease); - if (r < 0) - return r; - - r = hashmap_ensure_put(&server->bound_leases_by_address, NULL, UINT32_TO_PTR(lease->address), lease); + r = dhcp_server_put_lease(server, lease, /* is_static = */ false); if (r < 0) return r; |