Commit Graph

7204 Commits

Author SHA1 Message Date
Marcel Holtmann 9a5c64481e Release 2.18 2024-06-04 15:36:50 +02:00
Marcel Holtmann 6de09a5eba build: Require at least version 0.66 when building with external ELL 2024-06-03 20:33:31 +02:00
Laura Peeters 03645acf4f eap-tls: Allow tls_msg_len to be zero
EAP-TTLS Start packets are empty by default, but can still be sent with
the L flag set. When attempting to reassemble a message we should not
fail if the length of the message is 0, and just treat it as any other
unfragmented message with the L flag set.
2024-05-31 16:23:15 -05:00
Denis Kenzior c1e2a6c44c build: Add notifylist.[ch] from ell 2024-05-31 15:45:11 -05:00
Denis Kenzior b3e7b7539e watchlist: Remove unused APIs
watchlist_new and watchlist_free were never used.  Get rid of them.
2024-05-29 17:52:23 -05:00
James Prestwood fdbbd8b383 unit: add test for band fallback
This test uses the same country/country3 values seen by an AP vendor
which causes issues with IWD. The alpha2 is ES (Spain) and the 3rd
byte is 4, indicating to use the E-4. The issue then comes when the
neighbor report claims the BSS is under operating class 3 which is
not part of E-4.

With the fallback implemented, this test will pass since it will
try and lookup only on ES (the EU table) which operating class 3 is
part of.
2024-05-14 10:30:48 -05:00
James Prestwood 70d1d71612 band: support band lookup fallback for buggy APs
Its been seen that some vendors incorrectly set the 3rd byte of the
country code which causes the band lookup to fail with the provided
operating class. This isn't compliant with the spec, but its been
seen out in the wild and it causes IWD to behave poorly, specifically
with roaming since it cannot parse neighbor reports. This then
requires IWD to do a full scan on each roam.

Instead of a hard rejection, IWD can instead attempt to determine
the band by ignoring that 3rd byte and only use the alpha2 string.
This makes IWD slightly less strict but at the advantage of not being
crippled when exposed to poor AP configurations.
2024-05-14 10:27:36 -05:00
James Prestwood 4bfc794a37 auto-t: remove default group SAE test for specific OUI
There are already tests for UseDefaultEccGroup and this test is
not longer valid as the static OUI list has been removed.
2024-05-14 10:26:17 -05:00
James Prestwood 8a1f8d1a9a ie: remove is_ie_default_sae_group_oui
This is no longer used and instead a generic option was added
rather than referencing a static OUI list.
2024-05-14 10:26:11 -05:00
James Prestwood b05c1cafcd scan: remove force_default_sae_group from scan_bss
This was added to support a single buggy AP model that failed to
negotiate the SAE group correctly. This may still be a problem but
since then the [Network].UseDefaultEccGroup option has been added
which accomplishes the same thing.

Remove the special handling for this specific OUI and rely on the
user setting the new option if they have problems.
2024-05-14 10:25:46 -05:00
James Prestwood 3be01a83ab build: Create ell directory for ell/ell.h target
Both ell/shared and ell/internal targets first create the ell/
directory within IWD. This apparently was just luck that one of
these always finished first in parallel builds. On my system at
least when building using dpkg-buildpackage IWD fails to build
due to the ell/ directory missing. From the logs it appears that
both the shared/internal targets were started but didn't complete
(or at least create the directory) before the ell/ell.h target:

make[1]: Entering directory '/home/jprestwood/tmp/iwd'
/usr/bin/mkdir -p ell
/usr/bin/mkdir -p ell
echo -n > ell/ell.h
/usr/bin/mkdir -p src
/bin/bash: line 1: ell/ell.h: No such file or directory
make[1]: *** [Makefile:4028: ell/ell.h] Error 1

Creating the ell/ directory within the ell/ell.h target solve
the issue. For reference this is the configure command dpkg
is using:

