diff options
author | Joerie de Gram <j.de.gram@gmail.com> | 2022-02-08 14:56:26 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-02-10 09:35:41 +0100 |
commit | 77d65e5659b681209f15ca914cdc7a40e5ead48e (patch) | |
tree | 1d7814ced345f28737ecf244f4985b74919bf43f /src/network/networkd-ipv6ll.c | |
parent | network: move link_set_ipv6ll_stable_secret() to networkd-ipv6ll.c (diff) | |
download | systemd-77d65e5659b681209f15ca914cdc7a40e5ead48e.tar.xz systemd-77d65e5659b681209f15ca914cdc7a40e5ead48e.zip |
network: attempt to trigger kernel IPv6LL address generation
Try to ensure kernel IPv6 link local address generation occurs by
setting the per-if addr_gen_mode sysctl when the link is already up,
instead of the netlink interface (IFLA_INET6_ADDR_GEN_MODE).
The netlink setting is sufficient in cases where the interface is not
yet up when networkd configures an interface - bringing the interface
up will trigger in-kernel address generation.
If the interface is already up, yet the interface has no IPv6LL assigned
setting IFLA_INET6_ADDR_GEN_MODE has no effect.
Writing the addr_gen_mode sysctl is a best effort attempt at triggering
address generation regardless of interface state because it also works
in cases where the interface is already up.
Fixes #22424.
Diffstat (limited to 'src/network/networkd-ipv6ll.c')
-rw-r--r-- | src/network/networkd-ipv6ll.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c index 992be2fca6..79cf679daf 100644 --- a/src/network/networkd-ipv6ll.c +++ b/src/network/networkd-ipv6ll.c @@ -223,6 +223,16 @@ int link_set_ipv6ll_stable_secret(Link *link) { return sysctl_write_ip_property(AF_INET6, link->ifname, "stable_secret", str); } +int link_set_ipv6ll_addrgen_mode(Link *link, IPv6LinkLocalAddressGenMode mode) { + assert(link); + assert(mode >= 0 && mode < _IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_MAX); + + if (mode == link->ipv6ll_address_gen_mode) + return 0; + + return sysctl_write_ip_property_uint32(AF_INET6, link->ifname, "addr_gen_mode", mode); +} + static const char* const ipv6_link_local_address_gen_mode_table[_IPV6_LINK_LOCAL_ADDRESS_GEN_MODE_MAX] = { [IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_EUI64] = "eui64", [IPV6_LINK_LOCAL_ADDRESSS_GEN_MODE_NONE] = "none", |