1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00

network: address: do not adjust user specified scope

This reverts cd1caf30c0.

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.
This commit is contained in:
Yu Watanabe 2021-12-09 15:18:34 +09:00
parent 12caf72716
commit 8f8dc32cc9

View File

@ -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))