wifi: enable mac-address-randomization by default for new connections

But ensure that old keyfiles that did not yet understand
the new key continue to have it disabled.
This commit is contained in:
Thomas Haller 2015-10-08 13:08:59 +02:00
parent 6a46dfca26
commit 4f6c91d696
3 changed files with 21 additions and 7 deletions

View file

@ -1279,8 +1279,13 @@ set_default_for_missing_key (NMSetting *setting, const char *property)
{
/* Set a value different from the default value of the property's spec */
if (NM_IS_SETTING_VLAN (setting) && !strcmp (property, NM_SETTING_VLAN_FLAGS))
g_object_set (setting, property, (NMVlanFlags) 0, NULL);
if (NM_IS_SETTING_VLAN (setting)) {
if (!strcmp (property, NM_SETTING_VLAN_FLAGS))
g_object_set (setting, property, (NMVlanFlags) 0, NULL);
} else if (NM_IS_SETTING_WIRELESS (setting)) {
if (!strcmp (property, NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION))
g_object_set (setting, property, (NMSettingMacRandomization) NM_SETTING_MAC_RANDOMIZATION_NEVER, NULL);
}
}
static void

View file

@ -608,9 +608,16 @@ 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))
|| (NM_IS_SETTING_IP6_CONFIG (setting) && !strcmp (property, NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE)))
return FALSE;
if (NM_IS_SETTING_VLAN (setting)) {
if (!strcmp (property, NM_SETTING_VLAN_FLAGS))
return FALSE;
} else if (NM_IS_SETTING_IP6_CONFIG (setting)) {
if (!strcmp (property, NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE))
return FALSE;
} else if (NM_IS_SETTING_WIRELESS (setting)) {
if (!strcmp (property, NM_SETTING_WIRELESS_MAC_ADDRESS_RANDOMIZATION))
return FALSE;
}
return TRUE;
}

View file

@ -465,8 +465,10 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self,
if (priv->mac_randomization == NM_SETTING_MAC_RANDOMIZATION_DEFAULT) {
priv->mac_randomization = mac_randomization_fallback;
if (priv->mac_randomization == NM_SETTING_MAC_RANDOMIZATION_DEFAULT) {
/* the value is unconfigured. For now, that means we don't use randomization.*/
priv->mac_randomization = NM_SETTING_MAC_RANDOMIZATION_NEVER;
/* use randomization if supported. */
priv->mac_randomization = (mac_randomization_support == NM_SUPPLICANT_FEATURE_YES)
? NM_SETTING_MAC_RANDOMIZATION_ALWAYS
: NM_SETTING_MAC_RANDOMIZATION_NEVER;
}
}