summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-10-06 16:04:00 +0200
committerThomas Haller <thaller@redhat.com>2014-10-12 20:13:17 +0200
commit210e0dbc1124015161575b201bc7adbcdda96e0e (patch)
treef4fdf92acb2abf5c4cb3a7464a8bebca97fbf15a /src
parent212f5dcba6a88a6212faee202cc4166963af6e13 (diff)
downloadNetworkManager-210e0dbc1124015161575b201bc7adbcdda96e0e.tar.gz
ifcfg-rh: add support for NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY
Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/settings/plugins/ifcfg-rh/reader.c8
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open1
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c2
-rw-r--r--src/settings/plugins/ifcfg-rh/writer.c7
4 files changed, 17 insertions, 1 deletions
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 5cb96a0349..1c6aa70cb2 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -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);
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open
index d4bb8f75b0..48db45b25d 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wifi-open
@@ -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
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index e72e7a3681..03caff5f81 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -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);
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index 86f317cc19..70c0e1b024 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -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);