From f58b281ef4b62cfb1910743f7fdaa7fa8d14b638 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 28 Mar 2024 10:25:06 +0100 Subject: [PATCH] ndisc: accept unknown ip6-privacy value The value can be unknown for different reasons: - we don't have a value saved in NMDevice's "ip6_saved_properties" because NM was restarted or because the device didn't have an ifindex when it became managed. - the value read from /proc is outside the allowed range (kernel allows "echo 42 > /proc/sys/net/ipv6/conf/enp1s0/use_tempaddr") Note that the second case was already possible before commit 797f3cafeece ('device: fall back to saved use_tempaddr value instead of rereading /proc'). If we can't determine the previous value, pass "unknown" to ndisc; it will generate a l3cd with "unknown" ip6-privacy, which means to not set the value when committing the configuration. Fixes: 797f3cafeece ('device: fall back to saved use_tempaddr value instead of rereading /proc') https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1907 --- src/core/ndisc/nm-ndisc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c index e6b1a94ea0..ca646a6dad 100644 --- a/src/core/ndisc/nm-ndisc.c +++ b/src/core/ndisc/nm-ndisc.c @@ -1853,6 +1853,7 @@ _config_init(NMNDiscConfig *config, const NMNDiscConfig *src) g_return_if_fail( NM_IN_SET(config->node_type, NM_NDISC_NODE_TYPE_HOST, NM_NDISC_NODE_TYPE_ROUTER)); g_return_if_fail(NM_IN_SET(config->ip6_privacy, + NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN, NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR));