Commit graph

56 commits

Author SHA1 Message Date
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
e59f9253aa hardware: add device ids for QCA9984, 88W8887 and 88W8964 radios
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-26 21:50:08 +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
ce51cb8123 Allow storing more info about each frequency
This adds flags field which may be used to mark frequency not available
under some conditions.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Acked-by: Jo-Philipp Wich <jo@mein.io>
2017-08-16 17:15:03 +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
Sven Roederer
d22c64c2eb iwinfo: add device id for Ubiquiti NanoStation Loco M2
id read from unit and txoffset from datasheet

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2016-10-15 19:56:24 +02:00
Jo-Philipp Wich
fd9e17be0c lua: fix WPA cipher reporting
Use the same logic as the command line interface for reporting the used WPA
ciphers. Instead of printing the intersection of pairwise and group ciphers,
report both group and pairwise ciphers.

This fixes a case where a connection which uses CCMP for pairwise and TKIP
as groupwise cipher is getting reported as using the NONE cipher.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2016-09-21 21:02:15 +02:00
Felix Fietkau
717ff71750 Makefile: drop link against libblobmsg_json and libjson-c
They are not necessary

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-07-29 16:28:32 +02:00
Florian Fainelli
8e68ab0bb4 Makefile: explictly link with all shared libraries
linking with libuci means we need to link with libblobmsg_json, libjson-c and
libubox. Sinc e we do not use pkg-config or something equivalent, we need to
specify all dependencies.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
2016-07-23 12:31:12 +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
e4aca3910d lua: support reporting VHT rates
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-25 16:01:32 +01:00
Jo-Philipp Wich
78f0fafa59 cli: support reporting VHT rates
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-25 15:02:50 +01: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
e3bd6c3653 iwinfo: assign explicit length to IWINFO_*_NAMES[] to fix compile issues
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-25 15:00:22 +01:00
Jo-Philipp Wich
1b471aa33d Sync with upstream nl80211.h
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-25 14:41:31 +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
89296a5f17 utils: fix possibly unterminated ifname string
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-29 10:53:48 +01:00
Jo-Philipp Wich
1e628bb535 wext_scan: fix possibly unterminated ifname string
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-29 10:53:32 +01:00
Jo-Philipp Wich
8d5afddf22 lua: fix possible out-of-bounds read in iwinfo_L_cryptotable()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-10-29 10:46:59 +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
ade8b1b299 utils: fix segfault in iwinfo_hardware_id_from_mtd()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-06-01 06:23:14 +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
9842d2507f iwinfo: move ARRAY_SIZE macro to iwinfo/utils.h
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-05-08 13:21:16 +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
Imre Kaloz
c9fd399316 iwinfo: add device id for Marvell 88W8864
Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
2015-01-04 18:38:19 +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
d5dc3d0605 utils: only enable extended lookup if section looks like it
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 17:33:02 +01:00
Jo-Philipp Wich
c92728fbac utils: support extended format for uci section lookup
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 17:27:52 +01:00
Jo-Philipp Wich
149ce00582 cli: add command to translate uci section to phy name
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 17:18:21 +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
d051a0bf7a include: add lookup_phy() op
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 16:59:03 +01:00
Jo-Philipp Wich
7901e7c69f lib: add iwinfo_backend_by_name()
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2014-10-27 16:57:19 +01:00