settings: read/write NMSettingConnection:interface-name

https://bugzilla.gnome.org/show_bug.cgi?id=693684
This commit is contained in:
Dan Winship
2013-03-07 09:45:07 -05:00
parent 2d668d763e
commit cda65e1802
5 changed files with 20 additions and 3 deletions

View File

@@ -155,6 +155,17 @@ make_connection_setting (const char *file,
NULL);
g_free (uuid);
value = svGetValue (ifcfg, "DEVICE", FALSE);
if (value) {
if (nm_utils_iface_valid_name (value)) {
g_object_set (s_con,
NM_SETTING_CONNECTION_INTERFACE_NAME, value,
NULL);
} else
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: invalid DEVICE name '%s'", value);
g_free (value);
}
/* Missing ONBOOT is treated as "ONBOOT=true" by the old network service */
g_object_set (s_con, NM_SETTING_CONNECTION_AUTOCONNECT,
svTrueValue (ifcfg, "ONBOOT", TRUE),

View File

@@ -1426,6 +1426,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
svSetValue (ifcfg, "NAME", nm_setting_connection_get_id (s_con), FALSE);
svSetValue (ifcfg, "UUID", nm_setting_connection_get_uuid (s_con), FALSE);
svSetValue (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con), FALSE);
svSetValue (ifcfg, "ONBOOT",
nm_setting_connection_get_autoconnect (s_con) ? "yes" : "no",
FALSE);

View File

@@ -1678,9 +1678,12 @@ ifnet_update_connection_from_config_block (const char *conn_name,
if (value && !strcmp (value, "false"))
auto_conn = FALSE;
update_connection_id (connection, conn_name);
g_object_set (setting, NM_SETTING_CONNECTION_TYPE, type,
NM_SETTING_CONNECTION_READ_ONLY, FALSE,
NM_SETTING_CONNECTION_AUTOCONNECT, auto_conn, NULL);
g_object_set (setting,
NM_SETTING_CONNECTION_TYPE, type,
NM_SETTING_CONNECTION_INTERFACE_NAME, conn_name,
NM_SETTING_CONNECTION_READ_ONLY, FALSE,
NM_SETTING_CONNECTION_AUTOCONNECT, auto_conn,
NULL);
if (!strcmp (NM_SETTING_WIRED_SETTING_NAME, type)
|| !strcmp (NM_SETTING_PPPOE_SETTING_NAME, type)) {

View File

@@ -726,6 +726,7 @@ ifupdown_update_connection_from_if_block (NMConnection *connection,
uuid = nm_utils_uuid_generate_from_string (uuid_base);
g_object_set (s_con,
NM_SETTING_CONNECTION_TYPE, type,
NM_SETTING_CONNECTION_INTERFACE_NAME, block->name,
NM_SETTING_CONNECTION_ID, idstr,
NM_SETTING_CONNECTION_UUID, uuid,
NM_SETTING_CONNECTION_READ_ONLY, TRUE,

View File

@@ -2819,6 +2819,7 @@ test_write_bridge_main (void)
NM_SETTING_CONNECTION_UUID, uuid,
NM_SETTING_CONNECTION_AUTOCONNECT, TRUE,
NM_SETTING_CONNECTION_TYPE, NM_SETTING_BRIDGE_SETTING_NAME,
NM_SETTING_CONNECTION_INTERFACE_NAME, "br0",
NULL);
g_free (uuid);