From d9577c5b5e0463bc12d6473d90e6ac656aae8aff Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 27 Oct 2026 13:44:45 +0000 Subject: [PATCH] wifi-scripts: pair every supplicant mld_set with an mld_start wpa_supplicant marks an MLD start pending at every mld_set, also at one that changes nothing, and mld_start() does nothing while that mark stands. netifd sends mld_start only from wireless_config_done(), at the end of a round that ran a handler. A reload that changes no device sends an mld_set but runs no handler, so the mark stays until the next round. A radio that hostapd gives back in that time does not start the station MLD, and the MLD stays down. Send mld_start after netifd started the wireless devices of a config load, if no handler is queued or running at that time. A round that the same load starts keeps the deferral, because its end sends mld_start as before. Do not send the netifd.wireless.done event there, since no round ended. With the mark cleared after such a load, a later round that sends no mld_set of its own, such as the network.wireless up call of `wifi up`, a check_interfaces() round or the restart after a hostapd process died, would start the MLD radio by radio as hostapd starts each AP. Send the supplicant mld_set when a handler is queued while no other handler runs or waits, so that every round defers the MLD start to its end. That mld_set runs after setup() or teardown() set the device state, so a raise in it would leave the device in setup or teardown with no handler. The two previous commits make wpad_update_mlo() and find_phy() return without a raise for a radio that cannot be resolved. Signed-off-by: Felix Fietkau --- .../files/lib/netifd/wireless-device.uc | 24 ++++++++++++++++++- .../wifi-scripts/files/lib/netifd/wireless.uc | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc b/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc index d700a2897e4..b54afeee781 100644 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc @@ -18,8 +18,9 @@ let wdev_cur; let wdev_handler = {}; let wdev_script_task, wdev_script_timeout; let handler_timer; +let round_start_cb; -function wireless_config_done() +function supplicant_mld_start() { ubus.call({ object: "wpa_supplicant", @@ -27,6 +28,11 @@ function wireless_config_done() return: "ignore", data: { }, }); +} + +function wireless_config_done() +{ + supplicant_mld_start(); ubus.call({ object: "service", @@ -265,6 +271,9 @@ function run_next_handler() function run_handler(wdev, op, cb) { + if (!wdev_cur && !length(wdev_handler) && round_start_cb) + round_start_cb(); + wdev.dbg("queue " + op); wdev_handler[wdev.name] = { op, wdev, cb, @@ -675,6 +684,19 @@ const wdev_proto = { dbg, }; +export function round_start_set(cb) +{ + round_start_cb = cb; +}; + +export function mld_start_idle() +{ + if (wdev_cur || length(wdev_handler) > 0) + return; + + supplicant_mld_start(); +}; + export function new(data, script, driver) { let wdev = { diff --git a/package/network/config/wifi-scripts/files/lib/netifd/wireless.uc b/package/network/config/wifi-scripts/files/lib/netifd/wireless.uc index e2158c17db4..525c01d60a4 100644 --- a/package/network/config/wifi-scripts/files/lib/netifd/wireless.uc +++ b/package/network/config/wifi-scripts/files/lib/netifd/wireless.uc @@ -433,6 +433,8 @@ function config_start() dev.start(); dev.check(); } + + wdev.mld_start_idle(); } function check_interfaces() @@ -734,6 +736,7 @@ function wifi_reset() } wifi_reset(); +wdev.round_start_set(supplicant_update_mlo); wireless.obj = ubus.publish("network.wireless", ubus_obj); wireless.listener = ubus.listener("ubus.object.add", (event, msg) => {