From dc12457bfdfe206f957f922557d28860ece0175a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 2 Nov 2024 01:01:30 +0900 Subject: [PATCH] network/address: slightly optimize link_address_is_dynamic() --- src/network/networkd-address.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index d580840a26e..452258891cf 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -1270,6 +1270,10 @@ bool link_address_is_dynamic(const Link *link, const Address *address) { if (address->lifetime_preferred_usec != USEC_INFINITY) return true; + /* There is no way to drtermine if the IPv6 address is dynamic when the lifetime is infinity. */ + if (address->family != AF_INET) + return false; + /* Even when the address is leased from a DHCP server, networkd assign the address * without lifetime when KeepConfiguration=dhcp. So, let's check that we have * corresponding routes with RTPROT_DHCP. */ @@ -1277,7 +1281,7 @@ bool link_address_is_dynamic(const Link *link, const Address *address) { if (route->source != NETWORK_CONFIG_SOURCE_FOREIGN) continue; - /* The route is not assigned yet, or already removed. Ignoring. */ + /* The route is not assigned yet, or already being removed. Ignoring. */ if (!route_exists(route)) continue; -- 2.47.3