Commit Graph

319 Commits

Author SHA1 Message Date
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
Denis Kenzior eb86da3b4b wiphy: Add wiphy_rrm_capable 2019-07-10 16:46:29 -05:00
Denis Kenzior f4402ef56e wiphy: Add wiphy_generate_random_address 2019-07-02 15:47:05 -05:00
Denis Kenzior f72d9c2999 wiphy: Add wiphy_get_name 2019-07-02 15:47:05 -05:00
Denis Kenzior 1c22847cf2 wiphy: Obtain permanent mac address from sysfs 2019-07-02 15:47:05 -05:00
Denis Kenzior 1e9f9e61f1 wiphy: Remove unused regulatory query / notifications
Regulatory domain management is now completely handled by the kernel, so
iwd doesn't really need to query or be aware of changes to this.  This
may change in the future, but for now this code has not been used and
can be safely gotten rid of.
2019-07-02 15:47:05 -05:00
Denis Kenzior 6414be86db wiphy: Remove protocol features query
We run on newer kernels which are guaranteed to have split wiphy dump
support.  So no point in actually querying this.
2019-07-02 15:47:05 -05:00
James Prestwood 77a6b49803 wiphy: parse OFFCHANNEL_TX_OK attribute
The wiphy can indicate if it supports sending offchannel frames. This
allows us to bail out of a Hotspot connection early if this is not
supported.
2019-06-14 13:33:35 -05:00
James Prestwood 5ca4fa9b9e wiphy: allow both FILS-FT AKMs to be chosen 2019-05-23 15:23:46 -05:00
Andrew Zaborowski ac2eeab570 wiphy: Add wiphy_get_driver api
Read the driver name for each wiphy from sysfs if available.  I didn't
find a better way to obtain the driver name for a phy than by reading
the dir name that the "driver" symlink points at.  For an existing
netdev this can be done using the SIOCETHTOOL ioctl.
2019-05-08 11:52:25 -05:00
Andrew Zaborowski 14d69873b0 wiphy: Add wiphy_create_complete
Let manager.c signal to wiphy.c when the wiphy parsing from the genl
messages is complete.  When we query for existing wiphy using the
GET_WIPHY dump command we get many genl messages per wiphy, on a
notification we only get one message.  So after wiphy_create there may
be one or many calls to wiphy_update_from_genl.  wiphy_create_complete
is called after all of them, so wiphy.c can be sure it's done with
parsing the wiphy attributes when in prints the new wiphy summary log
message, like it did before manager.c was added.

I had wrongly assumed that all the important wiphy attributes were in
the first message in the dump, but NL80211_ATTR_EXT_FEATURES was not and
wasn't being parsed which was breaking at least testRSSIAgent.
2019-04-22 16:34:51 -05:00
James Prestwood bc7b12d1a4 wiphy: handle FILS AKMs
wiphy_select_akm needed to be updated to take a flag, which can be
set to true if there are known reauth keys for this connection. If
we have reauth keys, and FILS is available we will choose it.
2019-04-19 15:05:23 -05:00
Tim Kourt c44da22470 wiphy: Add freq set constrain API 2019-04-15 12:34:36 -05:00
Andrew Zaborowski 65109ec46d wiphy: Drop wiphy creation logic 2019-04-11 11:20:04 -05:00
Andrew Zaborowski 4a969294f7 wiphy: Add wiphy_create/wiphy_destroy API
Add wiphy_create, wiphy_update_from_genl and wiphy_destroy that together
will let a new file command the wiphy creation, updates and deletion
with the same functionality the current config notification handler
implements in wiphy.c.
2019-04-11 11:15:10 -05:00
Andrew Zaborowski fd0892baf0 wiphy: Make wiphy_parse_id_and_name public 2019-04-11 11:13:28 -05:00
Andrew Zaborowski c06754a978 wiphy: Drop name_len from wiphy_parse_id_and_name
As mentioned in code comments the name is NUL-terminated so there's no
need to return the length path, which was ignored in some occasions
anyway.  Consistently treat it as NUL-terminated but also validate.
2019-04-11 11:11:52 -05:00
James Prestwood 588848651a wiphy: enforce MFP requirement on SAE connections
wiphy_select_akm will now check if BIP is supported, and if MFPR is
set in the scan_bss before returning either SAE AKMs. This will allow
fallback to another PSK AKM (e.g. hybrid APs) if any of the requirements
are not met.
2019-03-22 12:11:05 -05:00
Andrew Zaborowski 154e9f63bc wiphy, netdev: Add enum values for P2P-related iftypes
Also add a mask parameter to wiphy_get_supported_iftypes to make sure
the SupportedModes property only contains the values that can be used
as Device.Mode.
2019-03-11 18:03:40 -05:00
Andrew Zaborowski e344df432b wiphy: Fix printing supported iftypes
dbus_iftype_to_string returns NULL for unknown iftypes, the strdup will
also return NULL and ret[i] will be assigned a NULL.  As a result
the l_strjoinv will not print the known iftypes that might have come
after that and will the l_strfreev will leak the strduped strings.
2019-03-11 18:03:38 -05:00
Tim Kourt 8f09a0c937 wiphy: Add accessor for supported frequencies 2019-02-28 10:53:04 -06:00
Tim Kourt 81d570572e wiphy: Add MAC randomization feature check API 2019-01-16 13:01:12 -06:00
Denis Kenzior 0dd8114970 wiphy: Add wiphy state watch add / remove 2018-11-29 11:22:50 -06:00
Denis Kenzior 9be982b460 wiphy: Introduce wiphy_new 2018-11-29 11:22:07 -06:00
James Prestwood d19b1bb85e wiphy: Handle OWE AKM for SECURITY_TYPE_NONE 2018-11-16 16:59:59 -06:00
James Prestwood 50acc11f07 wiphy: added wiphy_select_akm
This is a replacement for station's static select_akm_suite. This was
done because wiphy can make a much more intellegent decision about the
akm suite by checking the wiphy supported features e.g. SAE support.

This allows a connection to hybrid WPA2/WPA3 AP's if SAE is not
supported in the kernel.
2018-09-25 10:58:04 -05:00