ifcfg-rh: read wired properties for bridge connections

A bridge connection can have ethernet settings, read them from the
ifcfg file.
This commit is contained in:
Beniamino Galvani 2017-11-22 13:54:56 +01:00
parent 563ead4974
commit 56a02c9baf
2 changed files with 18 additions and 2 deletions

View file

@ -4805,6 +4805,8 @@ bridge_connection_from_ifcfg (const char *file,
NMConnection *connection = NULL;
NMSetting *con_setting = NULL;
NMSetting *bridge_setting = NULL;
NMSetting *wired_setting = NULL;
NMSetting8021x *s_8021x = NULL;
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
@ -4827,6 +4829,16 @@ bridge_connection_from_ifcfg (const char *file,
}
nm_connection_add_setting (connection, bridge_setting);
wired_setting = make_wired_setting (ifcfg, file, &s_8021x, error);
if (!wired_setting) {
g_object_unref (connection);
return NULL;
}
nm_connection_add_setting (connection, wired_setting);
if (s_8021x)
nm_connection_add_setting (connection, NM_SETTING (s_8021x));
return connection;
}

View file

@ -7440,8 +7440,8 @@ test_write_bridge_main (void)
gs_unref_object NMConnection *reread = NULL;
NMSettingConnection *s_con;
NMSettingBridge *s_bridge;
NMSettingIPConfig *s_ip4;
NMSettingIPConfig *s_ip6;
NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingWired *s_wired;
NMIPAddress *addr;
static const char *mac = "31:33:33:37:be:cd";
GError *error = NULL;
@ -7493,6 +7493,10 @@ test_write_bridge_main (void)
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_IGNORE,
NULL);
/* Wired setting */
s_wired = (NMSettingWired *) nm_setting_wired_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wired));
nm_connection_add_setting (connection, nm_setting_proxy_new ());
nmtst_assert_connection_verifies_without_normalization (connection);