3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-24 16:49:25 +01:00
Commit Graph

7144 Commits

Author SHA1 Message Date
James Prestwood
9d4c34dc7a auto-t: Add test for new SAE default group behavior
Tests the 3 possible options to UseDefaultEccGroup behave as
expected:
 - When not provided use the "auto" behavior.
 - When false, always use higher order groups
 - When true, always use default group
2024-02-27 13:55:37 -06:00
James Prestwood
e296a61e3f auto-t: refactor/fix testSAE
The SAE test made some assumptions on certain conditions due to
there being no way of checking if those conditions were met
Mainly the use of H2E/hunt-and-peck.

We assumed that when we told hostapd to use H2E or hunt/peck it
would but in reality it was not. Hostapd is apparently not very
good at swapping between the two with a simple "reload" command.
Once H2E is enabled it appears that it cannot be undone.
Similarly the vendor elements seem to carry over from test to
test, and sometimes not which causes unintended behavior.

To fix this create separate APs for the specific scenario being
tested:
 - Hunt and peck
 - H2E
 - Special vendor_element simulating buggy APs

Another issue found was that if password identifies are used
hostapd automatically chooses H2E which was not intented, at
least based on the test names (in reality it wasn't causing any
problems).

The tests have also been improved to use hostapds "sta_status"
command which contains the group number used when authenticating,
so now that at least can be verified.
2024-02-27 13:55:37 -06:00
James Prestwood
82161909a1 auto-t: add HostapdCLI.sta_status
Gets information about a specific STA hostapd is tracking. This
object will contain detailed information such as the SAE group
number used.
2024-02-27 13:55:37 -06:00
James Prestwood
c2ef5f3f68 auto-t: add Device.event_ocurred
Checks that an event happened previously, and consumes events. This
is useful for checking that an event did not happen after some
testing operations.
2024-02-27 13:55:37 -06:00
James Prestwood
fba4ee90d0 netdev: add NETDEV_EVENT_ECC_GROUP_RETRY, handle in station
In order to complete the learned default group behavior station needs
to be aware of when an SAE/OWE connection retried. This is all
handled within netdev/sae so add a new netdev event so station can
set the appropriate network flags to prevent trying the non-default
group again.
2024-02-27 13:55:37 -06:00
James Prestwood
a559bd7c40 sae: remove sae_sm_set_force_group_19, use handshake
Use the flag set into the handshake to force the default ECC group
2024-02-27 13:55:37 -06:00
James Prestwood
988f68e916 network: set use default ECC group in handshake setup
If either the settings specify it, or the scan_bss is flagged, set
the use_default_ecc_group flag in the handshake.

This also renames the flag to cover both OWE and SAE
2024-02-27 13:55:37 -06:00
James Prestwood
b38f71f221 network: retain default ECC group for OWE after setting
There is special handling for buggy OWE APs which set a network flag
to use the default OWE group. Utilize the more persistent setting
within known-networks as well as the network object (in case there
is no profile).

This also renames the get/set APIs to be generic to ECC groups rather
than only OWE.
2024-02-27 13:55:37 -06:00
James Prestwood
3f04bc427d knownnetworks: add option to force a default ECC group
This adds the option [Settings].UseDefaultEccGroup which allows a
network profile to specify the behavior when using an ECC-based
protocol. If unset (default) IWD will learn the behavior of the
network for the lifetime of its process.

