From be28a1173537f664e2bf14c73db1715a60ade7f0 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 20 Jun 2024 16:49:59 +0200 Subject: [PATCH] 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: 830a5a14cb29 ('device: add support for OpenVSwitch devices') https://issues.redhat.com/browse/RHEL-34617 --- NEWS | 2 ++ src/core/devices/ovs/nm-ovsdb.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 4abb6fc1d5..716b90546a 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,8 @@ subject to change and not guaranteed to be compatible with the later release. USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE! +* Support matching a OVS system interface by MAC address. + ============================================= NetworkManager-1.48 Overview of changes since NetworkManager-1.46 diff --git a/src/core/devices/ovs/nm-ovsdb.c b/src/core/devices/ovs/nm-ovsdb.c index 68366f7398..8e32cff57c 100644 --- a/src/core/devices/ovs/nm-ovsdb.c +++ b/src/core/devices/ovs/nm-ovsdb.c @@ -461,7 +461,7 @@ ovsdb_call_method(NMOvsdb *self, "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.port), - nm_connection_get_interface_name(call->payload.add_interface.interface)); + nm_device_get_iface(call->payload.add_interface.interface_device)); break; case OVSDB_DEL_INTERFACE: 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}", "name", - nm_connection_get_interface_name(interface), + nm_device_get_iface(interface_device), "type", type ?: "", "options", @@ -1196,7 +1196,7 @@ _add_interface(NMOvsdb *self, bridge_name = nm_connection_get_interface_name(bridge); 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); /* Determine cloned MAC addresses */