summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2024-09-21 16:26:50 +0000
committerFelix Fietkau2024-09-21 16:26:51 +0000
commit24f9a93a9559c93cf1e794fdfcd87a38d27a8e0e (patch)
tree25001e49b4a1707e177d891818822ccf2d270c75
parent02aa43d82d587d87523231be5a5e0bf956435725 (diff)
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 <nbd@nbd.name>
-rw-r--r--interface.c8
1 files changed, 7 insertions, 1 deletions
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);