Many APs do not support group 20 which IWD tries first by default.
This leads to an initial failure followed by a retry using group 19.
This option will allow the user to configure IWD to use group 19
first or learn the network capabilities, if the authentication fails
with group 20 IWD will always use group 19 for the process lifetime.
2024-02-27 13:55:37 -06:00
James Prestwood
3ab09e0ae2 doc: Document UseDefaultEccGroup 2024-02-27 13:55:37 -06:00
Marcel Holtmann
cc0fcb2bb4 Release 2.15 2024-02-26 20:55:02 +01:00
Marcel Holtmann
b1edef3a14 build: Require at least version 0.63 when building with external ELL 2024-02-26 20:50:33 +01:00
Ram Subramanian
c0058c07bf doc: document channel field in station diagnostics 2024-02-26 09:44:38 -06:00
Ram Subramanian
9f31663e21 client: report channel if present in diag message 2024-02-26 09:44:25 -06:00
Ram Subramanian
793228028d station: add channel number to diagnostics message
As a small convenience to the user.
2024-02-26 09:44:12 -06:00
James Prestwood
d4c68d7d83 netdev: add notice events for connection timeouts
The information specific to auth/assoc/connect timeouts isn't
communicated to station so emit the notice events within netdev.
We could communicate this to station by adding separate netdev
events, but this does not seem worth it for this use case as
these notice events aren't strictly limited to station.
2024-02-22 10:15:07 -06:00
James Prestwood
77cdbd186b station: use iwd_notice for state/event information
For anyone debugging or trying to identify network infrastructure
problems the IWD DBus API isn't all that useful and ultimately
requires going through debug logs to figure out exactly what
happened. Having a concise set of debug logs containing only
relavent information would be very useful. In addition, having
some kind of syntax for these logs to be parsed by tooling could
automate these tasks.

This is being done, starting with station, by using iwd_notice
which internally uses l_notice. The use of the notice log level
(5) in IWD will be strictly for the type of messages described
above.
2024-02-22 10:15:04 -06:00
James Prestwood
98ae3d4197 doc: document use of l_log APIs
With the introduction of l_notice in IWD some guidelines need to be
set for l_info, l_warn, l_error, l_debug and l_notice.
2024-02-22 10:15:02 -06:00
James Prestwood
d8a6fb86c1 iwd: add iwd_notice for special event/state type of logging
iwd_notice is being added so modules can communicate internal
state or event information via the NOTICE log level. This log
level will be reserved in IWD for only these type of messages.

The iwd_notice macro aims to help enforce some formatting
requirements for these type of log messages. The messages
should be one or more comma-separated "key: value" pairs starting
with "event: <name>" and followed by any additional info that
pertains to that event.

iwd_notice only enforces the initial event key/value format and
additional arguments are left to the caller to be formatted
correctly.
2024-02-22 10:14:59 -06:00
James Prestwood
32f3745745 main: add runtime flag for setting the logger
The --logger,-l flag can now be used to specify the logger type.
Unset (default) will set log output to stderr as it is today. The
other valid options are "syslog" and "journal".
2024-02-22 10:14:41 -06:00
James Prestwood
c54ef5a8da auto-t: timestamp log files in test-runner
The log files become much more useful when there are timestamps
associated with each log.
2024-02-22 09:28:55 -06:00
James Prestwood
a507c08bfe auto-t: fix failed_roam_test to pass when run on its own
When running this test with others the hostapd neighbors are already
grouped which lets the test pass. On its own this does not happen
and it fails.
2024-02-22 09:28:55 -06:00
Denis Kenzior
ba5a6df2d1 wiphy: Remove basename() use
basename use is considered harmful.  There are two versions of
basename (see man 3 basename for details).  The more intuitive version,
which is currently being used inside wiphy.c, is not supported by musl
libc implementation.  Use of the libgen version is not preferred, so
drop use of basename entirely.  Since wiphy.c is the only call site of
basename() inside iwd, open code the required logic.
2024-02-14 14:50:06 -06:00
James Prestwood
6315b42861 netdev: use reason code from netdev_deauthenticate_event
The reason code was not being passed to netdev_connect_failed as
it should have been.
2024-02-13 17:00:39 -06:00
Marcel Holtmann
42b4da1be2 Release 2.14 2024-02-09 22:13:55 +01:00
Marcel Holtmann
bcfbaa096d build: Require at least version 0.62 when building with external ELL 2024-02-09 22:09:38 +01:00
James Prestwood
593c9dee6c auto-t: add netconfig timeout test
Tests that netconfig eventually times out and that IWD disconnects
2024-01-30 14:00:30 -06:00
James Prestwood
aa0a439856 netconfig: limit DHCPv4 attempts to avoid extended netconfig times
ELL now has a setting to limit the number of DHCP attempts. This
will now be set in IWD and if reached will result in a failure
event, and in turn a disconnect.

