network: split link_may_have_ipv6ll() into two

This renames and splits link_may_have_ipv6ll() into
link_ipv6ll_enabled_harder() and link_multicast_enabled(),
as they are completely irrelevant to each other.

Also, this makes link_ipv6ll_enabled_harder() work non-Wireguard
interfaces.
This commit is contained in:
Yu Watanabe
2025-07-11 20:53:04 +09:00
parent 2b69797b6d
commit 291b6feedd
7 changed files with 36 additions and 33 deletions
+12 -1
View File
@@ -133,7 +133,7 @@ bool link_ipv6_enabled(Link *link) {
if (link->network->bond)
return false;
if (link_may_have_ipv6ll(link, /* check_multicast = */ false))
if (link_ipv6ll_enabled(link))
return true;
if (network_has_static_ipv6_configurations(link->network))
@@ -2126,6 +2126,17 @@ bool link_has_carrier(Link *link) {
return netif_has_carrier(link->kernel_operstate, link->flags);
}
bool link_multicast_enabled(Link *link) {
assert(link);
/* If Multicast= is specified, use the value. */
if (link->network && link->network->multicast >= 0)
return link->network->multicast;
/* Otherwise, return the current state. */
return FLAGS_SET(link->flags, IFF_MULTICAST);
}
#define FLAG_STRING(string, flag, old, new) \
(((old ^ new) & flag) \
? ((old & flag) ? (" -" string) : (" +" string)) \