From: Yu Watanabe Date: Fri, 1 Nov 2024 16:01:30 +0000 (+0900) Subject: network/address: slightly optimize link_address_is_dynamic() X-Git-Tag: v257-rc1~33^2~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc12457bfdfe206f957f922557d28860ece0175a;p=thirdparty%2Fsystemd.git network/address: slightly optimize link_address_is_dynamic() --- 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;