]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/dhcp6: return earlier if no lease acquired
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 9 Apr 2024 01:49:32 +0000 (10:49 +0900)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 9 Apr 2024 07:39:36 +0000 (09:39 +0200)
Previously, even If an interface has not acquired a DHCPv6 lease,
networkd logs a misleading message:
===
Apr 09 10:44:57 systemd-networkd[3970750]: veth99: DHCPv6 lease lost
===
The function should do nothing when no lease acquired. Let's return
earlier and suppress the log message.

src/network/networkd-dhcp6.c

index d280251e07e16715b359ecd433291f227c199622..cf643194d58f55bab25792aa7339ab409143665f 100644 (file)
@@ -352,6 +352,9 @@ static int dhcp6_lease_lost(Link *link) {
         assert(link);
         assert(link->manager);
 
+        if (!link->dhcp6_lease)
+                return 0;
+
         log_link_info(link, "DHCPv6 lease lost");
 
         if (sd_dhcp6_lease_has_pd_prefix(link->dhcp6_lease))