Commit Graph

344 Commits

Author SHA1 Message Date
Denis Kenzior 667023b01b wiphy: ensure CCMP support when considering SAE 2021-07-05 19:53:52 -05:00
Denis Kenzior 43692cb377 wiphy: Use new data rate estimation utilities 2021-06-04 10:14:04 -05:00
Denis Kenzior e41bee377d band: Add band.[ch]
Move the band definition out of wiphy.c and into band.[ch].  This is
done to make certain utilities that depend on band information capable
of being tested from unit tests.

The band concept will most likely grow over time.  For now, the only
user will be wiphy.c and unit tests, so the structures are kept public.
2021-06-04 10:14:04 -05:00
Denis Kenzior e39cdc7a29 wiphy: Print basic VHT info for each band 2021-06-04 10:14:04 -05:00
Denis Kenzior 683ff1a4e4 wiphy: Return -errno instead of false 2021-06-01 16:46:23 -05:00
Denis Kenzior dbd66bd497 wiphy: Print more basic wiphy info 2021-06-01 13:41:56 -05:00
Denis Kenzior 74761fcdd3 wiphy: Add wiphy_estimate_data_rate
The data rate estimation belongs in wiphy since it should take hardware
capabilities into account.  Right now the data rate calculation simply
assumes the hardware is as capable as the AP.  scan.c will be ported to
use this utility and the data rate estimation will be expanded to take
wiphy capabilities into account.
2021-06-01 13:41:56 -05:00
Denis Kenzior 10ac107ba6 wiphy: Parse HT Capabilities & MCS Set 2021-06-01 13:41:56 -05:00
Denis Kenzior ea9bc11fc8 wiphy: Parse VHT Capabilities & MCS Set 2021-06-01 13:41:56 -05:00
Denis Kenzior 7a4d48c16d wiphy: Add a more formal representation of band
Right now a very limited set of band parameters are parsed into wiphy.
This includes the supported rates and the supported frequencies.
However, there is much more information that is given for each band.
Introduce a new band object that will store this information and can be
extended for future use.
2021-06-01 13:41:55 -05:00
James Prestwood 9d9c516596 wiphy: add fils_hint to wiphy_can_connect
A prior commit refactored the AKM selection in wiphy.c. This
ended up breaking FILS tests due to the hard coding of a
false fils_hint in wiphy_select_akm. Since our FILS tests
only advertise FILS AKMs wiphy_can_connect would return false
for these networks.

Similar to wiphy_select_akm, add a fils hint parameter to
wiphy_can_connect and pass that down directly to wiphy_select_akm.
2021-04-27 14:48:23 -05:00
Denis Kenzior 61d0abe910 netdev: Move iftype_to_string utility
Move and rename this utility into netdev_iftype_to_string away from
dbus.c.  This also allows us to drop including nl80211.h in dbus.c
2021-04-20 09:37:48 -05:00
James Prestwood 1c0b001b53 wiphy: add wiphy_radio_work_is_running
This provides a way to know if a work item is actually running
vs only been queued and waiting to run.
2021-04-05 16:58:43 -05:00
James Prestwood f5c5efa033 wiphy: allow FT AKM to be used if Auth/Assoc is not supported
Until now FT was only supported via Auth/Assoc commands which barred
any fullmac cards from using FT AKMs. With PSK offload support these
cards can do FT but only when offloading is used.
2021-04-02 17:23:07 -05:00
James Prestwood b5b815ef16 wiphy: Use wiphy_select_akm in wiphy_can_connect
Commit 6e8b76527 added a switch statement for AKM suites which
was not correct as this is a bitmask and may contain multiple
values. Intead we can rely on wiphy_select_akm which is a more
robust check anyways.

