all: make "ipv6.addr-gen-mode" configurable by global default

It can be useful to choose a different "ipv6.addr-gen-mode". And it can be
useful to override the default for a set of profiles.

For example, in cloud or in a data center, stable-privacy might not be
the best choice. Add a mechanism to override the default via global defaults
in NetworkManager.conf:

  # /etc/NetworkManager/conf.d/90-ipv6-addr-gen-mode-override.conf
  [connection-90-ipv6-addr-gen-mode-override]
  match-device=type:ethernet
  ipv6.addr-gen-mode=0

"ipv6.addr-gen-mode" is a special property, because its default depends on
the component that configures the profile.

- when read from disk (keyfile and ifcfg-rh), a missing addr-gen-mode
  key means to default to "eui64".
- when configured via D-Bus, a missing addr-gen-mode property means to
  default to "stable-privacy".
- libnm's ip6-config::addr-gen-mode property defaults to
  "stable-privacy".
- when some tool creates a profile, they either can explicitly
  set the mode, or they get the default of the underlying mechanisms
  above.

  - nm-initrd-generator explicitly sets "eui64" for profiles it creates.
  - nmcli doesn' explicitly set it, but inherits the default form
    libnm's ip6-config::addr-gen-mode.
  - when NM creates a auto-default-connection for ethernet ("Wired connection 1"),
    it inherits the default from libnm's ip6-config::addr-gen-mode.

Global connection defaults only take effect when the per-profile
value is set to a special default/unset value. To account for the
different cases above, we add two such special values: "default" and
"default-or-eui64". That's something we didn't do before, but it seams
useful and easy to understand.

Also, this neatly expresses the current behaviors we already have. E.g.
if you don't specify the "addr-gen-mode" in a keyfile, "default-or-eui64"
is a pretty clear thing.

Note that usually we cannot change default values, in particular not for
libnm's properties. That is because we don't serialize the default
values to D-Bus/keyfile, so if we change the default, we change
behavior. Here we change from "stable-privacy" to "default" and
from "eui64" to "default-or-eui64". That means, the user only experiences
a change in behavior, if they have a ".conf" file that overrides the default.

https://bugzilla.redhat.com/show_bug.cgi?id=1743161
https://bugzilla.redhat.com/show_bug.cgi?id=2082682

See-also: https://github.com/coreos/fedora-coreos-tracker/issues/907

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1213
This commit is contained in:
Thomas Haller 2022-05-06 16:57:51 +02:00
parent 7f766014c5
commit e6a33c04eb
No known key found for this signature in database
GPG Key ID: 29C2366E4DFC5728
49 changed files with 852 additions and 764 deletions

View File

@ -936,6 +936,12 @@ ipv6.ip6-privacy=0
removes extraneous routes from the tables.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ipv6.addr-gen-mode</varname></term>
<listitem><para>If the per-profile setting is either "default" or "default-or-eui64", the
global default is used. If the default is unspecified, the fallback value is either "stable-privacy"
or "eui64", depending on whether the per-profile setting is "default" or "default-or-eui64, respectively.</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>ipv6.ra-timeout</varname></term>
<listitem><para>If left unspecified, the default value depends on the sysctl solicitation settings.</para></listitem>

View File