./configure --build=x86_64-linux-gnu \
	--prefix=/usr \
	--includedir=/usr/include \
	--mandir=/usr/share/man \
	--infodir=/usr/share/info \
	--sysconfdir=/etc \
	--localstatedir=/var \
	--disable-option-checking \
	--disable-silent-rules \
	--libdir=/usr/lib/x86_64-linux-gnu \
	--runstatedir=/run \
	--disable-maintainer-mode \
	--disable-dependency-tracking \
	--enable-tools \
	--enable-dbus-policy
2024-05-14 10:24:09 -05:00
James Prestwood 26efca80d7 nlmon: parse/print neighbor reports
Adds an IE parser for neighbor report elements
2024-05-09 10:23:45 -05:00
John Brandt 5fb3ac5937 eapol: include IGTK in 4-way handshake as AP
When SAE with MFP is being used, include the IGTK in message 3 of the
4-way handshake.
2024-05-07 11:19:51 -05:00
John Brandt 9274f70fec handshake: add functions to save and set IGTK
To add MFP support in the AP mode, add utility functions to save the
IGTK and to add the IGTK to handshake messages.
2024-05-07 11:15:25 -05:00
John Brandt 78bdb26296 eapol: encrypt key data for AKM-defined ciphers
Support encrypting key data when the cipher is AKM-defined. This is
needed to support SAE in AP mode.
2024-05-07 11:03:45 -05:00
John Brandt 3132e9f595 eapol: support PTK derivation with SHA256
Support PTK derivation in case the negotiated AKM requires SHA256. This
is needed to support SAE in AP mode.
2024-05-07 10:52:20 -05:00
John Brandt b9e4dfbd40 sae: support reception of Confirm frame by AP
Experimental AP-mode support for receiving a Confirm frame when in the
COMMITTED state. The AP will reply with a Confirm frame.

Note that when acting as an AP, on reception of a Commit frame, the AP
only replies with a Commit frame. The protocols allows to also already
send the Confirm frame, but older clients may not support simultaneously
receiving a Commit and Confirm frame.
2024-05-07 10:50:39 -05:00
John Brandt 2e80a09184 sae: refactor and add function sae_calculate_keys
Refactor code by moving code to the new function sae_calculate_keys.
This will make it easier in the next commits to add SAE support for AP
mode.
2024-05-07 10:50:39 -05:00
John Brandt 49cddea10b unit: fix SAE unit tests
Don't mark either client as being the authenticator. In the current unit
tests, both instances act as clients to test functionality. This ensures
the unit does not show an error during the following commits where SAE
for AP mode is added.
2024-05-07 10:50:39 -05:00
Marcel Holtmann be3f6a2ca0 udev: Add module for checking interface renaming actions 2024-04-16 14:57:57 +02:00
James Prestwood 88d3261bc2 unit: fix test-band with new rate estimation returns
-ENETUNREACH is the correct return to check as this indicates either
the RSSI was too low or the local capabilities were not compatible.
2024-04-15 16:51:54 -05:00
James Prestwood e5816b024f band: return -ENETUNREACH for HE rate estimation
This was overlooked in a prior patch and causes warnings to be
printed when the RSSI is too low to estimate an HE data rate or
due to incompatible local capabilities (e.g. MCS support).

Similar to the other estimations, return -ENETUNREACH if the IE
was valid but incompatible.
2024-04-15 16:51:54 -05:00
James Prestwood 9cdc726dc1 wiphy: handle -ENETUNREACH for rate estimation
If the RSSI is too low or the local capabilities were not
compatible to estimate the rate don't warn but instead treat
this the same as -ENOTSUP and drop down to the next capability
set.
2024-04-15 16:51:54 -05:00
James Prestwood e196cb1178 wiphy: include MAC of BSS with invalid HE capabilities
The prior print was not very descriptive, and now will log the
MAC of the offending BSS.
2024-04-15 16:51:54 -05:00
Marcel Holtmann 468cecdbca Release 2.17 2024-03-29 00:26:29 +01:00
Marcel Holtmann 546dea11b6 build: Require at least version 0.64 when building with external ELL 2024-03-29 00:03:13 +01:00
Ed Smith da13aab419 Register EAPOL frame listeners earlier
If we register the main EAPOL frame listener as late as the associate
event, it may not observe ptk_1_of_4. This defeats handling for early
messages in eapol_rx_packet, which only sees messages once it has been
registered.