Fixes: 6e8b765278 ("wiphy: add check for CMD_AUTH/CMD_ASSOC support")
2021-03-30 17:29:04 -05:00
James Prestwood 997c54f185 wiphy: check SAE offload in wiphy_can_connect
This allows this wiphy_can_connect to pass for an SAE BSS
if the hardware does not support user space SAE, but does
support SAE offload.
2021-03-22 14:14:16 -05:00
James Prestwood 3e3ef284de wiphy: check SAE offload in wiphy_select_akm
This allows an SAE AKM to be selected if the hardware does not
support SAE in userspace, but does support SAE offload.
2021-03-22 14:12:50 -05:00
James Prestwood af3d0d21a0 wiphy: add getter for 'supports_cmds_auth_assoc' 2021-03-22 14:12:32 -05:00
James Prestwood 2a46ab3042 wiphy: parse NL80211_ATTR_ROAM_SUPPORT flag
This tells us if the hardware is going to automatically
roam. We need this to know if station roaming logic should
be disabled.
2021-03-15 13:32:08 -05:00
Denis Kenzior 0c0d9e5696 iwd: Use test_bit from ell 2021-03-12 13:49:23 -06:00
Denis Kenzior 666402870e wiphy: Use ell's set_bit 2021-03-11 22:23:52 -06:00
Denis Kenzior 17cf4da726 build: Add useful.h to files that use minsize
Now that minsize has been moved out of ell/util.h to ell/minsize.h
2021-03-11 21:55:57 -06:00
Denis Kenzior 7de5b4adef treewide: replace util_mem_is_zero with l_memeqzero 2021-03-09 15:40:35 -06:00
Denis Kenzior 4fbfa76fc5 wiphy: Fix not attempting WPA3 connections for APs in transition mode
Fix a logic error which prevented iwd from using SAE/WPA3 when
attempting to connect to APs that are in transition mode.  The SAE/WPA3
check incorrectly required mfpr bit to be set, which is true for
APs in WPA3-Personal only mode, but is set to 0 for APs in
WPA3-Personal transition mode.

This patch also adds a bit more diagnostic output to help diagnose
causes for connections where WPA3 is not attempted even when advertised
by the AP.
2020-08-13 14:27:14 -05:00
James Prestwood 771f292939 wiphy: introduce new radio management APIs
These APIs will handle fairness and order in any operations which
radios can only do sequentially (offchannel, scanning, connection etc.).

Both scan and frame-xchg are complex modules (especially scanning)
which is why the radio management APIs were implemented generic enough
where the changes to both modules will be minimal. Any module that
requires this kind of work can push a work item into the radio
management work queue (wiphy_radio_work_insert) and when the work
is ready to be started radio management will call back into the module.
Once the work is completed (and this may be some time later e.g. in
scan results or a frame watch) the module can signal back that the
work is finished (wiphy_radio_work_done). Wiphy will then pop the
queue and continue with the next work item.

A concept of priority was added in order to allow important offchannel
operations (e.g. ANQP) to take priority over other work items. The
priority is an integer, where lower values are of a higher priority.
The concept of priority cleanly solves a lot of the complexity that
was added in order to support ANQP queries (suspending scanning and
waiting for ANQP to finish before connecting).

Instead ANQP queries can be queued at a higher priority than scanning
which removes the need for suspending scans. In addition we can treat
connections as radio management work and insert them at a lower
priority than ANQP, but higher than scanning. This forces the
connection to wait for ANQP without having to track any state.
2020-07-09 09:57:13 -05:00
James Prestwood dfb6f7f025 wiphy: restrict FT AKMs when not supported
Some full mac cards don't like being given a FT AKM when connecting.
From an API perspective this should be supported, but in practice
these cards behave differently and some do no accept FT AKMs. Until
this becomes more stable any cards not supporting Auth/Assoc commands
(full mac) will not connect using FT AKMs.
2020-05-01 19:55:18 -05:00
James Prestwood 1c75f636ed wiphy: remove useless debug prints
Several parsing functions printed the function name, which isn't
very useful to anyone.
2020-05-01 19:55:15 -05:00
Andrew Zaborowski b43e915b98 wiphy: Track regulatory domain changes
When a new wiphy is added query its regulatory domain and listen for
nl80211 regulatory notifications to be able to provide current
regulatory country code through the new wiphy_get_reg_domain_country().
2020-04-24 11:39:00 -05:00
James Prestwood 6e8b765278 wiphy: add check for CMD_AUTH/CMD_ASSOC support
If the AP only supports an AKM which requires an auth protocol
CMD_AUTHENTICATE/CMD_ASSOCIATE must be supported or else the
auth protocol cannot be run. All the auth protocols are started
assuming that the card supports these commands, but the support
was never checked when parsing supported commands.

This patch will prevent any fullMAC cards from using
SAE/FILS/OWE. This was the same behavior as before, just an
earlier failure path.
2020-03-20 18:58:55 -05:00
James Prestwood 1f14782857 wiphy: add _generate_address_from_ssid
This API is being added to support per-network MAC address
generation. The MAC is generated based on the network SSID
and the adapters permanent address using HMAC-SHA256. The
SHA digest is then constrained to make it MAC address
compliant.

