stop() and destroy() set cancel_setup while a setup handler is running, but
nothing read it, so a device brought down (or removed) mid-setup still went
up and stayed up, holding its interface links. Check the flag (and
autostart/delete) in wdev_mark_up and tear the device down instead of
completing the up transition.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (wdev.state != "setup")
return;
+ if (wdev.cancel_setup || !wdev.autostart || wdev.delete) {
+ delete wdev.cancel_setup;
+ wdev.teardown();
+ return 0;
+ }
+
for (let section, data in wdev.handler_data) {
if (data.ifname)
handle_link(data.ifname, data, true);