Commit Graph

2575 Commits

Author SHA1 Message Date
Andrew Zaborowski 1d57ec0d46 scan: Parse P2P IEs according to frame type
Save the source frame type in struct scan_bss as it may affect how some
of the data in the struct will be parsed.  Also replace the P2P IE
payload data in that struct with a union containing pre-parsed p2p
attributes corresponding to the frame type.

This means users don't have to call the parsers in p2putil.c on that
data, which wouldn't have worked anyway because those parsers assume
input is the raw IE sequence rather than just the "payload".
2019-11-21 20:51:17 -06:00
Denis Kenzior 41ff1d2383 rrm: Remove unneeded casts 2019-11-21 20:34:06 -06:00
James Prestwood 32dfb6208d rrm: add packed struct for beacon reports
build_report_for_bss was refactored to use this packed structure rather
than l_put_* APIs.
2019-11-21 16:33:06 -06:00
Andrew Zaborowski ce94133472 p2putil: Replace free with clear in function names
All these functions free up the resources used by the struct but don't
free the struct itself (allowing it to be static) so rename the
functions to avoid confusion.
2019-11-21 14:02:19 -06:00
James Prestwood c86f5678b2 wsc: fix use of non-ascii apostrophe 2019-11-21 14:00:35 -06:00
James Prestwood 0381361c81 eapol: fix use of non-ascii apostrophe 2019-11-21 14:00:35 -06:00
James Prestwood ccfe369766 rrm: include actual scan start time in report 2019-11-21 13:45:40 -06:00
James Prestwood 27af5b715e scan: parse the scan start time
The kernel sends NL80211_ATTR_SCAN_START_TIME_TSF with CMD_TRIGGER and
RRM requires this value for beacon measurement reports.

The start time is parsed during CMD_TRIGGER and set into the scan request.
A getter was added to obtain this time value for an already triggered
scan.

After making the change, the SCAN_ABORTED case was cleaned up a bit to
remove the local scan_request usage in favor of the one used for all the
other cases.
2019-11-21 13:45:40 -06:00
James Prestwood 002fdb5c10 rrm: fix non-ascii character in comment 2019-11-21 13:45:40 -06:00
Marcel Holtmann ee864662fe module: Add missing empty line 2019-11-21 18:03:55 +01:00
Andrew Zaborowski 59b963a121 netdev: Power P2P interfaces up like other interfaces
After all we will want to power these iftypes up on init just like
station, etc.
2019-11-20 20:29:34 -06:00
Andrew Zaborowski 81be5fbae5 rtnlutil: Move rtnl_set_powered from netdev to rtnlutil
This function fits with the other utilities in rtnlutil and netdev.c
can slim down.
2019-11-20 20:28:48 -06:00
Andrew Zaborowski 3ffb645f22 device: Make functions static, drop device.h 2019-11-20 20:26:55 -06:00
Andrew Zaborowski 1057d8aa74 device: Move device creation from netdev.c to event watch
Create and destroy the device state struct and the DBus interfaces in a
way more similar to the Station, AdHoc and AP interfaces.  Drop
netdev_get_device() and the device specific code in netdev that as far
as I can tell wasn't needed.
2019-11-20 20:24:48 -06:00
Andrew Zaborowski bc1b9ce10c anqp: Only register for frames on station interfaces
Check the iftype before registering ANQP on new interface.

Not that the check here and in rrm.c (which already checks the iftype)
may need to be extended to run on NETDEV_WATCH_EVENT_UP because a device
could be created with a different iftype and then have the iftype changed
before powering up.
2019-11-20 20:24:43 -06:00
Denis Kenzior aa754cbb4a rrm: include actual parent TSF value
If the scan results included a parent TSF value use it.
2019-11-20 20:11:47 -06:00
James Prestwood e92424611a scan: fix parent TSF parsing
The value coming from the kernel is in the same endianness as IWD, so
just parse it as a u64 rather than le64.
2019-11-20 20:04:30 -06:00
James Prestwood c1c2ca5e7f rrm: remove use of floating point math
The RCPI value was using floating point values as per the spec. But instead
we can just use the signal strength coming from the kernel in mili mdm and
scale the hard coded values by a factor of 100.
2019-11-18 12:52:33 -06:00
James Prestwood be4ab2826f scan: parse parent TSF value in scan results
RRM can include this in measurement reports if present in scans
2019-11-15 14:28:26 -06:00
James Prestwood 1b35eda3dd rrm: support scan duration and mandatory flags
Beacon requests can specify a scan duration, and set a flag which makes
this duration mandatory. The kernel supports both these values for scan
requests so we no longer need to reject requests which contain these.

