summaryrefslogtreecommitdiff
path: root/iwinfo_nl80211.c
Commit message (Collapse)AuthorAgeFilesLines
...
* nl80211: properly handle netdev names starting with "radio"Jo-Philipp Wich2019-12-271-4/+4
| | | | | | | | | | This fixes VAPs not being queried correctly when the netdev name starts with "radio". Fixes: FS#2629 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: David Bauer <mail@david-bauer.net>
* nl80211: handle hidden SSIDs in wpa_supplicant scan resultsJo-Philipp Wich2019-10-161-2/+5
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: align path to phy mapping logic with mac80211.shJo-Philipp Wich2019-10-151-13/+37
| | | | | | | | | | | | | | | The mac80211.sh implementation of the uci "path" option compares the readlink() results of each /sys/class/ieee80211/*/device link to find the proper phy directory while iwinfo so far tried to construct a full path out of the uci value. The iwinfo approach appears to fail under certain circumstances, e.g. with Hyper-V systems utilizing PCI passthrough for the radio devices. This commit mimicks the behaviour of mac80211.sh more closely to achieve the same results. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: recognize SAE encrypted meshJo-Philipp Wich2019-09-301-2/+28
| | | | | | | Also report open Ad-Hoc and Mesh network encryption as "none" and not as "unknown". Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: keep awaiting wpa_supplicant scan results on busy responseJo-Philipp Wich2019-09-221-1/+7
| | | | | | | | | | When wpa_supplicant responds with FAIL-BUSY in response to the SCAN command, a scan process is already in process. Instead of failing in this case, simply keep awaiting the result list. This also significantly speeds up the scan operation in many cases. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: fix parsing of mixed wpa encryption in wpa_supp scan resultsJo-Philipp Wich2019-09-221-2/+2
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: properly detect WEP encryption in wpa_supp scan resultsJo-Philipp Wich2019-09-201-0/+8
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: do not confuse open connections with WEP onesJo-Philipp Wich2019-09-201-5/+12
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: rework hostapd and wpa_supplicant wpa suite parsingJo-Philipp Wich2019-09-201-116/+148
| | | | | | | | Refactor the parsing of wpa_supplicant scan list results, the wpa_supplicant status output and the hostapd configuration file format to properly detect WPA3 key management protocols like SAE, OWE or EAP Suite B. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* iwinfo: Fix buffer sizeHauke Mehrtens2019-09-011-1/+1
| | | | | | | | | | With WPA3 the wpa_key_mgmt string can be longer than 16 bytes. The sea-mixed setting for example is 27 bytes long: wpa_key_mgmt=WPA-PSK WPA-PSK-SHA256 SAE Increase the buffer to better detect more complicated authentication methods. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* iwinfo: Add support for WPA3Robert Marko2019-09-011-0/+10
| | | | | | | This patch adds support for WPA3, meaning SAE and OWE are now properly identified. This fixes iwinfo and LuCi showing WPA2 NONE for WPA3 SAE and OWE. Signed-off-by: Robert Marko <robimarko@gmail.com>
* nl80211: support reading hardware id from phy directlyJo-Philipp Wich2019-08-281-24/+24
| | | | | | | | Do not require a temporary interface just to read the hardware ID numbers from a given phy name, instead read the data from the ieee80211 sysfs directory. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* iwinfo: Fix 802.11ad channel to frequencyRobert Marko2019-03-281-1/+1
| | | | | | | | | This patch enables proper identification of ad hwmode in channel2frequency function. Now iwinfo will properly calculate frequency for a channels 1-6 in 802.11ad. Fixes a8e827592338d7f10d93b4b93d04f367221465c2 Signed-off-by: Robert Marko <robimarko@gmail.com>
* iwinfo: Add support for 802.11adRobert Marko2019-03-211-0/+10
| | | | | | | | | | | This patch adds support for identifying, calculating channels from frequency and vice versa as well as Lua hwmode for 802.11ad. Support has been added for channels 1-6. Signed-off-by: Robert Marko <robimarko@gmail.com> [Increase buffer size for hwmodes] Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* libiwinfo: nl80211: add mesh stats on assoclist.Daniel Danzberger2018-11-261-0/+76
| | | | Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
* nl80211: attempt to query Mesh ID from ubusJo-Philipp Wich2018-07-241-0/+5
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: add support for obtaining bssid from NL80211_CMD_GET_INTERFACEJo-Philipp Wich2018-07-231-3/+23
| | | | | | Fixes missing "BSSID" on Mesh Point interfaces Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: handle Mesh ID IEJo-Philipp Wich2018-07-231-3/+6
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* iwinfo: nl80211: add survey.Daniel Danzberger2018-07-161-0/+69
| | | | Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
* iwinfo: nl80211: add more stats to assoclist.Daniel Danzberger2018-07-161-0/+12
| | | | | | | | + NL80211_STA_INFO_SIGNAL_AVG + NL80211_STA_INFO_RX_DROP_MISC + NL80211_STA_INFO_CONNECTED_TIME Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
* nl80211: back out early when receiving FAIL-BUSY replyJo-Philipp Wich2018-04-261-0/+6
| | | | | | | | The wpa_supplicant control socket might reply with "FAIL-BUSY" when attempting to start a scan while another scanning process is already running, back out early in this case. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: fix code calculating average signal and rateRafał Miłecki2018-04-091-7/+7
| | | | | | | | | Using average of previous average and the next value is highly imprecise. E.g. for values 20, 20, 20, 180 it would result in /average/ of 100 (instead of 60). Fix it by storing & using an info of how many samples were used for the previous calculation. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* add support for expected throughputDaniel Golle2018-02-151-0/+4
| | | | | | | | | | cfg80211 allows drivers to announce the to-be-expected layer-2 datarate using the NL80211_STA_INFO_EXPECTED_THROUGHPUT field. This information is useful as a metric for user-space routing daemons, so grab it via nl80211 and make it available in both C and Lua APIs, and show expected throughput on CLI interface assoclist. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* nl80211: do not block when driver aborts scanOlof Sivertsson2018-01-171-1/+2
| | | | | | | | | | | | | | Drivers may abort a scan by calling cfg80211_scan_done() with a struct cfg80211_scan_info that sets aborted to true. To avoid blocking forever consider both NL80211_CMD_NEW_SCAN_RESULTS and NL80211_CMD_SCAN_ABORTED when waiting for scan results. Tested with Broadcom's bcmdhd driver. Signed-off-by: Olof Sivertsson <olof.sivertsson@zenterio.com> [rebased on top of variadic nl80211_wait()] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: turn nl80211_wait() into variadic functionJo-Philipp Wich2018-01-171-3/+15
| | | | | | | | | Extend the nl82011_wait() function to accept multiple command numbers. This is useful to wait for different possible results, e.g. either NL80211_CMD_NEW_SCAN_RESULTS or NL80211_CMD_SCAN_ABORTED. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: skip event notifications in wpa_supplicant scan result replyJo-Philipp Wich2018-01-161-1/+6
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: request split information about frequenciesRafał Miłecki2017-08-231-2/+36
| | | | | | | This allows kernel send more details including all the NL80211_FREQUENCY_ATTR_NO_* flags. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* nl80211: store info about freq being not available for some bandwidthsRafał Miłecki2017-08-161-0/+13
| | | | | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: support receiving split frequenciesRafał Miłecki2017-08-161-19/+26
| | | | | | | | | | | | In order to get more details about each frequency we will need to set NL80211_ATTR_SPLIT_WIPHY_DUMP in the future. This will result in our callback being called multiple times. Modify it to support such a scenario: 1) Start putting new frequencies after the last set one 2) Make sure that attribute is set before iterating it Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: improve error handlingJo-Philipp Wich2017-06-261-183/+120
| | | | | | | | | | | | | - introduce a new nl80211_request() which combines nl80211_msg() with nl80211_send() to simplify calling code - always invoke nl80211_free() in nl80211_send() and remove explicit nl80211_free() invocations in callers - back out early on netlink errors in functions performing multiple calls, e.g. when fetching scan results Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: propagate netlink errors to callersJo-Philipp Wich2017-06-261-13/+10
| | | | | | | | Adjust nl80211_send() to propagate errors back to the caller and do not free message and callbacks in send error case anymore since all callsites immediately invoke nl80211_free() anyway. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: handle netlink errors in nl80211_wait()Jo-Philipp Wich2017-06-261-2/+4
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: retry phy lookup with platform/ prefixJo-Philipp Wich2016-07-041-0/+3
| | | | | | | | If the first attempt to lookup the phy index by the path value fails, retry to find the index within the platform/ subdirectory to follow the logic used by the mac80211 package. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* nl80211: add VHT rateinfo supportJo-Philipp Wich2016-01-251-28/+44
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* nl80211: remove dead codeJo-Philipp Wich2015-10-291-3/+0
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* nl80211: fix possibly unterminated ifname stringJo-Philipp Wich2015-10-291-1/+1
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* nl80211: fix possible fd leak in nl80211_hostapd_hup()Jo-Philipp Wich2015-10-291-1/+1
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* nl80211: fix possible unitialized memory access in nl80211_get_hardware_id()Jo-Philipp Wich2015-10-291-1/+1
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* nl80211: read TX power using NL80211_CMD_GET_INTERFACERafał Miłecki2015-10-051-9/+22
| | | | | | | | | With the mac80211 commit d55d0d598e66 ("nl80211: put current TX power in interface info") it is possible now to get TX power using nl80211. As we don't really support any wext-only drivers it doesn't make sense to leave wext as a fallback. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* iwinfo: null-terminate country codeFelix Fietkau2015-09-111-0/+1
| | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* iwinfo: report additional data for stationsJernej Kos2015-08-111-0/+56
| | | | Signed-off-by: Jernej Kos <jernej@kos.mx>
* Fix -Wall -Wpedantic warningsJo-Philipp Wich2015-05-191-23/+12
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* nl80211: rework hostapd and wpa_supplicant query codeJo-Philipp Wich2015-05-191-360/+446
| | | | | | | | | | | The old nl80211_hostapd_info() used a global static buffer which was not properly zeroed on subsequent invocations, leading to misreported encryption values when querying multiple radios or radious with multiple vifs. Also rework and simplify the control socket code for wpa_supplicant by splitting status query and scan handling. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* iwinfo: add support for querying available HT modesJo-Philipp Wich2015-05-081-12/+69
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* nl80211: relax definition of restricted channelsJo-Philipp Wich2015-03-311-3/+2
| | | | | | Only mark channels restricted that do not have a radar flag set. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* iwinfo: don't report AC capabilities on 2GHz-only interfacesImre Kaloz2015-03-201-7/+8
| | | | | | | If a 802.11ac capable chip is in 2GHz-only mode, the hwmode reported should be 802.11bgn. Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
* iwinfo: Fix incorrect buffer allocation in nl80211_get_ifcomb_cb()Andrew McDonnell2014-12-121-3/+3
| | | | This fixes a buffer overwrite, I found it when building with SSP enabled
* nl80211: implement lookup_phy() opJo-Philipp Wich2014-10-271-0/+12
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* nl80211: support phy lookup by macaddr and phy nameJo-Philipp Wich2014-10-271-23/+92
| | | | Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* iwinfo: fix handling of accessing nl80211 interfaces via radio*nbd2014-10-271-2/+48
| | | | | | | | look up device path via uci instead of assuming a direct phy index Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn+ssh://svn.openwrt.org/openwrt/trunk@42759 3c298f89-4303-0410-b956-a3cf2f4a3e73