ifcfg-rh: ignore "sit" connections without explicit TYPE based on IPV6TUNNELIPV4

If a ifcfg file has no TYPE=sit, we would detect it as ethernet,
although the presence of IPV6TUNNELIPV4 indicates that it of type
"sit". Ignore such connections.
This commit is contained in:
Thomas Haller 2016-03-04 16:34:54 +01:00
parent 8ccba8d09f
commit 9e4abc99e7
3 changed files with 37 additions and 0 deletions

View file

@ -4993,8 +4993,17 @@ connection_from_file_full (const char *filename,
type = svGetValue (parsed, "TYPE", FALSE);
if (!type) {
gs_free char *tmp = NULL;
char *device;
if ((tmp = svGetValue (parsed, "IPV6TUNNELIPV4", FALSE))) {
if (out_ignore_error)
*out_ignore_error = TRUE;
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,
"Ignoring unsupported connection due to IPV6TUNNELIPV4");
goto done;
}
device = svGetValue (parsed, "DEVICE", FALSE);
if (!device) {
g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION,

View file

@ -0,0 +1,12 @@
# this ifcfg-file represents a "sit" type without explicit TYPE.
# Such connection types are not supported by NetworkManager and
# the connection should be ignored based on the presence of
# IPV6TUNNELIPV4.
DEVICE=sit1
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=yes
IPV6TUNNELIPV4=5.4.3.6
IPV6TUNNELIPV4LOCAL=172.17.1.9
IPV6ADDR=2001:470:2:3:4::2/64

View file

@ -8735,6 +8735,20 @@ test_read_vlan_trailing_spaces (void)
g_object_unref (connection);
}
/*****************************************************************************/
static void
test_sit_read_ignore (void)
{
gs_free_error GError *error = NULL;
_connection_from_file_fail (TEST_IFCFG_DIR "/network-scripts/ifcfg-test-sit-ignore",
NULL, TYPE_ETHERNET, &error);
nmtst_assert_error (error, 0, 0, "*Ignoring unsupported connection due to IPV6TUNNELIPV4*");
}
/*****************************************************************************/
#define TPATH "/settings/plugins/ifcfg-rh/"
@ -8971,6 +8985,8 @@ int main (int argc, char **argv)
g_test_add_func (TPATH "team/write-port", test_write_team_port);
g_test_add_func (TPATH "team/read-port-empty-config", test_read_team_port_empty_config);
g_test_add_func (TPATH "sit/read/ignore", test_sit_read_ignore);
/* Stuff we expect to fail for now */
g_test_add_func (TPATH "pppoe/write-wired", test_write_wired_pppoe);
g_test_add_func (TPATH "vpn/write", test_write_vpn);