Drivers which do not support EXT_FEATURE_SET_SCAN_DWELL will ignore the
duration value, but if duration mandatory is set we must reject the
request.
2019-11-15 14:12:24 -06:00
James Prestwood dca90abdc5 scan: add duration scan_parameters
The kernel allows a scan duration and duration mandatory flag to be
set in scan requests. RRM requests can contain these values so they
have been added to scan_parameters.

Scanning with drivers which do not support EXT_FEATURE_SET_SCAN_DWELL
will not include these values in scan requests.
2019-11-15 14:11:16 -06:00
James Prestwood 4cee10ec50 scan: add scan_passive_full variant
Just like active scans, add an API for passive scans which take in
the full scan_parameters structure.
2019-11-15 14:11:16 -06:00
James Prestwood 5528403d77 rrm: fix invalid IE tag when rejecting request
The rejection report actually contained a request IE, not a report IE
2019-11-15 11:03:39 -06:00
James Prestwood 90fb7eff7d station: fail if trying to scan while connecting
If a scan is requested during the middle of a connection we should
return busy instead of attempting the scan. The kernel ends up coming
back with not supported in this case, which is misleading and
difficult to debug.
2019-11-14 15:23:03 -06:00
James Prestwood 81ac94fd01 hotspot: fix double free between hostpot and knownnetworks
The module framework was changed to call the module exit functions in
the reverse order as the init functions. This uncovered/caused known
networks to try and free the network_info structures after hotspot had
already freed them. Since known networks clean up the network_info's
anyways, we don't actually need hotspot to do any cleanup.
2019-11-13 16:37:17 -06:00
Andrew Zaborowski 95d4eea68f modules: Unload modules in reverse order from loading
Make sure a module A that is needed by B is not unloaded before B.
2019-11-11 18:29:45 -06:00
Andrew Zaborowski 083143ed05 module: Fix variable names
Apparently the intention was for the dependent module's name to appear
in the variable name resulting from using IWD_MODULE_DEPENDS, so the
dependencies all have unique names (apparently not critical).
2019-11-11 18:29:45 -06:00
Tim Kourt 96a97dc959 peap: Adjust V0 not to close tunnel on Success of Phase2
Despite that PEAPv0 spec indicates that TLS tunnel needs to be torn
down after the transmission of a secure Result response, some servers
treat this TLS close alert as a failure. This patch changes the above
behavior to explicitly torn the tunnel only in the case of
authentication failure and leave it open after the success.
2019-11-11 18:29:12 -06:00
Denis Kenzior bc17925f3a manpage: Fix section naming
The previous refactoring somehow changed the 'Settings' section name
into 'General'

Fixes: ac53239109 ("doc: Split network configuration description into separate manpage")
2019-11-08 21:24:54 -06:00
Tim Kourt aea6c1ccb6 scan: Separate IE attr creation into logical block
This also introduces the max IE length check and exludes the addition
of IEs for the drivers that don't support it.
2019-11-08 21:05:51 -06:00
Tim Kourt 0490c25fde scan: Fix bit checking for interworking
The checker function will later be changed to match the bit setter.
2019-11-08 21:05:39 -06:00
Tim Kourt 48570141ba scan: Improve comment 2019-11-08 20:43:16 -06:00
Tim Kourt 175bf574c6 manpage: Add route prioritization setting 2019-11-08 17:05:18 -06:00
Marcel Holtmann ab5742bb32 module: Move declarations into separate header file 2019-11-07 23:40:13 +01:00
James Prestwood 1f01819c70 rrm: add radio resource management module
This module takes care of radio measurements which an AP can request.
There are many types of requests, and for now only beacon requests
are supported.

