mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-06 10:18:03 +02:00
keyfile: remove ensure_slave_setting() when reading connection
nm_connection_normalize() can now add the slave setting as needed. Remove
the duplicate functionality.
This undoes commit 664d64e0c0
but the same functionality is now provided via normalize().
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
7279e7e150
commit
cf44a15874
1 changed files with 4 additions and 31 deletions
|
|
@ -1200,30 +1200,6 @@ read_vpn_secrets (GKeyFile *file, NMSettingVpn *s_vpn)
|
||||||
g_strfreev (keys);
|
g_strfreev (keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
ensure_slave_setting (NMConnection *connection)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
const char *slave_type;
|
|
||||||
GType slave_gtype = G_TYPE_INVALID;
|
|
||||||
NMSetting *setting;
|
|
||||||
|
|
||||||
slave_type = nm_setting_connection_get_slave_type (s_con);
|
|
||||||
if (!slave_type)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (g_strcmp0 (slave_type, NM_SETTING_BRIDGE_SETTING_NAME) == 0)
|
|
||||||
slave_gtype = NM_TYPE_SETTING_BRIDGE_PORT;
|
|
||||||
else if (g_strcmp0 (slave_type, NM_SETTING_TEAM_SETTING_NAME) == 0)
|
|
||||||
slave_gtype = NM_TYPE_SETTING_TEAM_PORT;
|
|
||||||
|
|
||||||
if (slave_gtype != G_TYPE_INVALID && !nm_connection_get_setting (connection, slave_gtype)) {
|
|
||||||
setting = (NMSetting *) g_object_new (slave_gtype, NULL);
|
|
||||||
g_assert (setting);
|
|
||||||
nm_connection_add_setting (connection, setting);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NMConnection *
|
NMConnection *
|
||||||
nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
|
nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
|
||||||
{
|
{
|
||||||
|
|
@ -1274,11 +1250,10 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
|
||||||
nm_connection_add_setting (connection, setting);
|
nm_connection_add_setting (connection, setting);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that we have the base device type and slave type settings
|
/* Make sure that we have the base device type setting even if
|
||||||
* even if the keyfile didn't include it, which can happen when the
|
* the keyfile didn't include it, which can happen when the base
|
||||||
* setting in question is all default values (like ethernet where
|
* device type setting is all default values (like ethernet where
|
||||||
* the MAC address isn't given, or VLAN when the VLAN ID is zero, or
|
* the MAC address isn't given, or VLAN when the VLAN ID is zero).
|
||||||
* bridge port with all default settings).
|
|
||||||
*/
|
*/
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
s_con = nm_connection_get_setting_connection (connection);
|
||||||
if (!s_con) {
|
if (!s_con) {
|
||||||
|
|
@ -1319,8 +1294,6 @@ nm_keyfile_plugin_connection_from_file (const char *filename, GError **error)
|
||||||
g_free (hashed_uuid);
|
g_free (hashed_uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_slave_setting (connection);
|
|
||||||
|
|
||||||
/* Handle vpn secrets after the 'vpn' setting was read */
|
/* Handle vpn secrets after the 'vpn' setting was read */
|
||||||
if (vpn_secrets) {
|
if (vpn_secrets) {
|
||||||
NMSettingVpn *s_vpn;
|
NMSettingVpn *s_vpn;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue