mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 03:20:11 +01:00
core: don't try to create VLANs on devices that don't support them
VLANs are only supported on certain kinds of devices, so don't try to create them on other devices. (In fact, NM currently assumes that VLANs are only created on Ethernet devices, so we need to be even more picky than that.)
This commit is contained in:
parent
de0163fc5c
commit
0a30843caa
3 changed files with 19 additions and 1 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#include "nm-glib-compat.h"
|
||||
#include "nm-device.h"
|
||||
#include "nm-device-private.h"
|
||||
#include "nm-device-ethernet.h"
|
||||
#include "NetworkManagerUtils.h"
|
||||
#include "nm-system.h"
|
||||
#include "nm-dhcp-manager.h"
|
||||
|
|
@ -5117,3 +5118,9 @@ cp_connection_updated (NMConnectionProvider *cp, NMConnection *connection, gpoin
|
|||
_signal_available_connections_changed (NM_DEVICE (user_data));
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_supports_vlans (NMDevice *device)
|
||||
{
|
||||
/* At the moment, NM's VLAN code assumes all VLANs are over ethernet. */
|
||||
return NM_IS_DEVICE_ETHERNET (device);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,6 +288,8 @@ gboolean nm_device_activate (NMDevice *device, NMActRequest *req, GError **error
|
|||
|
||||
void nm_device_set_connection_provider (NMDevice *device, NMConnectionProvider *provider);
|
||||
|
||||
gboolean nm_device_supports_vlans (NMDevice *device);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_DEVICE_H */
|
||||
|
|
|
|||
|
|
@ -1026,11 +1026,20 @@ get_virtual_iface_name (NMManager *self,
|
|||
|
||||
parent = find_vlan_parent (self, connection, TRUE);
|
||||
if (parent) {
|
||||
ifname = nm_connection_get_virtual_iface_name (connection);
|
||||
|
||||
if (!nm_device_supports_vlans (parent)) {
|
||||
nm_log_warn (LOGD_DEVICE, "(%s): No support for VLANs on interface %s of type %s",
|
||||
ifname ? ifname : nm_connection_get_id (connection),
|
||||
nm_device_get_ip_iface (parent),
|
||||
nm_device_get_type_desc (parent));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If the connection doesn't specify the interface name for the VLAN
|
||||
* device, we create one for it using the VLAN ID and the parent
|
||||
* interface's name.
|
||||
*/
|
||||
ifname = nm_connection_get_virtual_iface_name (connection);
|
||||
if (ifname)
|
||||
vname = g_strdup (ifname);
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue