mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 22:20:19 +01:00
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
This commit is contained in:
parent
2e5e7285a8
commit
da70fbd7d5
2 changed files with 3 additions and 20 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue