ifcfg-rh: persist ipv4.dad-timeout without rounding
Introduce a new ifcfg-rh variable ACD_TIMEOUT that stores the exact value of ipv4.dad-timeout without rounding. We still write the initscripts-compatible ARPING_WAIT variable, and read it when ACD_TIMEOUT is missing.
This commit is contained in:
@@ -748,11 +748,12 @@ nm_setting_ip4_config_class_init (NMSettingIP4ConfigClass *ip4_class)
|
|||||||
|
|
||||||
/* ---ifcfg-rh---
|
/* ---ifcfg-rh---
|
||||||
* property: dad-timeout
|
* property: dad-timeout
|
||||||
* variable: ARPING_WAIT
|
* variable: ACD_TIMEOUT, ARPING_WAIT
|
||||||
* default: missing variable means global default (config override or 3)
|
* default: missing variable means global default (config override or 3)
|
||||||
* description: Timeout (in seconds) for performing DAD before configuring
|
* description: Timeout (in milliseconds for ACD_TIMEOUT or in seconds
|
||||||
* IPv4 addresses. 0 turns off the DAD completely, -1 means default value.
|
* for ARPING_WAIT) for address conflict detection before configuring
|
||||||
* example: ARPING_WAIT=2
|
* IPv4 addresses. 0 turns off the ACD completely, -1 means default value.
|
||||||
|
* example: ACD_TIMEOUT=2000 or ARPING_WAIT=2
|
||||||
* ---end---
|
* ---end---
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -1555,10 +1555,14 @@ make_ip4_setting (shvarFile *ifcfg,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = svGetValueInt64 (ifcfg, "ARPING_WAIT", 10, -1,
|
timeout = svGetValueInt64 (ifcfg, "ACD_TIMEOUT", 10, -1, NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX, -2);
|
||||||
NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX / 1000, -1);
|
if (timeout == -2) {
|
||||||
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DAD_TIMEOUT,
|
timeout = svGetValueInt64 (ifcfg, "ARPING_WAIT", 10, -1,
|
||||||
(gint) (timeout <= 0 ? timeout : timeout * 1000), NULL);
|
NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX / 1000, -1);
|
||||||
|
if (timeout > 0)
|
||||||
|
timeout *= 1000;
|
||||||
|
}
|
||||||
|
g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DAD_TIMEOUT, (gint) timeout, NULL);
|
||||||
|
|
||||||
return g_steal_pointer (&s_ip4);
|
return g_steal_pointer (&s_ip4);
|
||||||
}
|
}
|
||||||
|
@@ -2417,12 +2417,15 @@ write_ip4_setting (NMConnection *connection,
|
|||||||
NM_SET_OUT (out_route_content, write_route_file (s_ip4));
|
NM_SET_OUT (out_route_content, write_route_file (s_ip4));
|
||||||
|
|
||||||
timeout = nm_setting_ip_config_get_dad_timeout (s_ip4);
|
timeout = nm_setting_ip_config_get_dad_timeout (s_ip4);
|
||||||
if (timeout < 0)
|
if (timeout < 0) {
|
||||||
|
svUnsetValue (ifcfg, "ACD_TIMEOUT");
|
||||||
svUnsetValue (ifcfg, "ARPING_WAIT");
|
svUnsetValue (ifcfg, "ARPING_WAIT");
|
||||||
else if (timeout == 0)
|
} else if (timeout == 0) {
|
||||||
|
svSetValueStr (ifcfg, "ACD_TIMEOUT", "0");
|
||||||
svSetValueStr (ifcfg, "ARPING_WAIT", "0");
|
svSetValueStr (ifcfg, "ARPING_WAIT", "0");
|
||||||
else {
|
} else {
|
||||||
/* Round the value up to next integer */
|
svSetValueInt64 (ifcfg, "ACD_TIMEOUT", timeout);
|
||||||
|
/* Round the value up to next integer for initscripts */
|
||||||
svSetValueInt64 (ifcfg, "ARPING_WAIT", (timeout - 1) / 1000 + 1);
|
svSetValueInt64 (ifcfg, "ARPING_WAIT", (timeout - 1) / 1000 + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,6 +14,8 @@ DNS2=4.2.2.2
|
|||||||
DOMAIN="foobar.com lab.foobar.com"
|
DOMAIN="foobar.com lab.foobar.com"
|
||||||
DEFROUTE=yes
|
DEFROUTE=yes
|
||||||
IPV4_FAILURE_FATAL=no
|
IPV4_FAILURE_FATAL=no
|
||||||
|
ACD_TIMEOUT=400
|
||||||
|
ARPING_WAIT=1
|
||||||
IPV6INIT=no
|
IPV6INIT=no
|
||||||
NAME="Test Write Wired Static Routes"
|
NAME="Test Write Wired Static Routes"
|
||||||
UUID=${UUID}
|
UUID=${UUID}
|
||||||
|
@@ -10,3 +10,5 @@ PREFIX1=16
|
|||||||
IPADDR2=3.3.3.3
|
IPADDR2=3.3.3.3
|
||||||
PREFIX2=8
|
PREFIX2=8
|
||||||
GATEWAY=1.1.1.1
|
GATEWAY=1.1.1.1
|
||||||
|
ACD_TIMEOUT=2000
|
||||||
|
ARPING_WAIT=1
|
||||||
|
@@ -9,3 +9,5 @@ IPADDR2=9.8.7.6
|
|||||||
PREFIX2=16
|
PREFIX2=16
|
||||||
IPADDR3=3.3.3.3
|
IPADDR3=3.3.3.3
|
||||||
PREFIX3=8
|
PREFIX3=8
|
||||||
|
ACD_TIMEOUT=2000
|
||||||
|
ARPING_WAIT=1
|
||||||
|
@@ -9,3 +9,5 @@ IPADDR3=9.8.7.6
|
|||||||
PREFIX3=16
|
PREFIX3=16
|
||||||
IPADDR4=3.3.3.3
|
IPADDR4=3.3.3.3
|
||||||
PREFIX4=8
|
PREFIX4=8
|
||||||
|
ACD_TIMEOUT=2000
|
||||||
|
ARPING_WAIT=1
|
||||||
|
@@ -9,3 +9,5 @@ IPADDR1=9.8.7.6
|
|||||||
PREFIX1=16
|
PREFIX1=16
|
||||||
IPADDR2=3.3.3.3
|
IPADDR2=3.3.3.3
|
||||||
PREFIX2=8
|
PREFIX2=8
|
||||||
|
ACD_TIMEOUT=2000
|
||||||
|
ARPING_WAIT=1
|
||||||
|
@@ -1473,6 +1473,7 @@ test_read_wired_ipv4_manual (gconstpointer data)
|
|||||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||||
g_assert (s_ip4);
|
g_assert (s_ip4);
|
||||||
g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
|
g_assert_cmpstr (nm_setting_ip_config_get_method (s_ip4), ==, NM_SETTING_IP4_CONFIG_METHOD_MANUAL);
|
||||||
|
g_assert_cmpint (nm_setting_ip_config_get_dad_timeout (s_ip4), ==, 2000);
|
||||||
|
|
||||||
/* IP addresses */
|
/* IP addresses */
|
||||||
g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 3);
|
g_assert_cmpint (nm_setting_ip_config_get_num_addresses (s_ip4), ==, 3);
|
||||||
@@ -4764,6 +4765,7 @@ test_write_wired_static_routes (void)
|
|||||||
g_object_set (s_ip4,
|
g_object_set (s_ip4,
|
||||||
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
|
||||||
NM_SETTING_IP_CONFIG_GATEWAY, "1.1.1.1",
|
NM_SETTING_IP_CONFIG_GATEWAY, "1.1.1.1",
|
||||||
|
NM_SETTING_IP_CONFIG_DAD_TIMEOUT, 400,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, &error);
|
addr = nm_ip_address_new (AF_INET, "1.1.1.3", 24, &error);
|
||||||
|
Reference in New Issue
Block a user