IWD will filter certain types of beacon requests that are NOT
supported:

 - AP channel reports. Only single channel requests will be supported
 - Autonomous measurements. Only direct requests will be supported.
   IWD will not accept requets to trigger reports under certain
   conditions (SNR/RSSI thresholds, etc.)
 - Timed measurements. Only immediate measurements will be performed.
   The accuracy for timed measurements cannot be reliably guaranteed
   due to kernel scheduling/queues.
 - Full reporting detail. The AP can request the STA return the full
   set of IEs in a beacon. IWD does not currently save all IEs, plus
   there is quite a bit of complexity involved as certain IEs get
   truncated, and there are other length limitations.

There are other limitations not specific to beacon requests:

 - IWD will support single measurement requests per report. Multiple
   measurement request IEs can be included, but the reports will be
   sent out separately.

 - IWD will limit the number of requests it responds to in a given
   amount of time. As it stands now this is hard coded to 2 requests
   per second maximum. This will prevent DoS attacks.

 - IWD will not accept any measurement requests from APs it is not
   connected to, and will not accept any requests until connected.
2019-11-07 12:26:19 -06: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
Marcel Holtmann 754ce0d112 anqputil: Use complete path internal includes 2019-11-07 18:29:11 +01:00
Tim Kourt 259a666a76 wsc: Check capability before adding interface 2019-11-06 17:46:00 -06:00
Tim Kourt df43470c32 wiphy: Add parser and getter for max ie len attr 2019-11-06 17:04:00 -06:00
Marcel Holtmann c6f9e89748 doc: Add manual page for debugging information 2019-11-05 22:14:09 +01:00
Marcel Holtmann 1365fc6820 doc: Fix manual page title names 2019-11-05 22:12:22 +01:00
James Prestwood 2962a80e14 station: add APIs to get connected BSS and BSS list
For Radio Resource Management (RRM) we will need access to the currently
connected BSS as well as the last scan results in order to do certain
kinds of requested measurements.
2019-11-04 14:43:38 -06:00
Tim Kourt 597920d06c knownnetworks: Check result of setting getter
Set the value of 'is_hidden' if necessary.
2019-10-30 14:39:21 -05:00
Andrew Zaborowski 77e9df23c1 netdev: Drop unused netdev_connect_wsc 2019-10-30 14:36:23 -05:00
Andrew Zaborowski 6d3ae88a21 wsc: Replace netdev_connect_wsc with netdev_connect usage
netdev_connect can achieve the same effect as netdev_connect_wsc but is
more flexible as it allows us to supply additional association IEs.  We
will need this capability to make P2P connections.  This way we're also
moving the WSC-specific bits to wsc.c from the crowded netdev.c.
2019-10-30 14:35:10 -05:00
Andrew Zaborowski 0651c2c430 eapol: Drop unused eapol_sm_set_event_func 2019-10-30 14:34:20 -05:00
Andrew Zaborowski dcf419ee7f eapol: Move the EAP events to handshake event handler
On EAP events, call the handshake_event handler with the new event type
HANDSHAKE_EVENT_EAP_NOTIFY isntead of the eapol_event callback.

This allows the handler to be set before calling
netdev_connect/netdev_connect_wsc.  It's also in theory more type-safe
because we don't need the cast in netdev_connect_wsc anymore.
2019-10-30 14:26:09 -05:00
Andrew Zaborowski 0cccbea904 handshake: Convert handshake event callbacks variadic functions
Convert the handshake event callback type to use variable argument
list to allow for more flexibility in event-specific arguments
passed to the callbacks.

