Skip to content

Commit 9aca8a9

Browse files
committed
wpa_supplicant: add MLO client support
Can also be used for a client mode interface that is able to connect on multiple bands individually, while handling hostapd state for the correct band. Signed-off-by: Felix Fietkau <[email protected]>
1 parent 5170a24 commit 9aca8a9

File tree

7 files changed

+557
-79
lines changed

7 files changed

+557
-79
lines changed

package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/supplicant.uc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ export function generate(config_list, data, interface) {
248248
iface: interface.config.ifname,
249249
config: file_name,
250250
'4addr': !!interface.config.wds,
251+
mlo: !!interface.config.mlo,
252+
freq_list: data.config.scan_list,
251253
powersave: false
252254
};
253255

package/network/config/wifi-scripts/files/lib/netifd/wireless-device.uc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@ let wdev_handler = {};
1717
let wdev_script_task, wdev_script_timeout;
1818
let handler_timer;
1919

20+
function supplicant_start_mlo()
21+
{
22+
ubus.call({
23+
object: "wpa_supplicant",
24+
method: "mld_start",
25+
return: "ignore",
26+
data: { },
27+
});
28+
}
29+
2030
function delete_wdev(name)
2131
{
2232
delete netifd.wireless.devices[name];
@@ -216,6 +226,9 @@ function run_next_handler()
216226
{
217227
while (!wdev_cur && length(wdev_handler) > 0)
218228
__run_next_handler();
229+
230+
if (!wdev_cur && !length(wdev_handler))
231+
supplicant_start_mlo();
219232
}
220233
221234
function run_handler(wdev, op, cb)

package/network/config/wifi-scripts/files/lib/netifd/wireless.uc

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ let wireless = netifd.wireless = {
1717
path: realpath(netifd.main_path + "/wireless"),
1818
};
1919
20-
function hostapd_update_mlo()
20+
function wpad_update_mlo(service, mode)
2121
{
2222
let config = {};
2323
2424
for (let ifname, data in wireless.mlo) {
25-
if (data.mode != "ap")
25+
if (data.mode != mode)
2626
continue;
2727
2828
data.phy = find_phy(data.radio_config[0], true);
@@ -33,17 +33,28 @@ function hostapd_update_mlo()
3333
}
3434
3535
ubus.call({
36-
object: "hostapd",
36+
object: service,
3737
method: "mld_set",
3838
return: "ignore",
3939
data: { config },
4040
});
4141
}
4242
43+
function hostapd_update_mlo()
44+
{
45+
wpad_update_mlo("hostapd", "ap");
46+
}
47+
48+
function supplicant_update_mlo()
49+
{
50+
wpad_update_mlo("wpa_supplicant", "sta");
51+
}
52+
4353
function update_config(new_devices, mlo_vifs)
4454
{
4555
wireless.mlo = mlo_vifs;
4656
hostapd_update_mlo();
57+
supplicant_update_mlo();
4758
4859
for (let name, dev in wireless.devices)
4960
if (!new_devices[name])
@@ -516,6 +527,8 @@ wireless.obj = ubus.publish("network.wireless", ubus_obj);
516527
wireless.listener = ubus.listener("ubus.object.add", (event, msg) => {
517528
if (msg.path == "hostapd")
518529
hostapd_update_mlo();
530+
else if (msg.path == "wpa_supplicant")
531+
supplicant_update_mlo();
519532
});
520533

521534
return {

0 commit comments

Comments
 (0)