]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: keep static lease section valid on MACAddress= reset
authornoxiouz <atiurin@proton.me>
Tue, 7 Apr 2026 13:47:44 +0000 (14:47 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 8 Apr 2026 11:57:39 +0000 (13:57 +0200)
config_parse_dhcp_static_lease_hwaddr() uses a cleanup helper that marks
a lease section invalid unless ownership is taken.

Add TAKE_PTR(lease) on the empty-rvalue reset path so subsequent valid
MACAddress= assignments in the same section are not dropped.

Co-developed-by: Codex (GPT-5) <noreply@openai.com>
src/network/networkd-dhcp-server-static-lease.c

index 2f04232c49f1c735ec75a9aa2c90093096027424..2814be8987ccafdc4ced715b898d829bddffc86a 100644 (file)
@@ -188,6 +188,7 @@ int config_parse_dhcp_static_lease_hwaddr(
         if (isempty(rvalue)) {
                 lease->client_id = mfree(lease->client_id);
                 lease->client_id_size = 0;
+                TAKE_PTR(lease);
                 return 0;
         }