ifcfg-rh: fix handling VLAN connections as bond/bridge slaves (bgo #737377)

MASTER=something denotes a bond slave. Thus we cannot write it for VLAN
setting. When reading, set the correct 'bond' slave type, not 'vlan'.

https://bugzilla.gnome.org/show_bug.cgi?id=737377
This commit is contained in:
Jiří Klimeš 2014-09-25 18:07:56 +02:00
parent 6ae3c1bb82
commit accaedbc37
2 changed files with 5 additions and 17 deletions

View file

@ -4376,7 +4376,6 @@ parse_prio_map_list (NMSettingVlan *s_vlan,
static NMSetting *
make_vlan_setting (shvarFile *ifcfg,
const char *file,
char **out_master,
GError **error)
{
NMSettingVlan *s_vlan = NULL;
@ -4429,7 +4428,7 @@ make_vlan_setting (shvarFile *ifcfg,
}
p++;
} else {
/* format like vlan43; PHYSDEV or MASTER must be set */
/* format like vlan43; PHYSDEV must be set */
if (g_str_has_prefix (iface_name, "vlan"))
p = iface_name + 4;
}
@ -4479,8 +4478,6 @@ make_vlan_setting (shvarFile *ifcfg,
parse_prio_map_list (s_vlan, ifcfg, "VLAN_INGRESS_PRIORITY_MAP", NM_VLAN_INGRESS_MAP);
parse_prio_map_list (s_vlan, ifcfg, "VLAN_EGRESS_PRIORITY_MAP", NM_VLAN_EGRESS_MAP);
if (out_master)
*out_master = svGetValue (ifcfg, "MASTER", FALSE);
return (NMSetting *) s_vlan;
error:
@ -4500,7 +4497,6 @@ vlan_connection_from_ifcfg (const char *file,
NMSetting *wired_setting = NULL;
NMSetting *vlan_setting = NULL;
NMSetting8021x *s_8021x = NULL;
char *master = NULL;
g_return_val_if_fail (file != NULL, NULL);
g_return_val_if_fail (ifcfg != NULL, NULL);
@ -4514,24 +4510,17 @@ vlan_connection_from_ifcfg (const char *file,
g_object_unref (connection);
return NULL;
}
check_if_bond_slave (ifcfg, NM_SETTING_CONNECTION (con_setting));
check_if_team_slave (ifcfg, NM_SETTING_CONNECTION (con_setting));
nm_connection_add_setting (connection, con_setting);
vlan_setting = make_vlan_setting (ifcfg, file, &master, error);
vlan_setting = make_vlan_setting (ifcfg, file, error);
if (!vlan_setting) {
g_object_unref (connection);
return NULL;
}
nm_connection_add_setting (connection, vlan_setting);
/* Handle master interface or connection */
if (master) {
g_object_set (con_setting, NM_SETTING_CONNECTION_MASTER, master, NULL);
g_object_set (con_setting,
NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_VLAN_SETTING_NAME,
NULL);
g_free (master);
}
wired_setting = make_wired_setting (ifcfg, file, &s_8021x, error);
if (!wired_setting) {
g_object_unref (connection);

View file

@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2009 - 2013 Red Hat, Inc.
* Copyright 2009 - 2014 Red Hat, Inc.
*/
#include <string.h>
@ -1179,7 +1179,6 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired,
svSetValue (ifcfg, "TYPE", TYPE_VLAN, FALSE);
svSetValue (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con), FALSE);
svSetValue (ifcfg, "PHYSDEV", nm_setting_vlan_get_parent (s_vlan), FALSE);
svSetValue (ifcfg, "MASTER", nm_setting_connection_get_master (s_con), FALSE);
tmp = g_strdup_printf ("%d", nm_setting_vlan_get_id (s_vlan));
svSetValue (ifcfg, "VLAN_ID", tmp, FALSE);