veth: drop iface peer check during create_and_realize()

When fetching the parent device, if the system is slow, NetworkManager
can hit a race condition where the property is still NULL. In that case,
NetworkManager should create the veth link.

Checking that the peer device exists, it is type NM_DEVICE_TYPE_VETH and
it have a parent device is enough to know that we can skip the link
creation.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1399

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

Fixes: 4655b7c308 ('veth: fix veth activation on booting')
This commit is contained in:
Fernando Fernandez Mancera
2022-09-27 12:26:14 +02:00
parent 520411623d
commit 07e0ab48d1

View File

@@ -101,8 +101,8 @@ create_and_realize(NMDevice *device,
peer = nm_setting_veth_get_peer(s_veth);
peer_device = nm_manager_get_device(NM_MANAGER_GET, peer, NM_DEVICE_TYPE_VETH);
if (peer_device) {
/* The veth device and its peer already exist. No need to create it again. */
if (nm_streq0(nm_device_get_iface(nm_device_parent_get_device(peer_device)), iface))
if (nm_device_parent_get_device(peer_device))
/* The veth device and its peer already exist. No need to create it again. */
return TRUE;
}