ifcfg-rh: treat lack of ONBOOT as autoconnect=true (rh #489422)
This commit is contained in:
@@ -132,9 +132,9 @@ make_connection_setting (const char *file,
|
|||||||
NULL);
|
NULL);
|
||||||
g_free (uuid);
|
g_free (uuid);
|
||||||
|
|
||||||
/* Be somewhat conservative about autoconnect */
|
/* 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", FALSE),
|
svTrueValue (ifcfg, "ONBOOT", TRUE),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
value = svGetValue (ifcfg, "LAST_CONNECT", FALSE);
|
value = svGetValue (ifcfg, "LAST_CONNECT", FALSE);
|
||||||
|
@@ -7,6 +7,7 @@ EXTRA_DIST = \
|
|||||||
network-test-wired-global-gateway \
|
network-test-wired-global-gateway \
|
||||||
ifcfg-test-wired-never-default \
|
ifcfg-test-wired-never-default \
|
||||||
network-test-wired-never-default \
|
network-test-wired-never-default \
|
||||||
|
ifcfg-test-onboot-no \
|
||||||
ifcfg-test-wifi-open \
|
ifcfg-test-wifi-open \
|
||||||
ifcfg-test-wifi-wep \
|
ifcfg-test-wifi-wep \
|
||||||
keys-test-wifi-wep \
|
keys-test-wifi-wep \
|
||||||
|
@@ -0,0 +1,5 @@
|
|||||||
|
# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
|
||||||
|
DEVICE=eth0
|
||||||
|
HWADDR=00:11:22:33:44:ee
|
||||||
|
ONBOOT=no
|
||||||
|
|
@@ -106,7 +106,7 @@ test_read_minimal (void)
|
|||||||
NM_SETTING_CONNECTION_TIMESTAMP);
|
NM_SETTING_CONNECTION_TIMESTAMP);
|
||||||
|
|
||||||
/* Autoconnect */
|
/* Autoconnect */
|
||||||
ASSERT (nm_setting_connection_get_autoconnect (s_con) == FALSE,
|
ASSERT (nm_setting_connection_get_autoconnect (s_con) == TRUE,
|
||||||
"minimal-wired-verify-connection", "failed to verify %s: unexpected %s /%s key value",
|
"minimal-wired-verify-connection", "failed to verify %s: unexpected %s /%s key value",
|
||||||
TEST_IFCFG_MINIMAL,
|
TEST_IFCFG_MINIMAL,
|
||||||
NM_SETTING_CONNECTION_SETTING_NAME,
|
NM_SETTING_CONNECTION_SETTING_NAME,
|
||||||
@@ -851,6 +851,52 @@ test_read_wired_never_default (void)
|
|||||||
g_object_unref (connection);
|
g_object_unref (connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define TEST_IFCFG_ONBOOT_NO TEST_DIR"/network-scripts/ifcfg-test-onboot-no"
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_read_onboot_no (void)
|
||||||
|
{
|
||||||
|
NMConnection *connection;
|
||||||
|
NMSettingConnection *s_con;
|
||||||
|
gboolean unmanaged = FALSE;
|
||||||
|
char *keyfile = NULL;
|
||||||
|
gboolean ignore_error = FALSE;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
connection = connection_from_file (TEST_IFCFG_ONBOOT_NO,
|
||||||
|
NULL,
|
||||||
|
TYPE_ETHERNET,
|
||||||
|
&unmanaged,
|
||||||
|
&keyfile,
|
||||||
|
&error,
|
||||||
|
&ignore_error);
|
||||||
|
ASSERT (connection != NULL,
|
||||||
|
"onboot-no-read", "failed to read %s: %s", TEST_IFCFG_ONBOOT_NO, error->message);
|
||||||
|
|
||||||
|
ASSERT (nm_connection_verify (connection, &error),
|
||||||
|
"onboot-no-verify", "failed to verify %s: %s", TEST_IFCFG_ONBOOT_NO, error->message);
|
||||||
|
|
||||||
|
ASSERT (unmanaged == FALSE,
|
||||||
|
"onboot-no-verify", "failed to verify %s: unexpected unmanaged value", TEST_IFCFG_WIRED_DHCP);
|
||||||
|
|
||||||
|
/* ===== CONNECTION SETTING ===== */
|
||||||
|
|
||||||
|
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
|
||||||
|
ASSERT (s_con != NULL,
|
||||||
|
"onboot-no-verify-connection", "failed to verify %s: missing %s setting",
|
||||||
|
TEST_IFCFG_ONBOOT_NO,
|
||||||
|
NM_SETTING_CONNECTION_SETTING_NAME);
|
||||||
|
|
||||||
|
/* Autoconnect */
|
||||||
|
ASSERT (nm_setting_connection_get_autoconnect (s_con) == FALSE,
|
||||||
|
"wired-dhcp-verify-connection", "failed to verify %s: unexpected %s /%s key value",
|
||||||
|
TEST_IFCFG_ONBOOT_NO,
|
||||||
|
NM_SETTING_CONNECTION_SETTING_NAME,
|
||||||
|
NM_SETTING_CONNECTION_AUTOCONNECT);
|
||||||
|
|
||||||
|
g_object_unref (connection);
|
||||||
|
}
|
||||||
|
|
||||||
#define TEST_IFCFG_WIFI_OPEN TEST_DIR"/network-scripts/ifcfg-test-wifi-open"
|
#define TEST_IFCFG_WIFI_OPEN TEST_DIR"/network-scripts/ifcfg-test-wifi-open"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2202,6 +2248,7 @@ int main (int argc, char **argv)
|
|||||||
test_read_wired_dhcp ();
|
test_read_wired_dhcp ();
|
||||||
test_read_wired_global_gateway ();
|
test_read_wired_global_gateway ();
|
||||||
test_read_wired_never_default ();
|
test_read_wired_never_default ();
|
||||||
|
test_read_onboot_no ();
|
||||||
test_read_wifi_unencrypted ();
|
test_read_wifi_unencrypted ();
|
||||||
test_read_wifi_wep ();
|
test_read_wifi_wep ();
|
||||||
test_read_wifi_wep_adhoc ();
|
test_read_wifi_wep_adhoc ();
|
||||||
|
Reference in New Issue
Block a user