From 20228b6d9630b953fdc0863b669dce1fad647d68 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 9 Dec 2021 15:23:32 +0900 Subject: [PATCH] network: address: also adjust scope when address is link local address But again only when Scope= is not explicitly specified. --- src/network/networkd-address.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index f9d21af158..618c278abf 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -1916,8 +1916,12 @@ static int address_section_verify(Address *address) { address->label = mfree(address->label); } - if (!address->scope_set && in_addr_is_localhost(address->family, &address->in_addr) > 0) - address->scope = RT_SCOPE_HOST; + if (!address->scope_set) { + if (in_addr_is_localhost(address->family, &address->in_addr) > 0) + address->scope = RT_SCOPE_HOST; + else if (in_addr_is_link_local(address->family, &address->in_addr) > 0) + address->scope = RT_SCOPE_LINK; + } if (address->family == AF_INET6 && !FLAGS_SET(address->duplicate_address_detection, ADDRESS_FAMILY_IPV6)) -- 2.25.1