Lines Matching refs:link
17 bool link_ipv6ll_enabled(Link *link) { in link_ipv6ll_enabled() argument
18 assert(link); in link_ipv6ll_enabled()
23 if (link->flags & IFF_LOOPBACK) in link_ipv6ll_enabled()
26 if (!link->network) in link_ipv6ll_enabled()
29 if (link->iftype == ARPHRD_CAN) in link_ipv6ll_enabled()
32 if (STRPTR_IN_SET(link->kind, "vrf", "wireguard", "ipip", "gre", "sit", "vti", "nlmon")) in link_ipv6ll_enabled()
35 if (link->network->bond) in link_ipv6ll_enabled()
38 return link->network->link_local & ADDRESS_FAMILY_IPV6; in link_ipv6ll_enabled()
41 bool link_may_have_ipv6ll(Link *link) { in link_may_have_ipv6ll() argument
42 assert(link); in link_may_have_ipv6ll()
55 if (link_ipv6ll_enabled(link)) in link_may_have_ipv6ll()
59 if (streq_ptr(link->kind, "wireguard")) { in link_may_have_ipv6ll()
62 if (!link->network) in link_may_have_ipv6ll()
65 ORDERED_HASHMAP_FOREACH(a, link->network->addresses_by_section) { in link_may_have_ipv6ll()
78 IPv6LinkLocalAddressGenMode link_get_ipv6ll_addrgen_mode(Link *link) { in link_get_ipv6ll_addrgen_mode() argument
79 assert(link); in link_get_ipv6ll_addrgen_mode()
81 if (!link_ipv6ll_enabled(link)) in link_get_ipv6ll_addrgen_mode()
84 if (link->network->ipv6ll_address_gen_mode >= 0) in link_get_ipv6ll_addrgen_mode()
85 return link->network->ipv6ll_address_gen_mode; in link_get_ipv6ll_addrgen_mode()
87 if (in6_addr_is_set(&link->network->ipv6ll_stable_secret)) in link_get_ipv6ll_addrgen_mode()
122 int link_update_ipv6ll_addrgen_mode(Link *link, sd_netlink_message *message) { in link_update_ipv6ll_addrgen_mode() argument
126 assert(link); in link_update_ipv6ll_addrgen_mode()
148 mode = (uint8_t) link->ipv6ll_address_gen_mode; in link_update_ipv6ll_addrgen_mode()
161 if (mode == (uint8_t) link->ipv6ll_address_gen_mode) in link_update_ipv6ll_addrgen_mode()
165 …log_link_debug(link, "Received invalid IPv6 link-local address generation mode (%u), ignoring.", m… in link_update_ipv6ll_addrgen_mode()
169 if (link->ipv6ll_address_gen_mode < 0) in link_update_ipv6ll_addrgen_mode()
170 log_link_debug(link, "Saved IPv6 link-local address generation mode: %s", in link_update_ipv6ll_addrgen_mode()
173 log_link_debug(link, "IPv6 link-local address generation mode is changed: %s -> %s", in link_update_ipv6ll_addrgen_mode()
174 … ipv6_link_local_address_gen_mode_to_string(link->ipv6ll_address_gen_mode), in link_update_ipv6ll_addrgen_mode()
177 link->ipv6ll_address_gen_mode = mode; in link_update_ipv6ll_addrgen_mode()
184 int link_set_ipv6ll_stable_secret(Link *link) { in link_set_ipv6ll_stable_secret() argument
189 assert(link); in link_set_ipv6ll_stable_secret()
190 assert(link->network); in link_set_ipv6ll_stable_secret()
192 … if (link->network->ipv6ll_address_gen_mode != IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_STABLE_PRIVACY) in link_set_ipv6ll_stable_secret()
195 if (in6_addr_is_set(&link->network->ipv6ll_stable_secret)) in link_set_ipv6ll_stable_secret()
196 a = link->network->ipv6ll_stable_secret; in link_set_ipv6ll_stable_secret()
205 return log_link_debug_errno(link, r, "Failed to generate key: %m"); in link_set_ipv6ll_stable_secret()
207 v = htole64(siphash24_string(link->ifname, key.bytes)); in link_set_ipv6ll_stable_secret()
212 return log_link_debug_errno(link, r, "Failed to generate key: %m"); in link_set_ipv6ll_stable_secret()
214 v = htole64(siphash24_string(link->ifname, key.bytes)); in link_set_ipv6ll_stable_secret()
223 return sysctl_write_ip_property(AF_INET6, link->ifname, "stable_secret", str); in link_set_ipv6ll_stable_secret()
226 int link_set_ipv6ll_addrgen_mode(Link *link, IPv6LinkLocalAddressGenMode mode) { in link_set_ipv6ll_addrgen_mode() argument
227 assert(link); in link_set_ipv6ll_addrgen_mode()
230 if (mode == link->ipv6ll_address_gen_mode) in link_set_ipv6ll_addrgen_mode()
233 return sysctl_write_ip_property_uint32(AF_INET6, link->ifname, "addr_gen_mode", mode); in link_set_ipv6ll_addrgen_mode()