libnm-core: default to ip6.addr-gen-mode=stable-privacy

Take a missing value in keyfile/ifcfg-rh as EUI-64 to keep the compatibility
with the old conneciton. Nevertheless, the new connections should default to
the RFC7217 addresses.
This commit is contained in:
Lubomir Rintel 2015-10-26 18:21:18 +01:00
parent e603c86926
commit e9dfdfe9fe
4 changed files with 17 additions and 10 deletions

View file

@ -562,20 +562,21 @@ ip6_dns_parser (KeyfileReaderInfo *info, NMSetting *setting, const char *key)
static void
ip6_addr_gen_mode_parser (KeyfileReaderInfo *info, NMSetting *setting, const char *key)
{
NMSettingIP6ConfigAddrGenMode addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64;
NMSettingIP6ConfigAddrGenMode addr_gen_mode;
const char *setting_name = nm_setting_get_name (setting);
char *s;
gs_free char *s = NULL;
s = nm_keyfile_plugin_kf_get_string (info->keyfile, setting_name, key, NULL);
if (s) {
if (!nm_utils_enum_from_str (nm_setting_ip6_config_addr_gen_mode_get_type (), s,
(int *) &addr_gen_mode, NULL)) {
(int *) &addr_gen_mode, NULL)) {
handle_warn (info, key, NM_KEYFILE_WARN_SEVERITY_WARN,
_("invalid option '%s', use one of [%s]"),
s, "eui64,stable-privacy");
_("invalid option '%s', use one of [%s]"),
s, "eui64,stable-privacy");
return;
}
g_free (s);
}
} else
addr_gen_mode = NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64;
g_object_set (G_OBJECT (setting), key, (gint) addr_gen_mode, NULL);
}

View file

@ -608,7 +608,8 @@ static KeyWriter key_writers[] = {
static gboolean
can_omit_default_value (NMSetting *setting, const char *property)
{
if (NM_IS_SETTING_VLAN (setting) && !strcmp (property, NM_SETTING_VLAN_FLAGS))
if ( (NM_IS_SETTING_VLAN (setting) && !strcmp (property, NM_SETTING_VLAN_FLAGS))
|| (NM_IS_SETTING_IP6_CONFIG (setting) && !strcmp (property, NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE)))
return FALSE;
return TRUE;

View file

@ -115,7 +115,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_EUI64);
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY);
return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->addr_gen_mode;
}
@ -618,7 +618,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6ConfigClass *ip6_class)
(object_class, PROP_ADDR_GEN_MODE,
g_param_spec_int (NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE, "", "",
G_MININT, G_MAXINT,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));

View file

@ -1509,6 +1509,11 @@ make_ip6_setting (shvarFile *ifcfg,
else
PARSE_WARNING ("Invalid IPV6_ADDR_GEN_MODE");
g_free (tmp);
} else {
g_object_set (s_ip6,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE,
NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64,
NULL);
}
/* DNS servers