If we move registration to the authenticate event, then the EAPOL
frame listeners should observe all messages, without any possible
races. Note that the messages are not actually processed until
eapol_start() is called, and we haven't moved that call site. All
that's changing here is how early EAPOL messages can be observed.
2024-03-28 17:41:07 -05:00
James Prestwood ccd702f7da netdev: use CMD_DEAUTHENTICATE when needed on disconnect
netdev_disconnect() was unconditionally sending CMD_DISCONNECT which
is not the right behavior when IWD has not associated. This means
that if a connection was started then immediately canceled with
the Disconnect() method the kernel would continue to authenticate.

Instead if IWD has not yet associated it should send a deauth
command which causes the kernel to correctly cleanup its state and
stop trying to authenticate.

Below are logs showing the behavior. Autoconnect is started followed
immediately by a DBus Disconnect call, yet the kernel continues
sending authenticate events.

event: state, old: autoconnect_quick, new: connecting (auto)
src/scan.c:scan_cancel() Trying to cancel scan id 1 for wdev 7d
src/wiphy.c:wiphy_radio_work_done() Work item 1 done
src/wiphy.c:wiphy_radio_work_next() Starting work item 2
src/netdev.c:netdev_mlme_notify() MLME notification New Station(19)
src/station.c:station_dbus_disconnect()
src/station.c:station_reset_connection_state() 85
src/station.c:station_roam_state_clear() 85
event: state, old: connecting (auto), new: disconnecting
src/wiphy.c:wiphy_radio_work_done() Work item 2 done
src/station.c:station_connect_cb() 85, result: 5
src/station.c:station_disconnect_cb() 85, success: 1
event: state, old: disconnecting, new: disconnected
src/netdev.c:netdev_mlme_notify() MLME notification Authenticate(37)
src/netdev.c:netdev_authenticate_event()
Unexpected connection related event -- is another supplicant running?
src/netdev.c:netdev_mlme_notify() MLME notification Authenticate(37)
src/netdev.c:netdev_authenticate_event()
Unexpected connection related event -- is another supplicant running?
src/netdev.c:netdev_mlme_notify() MLME notification Authenticate(37)
src/netdev.c:netdev_authenticate_event()
Unexpected connection related event -- is another supplicant running?
src/netdev.c:netdev_mlme_notify() MLME notification Del Station(20)
src/netdev.c:netdev_mlme_notify() MLME notification Authenticate(37)
src/netdev.c:netdev_authenticate_event()
Unexpected connection related event -- is another supplicant running?
2024-03-28 17:16:37 -05:00
James Prestwood 6365c1f6de wiphy: add better handling for rate estimation errors
In most cases any failure here is likely just due to the AP not
supporting the feature, whether its HE/VHT/HE. This should result
in the estimation returning -ENOTSUP in which case we move down
the list. Any other non-zero return we will now warn to make it
clear the IEs did exist, but were not properly formatted.

All length check failures were changed to continue instead of
fail. This will now treat invalid lengths as if the IE did not
exist.

In addition HE specifically has an extra validation function which,
if failed, was bailing out of the estimation function entirely.
Instead this is now treated as if there was no HE capabilities and
the logic can move down to VHT, HT, or basic rates.
2024-03-28 10:21:08 -05:00
James Prestwood 2f2b5740da band: make HE/no-HT rate estimators return more descriptive
If the IEs were not provided return -ENOTSUP rather than -EINVAL
or -EBADMSG since this just means the AP doesn't support those
capabilities.
2024-03-28 10:20:53 -05:00
James Prestwood 6b94ab3889 iwmon: fix incorrect mask printing HE capabilities
This was changed from too large of a mask (0xff) in an earlier
commit but was masking 5 bits instead of 6.

Fixes: 121c2c5653 ("monitor: properly mask HE capabilities bitfield")
2024-03-15 08:46:56 -05:00
James Prestwood 6bedcb4622 client: fix two issues caught by static analysis
- va_end was not being called on an error condition
 - An uninitialized struct was being accessed if ioctl failed
