vlan: fix unmanaged VLAN interface problem (rh #1273879)

Commit 285ee1fda2 added NM_UNMANAGED_PLATFORM_INIT
flag marking platform uninitialized devices. The flags is set by
NM_DEVICE_PLATFORM_DEVICE property and on link changes. However, for virtual
devices, the platform device property was not set at NM device construction time
and link change event happened even before. That resulted in the device having
platform_link_initialized=FALSE and thus it was left unmanaged.

Make the change for other software devices too.

https://bugzilla.redhat.com/show_bug.cgi?id=1273879
This commit is contained in:
Jiří Klimeš 2015-10-21 14:57:23 +02:00
parent e0e043ef39
commit 4c9d7e7797
5 changed files with 20 additions and 10 deletions

View file

@ -572,6 +572,7 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
{
const char *iface = nm_connection_get_interface_name (connection);
NMPlatformError plerr;
const NMPlatformLink *plink;
g_assert (iface);
@ -584,14 +585,15 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
nm_platform_error_to_string (plerr));
return NULL;
}
plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
return (NMDevice *) g_object_new (NM_TYPE_DEVICE_BOND,
NM_DEVICE_IFACE, iface,
NM_DEVICE_DRIVER, "bonding",
NM_DEVICE_TYPE_DESC, "Bond",
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BOND,
NM_DEVICE_IS_MASTER, TRUE,
NULL);
NM_DEVICE_PLATFORM_DEVICE, plink,
NM_DEVICE_DRIVER, "bonding",
NM_DEVICE_TYPE_DESC, "Bond",
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BOND,
NM_DEVICE_IS_MASTER, TRUE,
NULL);
}
NM_DEVICE_FACTORY_DEFINE_INTERNAL (BOND, Bond, bond,

View file

@ -498,6 +498,7 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
const char *mac_address_str;
guint8 mac_address[NM_UTILS_HWADDR_LEN_MAX];
NMPlatformError plerr;
const NMPlatformLink *plink;
g_assert (iface);
@ -523,9 +524,10 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
nm_platform_error_to_string (plerr));
return NULL;
}
plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
return (NMDevice *) g_object_new (NM_TYPE_DEVICE_BRIDGE,
NM_DEVICE_IFACE, iface,
NM_DEVICE_PLATFORM_DEVICE, plink,
NM_DEVICE_DRIVER, "bridge",
NM_DEVICE_TYPE_DESC, "Bridge",
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_BRIDGE,

View file

@ -327,6 +327,7 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
int p_key, parent_ifindex;
const char *iface;
NMPlatformError plerr;
const NMPlatformLink *plink;
if (!NM_IS_DEVICE_INFINIBAND (parent)) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
@ -352,9 +353,10 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
nm_platform_error_to_string (plerr));
return NULL;
}
plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
return (NMDevice *) g_object_new (NM_TYPE_DEVICE_INFINIBAND,
NM_DEVICE_IFACE, iface,
NM_DEVICE_PLATFORM_DEVICE, plink,
NM_DEVICE_DRIVER, nm_device_get_driver (parent),
NM_DEVICE_TYPE_DESC, "InfiniBand",
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_INFINIBAND,

View file

@ -698,6 +698,7 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
NMSettingVlan *s_vlan;
gs_free char *iface = NULL;
NMPlatformError plerr;
const NMPlatformLink *plink;
if (!NM_IS_DEVICE (parent)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
@ -728,9 +729,10 @@ create_virtual_device_for_connection (NMDeviceFactory *factory,
nm_platform_error_to_string (plerr));
return NULL;
}
plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
device = (NMDevice *) g_object_new (NM_TYPE_DEVICE_VLAN,
NM_DEVICE_IFACE, iface,
NM_DEVICE_PLATFORM_DEVICE, plink,
NM_DEVICE_VLAN_INT_PARENT_DEVICE, parent,
NM_DEVICE_DRIVER, "8021q",
NM_DEVICE_TYPE_DESC, "VLAN",

View file

@ -710,6 +710,7 @@ nm_device_team_new_for_connection (NMConnection *connection, GError **error)
{
const char *iface = nm_connection_get_interface_name (connection);
NMPlatformError plerr;
const NMPlatformLink *plink;
g_assert (iface);
@ -722,9 +723,10 @@ nm_device_team_new_for_connection (NMConnection *connection, GError **error)
nm_platform_error_to_string (plerr));
return NULL;
}
plink = nm_platform_link_get_by_ifname (NM_PLATFORM_GET, iface);
return (NMDevice *) g_object_new (NM_TYPE_DEVICE_TEAM,
NM_DEVICE_IFACE, iface,
NM_DEVICE_PLATFORM_DEVICE, plink,
NM_DEVICE_DRIVER, "team",
NM_DEVICE_TYPE_DESC, "Team",
NM_DEVICE_DEVICE_TYPE, NM_DEVICE_TYPE_TEAM,