summaryrefslogtreecommitdiff
path: root/iwinfo_nl80211.c
Commit message (Collapse)AuthorAgeFilesLines
* nl80211: restore iterating over all devices in nl80211_phy2ifname()Andre Heider2023-02-061-4/+6
| | | | | | | | | | | | | | | This reverts to the earlier behaviour, because: * phys can be renamed, which breaks hardcoding "phy%d" * /sys/class/ieee80211/*/device can return networks of other phys, since "device" is a symlink which can have multiple phys The earlier behaviour fixes both points. Fixes: 6194aaf0 "nl80211: simplify iterating over phy's devices" Signed-off-by: Andre Heider <a.heider@gmail.com> Tested-by: Olcay Korkmaz <nuke_mania@hotmail.com> [ drop extra Fixes tag related to openwrt issue ] Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* nl80211: fix some commentsAndre Heider2023-01-201-4/+4
| | | | | | Spelling and indenting fixes. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: prefer non-supplicant-based devicesAndre Heider2023-01-201-4/+12
| | | | | | | | | | | | | If a phy has multiple devices, prefer non-supplicant-based ones as per link_mode, see [0] and [1]. The nl80211 API provides more information than wpa_supplicant/hostapd does, like HT/VHT operation, which are used by e.g. luci's channel analysis. [0] https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net [1] https://github.com/openwrt/luci/issues/6167#issuecomment-1364500296 Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: simplify iterating over phy's devicesAndre Heider2023-01-201-12/+9
| | | | | | | There's no need to iterate over all devices in /sys/class/net and check if the phy index matches, sysfs already provides per phy devices. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: remove redundant check in nl80211_phy2ifname()Andre Heider2023-01-201-16/+13
| | | | | | phyidx is already checked for <0 a few lines above. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: add "mhz" and "band" to iwinfo_scanlist_entryAndre Heider2023-01-201-3/+22
| | | | | | | | | Providing the channel alone isn't clear as there're overlapping channels on e.g. band 2 and 6. Note: This changes the ABI. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: add "band" to iwinfo_freqlist_entryAndre Heider2023-01-201-0/+1
| | | | | | | | | So that consumers don't have to fiddle around with mapping frequencies to bands, which everyone seems to do a little differently. Note: This changes the ABI. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: add support for radiation and indoor chan restrictionChristian Marangi2023-01-201-5/+8
| | | | | | Add new 'flags' bits to declare these two channel restrictions. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* devices: add support for declaring compatible matched devicesJo-Philipp Wich2023-01-101-63/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Some device have embedded wifi card that are not connected with usb or internall with pci. Such device have fake device_id and only the vendor_id actually reflect something real but internally they don't have any id and are just matched by the node compatible binding in DT. We currently match this with a big if-else to match the single devices but this can be improved and be matched directly in devices.txt Rework this so that we can drop the big if-else and move the matching to devices.txt When a device is matched using compatible in iwinfo the hardware will be flagged as embedded and won't print empty ids. Update devices.txt by migrating all the compatible matching device from fake id to compatible matching. Tested-by: Christian Marangi <ansuelsmth@gmail.com> # ipq4019 Co-developed-by: Christian Marangi <ansuelsmth@gmail.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Tested-by: Robert Marko <robimarko@gmail.com> # ipq8074 Reviewed-by: Andre Heider <a.heider@gmail.com>
* iwinfo: devices: add Qualcomm Atheros IPQ8074 WiSoCRobert Marko2023-01-061-0/+5
| | | | | | | Add detection of the Qualcomm Atheros IPQ8074 WiSoC using the compatible string from device tree. Signed-off-by: Robert Marko <robimarko@gmail.com>
* nl80211: mark frequencies where HE operation in not allowedAndre Heider2022-12-151-0/+2
| | | | | | | Repurpose the IWINFO_FREQ_NO_2160MHZ define for that, which was introduced but never used. nl80211 doesn't have such a flag either. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: add support for HE htmodesAndre Heider2022-12-151-7/+26
| | | | | | Query hostapd or wpa_supplicant to determine if 802.11ax is enabled. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: properly get available bands for the hwmodeAndre Heider2022-12-151-35/+21
| | | | | | | | Just use the already provided info instead of mapping frequencies. Fixes mapping lower frequencies of the 6G band, which starts at 5935MHz. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: fix frequency/channel conversion for the 6G bandAndre Heider2022-12-151-9/+41
| | | | | | | | | Update using current linux sources, which this was apparently based on. Signed-off-by: Andre Heider <a.heider@gmail.com> [don't fail if no ieee80211ax option is present] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: don't guess if a name is an ifnameAndre Heider2022-12-151-3/+13
| | | | | | | | | | | | | | | | | | | | | | | It's too slow to do it all over again and again, especially with e.g. luci constantly polling. Before: $ time iwinfo phy0 info real 0m 0.54s $ time iwinfo radio0 info real 0m 0.70s $ time ubus call luci-rpc getWirelessDevices real 0m 0.67s After: $ time iwinfo phy0 info real 0m 0.04s $ time iwinfo radio0 info real 0m 0.09s $ time ubus call luci-rpc getWirelessDevices real 0m 0.17s Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: add ability to describe USB devicesJo-Philipp Wich2022-12-151-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | Treat USB vendor and product IDs like PCI subsystem vendor and device IDs respectively to allow describing USB devices as `0000 0000 $vid $pid` in the hardware database. As a side effect, this also skips potentially expensive MTD lookups on embedded devices with plugged in USB radios. With a 5.15 kernel, such MTD lookups even spam dmesg with: mtdblock: MTD device 'factory' is NAND, please consider using UBI block devices instead. This fix speeds up iwinfo considerably on affected systems: Before: sys 0m 3.56s After: sys 0m 0.09s Suggested-by: Andre Heider <a.heider@gmail.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: remove ancient wpa_supplicant ctrl socket pathAndre Heider2022-12-151-10/+3
| | | | | | | | | | This isn't required nor used anymore, and it's been +8 years. See "735a03be: iwinfo: adjust for changed wpa_supplicant control socket path" on the main repository. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: fix wpa supplicant ctrl socket permissionsAndre Heider2022-12-151-0/+16
| | | | | | | | | No data at all can currently be read from the control socket. Set up the permission exactly like hostapd's wpa_cli utility to fix it. Among other this fixes a mesh's encryption being shown as "None". Signed-off-by: Andre Heider <a.heider@gmail.com>
* fix -Wreturn-type warningAndre Heider2022-12-151-1/+1
| | | | | | | The function doesn't return anything nor does any caller expect anything. Signed-off-by: Andre Heider <a.heider@gmail.com>
* fix -Wpointer-sign warningAndre Heider2022-12-151-1/+1
| | | | | | | sb.ssid is buf casted to unsigned char, just use that instead of casting it back. Signed-off-by: Andre Heider <a.heider@gmail.com>
* fix -Wmaybe-uninitialized warningAndre Heider2022-12-151-0/+2
| | | | | | | All previous cases not hit, which means no scan was possible. Indicate that. Signed-off-by: Andre Heider <a.heider@gmail.com>
* fix -Wunused-variable warningsAndre Heider2022-12-151-5/+0
| | | | | | Remove them. Signed-off-by: Andre Heider <a.heider@gmail.com>
* fix -Wformat-truncation warningsAndre Heider2022-12-151-3/+3
| | | | | | | Increase buffer sizes to get rid of e.g.: iwinfo_nl80211.c:797:41: note: 'snprintf' output between 24 and 279 bytes into a destination of size 64 Signed-off-by: Andre Heider <a.heider@gmail.com>
* Correctly identify key management algorithms starting with "FT-"Joerg Werner2022-11-011-0/+4
| | | | | | Correctly categorize FT-EAP-SHA384 as WPA3 Signed-off-by: Joerg Werner <schreibubi@gmail.com>
* nl80211: fix issues with renamed wiphy and multiple phy per deviceFelix Fietkau2022-10-141-6/+11
| | | | | | | Remove the assumption that phy names follow the format phy%d and instead look up the phy index from sysfs properly Signed-off-by: Felix Fietkau <nbd@nbd.name>
* nl80211: look up the phy name instead of assuming name == phy<idx>Felix Fietkau2022-09-221-3/+31
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* nl80211: fix phy/netdev index lookupFelix Fietkau2022-09-221-11/+13
| | | | | | | | | | | | Don't assume a fixed naming pattern. Check all options in this order: - netdev - phy name - wifi device in uci Use the first one that matches Signed-off-by: Felix Fietkau <nbd@nbd.name>
* nl80211: allow phy names that don't start with 'phy'Felix Fietkau2022-09-221-6/+0
| | | | | | This is needed for dealing with wiphy renaming Signed-off-by: Felix Fietkau <nbd@nbd.name>
* devices: add MediaTek MT7986 WiSoCDaniel Golle2022-08-311-0/+6
| | | | | | | Add detection of the MediaTek MT7986 WiSoC using the compatible string from device tree. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* Add support for CCMP-256 and GCMP-256 ciphersJoerg Werner2022-08-201-6/+8
| | | | Signed-off-by: Joerg Werner <schreibubi@gmail.com>
* iwinfo: nl80211: omit A-hwmode on non-5GHz hardwareDavid Bauer2022-04-271-5/+5
| | | | | | | | | | Don't add the hwmode A for radios which do not support 5GHz operation. Before, this hwmode was added to all non-VHT radios regardless of their supported bands. Fixes commit 562d01532616 ("iwinfo: nl80211: fix hwmode parsing for multi-band NICs") Signed-off-by: David Bauer <mail@david-bauer.net>
* iwinfo: nl80211: fix hwmode parsing for multi-band NICsDavid Bauer2022-04-231-6/+28
| | | | | | | | | | | | | | In case a NIC supports multiple frequency bands, the supported hw-modelist might not contain all valid hwmodes, as B/G/AD hwmodes are only included based on the last parsed supported frequency. In case a radio supports multiple bands, this might result in these hwmodes not being flagged as supported. Circumvent this by tracking all seen frequency bands using a bitmask which later determined which HW modes are listed as supported. Signed-off-by: David Bauer <mail@david-bauer.net>
* nl80211: fix path compatibility issueFelix Fietkau2021-06-281-1/+11
| | | | | | | | | The previous shell script implementation accepted shorter path values that omitted initial parts before the pcie bus node by only checking if the configured path is included in the determined path Add support for doing the same thing here Signed-off-by: Felix Fietkau <nbd@nbd.name>
* iwinfo: nl80211: fix typoFelix Fietkau2021-06-091-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* iwinfo: nl80211: support looking up phy by path=.. and macaddr=...Felix Fietkau2021-06-091-17/+25
| | | | | | | Can be used from within mac80211.sh without the need to reference the uci config directly Signed-off-by: Felix Fietkau <nbd@nbd.name>
* iwinfo: nl80211: use new path lookup function for nl80211_phy_idx_from_uci_pathFelix Fietkau2021-06-091-30/+17
| | | | | | Fixes issues with multiple phy instances of one device Signed-off-by: Felix Fietkau <nbd@nbd.name>
* iwinfo: nl80211: add support for printing the device path for a phyFelix Fietkau2021-06-091-0/+76
| | | | | | Will be used to replace the shell code from mac80211.sh Signed-off-by: Felix Fietkau <nbd@nbd.name>
* iwinfo: add 802.11ax HE rate informationDavid Bauer2021-05-021-1/+13
| | | | | | | | | This adds 802.11ax HE specific rate information to iwinfo. Add fields for HE status of a STA as well as DCM and guard interval fields specific to HE operation. Signed-off-by: David Bauer <mail@david-bauer.net>
* iwinfo: nl80211: perform split wiphy dumpDavid Bauer2021-04-201-78/+110
| | | | | | | | | | Perform a split wiphy dump when acquiring the hw modelist of a mac80211 device. Otherwise HE capabilities are missing from the message. This is necessary since upstream commit f8d504caa ("nl80211: reduce non-split wiphy dump size") (Kernel 5.9). Signed-off-by: David Bauer <mail@david-bauer.net>
* iwinfo: add basic IEEE 802.11ax supportDavid Bauer2021-04-121-0/+34
| | | | | | | | This adds basic support for IEEE 802.11ax when requesting HW or HT Modelist for a PHY from iwinfo. This way, applications using iwinfo can detect HE phys. Signed-off-by: David Bauer <mail@david-bauer.net>
* iwinfo: add hardware description for MediaTek MT7622Daniel Golle2021-01-281-1/+5
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* iwinfo: improve center channel handlingAnsuel Smith2021-01-061-9/+13
| | | | | | | - Improve iwinfo center channel struct position - Prevent read beyond buffer on malformed data Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* iwinfo: add hardware description for QCA MIPS WiSoCsDaniel Golle2021-01-061-1/+31
| | | | | | | Add description strings and detection logic for all 6 types of WiFi NICs integrated in QCA MIPS WiSoCs. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* iwinfo: add support for GCMP cipherDaniel Golle2021-01-051-2/+3
| | | | | | | Extend support for WPA ciphers by GCMP which is required for 802.11ad. Breaks ABI as ciphers now needs to be a field of 16 bits instead of 8. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* iwinfo: export center_chan info for local wifiAnsuel Smith2021-01-051-1/+75
| | | | | | | | | Iwinfo already export the htmode but there is no way to know where the channel expan in case a 40Mhz+ channel width is used. Export the center channels used by the driver to better know the channel utilizzation of the wifi. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* iwinfo: export ht and vht operation in scan resultsAnsuel Smith2021-01-051-0/+10
| | | | | | | Export ht and vht operation data in scan results. These additional data can be usefull to check wifi channel utilizzation by neraby stations. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* iwinfo: detect QCA IPQ4019 WiSoC from FDTDaniel Golle2021-01-051-0/+30
| | | | | | | | | | | As it's the most reliable and straight forward way on modern platforms, detect the hardware ID by checking the 'compatible'-string of non-PCI (ie. built-in) devices. As this is only relevant for WiSoCs, there won't be that many records, so it's not worth making any larger structural changes. Hence just match the compatible string and translate it into fake PCI IDs. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* Revert "iwinfo: add BSS load element to scan result"David Bauer2020-03-221-4/+0
| | | | | | | | | | | | This reverts commit a6914dc0dc3cba65e245fbe40076626ea2bcd5a3. iwinfo currently misses ABI version tracking in OpenWrt, potentially breaking other packages unintentionally. Revert this commit for now until this is implemented. Otherwise, we are not able to safely bump iwinfo at the moment. Signed-off-by: David Bauer <mail@david-bauer.net>
* iwinfo: add BSS load element to scan resultDavid Bauer2020-02-041-0/+4
| | | | | | | | This adds support for the BSS load information element. With this patch, the BSS load information is visible when using the CLI as well as when accessing scan results using the LUA binding. Signed-off-by: David Bauer <mail@david-bauer.net>
* nl80211: add htmode to iwinfo_opsDaniel Danzberger2020-01-051-0/+70
| | | | | | This callback shows the currently active HTMODE of the device. Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>