summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2016-10-08 10:27:21 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2016-10-16 12:56:09 +0200
commitf63e28b1476beac4fca72225b6336b39c4ee5191 (patch)
tree79da8135380b5a4ba374386b3375f76599ea6d23 /src
parent51d7a18f2e09c0c9e36c5f2995a356e2737931f5 (diff)
downloadNetworkManager-f63e28b1476beac4fca72225b6336b39c4ee5191.tar.gz
ifcfg-rh: support the autoconnect-retries property
Diffstat (limited to 'src')
-rw-r--r--src/NetworkManager.ver1
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c3
-rw-r--r--src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c5
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-misc-variables1
-rw-r--r--src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c3
5 files changed, 13 insertions, 0 deletions
diff --git a/src/NetworkManager.ver b/src/NetworkManager.ver
index db97295ef9..9e613d4142 100644
--- a/src/NetworkManager.ver
+++ b/src/NetworkManager.ver
@@ -292,6 +292,7 @@ global:
nm_setting_connection_add_secondary;
nm_setting_connection_get_autoconnect;
nm_setting_connection_get_autoconnect_priority;
+ nm_setting_connection_get_autoconnect_retries;
nm_setting_connection_get_autoconnect_slaves;
nm_setting_connection_get_connection_type;
nm_setting_connection_get_gateway_ping_timeout;
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
index 5b9e8f34c0..0d59063b0e 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c
@@ -184,6 +184,9 @@ make_connection_setting (const char *file,
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN,
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MAX,
NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT),
+ NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES,
+ (gint) svGetValueInt64 (ifcfg, "AUTOCONNECT_RETRIES", 10,
+ -1, G_MAXINT32, -1),
NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES,
svGetValueBoolean (ifcfg, "AUTOCONNECT_SLAVES", NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT),
NM_SETTING_CONNECTION_LLDP, lldp,
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
index e3e05e8782..0b6ed52cdc 100644
--- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
+++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c
@@ -1767,6 +1767,11 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg)
svSetValue (ifcfg, "AUTOCONNECT_PRIORITY", tmp, FALSE);
g_free (tmp);
+ i_int = nm_setting_connection_get_autoconnect_retries (s_con);
+ tmp = i_int != -1 ? g_strdup_printf ("%d", i_int) : NULL;
+ svSetValue (ifcfg, "AUTOCONNECT_RETRIES", tmp, FALSE);
+ g_free (tmp);
+
/* Only save the value for master connections */
svUnsetValue (ifcfg, "AUTOCONNECT_SLAVES");
type = nm_setting_connection_get_connection_type (s_con);
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-misc-variables b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-misc-variables
index c7892a219d..1b10cddbe5 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-misc-variables
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-misc-variables
@@ -1,3 +1,4 @@
DEVICE=eth0
HWADDR_BLACKLIST="00:16:41:11:22:88 00:16:41:11:22:99 XX:aa:invalid 6A:5D:5A:FA:DD:F0"
+AUTOCONNECT_RETRIES=100
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 8a12805c99..2359852f08 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -273,6 +273,7 @@ test_read_basic (void)
g_assert_cmpstr (nm_setting_connection_get_id (s_con), ==, "System test-minimal");
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, 0);
g_assert (nm_setting_connection_get_autoconnect (s_con));
+ g_assert_cmpint (nm_setting_connection_get_autoconnect_retries (s_con), ==, -1);
/* UUID can't be tested if the ifcfg does not contain the UUID key, because
* the UUID is generated on the full path of the ifcfg file, which can change
@@ -326,6 +327,7 @@ test_read_miscellaneous_variables (void)
g_assert (s_con);
g_assert_cmpint (nm_setting_connection_get_timestamp (s_con), ==, expected_timestamp);
g_assert (nm_setting_connection_get_autoconnect (s_con));
+ g_assert_cmpint (nm_setting_connection_get_autoconnect_retries (s_con), ==, 100);
/* ===== WIRED SETTING ===== */
s_wired = nm_connection_get_setting_wired (connection);
@@ -3535,6 +3537,7 @@ test_write_wired_static (void)
NM_SETTING_CONNECTION_ID, "Test Write Wired Static",
NM_SETTING_CONNECTION_UUID, uuid,
NM_SETTING_CONNECTION_AUTOCONNECT, TRUE,
+ NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES, 1,
NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
NULL);
g_free (uuid);