mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 02:57:58 +02:00
merge: branch 'nm-1-42-ovs-vlan'
[nm 1.42] ovs: Do not allow OVS bridge and port to be parent https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1917
This commit is contained in:
commit
5d95a12f42
3 changed files with 21 additions and 5 deletions
|
|
@ -8939,6 +8939,17 @@ nm_device_check_slave_connection_compatible(NMDevice *self, NMConnection *slave)
|
|||
return nm_streq(connection_type, slave_type);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_can_be_parent(NMDevice *self)
|
||||
{
|
||||
NMDeviceType device_type = nm_device_get_device_type(self);
|
||||
|
||||
if ((device_type == NM_DEVICE_TYPE_OVS_BRIDGE) || (device_type == NM_DEVICE_TYPE_OVS_PORT))
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_device_can_assume_connections:
|
||||
* @self: #NMDevice instance
|
||||
|
|
|
|||
|
|
@ -534,6 +534,7 @@ gboolean
|
|||
nm_device_check_connection_compatible(NMDevice *device, NMConnection *connection, GError **error);
|
||||
|
||||
gboolean nm_device_check_slave_connection_compatible(NMDevice *device, NMConnection *connection);
|
||||
gboolean nm_device_can_be_parent(NMDevice *device);
|
||||
|
||||
gboolean nm_device_can_assume_connections(NMDevice *self);
|
||||
gboolean nm_device_unmanage_on_quit(NMDevice *self);
|
||||
|
|
|
|||
|
|
@ -1410,7 +1410,8 @@ find_device_by_ip_iface(NMManager *self, const char *iface)
|
|||
* is given, this function will only return master devices and will ensure
|
||||
* @slave, when activated, can be a slave of the returned master device. If
|
||||
* @connection is given, this function will only consider devices that are
|
||||
* compatible with @connection.
|
||||
* compatible with @connection. If @child is given, this function will only
|
||||
* return parent device.
|
||||
*
|
||||
* Returns: the matching #NMDevice
|
||||
*/
|
||||
|
|
@ -1418,7 +1419,8 @@ static NMDevice *
|
|||
find_device_by_iface(NMManager *self,
|
||||
const char *iface,
|
||||
NMConnection *connection,
|
||||
NMConnection *slave)
|
||||
NMConnection *slave,
|
||||
NMConnection *child)
|
||||
{
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self);
|
||||
NMDevice *fallback = NULL;
|
||||
|
|
@ -1437,6 +1439,8 @@ find_device_by_iface(NMManager *self,
|
|||
if (!nm_device_check_slave_connection_compatible(candidate, slave))
|
||||
continue;
|
||||
}
|
||||
if (child && !nm_device_can_be_parent(candidate))
|
||||
continue;
|
||||
|
||||
if (nm_device_is_real(candidate))
|
||||
return candidate;
|
||||
|
|
@ -1899,7 +1903,7 @@ find_parent_device_for_connection(NMManager *self,
|
|||
NM_SET_OUT(out_parent_spec, parent_name);
|
||||
|
||||
/* Try as an interface name of a parent device */
|
||||
parent = find_device_by_iface(self, parent_name, NULL, NULL);
|
||||
parent = find_device_by_iface(self, parent_name, NULL, NULL, connection);
|
||||
if (parent)
|
||||
return parent;
|
||||
|
||||
|
|
@ -4404,7 +4408,7 @@ find_master(NMManager *self,
|
|||
return TRUE; /* success, but no master */
|
||||
|
||||
/* Try as an interface name first */
|
||||
master_device = find_device_by_iface(self, master, NULL, connection);
|
||||
master_device = find_device_by_iface(self, master, NULL, connection, NULL);
|
||||
if (master_device) {
|
||||
if (master_device == device) {
|
||||
g_set_error_literal(error,
|
||||
|
|
@ -5739,7 +5743,7 @@ validate_activation_request(NMManager *self,
|
|||
if (!iface)
|
||||
return NULL;
|
||||
|
||||
device = find_device_by_iface(self, iface, connection, NULL);
|
||||
device = find_device_by_iface(self, iface, connection, NULL, NULL);
|
||||
if (!device) {
|
||||
g_set_error_literal(error,
|
||||
NM_MANAGER_ERROR,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue