ovs: fail port enslavement when the bridge device is not found

Fail the enslavement of the ovs port if the bridge device is not
found, instead of generating assertions and potentially crash later.

https://bugzilla.redhat.com/show_bug.cgi?id=1797696

Fixes: 101e65d2bb ('ovs: allow changing mac address of bridges and interfaces')
(cherry picked from commit c5c49995b1)
(cherry picked from commit 7494a2e37a)
This commit is contained in:
Beniamino Galvani 2020-02-20 14:44:58 +01:00
parent 323a557f74
commit bb7f729eca

View file

@ -117,6 +117,11 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection, gboo
}
bridge_device = nm_active_connection_get_device (ac_bridge);
if (!bridge_device) {
_LOGW (LOGD_DEVICE, "can't enslave %s: bridge device not found",
nm_device_get_iface (slave));
return FALSE;
}
nm_ovsdb_add_interface (nm_ovsdb_get (),
nm_active_connection_get_applied_connection (ac_bridge),