Note the uint16_t reason code is promoted to an int when using variable
arguments so va_arg(args, int) has to be used.
2019-10-30 14:24:05 -05:00
Andrew Zaborowski 2c536ba4fa scan: Hide CCK rates if no_cck_rates set
no_cck_rates is set in the scan parameters generally to make sure
that the Probe Request frames are not sent at any of the 802.11b
rates during active scans.  With this patch we also omit those rates
from the Supported Rates IEs, which is required by the p2p spec and
also matches our flag's name.
2019-10-30 11:13:42 -05: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 7d24edf467 manpage: Add some examples of network configurations 2019-10-28 21:50:23 -05:00
Denis Kenzior 785fd8c6eb manpage: Add James to author info 2019-10-28 21:10:37 -05:00
Denis Kenzior 480d678a85 main: Update to the new ell API 2019-10-28 15:48:36 -05:00
Denis Kenzior ccc114fa5f dbus: Use the new /net/connman/iwd root path 2019-10-28 11:32:57 -05:00
James Prestwood d164923e7c manpages: replace shorthand words
Replaces cases of 'certs' with 'certificates', and 8021x with IEEE 802.1x
2019-10-28 10:45:30 -05:00
Marcel Holtmann 5a473a755c doc: Minor formatting changes for the configuration documentation 2019-10-26 02:07:03 +02:00
Denis Kenzior 3b937424db nl80211util: Ensure all entries are parsed
The current logic did not make sure that each entry provided was
actually parsed.  Also add a sanity check to make sure that no duplicate
parsing occurs.
2019-10-25 13:46:58 -05:00
Andrew Zaborowski d577036879 p2putils: Fix length in Channel List parsing 2019-10-25 13:34:37 -05:00
Andrew Zaborowski 6ee83fdca9 p2putil: Replace constants with wifi_alliance_oui 2019-10-25 13:34:05 -05:00
James Prestwood 0d7fbfe523 network: add L_WARN for known network lookup failure
When updating the network ranking there was a potential out of bounds
array access. The condition was if known_network_offset returned a
negative value, indicating the known network was not found. Since
network->info is only set for known networks this should not ever
happen as network->info is checked prior.

Though this is likely impossible, knownnetworks is complex enough that
its better to just be paranoid and put an L_WARN_ON to check the
return.
2019-10-25 13:19:31 -05:00
Denis Kenzior cf6499387f manpage: Update networking related settings 2019-10-25 13:18:42 -05:00
Denis Kenzior 16f51f5b5e treewide: Use CamelCase for netconfig settings 2019-10-25 13:18:42 -05:00
James Prestwood 8c3c81716f manpage: add section on embedding PEMs in settings 2019-10-25 11:22:36 -05:00
Denis Kenzior 624533e9c4 manpage: Document additional [General] settings 2019-10-25 11:21:29 -05:00
Denis Kenzior 7db8cf92fe manager: Switch to CamelCase for mac_randomize 2019-10-25 11:21:04 -05:00
Denis Kenzior 8d0860ef86 wiphy: Switch to CamelCase for mac_randomize_bytes 2019-10-25 11:16:28 -05:00
Denis Kenzior b3c08da45b manager: Use CamelCase for use_default_interface 2019-10-25 09:20:42 -05:00
Denis Kenzior d12ee292aa treewide: Use CamelCase for disable_anqp setting 2019-10-24 23:18:23 -05:00
Denis Kenzior 27afe6c49f netdev: Use CamelCase for pae over nl80211 setting 2019-10-24 21:36:53 -05:00
Denis Kenzior 43d386bbe4 netdev: Use CamelCase for roam threshold setting 2019-10-24 21:36:53 -05:00
Denis Kenzior 1fbf64b667 station: use CamelCase for MFP setting 2019-10-24 21:36:50 -05:00
Marcel Holtmann 7abd998d00 build: Move 50-iwd.link up to 80-iwd.link for less confusion 2019-10-25 01:08:56 +02:00
Marcel Holtmann 152b56a12a treewide: Move the Intel copyright forward to 2019 2019-10-25 00:43:08 +02:00
Marcel Holtmann 2a1cf2593b doc: Add missing author names to iwd config manual page 2019-10-25 00:22:20 +02:00
Marcel Holtmann eb4ea958c7 build: Rename iwd.conf.5 into iwd.config.5 2019-10-25 00:21:05 +02:00
Marcel Holtmann cd0d57077e build: Add systemd network link file to disable persistent naming 2019-10-25 00:15:05 +02:00
Denis Kenzior d4d35c7872 eapol: Use CamelCase for [EAPoL] settings 2019-10-24 15:58:08 -05:00
Denis Kenzior 3540cc5cc0 manpage: Document [Scan] settings 2019-10-24 15:58:08 -05:00
Denis Kenzior e540978633 treewide: Use CamelCase for [Scan] settings 2019-10-24 15:58:08 -05:00
Denis Kenzior 3a0c70210d manpage: Document [Rank] settings 2019-10-24 15:58:08 -05:00
Denis Kenzior b205d9bdf1 scan: Use CamelCase for [Rank] settings 2019-10-24 15:58:05 -05:00
Denis Kenzior 19a85a85e7 treewide: Rename EAP mtu key to MTU 2019-10-24 13:51:20 -05:00
Denis Kenzior f6994f502b manpage: Document Blacklist settings 2019-10-24 13:39:40 -05:00
Denis Kenzior d66139fe34 treewide: Switch to CamelCase for Blacklist settings 2019-10-24 13:38:11 -05:00
Denis Kenzior 8a1ce9e3e3 manpage: Use AutoConnect instead of Autoconnect 2019-10-24 13:04:53 -05:00
Denis Kenzior 356fadad5a hotspot: Use AutoConnect instead of Autoconnect 2019-10-24 13:04:53 -05:00
Denis Kenzior 2dec3ff1b6 knownnetworks: Use AutoConnect setting
Since the property Autoconnect was renamed to AutoConnect, change the
Autoconnect setting to match.

