ifcfg-rh: ignore BRIDGE and VLAN configs until we support them (rh #619863)

This commit is contained in:
Dan Williams 2010-08-03 16:17:45 -07:00
parent ec6d18ca66
commit 43c6800b35
7 changed files with 131 additions and 3 deletions

View file

@ -41,6 +41,7 @@
#define TYPE_ETHERNET "Ethernet"
#define TYPE_WIRELESS "Wireless"
#define TYPE_BRIDGE "Bridge"
GQuark ifcfg_plugin_error_quark (void);

View file

@ -3197,7 +3197,7 @@ connection_from_file (const char *filename,
{
NMConnection *connection = NULL;
shvarFile *parsed;
char *type, *nmc = NULL, *bootproto;
char *type, *nmc = NULL, *bootproto, *tmp;
NMSetting *s_ip4, *s_ip6;
const char *ifcfg_name = NULL;
gboolean nm_controlled = TRUE;
@ -3285,11 +3285,32 @@ connection_from_file (const char *filename,
g_free (lower);
}
/* Ignore BRIDGE= and VLAN= connections for now too (rh #619863) */
tmp = svGetValue (parsed, "BRIDGE", FALSE);
if (tmp) {
g_set_error (error, ifcfg_plugin_error_quark (), 0,
"Bridge component connections are not yet supported");
g_free (tmp);
goto done;
}
tmp = svGetValue (parsed, "VLAN", FALSE);
if (tmp) {
g_set_error (error, ifcfg_plugin_error_quark (), 0,
"VLAN connections are not yet supported");
g_free (tmp);
goto done;
}
/* Construct the connection */
if (!strcasecmp (type, TYPE_ETHERNET))
connection = wired_connection_from_ifcfg (filename, parsed, nm_controlled, unmanaged, error);
else if (!strcasecmp (type, TYPE_WIRELESS))
connection = wireless_connection_from_ifcfg (filename, parsed, nm_controlled, unmanaged, error);
else {
else if (!strcasecmp (type, TYPE_BRIDGE)) {
g_set_error (error, ifcfg_plugin_error_quark (), 0,
"Bridge connections are not yet supported");
} else {
g_set_error (error, ifcfg_plugin_error_quark (), 0,
"Unknown connection type '%s'", type);
}

View file

@ -65,7 +65,10 @@ EXTRA_DIST = \
keys-test-wifi-wep-40-ascii \
ifcfg-test-wifi-wep-104-ascii \
keys-test-wifi-wep-104-ascii \
ifcfg-test-wired-qeth-static
ifcfg-test-wired-qeth-static \
ifcfg-test-bridge-main \
ifcfg-test-bridge-component \
ifcfg-test-vlan-interface
check-local:
@for f in $(EXTRA_DIST); do \

View file

@ -0,0 +1,5 @@
DEVICE=eth0
HWADDR=00:22:15:59:62:97
ONBOOT=no
BRIDGE=br0

View file

@ -0,0 +1,7 @@
DEVICE=br0
ONBOOT=no
TYPE=Bridge
BOOTPROTO=dhcp
STP=on
DELAY=0

View file

@ -0,0 +1,7 @@
DEVICE=eth1.43
VLAN=yes
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.43.149
NETMASK=255.255.255.0

View file

@ -9282,6 +9282,87 @@ test_write_mobile_broadband (gboolean gsm)
g_object_unref (connection);
}
#define TEST_IFCFG_BRIDGE_MAIN TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bridge-main"
static void
test_read_bridge_main (void)
{
NMConnection *connection;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
char *route6file = NULL;
gboolean ignore_error = FALSE;
GError *error = NULL;
connection = connection_from_file (TEST_IFCFG_BRIDGE_MAIN,
NULL,
TYPE_ETHERNET,
NULL,
&unmanaged,
&keyfile,
&routefile,
&route6file,
&error,
&ignore_error);
ASSERT (connection == NULL,
"bridge-main-read", "unexpected success reading %s", TEST_IFCFG_BRIDGE_MAIN);
}
#define TEST_IFCFG_BRIDGE_COMPONENT TEST_IFCFG_DIR"/network-scripts/ifcfg-test-bridge-component"
static void
test_read_bridge_component (void)
{
NMConnection *connection;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
char *route6file = NULL;
gboolean ignore_error = FALSE;
GError *error = NULL;
connection = connection_from_file (TEST_IFCFG_BRIDGE_COMPONENT,
NULL,
TYPE_ETHERNET,
NULL,
&unmanaged,
&keyfile,
&routefile,
&route6file,
&error,
&ignore_error);
ASSERT (connection == NULL,
"bridge-component-read", "unexpected success reading %s", TEST_IFCFG_BRIDGE_COMPONENT);
}
#define TEST_IFCFG_VLAN_INTERFACE TEST_IFCFG_DIR"/network-scripts/ifcfg-test-vlan-interface"
static void
test_read_vlan_interface (void)
{
NMConnection *connection;
char *unmanaged = NULL;
char *keyfile = NULL;
char *routefile = NULL;
char *route6file = NULL;
gboolean ignore_error = FALSE;
GError *error = NULL;
connection = connection_from_file (TEST_IFCFG_VLAN_INTERFACE,
NULL,
TYPE_ETHERNET,
NULL,
&unmanaged,
&keyfile,
&routefile,
&route6file,
&error,
&ignore_error);
ASSERT (connection == NULL,
"vlan-interface-read", "unexpected success reading %s", TEST_IFCFG_VLAN_INTERFACE);
}
#define TEST_IFCFG_WIFI_OPEN_SSID_BAD_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-bad-hex"
#define TEST_IFCFG_WIFI_OPEN_SSID_LONG_QUOTED TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-long-quoted"
#define TEST_IFCFG_WIFI_OPEN_SSID_LONG_HEX TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open-ssid-long-hex"
@ -9411,6 +9492,9 @@ int main (int argc, char **argv)
test_write_vpn ();
test_write_mobile_broadband (TRUE);
test_write_mobile_broadband (FALSE);
test_read_bridge_main ();
test_read_bridge_component ();
test_read_vlan_interface ();
base = g_path_get_basename (argv[0]);
fprintf (stdout, "%s: SUCCESS\n", base);