IWD will set a maximum of 4 retries which should keep the maximum
DHCP time to ~60 seconds roughly.
2024-01-30 13:59:22 -06:00
James Prestwood
1fe68aef0b station: reverse roam scan results for sorted known frequencies
The known frequency list is now a sorted list and the roam scan
results were not complying with this new requirement. The fix is
easy though since the iteration order of the scan results does
not matter (the roam candidates are inserted by rank). To fix
the known frequencies order we can simply reverse the scan results
list before iterating it.
2024-01-30 13:58:45 -06:00
James Prestwood
643503eeea netdev: make unprotected disconnect debug log more clear
The debug log was just saying "disconnect event" but we should
distinguish between unprotected and protected events.
2024-01-30 13:58:45 -06:00
James Prestwood
085a2511f6 netdev: fix setting a uint8_t with l_get_le16 2024-01-30 13:58:45 -06:00
Mathy Vanhoef
6415420f1c ap: only accept ptk 4/4 after receiving ptk 2/4
When operating as an AP, drop message 4 of the 4-way handshake if the AP
has not yet received message 2. Otherwise an attacker can skip message 2
and immediately send message 4 to bypass authentication (the AP would be
using an all-zero ptk to verify the authenticity of message 4).
2024-01-29 21:00:00 -06:00
James Prestwood
1a79092383 auto-t: add test for known frequency sorting/maximum
Modify the existing frequency test to check that the ordering
lines up with the ranking of the BSS.

Add a test to check that quick scans limit the number of known
frequencies.
2024-01-29 20:45:32 -06:00
James Prestwood
f52180d41c station: knownnetworks: limit quick scans to 5 freqs per network
In very large network deployments there could be a vast amount of APs
which could create a large known frequency list after some time once
all the APs are seen in scan results. This then increases the quick
scan time significantly, in the very worst case (but unlikely) just
as long as a full scan.

To help with this support in knownnetworks was added to limit the
number of frequencies per network. Station will now only get 5
recent frequencies per network making the maximum frequencies 25
in the worst case (~2.5s scan).

The magic values are now defines, and the recent roam frequencies
was also changed to use this define as well.
2024-01-29 20:43:33 -06:00
James Prestwood
197087d081 station: use network_update_known_frequencies
Updates each network with its new, most current, set of BSS's
for the different types of scans: dbus/autoconnect, hidden, and
OWE.
2024-01-29 20:43:21 -06:00
James Prestwood
d03b06db85 network: add network_update_known_frequencies
In order to support an ordered list of known frequencies the list
should be in order of last seen BSS frequencies with the highest
ranked ones first. To accomplish this without adding a lot of
complexity the frequencies can be pushed into the list as long as
they are pushed in reverse rank order (lowest rank first, highest
last). This ensures that very high ranked BSS's will always get
superseded by subsequent scans if not seen.

This adds a new network API to update the known frequency list
based on the current newtork->bss_list. This assumes that station
always wipes the BSS list on scans and populates with only fresh
BSS entries. After the scan this API can be called and it will
reverse the list, then add each frequency.
2024-01-29 20:43:02 -06:00
Marcel Holtmann
4b3e82f742 Release 2.13 2024-01-12 20:07:31 +01:00
Fiona Klute
a6638513d4 Log falling back from SAE to WPA2
I've had connections to a WPA3-Personal only network fail with no log
message from iwd, and eventually figured out to was because the driver
would've required using CMD_EXTERNAL_AUTH. With the added log messages
the reason becomes obvious.

Additionally the fallback may happen even if the user explicitly
configured WPA3 in NetworkManager, I believe a warning is appropriate
there.
2024-01-09 21:32:28 -06:00
James Prestwood
5abf54f2dc auto-t: add test for roaming + netconfig
This test ensures IWD will continue to roam and restart netconfig if
roam conditions are met prior to netconfig finishing.
2024-01-08 22:08:53 -06:00
James Prestwood
7080a4453e station: add handling for new NETCONFIG state
There was an unhandled corner case if netconfig was running and
multiple roam conditions happened in sequence, all before netconfig
had completed. A single roam before netconfig was already handled
(23f0f5717c) but this did not take into account any additional roam
conditions.

