sd-dhcp-server: set DHCPLease::server before hashmap_put()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 26 Jan 2022 15:17:23 +0000 (00:17 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 22 Feb 2022 21:47:38 +0000 (21:47 +0000)
commit1dcd82a7bf4906b6d35cd742a272eede63a3c2b7
tree66cd09f22206e47cd43f66712297e5bcae3c0e76
parentfa6e263273905cfc9e4528e8175ace3d19d881e3
sd-dhcp-server: set DHCPLease::server before hashmap_put()

Otherwise, if the second push is failed, then the first hashmap contains
dirty entry.

Also, this makes hashmap_remove_value() used when removing leases to
make not wrong lease is removed from the hashmap.

Note, this just hide the root cause of the issue #22253, which will be
fixed in later commit.

Fixes #22253.

(cherry picked from commit 8a7d048d1ddb8916482f1422405d3e0e4bccb279)
src/libsystemd-network/sd-dhcp-server.c