platform: fix VLAN ingress/egress map setting

This commit is contained in:
Dan Winship
2013-09-03 14:02:59 -04:00
parent e4b92acdf7
commit fd85ec45b9

View File

@@ -1744,10 +1744,15 @@ vlan_get_info (NMPlatform *platform, int ifindex, int *parent, int *vlan_id)
static gboolean static gboolean
vlan_set_ingress_map (NMPlatform *platform, int ifindex, int from, int to) vlan_set_ingress_map (NMPlatform *platform, int ifindex, int from, int to)
{ {
auto_nl_object struct rtnl_link *change = rtnl_link_alloc (); /* We have to use link_get() because a "blank" rtnl_link won't have the
* right data structures to be able to call rtnl_link_vlan_set_ingress_map()
* on it. (Likewise below in vlan_set_egress_map().)
*/
auto_nl_object struct rtnl_link *change = link_get (platform, ifindex);
g_assert (change); if (!change)
rtnl_link_vlan_set_egress_map (change, from, to); return FALSE;
rtnl_link_vlan_set_ingress_map (change, from, to);
return link_change (platform, ifindex, change); return link_change (platform, ifindex, change);
} }
@@ -1755,9 +1760,10 @@ vlan_set_ingress_map (NMPlatform *platform, int ifindex, int from, int to)
static gboolean static gboolean
vlan_set_egress_map (NMPlatform *platform, int ifindex, int from, int to) vlan_set_egress_map (NMPlatform *platform, int ifindex, int from, int to)
{ {
auto_nl_object struct rtnl_link *change = rtnl_link_alloc (); auto_nl_object struct rtnl_link *change = link_get (platform, ifindex);
g_assert (change); if (!change)
return FALSE;
rtnl_link_vlan_set_egress_map (change, from, to); rtnl_link_vlan_set_egress_map (change, from, to);
return link_change (platform, ifindex, change); return link_change (platform, ifindex, change);