Skip to content

veth: fix detection of existing interfaces in create_and_realize()

Beniamino Galvani requested to merge bg/veth-detect-existing into main

The current implementation only checks that a device with name equal to veth.peer exists and it has a parent device; it doesn't check that its parent is actually the device we want to create. So for example, if the profile specifies interface-name A and peer B, while in platform we have a veth pair {B,C}, we'll skip the interface creation and the device will remain without a ifindex, leading to a crash later. Fix this by adding the missing check.

While at it, don't implement the check by inspecting NMDevices but look directly at the platform cache; that seems more robust because devices are often updated from platform events via idle handlers and so the information there could be outdated.

Fixes: 07e0ab48 ('veth: drop iface peer check during create_and_realize()')

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

Merge request reports