ovs: merge branch 'bg/rh1899745'
https://bugzilla.redhat.com/show_bug.cgi?id=1899745
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/691
(cherry picked from commit e2ed707c87
)
This commit is contained in:
@@ -707,7 +707,7 @@ _add_interface(NMOvsdb * self,
|
|||||||
nm_auto_decref_json json_t *interfaces = NULL;
|
nm_auto_decref_json json_t *interfaces = NULL;
|
||||||
nm_auto_decref_json json_t *new_interfaces = NULL;
|
nm_auto_decref_json json_t *new_interfaces = NULL;
|
||||||
gboolean has_interface = FALSE;
|
gboolean has_interface = FALSE;
|
||||||
gboolean interface_is_internal;
|
gboolean interface_is_local;
|
||||||
gs_free char * bridge_cloned_mac = NULL;
|
gs_free char * bridge_cloned_mac = NULL;
|
||||||
gs_free char * interface_cloned_mac = NULL;
|
gs_free char * interface_cloned_mac = NULL;
|
||||||
GError * error = NULL;
|
GError * error = NULL;
|
||||||
@@ -721,10 +721,10 @@ _add_interface(NMOvsdb * self,
|
|||||||
new_ports = json_array();
|
new_ports = json_array();
|
||||||
new_interfaces = json_array();
|
new_interfaces = json_array();
|
||||||
|
|
||||||
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_connection_get_interface_name(interface);
|
||||||
interface_is_internal = nm_streq0(bridge_name, interface_name);
|
interface_is_local = nm_streq0(bridge_name, interface_name);
|
||||||
|
|
||||||
/* Determine cloned MAC addresses */
|
/* Determine cloned MAC addresses */
|
||||||
if (!nm_device_hw_addr_get_cloned(bridge_device,
|
if (!nm_device_hw_addr_get_cloned(bridge_device,
|
||||||
@@ -733,7 +733,7 @@ _add_interface(NMOvsdb * self,
|
|||||||
&bridge_cloned_mac,
|
&bridge_cloned_mac,
|
||||||
NULL,
|
NULL,
|
||||||
&error)) {
|
&error)) {
|
||||||
_LOGW("Cannot determine cloned mac for OVS %s '%s': %s",
|
_LOGW("Cannot determine cloned MAC for OVS %s '%s': %s",
|
||||||
"bridge",
|
"bridge",
|
||||||
bridge_name,
|
bridge_name,
|
||||||
error->message);
|
error->message);
|
||||||
@@ -746,18 +746,34 @@ _add_interface(NMOvsdb * self,
|
|||||||
&interface_cloned_mac,
|
&interface_cloned_mac,
|
||||||
NULL,
|
NULL,
|
||||||
&error)) {
|
&error)) {
|
||||||
_LOGW("Cannot determine cloned mac for OVS %s '%s': %s",
|
_LOGW("Cannot determine cloned MAC for OVS %s '%s': %s",
|
||||||
"interface",
|
"interface",
|
||||||
interface_name,
|
interface_name,
|
||||||
error->message);
|
error->message);
|
||||||
g_clear_error(&error);
|
g_clear_error(&error);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interface_is_internal && !bridge_cloned_mac && interface_cloned_mac) {
|
/* For local interfaces, ovs complains if it finds a
|
||||||
_LOGT("'%s' is a local ovs-interface, the MAC will be set on ovs-bridge '%s'",
|
* MAC address in the Interface table because it only takes
|
||||||
interface_name,
|
* the MAC from the Bridge table.
|
||||||
bridge_name);
|
* Set any cloned MAC present in a local interface connection
|
||||||
bridge_cloned_mac = g_steal_pointer(&interface_cloned_mac);
|
* 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);
|
g_hash_table_iter_init(&iter, priv->bridges);
|
||||||
@@ -823,7 +839,7 @@ _add_interface(NMOvsdb * self,
|
|||||||
g_return_if_fail(ovs_bridge);
|
g_return_if_fail(ovs_bridge);
|
||||||
_expect_bridge_ports(params, ovs_bridge->name, ports);
|
_expect_bridge_ports(params, ovs_bridge->name, ports);
|
||||||
_set_bridge_ports(params, bridge_name, new_ports);
|
_set_bridge_ports(params, bridge_name, new_ports);
|
||||||
if (bridge_cloned_mac && interface_is_internal)
|
if (bridge_cloned_mac && interface_is_local)
|
||||||
_set_bridge_mac(params, bridge_name, bridge_cloned_mac);
|
_set_bridge_mac(params, bridge_name, bridge_cloned_mac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user