Commit da70fbd7 authored by Beniamino Galvani's avatar Beniamino Galvani

libnm-core: remove special handling of missing VLAN_FLAGS

On older NM versions the default value for vlan.flags was 0, but then
the actual value set on interfaces was REORDER_HDR. In order to
maintain backwards compatibility in behavior, remove the special
handling of vlan.flags so that a missing key is treated as the default
value REORDER_HDR.

https://bugzilla.gnome.org/show_bug.cgi?id=762626
parent 2e5e7285
......@@ -1278,10 +1278,7 @@ 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)) {
if (!strcmp (property, NM_SETTING_VLAN_FLAGS))
g_object_set (setting, property, (NMVlanFlags) 0, NULL);
} else if (NM_IS_SETTING_WIRELESS (setting)) {
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);
}
......@@ -1689,18 +1686,6 @@ nm_keyfile_read (GKeyFile *keyfile,
}
}
/* Make sure that if [vlan] group was missing we set vlan.flags to 0
* for backwards compatibility */
if (nm_connection_is_type (connection, NM_SETTING_VLAN_SETTING_NAME)) {
if (!nm_connection_get_setting_vlan (connection)) {
NMSettingVlan *s_vlan;
s_vlan = NM_SETTING_VLAN (nm_setting_vlan_new ());
g_object_set (s_vlan, NM_SETTING_VLAN_FLAGS, 0, NULL);
nm_connection_add_setting (connection, NM_SETTING (s_vlan));
}
}
return connection;
out_error:
g_propagate_error (error, info.error);
......
......@@ -2630,8 +2630,7 @@ test_read_missing_vlan_setting (void)
s_vlan = nm_connection_get_setting_vlan (connection);
g_assert (s_vlan);
g_assert_cmpint (nm_setting_vlan_get_id (s_vlan), ==, 0);
/* Ensure the VLAN flags are not set (0) */
g_assert_cmpint (nm_setting_vlan_get_flags (s_vlan), ==, 0);
g_assert_cmpint (nm_setting_vlan_get_flags (s_vlan), ==, NM_VLAN_FLAG_REORDER_HEADERS);
g_object_unref (connection);
}
......@@ -2657,8 +2656,7 @@ test_read_missing_vlan_flags (void)
g_assert_cmpint (nm_setting_vlan_get_id (s_vlan), ==, 444);
g_assert_cmpstr (nm_setting_vlan_get_parent (s_vlan), ==, "em1");
/* Ensure the VLAN flags are not set (0) */
g_assert_cmpint (nm_setting_vlan_get_flags (s_vlan), ==, 0);
g_assert_cmpint (nm_setting_vlan_get_flags (s_vlan), ==, NM_VLAN_FLAG_REORDER_HEADERS);
g_object_unref (connection);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment