summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-11-23 09:34:31 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2020-11-26 17:54:22 +0100
commitc4beaac67b2927141a69ce38c5988d6b56812415 (patch)
tree529d5ef443452df2597483fe771b3dd39392bee5
parente9e99b867780acfbd8e943451bb126af67209f40 (diff)
downloadNetworkManager-bg/rh1899745.tar.gz
ovs: avoid ovs error when same MAC is set on a local interface and bridgebg/rh1899745
If the same MAC address is set on both the bridge connection and the interface connection, and the interface is local, NM currently sets the hwaddr record in both Bridge and Interface ovsdb tables. As a result, ovs complains with error: bridge|ERR|interface br0: ignoring mac in Interface record (use Bridge record to set local port's mac) Avoid this error: if the bridge and interface MACs are the same, just set the address in the Bridge table; if they are different, give a more detailed warning and ignore the interface MAC. https://bugzilla.redhat.com/show_bug.cgi?id=1899745
-rw-r--r--src/devices/ovs/nm-ovsdb.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c
index d4b763d454..08bf573880 100644
--- a/src/devices/ovs/nm-ovsdb.c
+++ b/src/devices/ovs/nm-ovsdb.c
@@ -1038,11 +1038,27 @@ _add_interface(NMOvsdb * self,
g_clear_error(&error);
}
- if (interface_is_local && !bridge_cloned_mac && interface_cloned_mac) {
- _LOGT("'%s' is a local ovs-interface, the MAC will be set on ovs-bridge '%s'",
- interface_name,
- bridge_name);
- bridge_cloned_mac = g_steal_pointer(&interface_cloned_mac);
+ /* For local interfaces, ovs complains if it finds a
+ * MAC address in the Interface table because it only takes
+ * the MAC from the Bridge table.
+ * Set any cloned MAC present in a local interface connection
+ * into the Bridge table, unless conflicting with the bridge MAC. */
+ if (interface_is_local && interface_cloned_mac) {
+ if (bridge_cloned_mac && !nm_streq(interface_cloned_mac, bridge_cloned_mac)) {
+ _LOGW("Cloned MAC '%s' of local ovs-interface '%s' conflicts with MAC '%s' of bridge "
+ "'%s'",
+ interface_cloned_mac,
+ interface_name,
+ bridge_cloned_mac,
+ bridge_name);
+ nm_clear_g_free(&interface_cloned_mac);
+ } else {
+ nm_clear_g_free(&bridge_cloned_mac);
+ bridge_cloned_mac = g_steal_pointer(&interface_cloned_mac);
+ _LOGT("'%s' is a local ovs-interface, the MAC will be set on ovs-bridge '%s'",
+ interface_name,
+ bridge_name);
+ }
}
g_hash_table_iter_init(&iter, priv->bridges);