Generating the MAC address like this will ensure that the
MAC remains the same each time a given SSID is connected to.
2020-03-18 13:10:41 -05:00
Denis Kenzior c4b2f10483 manager: Handle missing NEW_WIPHY events
The kernel emits NEW_WIPHY events whenever a new wiphy is registered.
Unfortunately these events are emitted under the 'legacy' semantics and
have a hard size limit of 4096 bytes.  Unfortunately, it is possible for
a NEW_WIPHY message to exceed this limit (ath10k cards seem to be
affected in particular), which results in the kernel never sending these
messages out.  This can lead to NEW_INTERFACE events being emitted with
a wiphy_id that had no corresponding NEW_WIPHY event emitted.  Such a
sequence can confuse iwd's hardware detection logic, particularly during
hot-plug or system boot.

Fix this by re-dumping the wiphy if such a condition is detected.  This
has some interaction with blacklisted wiphys, so the wiphy objects are
now always tracked and marked as blacklisted.  Before, the blacklisted
wiphys were simply not added to the iwd list of tracked wiphys.
2020-02-04 10:42:07 -06:00
Denis Kenzior 6825721535 wiphy: Add wiphy_get_id 2020-02-03 17:37:28 -06:00
Denis Kenzior fcdddf2b72 build: Support missing rawmemchr 2020-02-03 11:54:28 -06:00
Marcel Holtmann ab5742bb32 module: Move declarations into separate header file 2019-11-07 23:40:13 +01:00
James Prestwood 63e8f146b7 wiphy: add beacon bits to RM Enabled Capabilities
This tells AP's that we support Passive, Active, and Table beacon
measurements.
2019-11-07 12:26:19 -06:00
Tim Kourt df43470c32 wiphy: Add parser and getter for max ie len attr 2019-11-06 17:04:00 -06:00
Andrew Zaborowski 07cef99e5c wiphy: Add wiphy_get_supported_rates
Add code to parse the supported data rates info from the wiphy dumps and
expose it for P2P's use with a getter function.
2019-10-30 10:58:36 -05:00
Denis Kenzior ccc114fa5f dbus: Use the new /net/connman/iwd root path 2019-10-28 11:32:57 -05:00
Denis Kenzior 8d0860ef86 wiphy: Switch to CamelCase for mac_randomize_bytes 2019-10-25 11:16:28 -05:00
Denis Kenzior d12ee292aa treewide: Use CamelCase for disable_anqp setting 2019-10-24 23:18:23 -05:00
Marcel Holtmann 152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
Andrew Zaborowski cd47834d6c wiphy: Add wiphy_get_max_roc_duration
Add a function to retrieve the maximum Remain On Channel listen duration
supported by the wiphy's driver.
2019-10-21 22:07:17 -05:00
James Prestwood d53dcf2334 wiphy: utilize IWD_MODULE
This converts wiphy into an IWD module. nl80211 was completely removed
from main.c as it is no longer passed with manager or wiphy.
2019-10-11 15:42:13 -05:00
James Prestwood 97bac236c8 wiphy: remove white/blacklist from wiphy_init
wiphy will now use getters for the phy white/black list.
2019-10-11 15:41:54 -05:00
Denis Kenzior 91784425ec wiphy: Remove wiphy_parse_id_and_name
in favor of using nl80211_parse_attrs
2019-09-19 22:55:07 -05:00
James Prestwood 74aa280b56 wiphy: set QoS bit in extended capabilities 2019-09-13 17:29:39 -05:00
James Prestwood 8d3b065022 wiphy: fix bits in extended capabilities
The extended capability bits were not being set properly inside
wiphy. Since we build the IE after the wiphy dump the first 2
bytes are the IE type and length. The way we were setting the bits
did not take this into account and were actually setting the
completely wrong bits.
2019-09-13 12:37:59 -05:00
Denis Kenzior 01cfcabfb4 wiphy: Setup RM Enabled Capabilities in wiphy 2019-08-23 08:55:54 -05:00
James Prestwood 20887dfe1a wiphy: explicitly set extended capability bits
Some capability bits are required by the spec to be set for
probe requests for certain features (HS20, FILS, FT). Currently
these features work as-is, but depending on the hardware we may
be in violation of the spec if we assume the correct bits are
set when we get the wiphy dump.

Just to be safe we can explicity set these capability bits.

There are also two ways the kernel exposes these capabilities.
Per-type or globally. The hardware may expose one, or both of
these capability arrays. To combat this we are now always
creating a per-type capability array for stations. If the
wiphy dump has not produced a per-type capability array we
now create one based off the global capability array. That
way we can always assume there is a capability array for a
station iftype.
2019-08-21 17:24:16 -05:00
Denis Kenzior 37610cf868 wiphy: Parse driver extended capabilities 2019-07-10 17:01:31 -05:00