From 8f8dc32cc98386097586451fea3c4c89d033d17f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 9 Dec 2021 15:18:34 +0900 Subject: [PATCH] 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. --- src/network/networkd-address.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 6eea4ff0bd..f9d21af158 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)) -- 2.25.1