From: Felix Fietkau Date: Sat, 21 Sep 2024 16:26:50 +0000 (+0200) Subject: interface: fix regression on adding hotplug devices to interfaces X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=24f9a93a9559c93cf1e794fdfcd87a38d27a8e0e;p=project%2Fnetifd.git interface: fix regression on adding hotplug devices to interfaces Adding the same device to an interface again led to a call chain that ended up removing the device again through device callbacks. Fix this by only toggling the interface available status when the device is still the same. Signed-off-by: Felix Fietkau --- diff --git a/interface.c b/interface.c index 69897dc..923b5b3 100644 --- a/interface.c +++ b/interface.c @@ -1083,8 +1083,14 @@ interface_add_link(struct interface *iface, struct device *dev, { struct device *mdev = iface->main_dev.dev; - if (mdev == dev && iface->state == IFS_UP) + if (mdev == dev) { + if (iface->state != IFS_UP) { + interface_set_available(iface, false); + if (dev->present) + interface_set_available(iface, true); + } return 0; + } if (iface->main_dev.hotplug) interface_set_main_dev(iface, NULL);