If IWD is in this state, having started netconfig, then roamed, and
again restarted netconfig it is still in a roaming state which will
prevent any further roams. IWD will remain "stuck" on the current
BSS until netconfig completes or gets disconnected.

In addition the general state logic is wrong here. If IWD roams
prior to netconfig it should stay in a connecting state (from the
perspective of DBus).

To fix this a new internal station state was added (no changes to
the DBus API) to distinguish between a purely WiFi connecting state
(STATION_STATE_CONNECTING/AUTO) and netconfig
(STATION_STATE_NETCONFIG). This allows IWD roam as needed if
netconfig is still running. Also, some special handling was added so
the station state property remains in a "connected" state until
netconfig actually completes, regardless of roams.

For some background this scenario happens if the DHCP server goes
down for an extended period, e.g. if its being upgraded/serviced.
2024-01-08 22:04:53 -06:00
James Prestwood
8f7443b0b3 station: add additional internal state, STATION_STATE_NETCONFIG
This is still treated as "connecting" from a DBus perspective but
will allow for better handling internally for some roaming corner
cases.
2024-01-08 22:04:41 -06:00
James Prestwood
407a8a4441 client: fix AP PairwiseCiphers parsing
This property was being parsed as "s" when it should be "as". This
results in "ap <wlan> show" having an empty entry for the
PairwiseCiphers list.
2024-01-04 12:18:40 -06:00
James Prestwood
705898d1db monitor: include unistd.h in main.c
This fixes a build break on some systems, specifically the
raspberry Pi 3 (ARM):

monitor/main.c: In function ‘open_packet’:
monitor/main.c:176:3: error: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Werror=implicit-function-declaration]
  176 |   close(fd);
      |   ^~~~~
      |   pclose
2024-01-04 12:18:05 -06:00
James Prestwood
aaf1d91d51 auto-t: fix random testPSK-roam failure
This was caused by the unused hostapd instance running after being
re-enabled by mistake. This cause an additional scan result with the
same rank to be seen which would then be connected to by luck of the
draw.
2024-01-04 11:59:41 -06:00
James Prestwood
b0ad6158e1 auto-t: improve failure handling in testPSK-roam
This really needs to be done to many more autotests but since this
one seems to have random failures ensure that all the tests still
run if one fails. In addition add better cleanup for hwsim rules.
2024-01-04 11:59:37 -06:00
James Prestwood
0a3797a4d4 auto-t: update roam test to use new debug events 2024-01-04 11:57:32 -06:00
James Prestwood
77e5c94dc6 station: add debug events for internal states
This gives the tests a lot more fine-tune control to wait for
specific state transitions rather than only what is exposed over
DBus.

The additional events for "ft-roam" and "reassoc-roam" were removed
since these are now covered by the more generic state change events
("ft-roaming" and "roaming" respectively).
2024-01-04 11:57:28 -06:00
James Prestwood
593fad5260 station: handle netconfig after roaming for FW roams
This was not taken into account for FW roams and would result in the
station state being set to connected regardless of netconfig's result.
2024-01-04 11:46:39 -06:00
James Prestwood
a2fff11823 monitor: indicate if the MPDU was invalid
If the frame was not parsed as an MPDU indicate this in iwmon. This
also adds handling to print probe requests.
2024-01-02 11:02:15 -06:00
Denis Kenzior
cfb468e44d monitor: Move iwmon reading logic into main.c
To support multiple nlmon sources, move the logic that reads from iwmon
device into main.c instead of nlmon.  nlmon.c now becomes agnostic of
how the packets are actually obtained.  Packets are fed in via
high-level APIs such as nlmon_print_rtnl, nlmon_print_genl,
nlmon_print_pae.
2024-01-02 10:59:38 -06:00