For now we still allow the legacy name to be used here, but a warning is
printed to remind users to update.
2019-10-24 13:04:53 -05:00
Denis Kenzior c49893c827 knownnetworks: Use AutoConnect as property name 2019-10-24 12:49:59 -05:00
Denis Kenzior 2d2bc70b64 device: Remove support for WDS property 2019-10-24 11:41:19 -05:00
Denis Kenzior 206bfbdf3a dbus: update to use InvalidArguments error 2019-10-24 10:54:21 -05:00
Denis Kenzior a06583ffc4 dbus: Update to the new wsc api naming 2019-10-24 10:49:13 -05:00
Tim Kourt b096c27377 hotspot: eliminate double assignment of variable 2019-10-23 17:57:35 -05:00
Tim Kourt d8f98a5f20 hotspot: Fix mem leak on failed hotspot config 2019-10-23 17:56:18 -05:00
Denis Kenzior 45bd459711 eap-tls-common: Relax certificate chain check
Relax the pre-check for local user certificate.  Before we used to check
that the CA provided (if any) was used to verify both the peer identity
and the local certificate chain.  However, there seem to be networks
that use different CAs to sign AP/Radius certificates and certificates
issued to users.

Drop the ca_certs argument from l_certchain_verify, but keep the call
there to make sure the certificate chain is indeed a chain as a sanity
check.
2019-10-23 09:51:29 -05:00
Andrew Zaborowski 1d29221ef0 netdev: Extend checks for P2P scenarios
Extend the iftype-based checks to handle the P2P iftypes and remove a
warning that may be triggered in normal situations in the P2P scenarios.
2019-10-21 22:35:31 -05: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 a1189d64b1 sae: remove unneeded NULL pointer check
The frame was already validated, and mmpdu_body will never return
a NULL pointer.
2019-10-21 17:14:49 -05:00
James Prestwood 27d698a0c0 sae: fix incorrect length adjustment
The commit/confirm processing was incorrectly subtracting 2 from
the length when they should be subtracting 6. As with the other
similar change, the length is validated with mpdu_validate so
subtracting 6 will not cause an overflow.
2019-10-21 17:12:01 -05:00
James Prestwood 47efe17461 sae: fix inproper return value in sae_verify_accepted
This function was returning a boolean and the expected return was
a signed integer. Since this function actually returned false in
all cases the check for a success (0) return always worked.

The comment about the 'standard code path' was removed as this is
no longer valid.
2019-10-21 16:50:42 -05:00
James Prestwood 3f2b558f57 sae: fix potential integer overflow
If an authentication frame of length <= 5 is sent sae will overflow an
integer. The original cause of this was due to incorrectly using the
sizeof(struct mmpdu_header). The header can be either 24 or 28 bytes
depending on fc.order. sizeof does not account for this so 28 is always
the calculated length.

This, in addition to hostapd not including a group number when rejecting,
cause this erroneous length calculation to be worked around as seen in
the removed comment. The comment is still valid (and described again
in another location) but the actual check for len == 4 is not correct.

To fix this we now rely on mpdu_validate to check that the authentication
frame is valid, and then subtract the actual header length using
mmpdu_header_len rather than sizeof. Doing this lets us also remove the
length check since it was validated previously.
2019-10-21 16:50:42 -05:00