ifcfg-rh: add support for non-fatal IP configuration failure

This commit is contained in:
Dan Williams
2010-05-03 01:33:55 -07:00
parent 8aef7ef411
commit 13e1aaa423
4 changed files with 19 additions and 0 deletions

View File

@@ -1233,6 +1233,7 @@ make_ip4_setting (shvarFile *ifcfg,
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE), NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "PEERDNS", TRUE),
NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE), NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "PEERROUTES", TRUE),
NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT, never_default,
NM_SETTING_IP4_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV4_FAILURE_FATAL", TRUE),
NULL); NULL);
/* Handle manual settings */ /* Handle manual settings */
@@ -1488,6 +1489,7 @@ make_ip6_setting (shvarFile *ifcfg,
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE), NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS, !svTrueValue (ifcfg, "IPV6_PEERDNS", TRUE),
NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE), NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES, !svTrueValue (ifcfg, "IPV6_PEERROUTES", TRUE),
NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT, never_default,
NM_SETTING_IP6_CONFIG_MAY_FAIL, !svTrueValue (ifcfg, "IPV6_FAILURE_FATAL", FALSE),
NULL); NULL);
if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { if (!strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {

View File

@@ -16,3 +16,4 @@ IPV6INIT=yes
IPV6_AUTOCONF=no IPV6_AUTOCONF=no
IPV6ADDR="1001:abba::1234/56" IPV6ADDR="1001:abba::1234/56"
IPV6ADDR_SECONDARIES="2001:abba::2234/64 3001:abba::3234/96" IPV6ADDR_SECONDARIES="2001:abba::2234/64 3001:abba::3234/96"
IPV6_FAILURE_FATAL=no

View File

@@ -2011,6 +2011,12 @@ test_read_wired_ipv6_manual (void)
NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_NEVER_DEFAULT); NM_SETTING_IP6_CONFIG_NEVER_DEFAULT);
ASSERT (nm_setting_ip6_config_get_may_fail (s_ip6) == TRUE,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
TEST_IFCFG_WIRED_IPV6_MANUAL,
NM_SETTING_IP6_CONFIG_SETTING_NAME,
NM_SETTING_IP6_CONFIG_MAY_FAIL);
/* IP addresses */ /* IP addresses */
ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 3, ASSERT (nm_setting_ip6_config_get_num_addresses (s_ip6) == 3,
"wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value", "wired-ipv6-manual-verify-ip6", "failed to verify %s: unexpected %s / %s key value",
@@ -5157,6 +5163,7 @@ test_write_wired_static (void)
g_object_set (s_ip4, g_object_set (s_ip4,
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
NULL); NULL);
addr = nm_ip4_address_new (); addr = nm_ip4_address_new ();
@@ -5188,6 +5195,7 @@ test_write_wired_static (void)
g_object_set (s_ip6, g_object_set (s_ip6,
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
NULL); NULL);
/* Add addresses */ /* Add addresses */

View File

@@ -1087,6 +1087,10 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE); svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE);
} }
svSetValue (ifcfg, "IPV4_FAILURE_FATAL",
nm_setting_ip4_config_get_may_fail (s_ip4) ? "no" : "yes",
FALSE);
/* Static routes - route-<name> file */ /* Static routes - route-<name> file */
route_path = utils_get_route_path (ifcfg->fileName); route_path = utils_get_route_path (ifcfg->fileName);
if (!route_path) { if (!route_path) {
@@ -1373,6 +1377,10 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
FALSE); FALSE);
} }
svSetValue (ifcfg, "IPV6_FAILURE_FATAL",
nm_setting_ip6_config_get_may_fail (s_ip6) ? "no" : "yes",
FALSE);
/* Static routes go to route6-<dev> file */ /* Static routes go to route6-<dev> file */
route6_path = utils_get_route6_path (ifcfg->fileName); route6_path = utils_get_route6_path (ifcfg->fileName);
if (!route6_path) { if (!route6_path) {