summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/missing.h1
-rw-r--r--src/network/networkd-link.c15
2 files changed, 15 insertions, 1 deletions
diff --git a/src/basic/missing.h b/src/basic/missing.h
index 651e414395..9b4be5e3d0 100644
--- a/src/basic/missing.h
+++ b/src/basic/missing.h
@@ -565,6 +565,7 @@ struct btrfs_ioctl_quota_ctl_args {
#define IN6_ADDR_GEN_MODE_EUI64 0
#define IN6_ADDR_GEN_MODE_NONE 1
+#define IN6_ADDR_GEN_MODE_STABLE_PRIVACY 2
#endif
#if !HAVE_DECL_IFLA_MACVLAN_FLAGS
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index a021fc886f..9d2f244087 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1607,7 +1607,20 @@ static int link_up(Link *link) {
if (r < 0)
return log_link_error_errno(link, r, "Could not open AF_INET6 container: %m");
- ipv6ll_mode = link_ipv6ll_enabled(link) ? IN6_ADDR_GEN_MODE_EUI64 : IN6_ADDR_GEN_MODE_NONE;
+ if (!link_ipv6ll_enabled(link))
+ ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE;
+ else {
+ const char *p = NULL;
+ _cleanup_free_ char *stable_secret = NULL;
+
+ p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/stable_secret");
+ r = read_one_line_file(p, &stable_secret);
+
+ if (r < 0)
+ ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64;
+ else
+ ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
+ }
r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
if (r < 0)
return log_link_error_errno(link, r, "Could not append IFLA_INET6_ADDR_GEN_MODE: %m");