ovs: allow specifying a system OVS interface by MAC address

The OVS interface can be matched via MAC address; in that case, the
"connection.interface-name" property of the connection is empty.

When populating the ovsdb, we need to pass the actual interface name
from the device, not the one from the connection.

Fixes: 830a5a14cb ('device: add support for OpenVSwitch devices')

https://issues.redhat.com/browse/RHEL-34617
This commit is contained in:
Beniamino Galvani
2024-06-20 16:49:59 +02:00
parent a5333f14b5
commit be28a11735
2 changed files with 5 additions and 3 deletions

2
NEWS
View File

@@ -8,6 +8,8 @@ subject to change and not guaranteed to be compatible with
the later release. the later release.
USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE! USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
* Support matching a OVS system interface by MAC address.
============================================= =============================================
NetworkManager-1.48 NetworkManager-1.48
Overview of changes since NetworkManager-1.46 Overview of changes since NetworkManager-1.46

View File

@@ -461,7 +461,7 @@ ovsdb_call_method(NMOvsdb *self,
"new: add-interface bridge=%s port=%s interface=%s", "new: add-interface bridge=%s port=%s interface=%s",
nm_connection_get_interface_name(call->payload.add_interface.bridge), nm_connection_get_interface_name(call->payload.add_interface.bridge),
nm_connection_get_interface_name(call->payload.add_interface.port), nm_connection_get_interface_name(call->payload.add_interface.port),
nm_connection_get_interface_name(call->payload.add_interface.interface)); nm_device_get_iface(call->payload.add_interface.interface_device));
break; break;
case OVSDB_DEL_INTERFACE: case OVSDB_DEL_INTERFACE:
call->payload.del_interface.ifname = g_strdup(payload->del_interface.ifname); call->payload.del_interface.ifname = g_strdup(payload->del_interface.ifname);
@@ -945,7 +945,7 @@ _insert_interface(json_t *params,
row = json_pack("{s:s, s:s, s:o, s:o, s:o}", row = json_pack("{s:s, s:s, s:o, s:o, s:o}",
"name", "name",
nm_connection_get_interface_name(interface), nm_device_get_iface(interface_device),
"type", "type",
type ?: "", type ?: "",
"options", "options",
@@ -1196,7 +1196,7 @@ _add_interface(NMOvsdb *self,
bridge_name = nm_connection_get_interface_name(bridge); bridge_name = nm_connection_get_interface_name(bridge);
port_name = nm_connection_get_interface_name(port); port_name = nm_connection_get_interface_name(port);
interface_name = nm_connection_get_interface_name(interface); interface_name = nm_device_get_iface(interface_device);
interface_is_local = nm_streq0(bridge_name, interface_name); interface_is_local = nm_streq0(bridge_name, interface_name);
/* Determine cloned MAC addresses */ /* Determine cloned MAC addresses */