[openwrt/openwrt] wifi-scripts: Fix parsing of Capabilities

LEDE Commits lede-commits at lists.infradead.org
Sat Nov 23 14:55:51 PST 2024


hauke pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/a281c022883937e6eec27b7811bcde55d5917d63

commit a281c022883937e6eec27b7811bcde55d5917d63
Author: Hauke Mehrtens <hauke at hauke-m.de>
AuthorDate: Sat Nov 23 00:34:30 2024 +0100

    wifi-scripts: Fix parsing of Capabilities
    
    Fixup capabilities parsing in iw output.
    
    In addition to the normal capabilities iw now also outputs HE MAC, HE
    PHY and EHT MAC and EHT PHY capabilities. Exclude them in the parsing.
    
    The grep returns this with mac80211-hwsim:
    ```
    root at OpenWrt:~# iw phy phy0 info | grep 'Capabilities:'
                    Capabilities: 0x107e
                            HE PHY Capabilities: (0x02bfce0000000000000000):
                            EHT PHY Capabilities: (0x7c0000feffff7f01):
                            HE PHY Capabilities: (0x02bfce0000000000000000):
                            EHT PHY Capabilities: (0x7c0000feffff7f01):
                            HE PHY Capabilities: (0x02bf000000000000000000):
                    Capabilities: 0x107e
                            HE PHY Capabilities: (0x1cbfce0000000000000000):
                            EHT PHY Capabilities: (0xfc1f3ffeffff7f37):
                            HE PHY Capabilities: (0x1cbfce0000000000000000):
                            EHT PHY Capabilities: (0xfc1f3ffeffff7f37):
                            HE PHY Capabilities: (0x1cbf000000000000000000):
                            HE PHY Capabilities: (0x1cbfce0000000000000000):
                            EHT PHY Capabilities: (0xfefffffeffffff7f):
                            HE PHY Capabilities: (0x1cbfce0000000000000000):
                            EHT PHY Capabilities: (0xfefffffeffffff7f):
                            HE PHY Capabilities: (0x1cbf000000000000000000):
                    Capabilities: 0x107e
    ```
    
    With busybox 1.36.1 the ht_cap_mask variable will be set to
    -72057598332895361. With busybox 1.37.0 it will be set to -1.
    Both values are wrong, after this change it will be set to 4222
    (0x107E).
    
    Link: https://github.com/openwrt/openwrt/pull/17043
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
    (cherry picked from commit adf958c9192d94fbeeb0ec8e16800b0071455909)
---
 package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index a80d106afa..e14b531c59 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -203,7 +203,7 @@ mac80211_hostapd_setup_base() {
 			dsss_cck_40:1
 
 		ht_cap_mask=0
-		for cap in $(iw phy "$phy" info | grep 'Capabilities:' | cut -d: -f2); do
+		for cap in $(iw phy "$phy" info | grep -E '^\s*Capabilities:' | cut -d: -f2); do
 			ht_cap_mask="$(($ht_cap_mask | $cap))"
 		done
 




More information about the lede-commits mailing list