1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-02-26 09:57:26 +03:00

network: address: also adjust scope when address is link local address

But again only when Scope= is not explicitly specified.
This commit is contained in:
Yu Watanabe 2021-12-09 15:23:32 +09:00
parent 8f8dc32cc9
commit 20228b6d96

View File

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