2024-03-11 22:08:26 -05:00
James Prestwood 121c2c5653 monitor: properly mask HE capabilities bitfield
Caught by static analysis, the bitfield was incorrect and was masking
8 entries (0xff), not 5 (0x1f).
2024-03-11 22:08:19 -05:00
James Prestwood eb3345b51b eap-mschapv2: Check Password-Hash exists when loading settings
Caught by static analysis, the Password-Hash was never validated so
it could end up memcpying from a NULL pointer.
2024-03-11 22:08:02 -05:00
James Prestwood 795f57e816 p2p: check connected peer before processing request
Caught by static analysis, the dev->conn_peer pointer was being
dereferenced very early on without a NULL check, but further it
was being NULL checked. If there is a possibility of it being NULL
the check should be done much earlier.
2024-03-11 22:07:37 -05:00
James Prestwood 71a7190ed2 eap-mschapv2: remove unneeded initialization 2024-03-04 13:48:08 -06:00
James Prestwood 405b897687 dpp: check wrapped data exists in authenticate response 2024-03-04 13:48:08 -06:00
James Prestwood 62e2a3535d files: remove unneeded initialization 2024-03-04 13:48:08 -06:00
James Prestwood d9aaf6c842 ie: remove unneeded initialization 2024-03-04 13:48:08 -06:00
James Prestwood b7559d68c7 client: remove unneeded initialization 2024-03-04 13:48:08 -06:00
Marcel Holtmann 8bb3e3c4fa Release 2.16 2024-03-04 08:51:22 +01:00
James Prestwood c76f7eac05 auto-t: add ability to reserve radios not for IWD/hostapd/etc
If the test needs to do something very specific it may be useful to
prevent IWD from managing all the radios. This can now be done
by setting a "reserve" option in the radio settings. The value of
this should be something other than iwd, hostapd, or wpa_supplicant.

For example:

[rad1]
reserve=false
2024-03-01 08:42:02 -06:00
James Prestwood c2ad0006eb ap: bail in ap_del_station if AP is going down
Caught by static analysis, if this condition is met the AP is going
down so we cannot continue further accessing the ap object.
2024-02-29 14:37:49 -06:00
James Prestwood 5fcfb430b2 ap: verify ATTR_MAC exists in NEW_STATION
Caught by static analysis, if ATTR_MAC was not in the message there
would be a memcpy with uninitialized bytes. In addition there is no
reason to memcpy twice. Instead 'mac' can be a const pointer which
both verifies it exists and removes the need for a second memcpy.
2024-02-29 14:37:42 -06:00
James Prestwood 3a17c8e3c5 nl80211util: check l_genl_attr_recurse return in extract_nested
Caught by static analysis, the recurse operation return was not being
checked.
2024-02-29 14:37:29 -06:00
James Prestwood 6febe5bed1 ap: allow va_end to get called in ap_handshake_event
Caught by static analysis, va_end was never being called since the
REKEY_COMPLETE event was returning early.
2024-02-29 14:37:19 -06:00
James Prestwood 338577bb3a ap: check that the last band_freq_attrs was set
Static analysis complains that 'last' could be NULL which is true.
This really could only happen if every frequency was disabled which
likely is impossible but in any case, check before dereferencing
the pointer.
2024-02-29 14:37:01 -06:00
James Prestwood 83c032a583 p2putil: check length of client info description
A length check was missing which could cause a out of bounds read.

Co-authored-by: Alex Radocea <alex@supernetworks.org>
2024-02-29 14:36:16 -06:00
James Prestwood d34b4e16e0 p2putil: initialize all parsing structures to zero
Since these are all stack variables they are not zero initialized.
If parsing fails there may be invalid pointers within the structures
which can get dereferenced by p2p_clear_*
2024-02-29 14:33:23 -06:00
James Prestwood 52a47c9fd4 p2putil: fix crash/remove side effect parsing adv service info
The input queue pointer was being initialized unconditionally so if
parsing fails the out pointer is still set after the queue is
destroyed. This causes a crash during cleanup.

Instead use a temporary pointer while parsing and only after parsing
has finished do we set the out pointer.

Reported-By: Alex Radocea <alex@supernetworks.org>
2024-02-29 14:32:53 -06:00