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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>
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>
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>
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>