From: Yu Watanabe Date: Thu, 9 Dec 2021 06:18:34 +0000 (+0900) Subject: network: address: do not adjust user specified scope X-Git-Tag: v250-rc1~10^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f8dc32cc98386097586451fea3c4c89d033d17f;p=thirdparty%2Fsystemd.git network: address: do not adjust user specified scope This reverts cd1caf30c0bd0d0c6e8df7610c614f52a7345c40. I cannot remember why such change was made. At least, the kernel does not refuse to set IPv4 localhost address with non-host scope, e.g. global. --- diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 6eea4ff0bda..f9d21af1581 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -1916,19 +1916,8 @@ static int address_section_verify(Address *address) { address->label = mfree(address->label); } - if (in_addr_is_localhost(address->family, &address->in_addr) > 0 && - (address->family == AF_INET || !address->scope_set)) { - /* For IPv4, scope must be always RT_SCOPE_HOST. - * For IPv6, use RT_SCOPE_HOST only when it is not explicitly specified. */ - - if (address->scope_set && address->scope != RT_SCOPE_HOST) - log_warning_errno(SYNTHETIC_ERRNO(EINVAL), - "%s: non-host scope is set for localhost address. " - "Ignoring Scope= setting in the [Address] section from line %u. ", - address->section->filename, address->section->line); - + if (!address->scope_set && in_addr_is_localhost(address->family, &address->in_addr) > 0) address->scope = RT_SCOPE_HOST; - } if (address->family == AF_INET6 && !FLAGS_SET(address->duplicate_address_detection, ADDRESS_FAMILY_IPV6))