ifcfg-rh: add support for NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY

Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
Thomas Haller
2014-10-06 16:04:00 +02:00
parent 212f5dcba6
commit 210e0dbc11
4 changed files with 17 additions and 1 deletions

View File

@@ -169,8 +169,14 @@ make_connection_setting (const char *file,
}
/* Missing ONBOOT is treated as "ONBOOT=true" by the old network service */
g_object_set (s_con, NM_SETTING_CONNECTION_AUTOCONNECT,
g_object_set (s_con,
NM_SETTING_CONNECTION_AUTOCONNECT,
svTrueValue (ifcfg, "ONBOOT", TRUE),
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY,
(gint) svGetValueInt64 (ifcfg, "AUTOCONNECT_PRIORITY", 10,
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN,
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MAX,
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT),
NULL);
value = svGetValue (ifcfg, "USERS", FALSE);

View File

@@ -3,6 +3,7 @@ DEVICE=eth2
HWADDR=00:16:41:11:22:33
NM_CONTROLLED=yes
BOOTPROTO=dhcp
AUTOCONNECT_PRIORITY=-1
ESSID=blahblah
CHANNEL=1
MODE=Managed

View File

@@ -2910,6 +2910,8 @@ test_read_wifi_open (void)
NM_SETTING_CONNECTION_SETTING_NAME,
NM_SETTING_CONNECTION_AUTOCONNECT);
g_assert_cmpint (nm_setting_connection_get_autoconnect_priority (s_con), ==, -1);
/* ===== WIRELESS SETTING ===== */
s_wireless = nm_connection_get_setting_wireless (connection);

View File

@@ -1664,6 +1664,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
GString *str;
const char *master;
char *tmp;
gint i_int;
svSetValue (ifcfg, "NAME", nm_setting_connection_get_id (s_con), FALSE);
svSetValue (ifcfg, "UUID", nm_setting_connection_get_uuid (s_con), FALSE);
@@ -1672,6 +1673,12 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
nm_setting_connection_get_autoconnect (s_con) ? "yes" : "no",
FALSE);
i_int = nm_setting_connection_get_autoconnect_priority (s_con);
tmp = i_int != NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT
? g_strdup_printf ("%d", i_int) : NULL;
svSetValue (ifcfg, "AUTOCONNECT_PRIORITY", tmp, FALSE);
g_free (tmp);
/* Permissions */
svSetValue (ifcfg, "USERS", NULL, FALSE);
n = nm_setting_connection_get_num_permissions (s_con);