Commit graph

98 commits

Author SHA1 Message Date
Jo-Philipp Wich
2a95086db2 nl80211: recognize SAE encrypted mesh
Also report open Ad-Hoc and Mesh network encryption as "none" and
not as "unknown".

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-30 12:41:26 +02:00
Jo-Philipp Wich
313e82709b nl80211: keep awaiting wpa_supplicant scan results on busy response
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>
2019-09-22 18:49:26 +02:00
Jo-Philipp Wich
a766751369 nl80211: fix parsing of mixed wpa encryption in wpa_supp scan results
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-22 18:12:47 +02:00
Jo-Philipp Wich
7faeaeafe1 nl80211: properly detect WEP encryption in wpa_supp scan results
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-20 13:12:56 +02:00
Jo-Philipp Wich
629b5ffdd9 nl80211: do not confuse open connections with WEP ones
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-09-20 13:12:56 +02:00
Jo-Philipp Wich
3d47ddda0c nl80211: rework hostapd and wpa_supplicant wpa suite parsing
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>
2019-09-20 13:12:53 +02:00
Hauke Mehrtens
71ec9be506 iwinfo: Fix buffer size
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>
2019-09-01 19:38:03 +02:00
Robert Marko
f8ef450652 iwinfo: Add support for WPA3
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>
2019-09-01 12:38:57 +02:00
Jo-Philipp Wich
a9f9557034 nl80211: support reading hardware id from phy directly
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>
2019-08-28 11:31:32 +02:00
Robert Marko
c2cfe9d96c iwinfo: Fix 802.11ad channel to frequency
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 a8e8275923

Signed-off-by: Robert Marko <robimarko@gmail.com>
2019-03-28 15:02:58 +01:00
Robert Marko
a8e8275923 iwinfo: Add support for 802.11ad
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>
2019-03-21 16:28:39 +01:00
Daniel Danzberger
5aa8c5496c libiwinfo: nl80211: add mesh stats on assoclist.
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2018-11-26 11:03:17 +01:00
Jo-Philipp Wich
94b1366de3 nl80211: attempt to query Mesh ID from ubus
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-24 17:36:22 +02:00
Jo-Philipp Wich
44956b780d nl80211: add support for obtaining bssid from NL80211_CMD_GET_INTERFACE
Fixes missing "BSSID" on Mesh Point interfaces

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-23 18:00:31 +02:00
Jo-Philipp Wich
49c0a4b1a2 nl80211: handle Mesh ID IE
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-23 17:08:44 +02:00
Daniel Danzberger
305f6955d6 iwinfo: nl80211: add survey.
Signed-off-by: Daniel Danzberger <daniel@dd-wrt.com>
2018-07-16 09:03:12 +02:00
Daniel Danzberger
2c5c641aab iwinfo: nl80211: add more stats to assoclist.
+ 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>
2018-07-16 09:01:23 +02:00
Jo-Philipp Wich
2a82f87ac9 nl80211: back out early when receiving FAIL-BUSY reply
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>
2018-04-26 17:12:16 +02:00
Rafał Miłecki
77c32f0eb6 nl80211: fix code calculating average signal and rate
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>
2018-04-09 07:30:37 +02:00
Daniel Golle
223e09bf3f add support for expected throughput
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>
2018-02-15 04:50:28 +01:00
Olof Sivertsson
fb749bf51a nl80211: do not block when driver aborts scan
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>
2018-01-17 13:34:08 +01:00
Jo-Philipp Wich
75c572074f nl80211: turn nl80211_wait() into variadic function
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>
2018-01-17 13:27:03 +01:00
Jo-Philipp Wich
5a5e21b158 nl80211: skip event notifications in wpa_supplicant scan result reply
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-01-16 14:03:37 +01:00
Rafał Miłecki
c1a03e8231 nl80211: request split information about frequencies
This allows kernel send more details including all the
NL80211_FREQUENCY_ATTR_NO_* flags.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
2017-08-23 11:00:00 +02:00
Rafał Miłecki
5638567dc7 nl80211: store info about freq being not available for some bandwidths
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Jo-Philipp Wich <jo@mein.io>
2017-08-16 17:15:19 +02:00
Rafał Miłecki
5c10efa2cb nl80211: support receiving split frequencies
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>
2017-08-16 17:14:26 +02:00
Jo-Philipp Wich
335967c6c2 nl80211: improve error handling
- 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>
2017-06-26 09:48:02 +02:00
Jo-Philipp Wich
ab089dda34 nl80211: propagate netlink errors to callers
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>
2017-06-26 07:30:56 +02:00
Jo-Philipp Wich
7bba117a3a nl80211: handle netlink errors in nl80211_wait()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-06-26 07:06:40 +02:00
Jo-Philipp Wich
96d322d594 nl80211: retry phy lookup with platform/ prefix
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>
2016-07-04 16:07:12 +02:00
Jo-Philipp Wich
bc8682aa5e nl80211: add VHT rateinfo support
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-25 15:01:49 +01:00
Jo-Philipp Wich
7781ba3f33 nl80211: remove dead code
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-29 13:46:12 +01:00
Jo-Philipp Wich
41ae5bd556 nl80211: fix possibly unterminated ifname string
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-29 10:53:56 +01:00
Jo-Philipp Wich
b19476dec2 nl80211: fix possible fd leak in nl80211_hostapd_hup()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-29 10:43:49 +01:00
Jo-Philipp Wich
eeaae3d011 nl80211: fix possible unitialized memory access in nl80211_get_hardware_id()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-29 10:40:40 +01:00
Rafał Miłecki
813f61e48b nl80211: read TX power using NL80211_CMD_GET_INTERFACE
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>
2015-10-05 11:00:22 +02:00
Felix Fietkau
3d38d1d17e iwinfo: null-terminate country code
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-09-11 15:46:59 +02:00
Jernej Kos
16597a70bc iwinfo: report additional data for stations
Signed-off-by: Jernej Kos <jernej@kos.mx>
2015-08-11 17:24:24 +02:00
Jo-Philipp Wich
e8a1e7d224 Fix -Wall -Wpedantic warnings
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-19 18:54:58 +02:00
Jo-Philipp Wich
5aef442328 nl80211: rework hostapd and wpa_supplicant query code
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>
2015-05-19 18:28:32 +02:00
Jo-Philipp Wich
7b39bee1c6 iwinfo: add support for querying available HT modes
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-08 13:29:10 +02:00
Jo-Philipp Wich
6e67940be5 nl80211: relax definition of restricted channels
Only mark channels restricted that do not have a radar flag set.

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-03-31 13:56:03 +02:00
Imre Kaloz
40f2844fad iwinfo: don't report AC capabilities on 2GHz-only interfaces
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>
2015-03-20 16:50:21 +01:00
Andrew McDonnell
50370d9e69 iwinfo: Fix incorrect buffer allocation in nl80211_get_ifcomb_cb()
This fixes a buffer overwrite, I found it when building with SSP enabled
2014-12-12 15:36:41 +01:00
Jo-Philipp Wich
665809c7f3 nl80211: implement lookup_phy() op
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 17:04:17 +01:00
Jo-Philipp Wich
32dad1a63a nl80211: support phy lookup by macaddr and phy name
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 15:22:20 +01:00
nbd
fe7133f7e5 iwinfo: fix handling of accessing nl80211 interfaces via radio*
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
2014-10-27 13:48:19 +01:00
Jo-Philipp Wich
8ae758db52 Initial commit
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-05 19:56:27 +02:00