@ -2169,6 +2169,50 @@ _prop_get_ipv6_ip6_privacy(NMDevice *self)
return _ip6_privacy_clamp(ip6_privacy);
}
static NMSettingIP6ConfigAddrGenMode
_prop_get_ipv6_addr_gen_mode(NMDevice *self)
{
NMSettingIP6ConfigAddrGenMode addr_gen_mode;
NMSettingIP6Config *s_ip6;
gint64 c;
g_return_val_if_fail(self, NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY);
s_ip6 = nm_device_get_applied_setting(self, NM_TYPE_SETTING_IP6_CONFIG);
if (s_ip6) {
addr_gen_mode = nm_setting_ip6_config_get_addr_gen_mode(s_ip6);
if (NM_IN_SET(addr_gen_mode,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY))
return addr_gen_mode;
} else
addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT;
nm_assert(NM_IN_SET(addr_gen_mode,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT));
c = nm_config_data_get_connection_default_int64(NM_CONFIG_GET_DATA,
NM_CON_DEFAULT("ipv6.addr-gen-mode"),
self,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT,
-1);
if (c != -1)
addr_gen_mode = c;
if (addr_gen_mode == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT)
addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY;
else if (addr_gen_mode == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64)
addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64;
nm_assert(NM_IN_SET(addr_gen_mode,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY));
return addr_gen_mode;
}
static const char *
_prop_get_x_cloned_mac_address(NMDevice *self, NMConnection *connection, gboolean is_wifi)
{
@ -10761,7 +10805,6 @@ _dev_ipll6_start(NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
NMConnection *connection;
NMSettingIP6Config *s_ip6 = NULL;
gboolean assume;
const char *ifname;
NML3IPv6LLState llstate;
@ -10782,14 +10825,10 @@ _dev_ipll6_start(NMDevice *self)
}
connection = nm_device_get_applied_connection(self);
if (connection)
s_ip6 = NM_SETTING_IP6_CONFIG(nm_connection_get_setting_ip6_config(connection));
assume = nm_device_sys_iface_state_is_external_or_assume(self);
if (s_ip6
&& nm_setting_ip6_config_get_addr_gen_mode(s_ip6)
== NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY) {
if (_prop_get_ipv6_addr_gen_mode(self) == NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY) {
NMUtilsStableType stable_type;
const char *stable_id;
@ -11484,7 +11523,7 @@ _dev_ipac6_start(NMDevice *self)
.ifname = nm_device_get_ip_iface(self),
.stable_type = stable_type,
.network_id = stable_id,
.addr_gen_mode = nm_setting_ip6_config_get_addr_gen_mode(s_ip),
.addr_gen_mode = _prop_get_ipv6_addr_gen_mode(self),
.node_type = node_type,
.max_addresses = max_addresses,
.router_solicitations = router_solicitations,

View File

@ -2555,7 +2555,13 @@ make_ip6_setting(shvarFile *ifcfg, shvarFile *network_ifcfg, gboolean routes_rea
}
}
i_val = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64;
/* IPv6 tokenized interface identifier */
nm_clear_g_free(&value);
v = svGetValueStr(ifcfg, "IPV6_TOKEN", &value);
if (v)
g_object_set(s_ip6, NM_SETTING_IP6_CONFIG_TOKEN, v, NULL);
i_val = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64;
if (!svGetValueEnum(ifcfg,
"IPV6_ADDR_GEN_MODE",
nm_setting_ip6_config_addr_gen_mode_get_type(),
@ -2563,15 +2569,14 @@ make_ip6_setting(shvarFile *ifcfg, shvarFile *network_ifcfg, gboolean routes_rea
&local)) {
PARSE_WARNING("%s", local->message);
g_clear_error(&local);
} else if (errno == ENOENT) {
/* The key is not specified. If "v" (IPV6_TOKEN) is set,
* we default to EUI64. Otherwise, the connection would not verify. */
if (v)
i_val = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64;
}
g_object_set(s_ip6, NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, i_val, NULL);
/* IPv6 tokenized interface identifier */
nm_clear_g_free(&value);
v = svGetValueStr(ifcfg, "IPV6_TOKEN", &value);
if (v)
g_object_set(s_ip6, NM_SETTING_IP6_CONFIG_TOKEN, v, NULL);
/* DNS servers
* Pick up just IPv6 addresses (IPv4 addresses are taken by make_ip4_setting())
*/

View File

@ -3167,7 +3167,7 @@ write_ip6_setting(NMConnection *connection, shvarFile *ifcfg, GString **out_rout
/* IPv6 Address generation mode */
addr_gen_mode = nm_setting_ip6_config_get_addr_gen_mode(NM_SETTING_IP6_CONFIG(s_ip6));
if (addr_gen_mode != NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64) {
if (addr_gen_mode != NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64) {
svSetValueEnum(ifcfg,
"IPV6_ADDR_GEN_MODE",
nm_setting_ip6_config_addr_gen_mode_get_type(),

View File

@ -13,4 +13,4 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default

View File

@ -28,7 +28,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test User 1"
UUID=${UUID}
ONBOOT=yes

View File

@ -13,7 +13,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Bond Main"
UUID=${UUID}
DEVICE=bond0

View File

@ -7,7 +7,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Permissions"
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Proxy Basic"
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
ROUTING_RULE_1="priority 10 from 0.0.0.0/0 table 1"
ROUTING_RULE_2="priority 10 to 192.167.8.0/24 table 2"
ROUTING_RULE6_3="priority 10 from ::/0 table 10"

View File

@ -15,7 +15,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write VLAN reorder_hdr"
UUID=${UUID}
ONBOOT=no

View File

@ -13,7 +13,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wi-Fi AP Mode"
UUID=${UUID}
ONBOOT=yes

View File

@ -12,7 +12,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wi-Fi Band A"
UUID=${UUID}
ONBOOT=yes

View File

@ -11,7 +11,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wi-Fi Hidden"
UUID=${UUID}
ONBOOT=yes

View File

@ -12,7 +12,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wi-Fi MAC always"
UUID=${UUID}
ONBOOT=yes

View File

@ -11,7 +11,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wi-Fi MAC default"
UUID=${UUID}
ONBOOT=yes

View File

@ -12,7 +12,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wi-Fi MAC missing"
UUID=${UUID}
ONBOOT=yes

View File

@ -12,7 +12,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wi-Fi MAC never"
UUID=${UUID}
ONBOOT=yes

View File

@ -13,7 +13,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wifi LEAP"
UUID=${UUID}
ONBOOT=yes

View File

@ -12,7 +12,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wifi WEP 104 ASCII"
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wired Auto-Negotiate"
UUID=${UUID}
ONBOOT=yes

View File

@ -19,6 +19,7 @@ ARPING_WAIT=1
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME="Test Write Wired Static Routes"
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wired Wake-on-LAN"
UUID=${UUID}
ONBOOT=yes

View File

@ -10,6 +10,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME="Test Write Wired with Match setting"
UUID=${UUID}
ONBOOT=yes

View File

@ -33,7 +33,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME=dcb-test
UUID=${UUID}
DEVICE=eth0

View File

@ -10,6 +10,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME="random wifi connection"
UUID=${UUID}
ONBOOT=yes

View File

@ -10,6 +10,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME="random wifi connection 2"
UUID=${UUID}
ONBOOT=yes

View File

@ -8,6 +8,7 @@ IPV6_DISABLED=yes
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=eui64
NAME="Test Write Wired Disabled IP6"
UUID=${UUID}
ONBOOT=yes

View File

@ -14,7 +14,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write SR-IOV config"
UUID=${UUID}
DEVICE=eth0

View File

@ -11,7 +11,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write TC config"
UUID=${UUID}
DEVICE=eth0

View File

@ -12,7 +12,7 @@ IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write TC config"
UUID=${UUID}
DEVICE=eth0

View File

@ -8,7 +8,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME=test_roundtrip_ethtool
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME=test_roundtrip_ethtool
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME=test_roundtrip_ethtool
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME=test_roundtrip_ethtool
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME=test_roundtrip_ethtool
UUID=${UUID}
ONBOOT=yes

View File

@ -9,7 +9,7 @@ IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
IPV6_ADDR_GEN_MODE=default
NAME="Test Write Wired Auto-Negotiate"
UUID=${UUID}
ONBOOT=yes

View File

@ -1159,17 +1159,30 @@ ip6_addr_gen_mode_parser(KeyfileReaderInfo *info, NMSetting *setting, const char
s,
(int *) &addr_gen_mode,
NULL)) {
read_handle_warn(info,
key,
key,
NM_KEYFILE_WARN_SEVERITY_WARN,
_("invalid option '%s', use one of [%s]"),
s,
"eui64,stable-privacy");
return;
if (!read_handle_warn(info,
key,
key,
NM_KEYFILE_WARN_SEVERITY_WARN,
_("invalid option '%s', use one of [%s]"),
s,
"eui64,stable-privacy"))
return;
addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64;
}
} else
addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64;
} else {
gs_free char *s2 = NULL;
s2 = nm_keyfile_plugin_kf_get_string(info->keyfile,
setting_name,
NM_SETTING_IP6_CONFIG_TOKEN,
NULL);
if (s2) {
/* If a token is set, but the addr-gen-mode is not, then the default
* is eui64. Otherwise, the result would not verify. */
addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64;
} else
addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64;
}
g_object_set(G_OBJECT(setting), key, (int) addr_gen_mode, NULL);
}
@ -2189,8 +2202,10 @@ ip6_addr_gen_mode_writer(KeyfileWriterInfo *info,
gs_free char *str = NULL;
addr_gen_mode = (NMSettingIP6ConfigAddrGenMode) g_value_get_int(value);
str = nm_utils_enum_to_str(nm_setting_ip6_config_addr_gen_mode_get_type(), addr_gen_mode);
nm_keyfile_plugin_kf_set_string(info->keyfile, nm_setting_get_name(setting), key, str);
if (addr_gen_mode != NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64) {
str = nm_utils_enum_to_str(nm_setting_ip6_config_addr_gen_mode_get_type(), addr_gen_mode);
nm_keyfile_plugin_kf_set_string(info->keyfile, nm_setting_get_name(setting), key, str);
}
}
static void

View File

@ -112,7 +112,7 @@ NMSettingIP6ConfigAddrGenMode
nm_setting_ip6_config_get_addr_gen_mode(NMSettingIP6Config *setting)
{
g_return_val_if_fail(NM_IS_SETTING_IP6_CONFIG(setting),
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY);
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT);
return NM_SETTING_IP6_CONFIG_GET_PRIVATE(setting)->addr_gen_mode;
}
@ -288,7 +288,9 @@ verify(NMSetting *setting, NMConnection *connection, GError **error)
if (!NM_IN_SET(priv->addr_gen_mode,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY)) {
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT)) {
g_set_error_literal(error,
NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_PROPERTY,
@ -776,8 +778,10 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
*
* Configure method for creating the address for use with RFC4862 IPv6
* Stateless Address Autoconfiguration. The permitted values are:
* %NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 or
* %NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
* %NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY.
* %NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64
* or %NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT.
*
* If the property is set to EUI64, the addresses will be generated
* using the interface tokens derived from hardware address. This makes
@ -792,9 +796,16 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
* and makes the address stable when the network interface hardware is
* replaced.
*
* On D-Bus, the absence of an addr-gen-mode setting equals enabling
* stable-privacy. For keyfile plugin, the absence of the setting
* on disk means EUI64 so that the property doesn't change on upgrade
* The special values "default" and "default-or-eui64" will fallback to the global
* connection default in as documented in NetworkManager.conf(5) manual. If the
* global default is not specified, the fallback value is "stable-privacy"
* or "eui64", respectively.
*
* For libnm, the property defaults to "default" since 1.40.
* Previously it defaulted to "stable-privacy".
* On D-Bus, the absence of an addr-gen-mode setting equals
* "default". For keyfile plugin, the absence of the setting
* on disk means "default-or-eui64" so that the property doesn't change on upgrade
* from older versions.
*
* Note that this setting is distinct from the Privacy Extensions as
@ -806,8 +817,8 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
/* ---ifcfg-rh---
* property: addr-gen-mode
* variable: IPV6_ADDR_GEN_MODE
* values: IPV6_ADDR_GEN_MODE: eui64, stable-privacy
* default: eui64
* values: IPV6_ADDR_GEN_MODE: default, default-or-eui64, eui64, stable-privacy
* default: "default-or-eui64"
* description: Configure IPv6 Stable Privacy addressing for SLAAC (RFC7217).
* example: IPV6_ADDR_GEN_MODE=stable-privacy
* ---end---
@ -818,10 +829,11 @@ nm_setting_ip6_config_class_init(NMSettingIP6ConfigClass *klass)
PROP_ADDR_GEN_MODE,
G_MININT32,
G_MAXINT32,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT,
NM_SETTING_PARAM_NONE,
NMSettingIP6ConfigPrivate,
addr_gen_mode);
addr_gen_mode,
.to_dbus_including_default = TRUE);
/**
* NMSettingIP6Config:token:

View File

@ -3596,7 +3596,7 @@ test_roundtrip_conversion(gconstpointer test_data)
"method=auto\n"
"\n"
"[ipv6]\n"
"addr-gen-mode=stable-privacy\n"
"addr-gen-mode=default\n"
"method=auto\n"
"\n"
"[proxy]\n"
@ -3623,7 +3623,7 @@ test_roundtrip_conversion(gconstpointer test_data)
"method=auto\n"
"\n"
"[ipv6]\n"
"addr-gen-mode=stable-privacy\n"
"addr-gen-mode=default\n"
"method=auto\n"
"",
ID,
@ -3660,7 +3660,7 @@ test_roundtrip_conversion(gconstpointer test_data)
"method=disabled\n"
"\n"
"[ipv6]\n"
"addr-gen-mode=stable-privacy\n"
"addr-gen-mode=default\n"
"method=disabled\n"
"\n"
"[proxy]\n"
@ -3714,7 +3714,7 @@ test_roundtrip_conversion(gconstpointer test_data)
"method=disabled\n"
"\n"
"[ipv6]\n"
"addr-gen-mode=stable-privacy\n"
"addr-gen-mode=default\n"
"method=disabled\n"
"\n"
"[proxy]\n"
@ -3795,7 +3795,7 @@ test_roundtrip_conversion(gconstpointer test_data)
"routing-rule3=priority 3 from 192.168.2.0/26 table 1002\n"
"\n"
"[ipv6]\n"
"addr-gen-mode=stable-privacy\n"
"addr-gen-mode=default\n"
"method=auto\n"
"routing-rule1=priority 1 from ::/0 table 1000\n"
"routing-rule2=priority 2 from 1:2:3:b::/65 table 1001\n"

View File

@ -130,6 +130,10 @@ typedef enum {
* is created by using a cryptographically secure hash of a secret host-specific
* key along with the connection identification and the network address as
* specified by RFC7217.
* @NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64: Fallback to the global
* default, and if unspecified use "eui64". Since: 1.40.
* @NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT: Fallback to the global
* default, and if unspecified use "stable-privacy". Since: 1.40.
*
* #NMSettingIP6ConfigAddrGenMode controls how the Interface Identifier for
* RFC4862 Stateless Address Autoconfiguration is created.
@ -137,8 +141,10 @@ typedef enum {
* Since: 1.2
*/
typedef enum {
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 = 0,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY = 1,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 = 0,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY = 1,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64 = 2,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT = 3,
} NMSettingIP6ConfigAddrGenMode;
typedef struct _NMSettingIP6ConfigClass NMSettingIP6ConfigClass;

View File

@ -256,7 +256,7 @@
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTE_TABLE N_("Enable policy routing (source routing) and set the routing table used when adding routes. This affects all routes, including device-routes, IPv4LL, DHCP, SLAAC, default-routes and static routes. But note that static routes can individually overwrite the setting by explicitly specifying a non-zero routing table. If the table setting is left at zero, it is eligible to be overwritten via global configuration. If the property is zero even after applying the global configuration value, policy routing is disabled for the address family of this connection. Policy routing disabled means that NetworkManager will add all routes to the main table (except static routes that explicitly configure a different table). Additionally, NetworkManager will not delete any extraneous routes from tables except the main table. This is to preserve backward compatibility for users who manage routing tables outside of NetworkManager.")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTES N_("A list of IPv4 destination addresses, prefix length, optional IPv4 next hop addresses, optional route metric, optional attribute. The valid syntax is: \"ip[/prefix] [next-hop] [metric] [attribute=val]...[,ip[/prefix]...]\". For example \"192.0.2.0/24 10.1.1.1 77, 198.51.100.0/24\".")
#define DESCRIBE_DOC_NM_SETTING_IP4_CONFIG_ROUTING_RULES N_("A comma separated list of routing rules for policy routing.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE N_("Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 (0) or NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY (1). If the property is set to EUI64, the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host's presence when it changes networks. The address changes when the interface hardware is replaced. The value of stable-privacy enables use of cryptographically secure hash of a secret host-specific key along with the connection's stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host's presence, and makes the address stable when the network interface hardware is replaced. On D-Bus, the absence of an addr-gen-mode setting equals enabling stable-privacy. For keyfile plugin, the absence of the setting on disk means EUI64 so that the property doesn't change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by \"ip6-privacy\" property and it does not affect the temporary addresses configured with this option.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE N_("Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 (0), NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY (1). NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64 (2) or NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT (3). If the property is set to EUI64, the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host's presence when it changes networks. The address changes when the interface hardware is replaced. The value of stable-privacy enables use of cryptographically secure hash of a secret host-specific key along with the connection's stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host's presence, and makes the address stable when the network interface hardware is replaced. The special values \"default\" and \"default-or-eui64\" will fallback to the global connection default in as documented in NetworkManager.conf(5) manual. If the global default is not specified, the fallback value is \"stable-privacy\" or \"eui64\", respectively. For libnm, the property defaults to \"default\" since 1.40. Previously it defaulted to \"stable-privacy\". On D-Bus, the absence of an addr-gen-mode setting equals \"default\". For keyfile plugin, the absence of the setting on disk means \"default-or-eui64\" so that the property doesn't change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by \"ip6-privacy\" property and it does not affect the temporary addresses configured with this option.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_ADDRESSES N_("A list of IPv6 addresses and their prefix length. Multiple addresses can be separated by comma. For example \"2001:db8:85a3::8a2e:370:7334/64, 2001:db8:85a3::5/64\". The addresses are listed in decreasing priority, meaning the first address will be the primary address. This can make a difference with IPv6 source address selection (RFC 6724, section 5).")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DAD_TIMEOUT N_("Timeout in milliseconds used to check for the presence of duplicate IP addresses on the network. If an address conflict is detected, the activation will fail. A zero value means that no duplicate address detection is performed, -1 means the default value (either configuration ipvx.dad-timeout override or zero). A value greater than zero is a timeout in milliseconds. The property is currently implemented only for IPv4.")
#define DESCRIBE_DOC_NM_SETTING_IP6_CONFIG_DHCP_DUID N_("A string containing the DHCPv6 Unique Identifier (DUID) used by the dhcp client to identify itself to DHCPv6 servers (RFC 3315). The DUID is carried in the Client Identifier option. If the property is a hex string ('aa:bb:cc') it is interpreted as a binary DUID and filled as an opaque value in the Client Identifier option. The special value \"lease\" will retrieve the DUID previously used from the lease file belonging to the connection. If no DUID is found and \"dhclient\" is the configured dhcp client, the DUID is searched in the system-wide dhclient lease file. If still no DUID is found, or another dhcp client is used, a global and permanent DUID-UUID (RFC 6355) will be generated based on the machine-id. The special values \"llt\" and \"ll\" will generate a DUID of type LLT or LL (see RFC 3315) based on the current MAC address of the device. In order to try providing a stable DUID-LLT, the time field will contain a constant timestamp that is used globally (for all profiles) and persisted to disk. The special values \"stable-llt\", \"stable-ll\" and \"stable-uuid\" will generate a DUID of the corresponding type, derived from the connection's stable-id and a per-host unique key. You may want to include the \"${DEVICE}\" or \"${MAC}\" specifier in the stable-id, in case this profile gets activated on multiple devices. So, the link-layer address of \"stable-ll\" and \"stable-llt\" will be a generated address derived from the stable id. The DUID-LLT time value in the \"stable-llt\" option will be picked among a static timespan of three years (the upper bound of the interval is the same constant timestamp used in \"llt\"). When the property is unset, the global value provided for \"ipv6.dhcp-duid\" is used. If no global value is provided, the default \"lease\" value is assumed.")

View File

@ -133,7 +133,7 @@ reader_create_connection(Reader *reader,
NM_SETTING_IP_CONFIG_MAY_FAIL,
TRUE,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE,
(int) NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
(int) NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64,
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS,
reader->ignore_auto_dns,
NM_SETTING_IP_CONFIG_DHCP_TIMEOUT,

View File

@ -258,7 +258,7 @@ nmi_dt_reader_parse(const char *sysfs_dir)
g_object_set(s_ip6,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE,
(int) NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
(int) NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64,
NULL);
if (!bootp && dt_get_property(base, "chosen", "bootp-response", NULL, NULL))

View File

@ -164,7 +164,7 @@ ip_setting_add_from_block(GHashTable *nic, NMConnection *connection, GError **er
g_object_set(s_ip6,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE,
(int) NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
(int) NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64,
NULL);
}

View File

@ -740,7 +740,7 @@
<property name="ip6-privacy"
description="Configure IPv6 Privacy Extensions for SLAAC, described in RFC4941. If enabled, it makes the kernel generate a temporary IPv6 address in addition to the public one generated from MAC address via modified EUI-64. This enhances privacy, but could cause problems in some applications, on the other hand. The permitted values are: -1: unknown, 0: disabled, 1: enabled (prefer public address), 2: enabled (prefer temporary addresses). Having a per-connection setting set to &quot;-1&quot; (unknown) means fallback to global configuration &quot;ipv6.ip6-privacy&quot;. If also global configuration is unspecified or set to &quot;-1&quot;, fallback to read &quot;/proc/sys/net/ipv6/conf/default/use_tempaddr&quot;. Note that this setting is distinct from the Stable Privacy addresses that can be enabled with the &quot;addr-gen-mode&quot; property&apos;s &quot;stable-privacy&quot; setting as another way of avoiding host tracking with IPv6 addresses." />
<property name="addr-gen-mode"
description="Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 (0) or NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY (1). If the property is set to EUI64, the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host&apos;s presence when it changes networks. The address changes when the interface hardware is replaced. The value of stable-privacy enables use of cryptographically secure hash of a secret host-specific key along with the connection&apos;s stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host&apos;s presence, and makes the address stable when the network interface hardware is replaced. On D-Bus, the absence of an addr-gen-mode setting equals enabling stable-privacy. For keyfile plugin, the absence of the setting on disk means EUI64 so that the property doesn&apos;t change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by &quot;ip6-privacy&quot; property and it does not affect the temporary addresses configured with this option." />
description="Configure method for creating the address for use with RFC4862 IPv6 Stateless Address Autoconfiguration. The permitted values are: NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64 (0), NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY (1). NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT_OR_EUI64 (2) or NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_DEFAULT (3). If the property is set to EUI64, the addresses will be generated using the interface tokens derived from hardware address. This makes the host part of the address to stay constant, making it possible to track host&apos;s presence when it changes networks. The address changes when the interface hardware is replaced. The value of stable-privacy enables use of cryptographically secure hash of a secret host-specific key along with the connection&apos;s stable-id and the network address as specified by RFC7217. This makes it impossible to use the address track host&apos;s presence, and makes the address stable when the network interface hardware is replaced. The special values &quot;default&quot; and &quot;default-or-eui64&quot; will fallback to the global connection default in as documented in NetworkManager.conf(5) manual. If the global default is not specified, the fallback value is &quot;stable-privacy&quot; or &quot;eui64&quot;, respectively. For libnm, the property defaults to &quot;default&quot; since 1.40. Previously it defaulted to &quot;stable-privacy&quot;. On D-Bus, the absence of an addr-gen-mode setting equals &quot;default&quot;. For keyfile plugin, the absence of the setting on disk means &quot;default-or-eui64&quot; so that the property doesn&apos;t change on upgrade from older versions. Note that this setting is distinct from the Privacy Extensions as configured by &quot;ip6-privacy&quot; property and it does not affect the temporary addresses configured with this option." />
<property name="ra-timeout"
description="A timeout for waiting Router Advertisements in seconds. If zero (the default), a globally configured default is used. If still unspecified, the timeout depends on the sysctl settings of the device. Set to 2147483647 (MAXINT32) for infinity." />
<property name="mtu"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -8,12 +8,12 @@ stderr: 136 bytes
Error: Could not create NMClient object: Key/Value pair 0, 'invalid', in address element 'very:invalid' does not contain an equal sign.
<<<
size: 319
size: 312
location: src/tests/client/test-client.py:test_offline()/2
cmd: $NMCLI --offline c add type ethernet
lang: C
returncode: 0
stdout: 169 bytes
stdout: 162 bytes
>>>
[connection]
id=ethernet
@ -26,7 +26,7 @@ type=ethernet
method=auto
[ipv6]
addr-gen-mode=stable-privacy
addr-gen-mode=default
method=auto
[proxy]
@ -62,12 +62,12 @@ stderr: 47 bytes
Error: command doesn't support --offline mode.
<<<
size: 443
size: 436
location: src/tests/client/test-client.py:test_offline()/6
cmd: $NMCLI --offline c add type wifi ssid lala 802-1x.eap pwd 802-1x.identity foo 802-1x.password bar
lang: C
returncode: 0
stdout: 232 bytes
stdout: 225 bytes
>>>
[connection]
id=wifi
@ -87,18 +87,18 @@ password=bar
method=auto
[ipv6]
addr-gen-mode=stable-privacy
addr-gen-mode=default
method=auto
[proxy]
<<<
size: 481
size: 474
location: src/tests/client/test-client.py:test_offline()/7
cmd: $NMCLI --offline c add type wifi ssid lala 802-1x.eap pwd 802-1x.identity foo 802-1x.password bar 802-1x.password-flags agent-owned
lang: C
returncode: 0
stdout: 236 bytes
stdout: 229 bytes
>>>
[connection]
id=wifi
@ -118,7 +118,7 @@ password-flags=1
method=auto
[ipv6]
addr-gen-mode=stable-privacy
addr-gen-mode=default
method=auto
[proxy]