summaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorAlexandru Gagniuc <mr.nuke.me@gmail.com>2024-04-03 14:32:08 -0500
committerFelix Fietkau <nbd@nbd.name>2024-04-07 11:12:43 +0200
commitcee9fcdb7350911f474544189817d25fd4070111 (patch)
tree05723b50fac4202c9d3e51bbe140a2cad4fe45d2 /package
parent7f85104ebb92f8a47868fa61ea952b802079e7be (diff)
downloadopenwrt-cee9fcdb7350911f474544189817d25fd4070111.tar.gz
openwrt-cee9fcdb7350911f474544189817d25fd4070111.tar.bz2
openwrt-cee9fcdb7350911f474544189817d25fd4070111.zip
wifi-scripts: fix creation of IBSS in legacy (non-HT) mode
When an IBBS interface is configured for IBSS legacy mode, wdev.htmode is empty. This is empty string results in an empty positional argument to the "ibbs join" command, for example: iw dev phy0-ibss0 ibss join crymesh 2412 '' fixed-freq beacon-interval 100 This empty argument is interpreted as an invalid HT mode by 'iw', causing the entire command to fail and print a "usage" message: daemon.notice netifd: radio0 (4527): Usage: iw [options] \ dev <devname> ibss join <SSID> <freq in MHz> ... Although nobody will ever need more than 640K of IBSS, explicitly use "NOHT" if an HT mode is not given. This fixes the problem. Fixes: e56c5f7b276a ("hostapd: add ucode support, use ucode for the main ubus object") Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> [extend to cover more cases]
Diffstat (limited to 'package')
-rw-r--r--package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc7
1 files changed, 4 insertions, 3 deletions
diff --git a/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc b/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc
index ff4d629fd6..d505e3035f 100644
--- a/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc
+++ b/package/network/config/wifi-scripts/files/usr/share/hostap/wdev.uc
@@ -32,10 +32,11 @@ function iface_start(wdev)
wdev_config.macaddr = phydev.macaddr_next();
wdev_create(phy, ifname, wdev_config);
wdev_set_up(ifname, true);
+ let htmode = wdev.htmode || "NOHT";
if (wdev.freq)
- system(`iw dev ${ifname} set freq ${wdev.freq} ${wdev.htmode}`);
+ system(`iw dev ${ifname} set freq ${wdev.freq} ${htmode}`);
if (wdev.mode == "adhoc") {
- let cmd = ["iw", "dev", ifname, "ibss", "join", wdev.ssid, wdev.freq, wdev.htmode, "fixed-freq" ];
+ let cmd = ["iw", "dev", ifname, "ibss", "join", wdev.ssid, wdev.freq, htmode, "fixed-freq" ];
if (wdev.bssid)
push(cmd, wdev.bssid);
for (let key in [ "beacon-interval", "basic-rates", "mcast-rate", "keys" ])
@@ -43,7 +44,7 @@ function iface_start(wdev)
push(cmd, key, wdev[key]);
system(cmd);
} else if (wdev.mode == "mesh") {
- let cmd = [ "iw", "dev", ifname, "mesh", "join", wdev.ssid, "freq", wdev.freq, wdev.htmode ];
+ let cmd = [ "iw", "dev", ifname, "mesh", "join", wdev.ssid, "freq", wdev.freq, htmode ];
for (let key in [ "mcast-rate", "beacon-interval" ])
if (wdev[key])
push(cmd, key, wdev[key]);