aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
5 daysunit: add test for band fallbackHEADmasterJames Prestwood1-0/+14
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.
5 daysband: support band lookup fallback for buggy APsJames Prestwood1-3/+55
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.
5 daysauto-t: remove default group SAE test for specific OUIJames Prestwood3-21/+1
There are already tests for UseDefaultEccGroup and this test is not longer valid as the static OUI list has been removed.
5 daysie: remove is_ie_default_sae_group_ouiJames Prestwood2-27/+0
This is no longer used and instead a generic option was added rather than referencing a static OUI list.
5 daysscan: remove force_default_sae_group from scan_bssJames Prestwood3-6/+1
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.
5 daysbuild: Create ell directory for ell/ell.h targetJames Prestwood1-0/+1
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
10 daysnlmon: parse/print neighbor reportsJames Prestwood1-0/+83
Adds an IE parser for neighbor report elements
12 dayseapol: include IGTK in 4-way handshake as APJohn Brandt1-0/+13
When SAE with MFP is being used, include the IGTK in message 3 of the 4-way handshake.
12 dayshandshake: add functions to save and set IGTKJohn Brandt2-0/+42
To add MFP support in the AP mode, add utility functions to save the IGTK and to add the IGTK to handshake messages.
12 dayseapol: encrypt key data for AKM-defined ciphersJohn Brandt1-15/+38
Support encrypting key data when the cipher is AKM-defined. This is needed to support SAE in AP mode.
12 dayseapol: support PTK derivation with SHA256John Brandt1-1/+6
Support PTK derivation in case the negotiated AKM requires SHA256. This is needed to support SAE in AP mode.
12 dayssae: support reception of Confirm frame by APJohn Brandt1-13/+39
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.
12 dayssae: refactor and add function sae_calculate_keysJohn Brandt1-36/+49
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.
12 daysunit: fix SAE unit testsJohn Brandt1-3/+0
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-04-16udev: Add module for checking interface renaming actionsMarcel Holtmann2-0/+286
2024-04-15unit: fix test-band with new rate estimation returnsJames Prestwood1-1/+1
-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-15band: return -ENETUNREACH for HE rate estimationJames Prestwood1-1/+1
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-15wiphy: handle -ENETUNREACH for rate estimationJames Prestwood1-4/+4
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-15wiphy: include MAC of BSS with invalid HE capabilitiesJames Prestwood1-1/+2
The prior print was not very descriptive, and now will log the MAC of the offending BSS.
2024-03-29Release 2.172.17Marcel Holtmann2-1/+6
2024-03-29build: Require at least version 0.64 when building with external ELLMarcel Holtmann1-1/+1
2024-03-28Register EAPOL frame listeners earlierEd Smith1-4/+17
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-28netdev: use CMD_DEAUTHENTICATE when needed on disconnectJames Prestwood1-3/+16
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-28wiphy: add better handling for rate estimation errorsJames Prestwood1-14/+30
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-28band: make HE/no-HT rate estimators return more descriptiveJames Prestwood1-2/+2
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-15iwmon: fix incorrect mask printing HE capabilitiesJames Prestwood1-1/+1
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-11client: fix two issues caught by static analysisJames Prestwood1-3/+4
- va_end was not being called on an error condition - An uninitialized struct was being accessed if ioctl failed
2024-03-11monitor: properly mask HE capabilities bitfieldJames Prestwood1-1/+1
Caught by static analysis, the bitfield was incorrect and was masking 8 entries (0xff), not 5 (0x1f).
2024-03-11eap-mschapv2: Check Password-Hash exists when loading settingsJames Prestwood1-0/+3
Caught by static analysis, the Password-Hash was never validated so it could end up memcpying from a NULL pointer.
2024-03-11p2p: check connected peer before processing requestJames Prestwood1-1/+4
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-04eap-mschapv2: remove unneeded initializationJames Prestwood1-1/+0
2024-03-04dpp: check wrapped data exists in authenticate responseJames Prestwood1-1/+1
2024-03-04files: remove unneeded initializationJames Prestwood1-1/+1
2024-03-04ie: remove unneeded initializationJames Prestwood1-3/+0
2024-03-04client: remove unneeded initializationJames Prestwood1-1/+1
2024-03-04Release 2.162.16Marcel Holtmann2-1/+10
2024-03-01auto-t: add ability to reserve radios not for IWD/hostapd/etcJames Prestwood1-3/+6
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-02-29ap: bail in ap_del_station if AP is going downJames Prestwood1-1/+2
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-29ap: verify ATTR_MAC exists in NEW_STATIONJames Prestwood1-3/+3
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-29nl80211util: check l_genl_attr_recurse return in extract_nestedJames Prestwood1-3/+1
Caught by static analysis, the recurse operation return was not being checked.
2024-02-29ap: allow va_end to get called in ap_handshake_eventJames Prestwood1-1/+1
Caught by static analysis, va_end was never being called since the REKEY_COMPLETE event was returning early.
2024-02-29ap: check that the last band_freq_attrs was setJames Prestwood1-2/+4
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-29p2putil: check length of client info descriptionJames Prestwood1-0/+3
A length check was missing which could cause a out of bounds read. Co-authored-by: Alex Radocea <alex@supernetworks.org>
2024-02-29p2putil: initialize all parsing structures to zeroJames Prestwood1-17/+17
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-29p2putil: fix crash/remove side effect parsing adv service infoJames Prestwood1-5/+8
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-29auto-t: Add frame fuzzing testJames Prestwood3-0/+116
Add a test to validate a crash found by Alex Radocea when sending a fuzzed beacon frame. Co-authored-by: Alex Radocea <alex@supernetworks.org>
2024-02-29auto-t: end process_io on HUP signal, detect process crashJames Prestwood1-3/+7
When HUP is received the IO read callback was never completing which caused it to block indefinitely until waited for. This didn't matter for most transient processes but for IWD, hostapd, wpa_supplicant it would cause test-runner to hang if the process crashed. Detecting a crash is somewhat hacky because we have no process management like systemd and the return code isn't reliable as some processes return non-zero under normal circumstances. So to detect a crash the process output is being checked for the string: "++++++++ backtrace ++++++++". This isn't 100% reliable obviously since its dependent on how the binary is compiled, but even if the crash itself isn't detected any test should still fail if written correctly. Doing this allows auto-tests to handle IWD crashes gracefully by failing the test, printing the exception (event without debugging) and continue with other tests.
2024-02-28netconfig: Fix copy-paste errorDenis Kenzior1-1/+1
netconfig_domains_update() was setting dns_list instead of the domains member.
2024-02-28auto-t: fix netconfig to handle resolvconf values out of orderJames Prestwood1-7/+14
The slaac_test was one that would occationally fail, but very rarely, due to the resolvconf log values appearing in an unexpected order. This appears to be related to a typo in netconfig-commit which would not set netconfig-domains and instead set dns_list. This was fixed with a pending patch: https://lore.kernel.org/iwd/20240227204242.1509980-1-denkenz@gmail.com/T/#u But applying this now leads to testNetconfig failing slaac_test 100% of the time. I'm not familiar enough with resolveconf to know if this test change is ok, but based on the test behavior the expected log and disk logs are the same, just in the incorrect order. I'm not sure if this the log order is deterministic so instead the check now iterates the expected log and verifies each value appears once in the resolvconf log. Here is an example of the expected vs disk logs after running the test: Expected: -a wlan1.dns nameserver 192.168.1.2 nameserver 3ffe:501:ffff:100::10 nameserver 3ffe:501:ffff:100::50 -a wlan1.domain search test1 search test2 Resolvconf log: -a wlan1.domain search test1 search test2 -a wlan1.dns nameserver 192.168.1.2 nameserver 3ffe:501:ffff:100::10 nameserver 3ffe:501:ffff:100::50
2024-02-28eap-wsc: Zero authenticator bytes to fix static analysis warningDenis Kenzior1-0/+17
static analysis complains that authenticator is used uninitialized. This isn't strictly true as memory region is reserved for the authenticator using the contents of the passed in structure. This region is then overwritten once the authenticator is actually computed by authenticator_put(). Silence this warning by explicitly setting authenticator bytes to 0. Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
2024-02-27station: warn on missing scan_bss in station_transition_startJames Prestwood1-0/+2
This shouldn't be possible in theory since the roam_bss_list being iterated is a subset of entire scan_bss list station/network has but to be safe, and catch any issues due to future changes warn on this condition.
2024-02-27crypto: fix uninitialized variable coverity warningJames Prestwood1-1/+1
Same as for aes_siv_decrypt, check num_ads before calling memcpy.
2024-02-27crypto: fix uninitialized variable coverity warningJames Prestwood1-1/+1
For some encrypt operations DPP passes no AD iovecs (both are NULL/0). But since the iovec itself is on the stack 'ad' is a valid pointer from within aes_siv_encrypt. This causes memcpy to be called which coverity complains about. Since the copy length is zero it was effectively a no-op, but check num_ad to prevent the call.
2024-02-27unit: fix memory leak in test-dppJames Prestwood1-0/+2
2024-02-27auto-t: add OWE test for auto default groupJames Prestwood1-0/+33
2024-02-27auto-t: Add test for new SAE default group behaviorJames Prestwood5-1/+120
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-27auto-t: refactor/fix testSAEJames Prestwood8-40/+52
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-27auto-t: add HostapdCLI.sta_statusJames Prestwood1-0/+16
Gets information about a specific STA hostapd is tracking. This object will contain detailed information such as the SAE group number used.
2024-02-27auto-t: add Device.event_ocurredJames Prestwood1-0/+6
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-27netdev: add NETDEV_EVENT_ECC_GROUP_RETRY, handle in stationJames Prestwood3-0/+31
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-27sae: remove sae_sm_set_force_group_19, use handshakeJames Prestwood3-12/+1
Use the flag set into the handshake to force the default ECC group
2024-02-27network: set use default ECC group in handshake setupJames Prestwood3-4/+4
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-27network: retain default ECC group for OWE after settingJames Prestwood3-11/+35
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-27knownnetworks: add option to force a default ECC groupJames Prestwood2-0/+19
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-27doc: Document UseDefaultEccGroupJames Prestwood1-0/+7
2024-02-26Release 2.152.15Marcel Holtmann2-1/+6
2024-02-26build: Require at least version 0.63 when building with external ELLMarcel Holtmann1-1/+1
2024-02-26doc: document channel field in station diagnosticsRam Subramanian1-0/+2
2024-02-26client: report channel if present in diag messageRam Subramanian1-0/+10
2024-02-26station: add channel number to diagnostics messageRam Subramanian1-0/+8
As a small convenience to the user.
2024-02-22netdev: add notice events for connection timeoutsJames Prestwood1-3/+4
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-22station: use iwd_notice for state/event informationJames Prestwood1-7/+27
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-22doc: document use of l_log APIsJames Prestwood1-0/+15
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-22iwd: add iwd_notice for special event/state type of loggingJames Prestwood1-0/+14
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-22main: add runtime flag for setting the loggerJames Prestwood1-2/+12
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-22auto-t: timestamp log files in test-runnerJames Prestwood1-1/+6
The log files become much more useful when there are timestamps associated with each log.
2024-02-22auto-t: fix failed_roam_test to pass when run on its ownJames Prestwood1-0/+2
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-14wiphy: Remove basename() useDenis Kenzior1-1/+4
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-13netdev: use reason code from netdev_deauthenticate_eventJames Prestwood1-1/+1
The reason code was not being passed to netdev_connect_failed as it should have been.
2024-02-09Release 2.142.14Marcel Holtmann2-1/+6
2024-02-09build: Require at least version 0.62 when building with external ELLMarcel Holtmann1-1/+1
2024-01-30auto-t: add netconfig timeout testJames Prestwood2-0/+67
Tests that netconfig eventually times out and that IWD disconnects
2024-01-30netconfig: limit DHCPv4 attempts to avoid extended netconfig timesJames Prestwood1-2/+7
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-30station: reverse roam scan results for sorted known frequenciesJames Prestwood1-0/+6
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-30netdev: make unprotected disconnect debug log more clearJames Prestwood1-1/+2
The debug log was just saying "disconnect event" but we should distinguish between unprotected and protected events.
2024-01-30netdev: fix setting a uint8_t with l_get_le16James Prestwood1-1/+1
2024-01-29ap: only accept ptk 4/4 after receiving ptk 2/4Mathy Vanhoef1-0/+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-29auto-t: add test for known frequency sorting/maximumJames Prestwood2-9/+102
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-29station: knownnetworks: limit quick scans to 5 freqs per networkJames Prestwood3-15/+31
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-29station: use network_update_known_frequenciesJames Prestwood2-3/+6
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-29network: add network_update_known_frequenciesJames Prestwood2-9/+30
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-12Release 2.132.13Marcel Holtmann2-1/+6
2024-01-09Log falling back from SAE to WPA2Fiona Klute1-1/+6
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-08auto-t: add test for roaming + netconfigJames Prestwood6-0/+186
This test ensures IWD will continue to roam and restart netconfig if roam conditions are met prior to netconfig finishing.
2024-01-08station: add handling for new NETCONFIG stateJames Prestwood1-9/+27
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-08station: add additional internal state, STATION_STATE_NETCONFIGJames Prestwood4-0/+8
This is still treated as "connecting" from a DBus perspective but will allow for better handling internally for some roaming corner cases.
2024-01-04client: fix AP PairwiseCiphers parsingJames Prestwood1-2/+11
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-04monitor: include unistd.h in main.cJames Prestwood1-0/+1
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-04auto-t: fix random testPSK-roam failureJames Prestwood1-3/+4
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-04auto-t: improve failure handling in testPSK-roamJames Prestwood3-17/+22
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-04auto-t: update roam test to use new debug eventsJames Prestwood1-5/+5
2024-01-04station: add debug events for internal statesJames Prestwood1-4/+2
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-04station: handle netconfig after roaming for FW roamsJames Prestwood1-1/+11
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-02monitor: indicate if the MPDU was invalidJames Prestwood1-9/+34
If the frame was not parsed as an MPDU indicate this in iwmon. This also adds handling to print probe requests.
2024-01-02monitor: Move iwmon reading logic into main.cDenis Kenzior3-168/+174
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-02monitor: Use nlmon_print_* inside nlmon_receiveDenis Kenzior1-26/+18
The current implementation inside nlmon_receive is asymmetrical. RTNL packets are printed using nlmon_print_rtnl while GENL packets are printed using nlmon_message. nlmon_print_genl and nlmon_print_rtnl already handle iterating over data containing multiple messages, and are used by nlmon started in reader mode. Use these for better symmetry inside nlmon_receive. While here, move store_netlink() call into nlmon_print_rtnl. This makes handling of PCAP output symmetrical for both RTNL and GENL packets. This also fixes a possibility where only the first message of a multi-RTNL packet would be stored.
2024-01-02monitor: Remove unused PACKET_AUXDATA handlingDenis Kenzior1-11/+2
2024-01-02monitor: Remove unused code pathDenis Kenzior1-33/+3
nlmon_print_genl invokes genl_ctrl when a generic netlink control message is encountered. genl_ctrl() tries to filter nl80211 family appearance messages and setup nlmon->id with the extracted family id. However, the id is already provided inside main.c by using nlmon_open, and no control messages are processed by nlmon in 'capture' mode (-r command line argument not passed) since all genl messages go through nlmon_message() path instead.
2023-12-31configure.ac: fix bashismSam James1-1/+1
configure scripts need to be runnable with a POSIX-compliant /bin/sh. On many (but not all!) systems, /bin/sh is provided by Bash, so errors like this aren't spotted. Notably Debian defaults to /bin/sh provided by dash which doesn't tolerate such bashisms as '+='. This retains compatibility with bash. Just copy the expanded append like we do on the line above. Fixes warnings like: ``` ./configure: 13352: CFLAGS+= -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2: not found ```
2023-12-31build: Fix build with openssl 3.2Denis Kenzior1-1/+0
make --no-print-directory all-am openssl req -new -extensions cert_ext \ -config ./unit/gencerts.cnf \ -subj '/O=Foo Example Organization/CN=Foo Example Organization/emailAddress=foo@mail.example' \ -key unit/cert-server-key.pem -out unit/cert-server.csr Error adding request extensions from section cert_ext 4057AC4D6F7F0000:error:11000079:X509 V3 routines:v2i_AUTHORITY_KEYID:no issuer certificate:crypto/x509/v3_akid.c:156: 4057AC4D6F7F0000:error:11000080:X509 V3 routines:X509V3_EXT_nconf_int:error in extension:crypto/x509/v3_conf.c:48:section=cert_ext, name=authorityKeyIdentifier, value=keyid:always,issuer:always make[1]: *** [Makefile:3962: unit/cert-server.csr] Error 1
2023-12-27Release 2.122.12Marcel Holtmann2-1/+6
2023-12-19auto-t: increase RAM when running with valgrind (UML)James Prestwood1-1/+6
This was done for QEMU but not for UML. Running more than a few tests with --valgrind will generally thrown an OOM error pretty quick.
2023-12-19auto-t: add DPP tests to check extra settings are appliedJames Prestwood5-4/+89
In order to test that extra settings are applied prior to connecting two tests were added for hidden networks as well as one testing if there is already an existing profile after DPP. The reason hidden networks were used was due to the requirement of the "Hidden" settings in the profile. If this setting doesn't get sync'ed to disk the connection will fail.
2023-12-19dpp: fix extra settings not being used when connectingJames Prestwood1-31/+93
Before this change DPP was writing the credentials both to disk and into the network object directly. This allowed the connection to work fine but additional settings were not picked up due to network_set_passphrase/psk loading the settings before they were written. Instead DPP can avoid setting the credentials to the network object entirely and just write them to disk. Then, wait for known networks to notify that the profile was either created or updated then DPP can proceed to connecting. network_autoconnect() will take care of loading the profile that DPP wrote and remove the need for DPP to touch the network object at all. One thing to note is that an idle callback is still needed from within the known networks callback. This is because a new profile requires network.c to set the network_info which is done in the known networks callback. Rather than assume that network.c will be called into before dpp.c an l_idle was added.
2023-12-19knownnetworks: Add UPDATED eventJames Prestwood3-0/+7
If a known network is modified on disk known networks does not have any way of notifying other modules. This will be needed to support a corner case in DPP if a profile exists but is overwritten after DPP configuration. Add this event to known networks and handle it in network.c (though nothing needs to be done in that case).
2023-12-18dpp: fix data corruption around prf_plus() callSergei Trofimovich2-3/+4
Without the change test-dpp fails on aarch64-linux as: $ unit/test-dpp TEST: DPP test responder-only key derivation TEST: DPP test mutual key derivation TEST: DPP test PKEX key derivation test-dpp: unit/test-dpp.c:514: test_pkex_key_derivation: Assertion `!memcmp(tmp, __tmp, 32)' failed. This happens due to int/size_t type mismatch passed to vararg parameters to prf_plus(): bool prf_plus(enum l_checksum_type type, const void *key, size_t key_len, void *out, size_t out_len, size_t n_extra, ...) { // ... va_start(va, n_extra); for (i = 0; i < n_extra; i++) { iov[i + 1].iov_base = va_arg(va, void *); iov[i + 1].iov_len = va_arg(va, size_t); // ... Note that varargs here could only be a sequence of `void *` / `size_t` values. But in src/dpp-util.c `iwd` attempted to pass `int` there: prf_plus(sha, prk, bytes, z_out, bytes, 5, mac_i, 6, // <- here mac_r, 6, // <- and here m_x, bytes, n_x, bytes, key, strlen(key)); aarch64 stores only 32-bit value part of the register: mov w7, #0x6 str w7, [sp, #...] and loads full 64-bit form of the register: ldr x3, [x3] As a result higher bits of `iov[].iov_len` contain unexpected values and sendmsg sends a lot more data than expected to the kernel. The change fixes test-dpp test for me. While at it fixed obvious `int` / `size_t` mismatch in src/erp.c. Fixes: 6320d6db0f ("crypto: remove label from prf_plus, instead use va_args")
2023-12-15network: remove 'path' from settings_load_pt_eccJames Prestwood1-6/+3
The path argument was used purely for debugging. It can be just as informational printing just the SSID of the profile that failed to parse the setting without requiring callers allocate a string to call the function.
2023-12-15auto-t: throw exception if executable is missingJames Prestwood1-0/+3
Certain tests may require external processes to work (e.g. testNetconfig) and if missing the test will just hang until the maximum test timeout. Check in start_process if the exe actually exists and if not throw an exception.
2023-12-15auto-t: add H2E password identifier testJames Prestwood5-8/+20
In order to support identifiers the test profiles needed to be reworked due to hostapd allowing multiple password entires. You cannot just call set_value() with a new entry as the old ones still exist. Instead use a unique password for the identifier and non-identifier use cases. After adding this test the failure_test started failing due to hostapd not starting up. This was due to the group being unsupported but oddly only when hostapd was reloaded (running the test individually worked). To fix this the group number was changed to 21 which hostapd does support but IWD does not.
2023-12-15doc: document [Security].PasswordIdentifierJames Prestwood1-0/+6
2023-12-15network: add support for SAE password identifiersJames Prestwood1-1/+36
Adds a new network profile setting [Security].PasswordIdentifier. When set (and the BSS enables SAE password identifiers) the network and handshake object will read this and use it for the SAE exchange. Building the handshake will fail if: - there is no password identifier set and the BSS sets the "exclusive" bit. - there is a password identifier set and the BSS does not set the "in-use" bit.
2023-12-14Release 2.112.11Marcel Holtmann2-1/+6
2023-12-13netdev: station: remove NETDEV_EVENT_FT_ROAMEDJames Prestwood2-7/+0
The notification for roaming success/failure is now handled with the connect callback.
2023-12-13ft: remove ft_associate and helpersJames Prestwood2-161/+1
The reassociation is done through netdev directly, these are no longer needed.
2023-12-13station: use netdev_ft_reassociateJames Prestwood1-2/+20
Using this will provide netdev with a connect callback and unify the roaming result notification between FT and reassociation. Both paths will now end up in station_reassociate_cb. This also adds another return case for ft_handshake_setup which was previously ignored by ft_associate. Its likely impossible to actually happen but should be handled nevertheless. Fixes: 30c6a10f28 ("netdev: Separate connect_failed and disconnected paths")
2023-12-13netdev: add netdev_ft_reassociateJames Prestwood2-18/+30
Essentially exposes (and renames) netdev_ft_tx_associate in order to be called similarly to netdev_reassociate/netdev_connect where a connect callback can be provided. This will fix the current bug where if association times out during FT IWD will hang and never transition to disconnected. This also removes the calling of the FT_ROAMED event and instead just calls the connect callback (since its now set). This unifies the callback path for reassociation and FT roaming.
2023-12-13ft: add ft_handshake_setupJames Prestwood2-0/+42
This will be called from station after FT-authentication has finished. It sets up the handshake object to perform reassociation. This is essentially a copy-paste of ft_associate without sending the actual frame.
2023-12-13ft: add FTE/RSNE building to ft_prepare_handshakeJames Prestwood1-2/+82
In preparation to remove ft_associate build the FTE/RSNE in ft_prepare_handshake and set into the handshake object directly.
2023-12-13handshake: remove handshake_state_set_fteJames Prestwood2-8/+0
Replaced by set_authenticator_fte
2023-12-13unit: use authenticator_fteJames Prestwood1-1/+1
2023-12-13handshake: use authenticator_fte instead of 'fte'James Prestwood5-6/+7
2023-12-13handshake: add setters for authenticator/supplicant_fteJames Prestwood2-0/+21
In general only the authenticator FTE is used/validated but with some FT refactoring coming there needs to be a way to build the supplicants FTE into the handshake object. Because of this there needs to be separate FTE buffers for both the authenticator and supplicant.
2023-12-13auto-t: only call set_value for changed values in default()James Prestwood1-1/+8
The default() method was added for convenience but was extending the test times significantly when the hostapd config was lengthy. This was because it called set_value for every value regardless if it had changed. Instead store the current configuration and in default() only reset values that differ.
2023-12-13auto-t: add association timeout testJames Prestwood1-18/+38
This tests ensures IWD disconnects after receiving an association timeout event. This exposes a current bug where IWD does not transition to disconnected after an association timeout when FT-roaming.
2023-12-13auto-t: add explicit stop() to IWD classJames Prestwood1-0/+4
If tests end in an unknown state it is sometimes required that IWD be stopped manually in order for future tests to run. Add a stop() method so test tearDown() methods can explicitly stop IWD.
2023-12-13auto-t: fix SignalAgent Release argumentsJames Prestwood1-3/+3
The path for IWD to call this doesn't ever happen in autotests but during debugging of the DPP agent it was noticed that the DBus signature was incorrect and would always result in an error when calling from IWD.
2023-12-13dpp: set "" arguments to Release method callJames Prestwood1-0/+1
Without this the DBus message does not initialize the message correctly which causes future DBus calls to fail.
2023-12-06sae: add debugging for incorrect password identifierJames Prestwood1-4/+12
If the AP rejects the auth because of an unknown identifier catch this and log the error.
2023-12-06mpdu: add unknown password identifier statusJames Prestwood1-0/+1
2023-12-06sae: include password identifier IE in commitJames Prestwood1-0/+8
Include the IE if a password identifier is being used. This is only supported by H2E as required by 802.11.
2023-12-06handshake: add password identifier/setterJames Prestwood2-0/+15
2023-12-06network: pass scan_bss into network_load_pskJames Prestwood1-30/+30
For adding SAE password identifiers the capability bits need to be verified when loading the identifier from the profile. Pass the BSS object in to network_load_psk rather than the 'need_passphrase' boolean.
2023-12-06scan: parse password identifier/exclusive bitsJames Prestwood2-3/+19
These bits are used to communicate to the station that SAE password identifiers are used or required.
2023-11-30netdev: Remove vendor_ies from netdev_connect signatureDenis Kenzior5-26/+9
The vendor IEs are now passed in the handshake_state object instead.
2023-11-30wsc: Use handshake to pass vendor iesDenis Kenzior1-1/+3
Instead of passing them directly via netdev_connect
2023-11-30p2p: Use handshake to pass vendor iesDenis Kenzior1-1/+2
Instead of passing them directly via netdev_connect
2023-11-30netdev: iov_ie_append: Support iovecs with multiple IEsDenis Kenzior1-13/+19
iov_ie_append assumed that a single IE was being added and thus the length of the IE could be extracted directly from the element. However, iov_ie_append was used on buffers which could contain multiple IEs concatenated together, for example in handshake_state::vendor_ies. Most of the time this was safe since vendor_ies was NULL or contained a single element, but would result in incorrect behavior in the general case. Fix that by changing iov_ie_append signature to take an explicit length argument and have the caller specify whether the element is a single IE or multiple. Fixes: 7e9971661bcb ("netdev: Append any vendor IEs from the handshake")
2023-11-30p2p: Simplify cleanup of iesDenis Kenzior1-12/+7
Use an _auto_ variable to cleanup IEs allocated by p2p_build_association_req(). While here, take out unneeded L_WARN_ON since p2p_build_association_req cannot fail.
2023-11-30p2p: Simplify handshake_state cleanupDenis Kenzior1-4/+2
2023-11-30handshake: Add cleanup function for handshake_stateDenis Kenzior2-1/+9
To allow _auto_(handshake_state_free) variables to be used.
2023-11-27Release 2.102.10Marcel Holtmann2-1/+6
2023-11-27build: Require at least version 0.61 when building with external ELLMarcel Holtmann1-1/+1
2023-11-27station: fix crash when deauth comes before FT work completesJames Prestwood1-0/+3
If the FT-Authenticate frame has been sent then a deauth is received the work item for sending the FT-Associate frame is never canceled. When this runs station->connected_network is NULL which causes a crash: src/station.c:station_try_next_transition() 7, target xx:xx:xx:xx:xx:xx src/wiphy.c:wiphy_radio_work_insert() Inserting work item 5843 src/wiphy.c:wiphy_radio_work_insert() Inserting work item 5844 src/wiphy.c:wiphy_radio_work_done() Work item 5842 done src/wiphy.c:wiphy_radio_work_next() Starting work item 5843 src/netdev.c:netdev_mlme_notify() MLME notification Remain on Channel(55) src/ft.c:ft_send_authenticate() src/netdev.c:netdev_mlme_notify() MLME notification Frame TX Status(60) src/netdev.c:netdev_link_notify() event 16 on ifindex 7 src/netdev.c:netdev_mlme_notify() MLME notification Del Station(20) src/netdev.c:netdev_mlme_notify() MLME notification Deauthenticate(39) src/netdev.c:netdev_deauthenticate_event() src/netdev.c:netdev_mlme_notify() MLME notification Disconnect(48) src/netdev.c:netdev_disconnect_event() Received Deauthentication event, reason: 7, from_ap: true src/station.c:station_disconnect_event() 7 src/station.c:station_disassociated() 7 src/station.c:station_reset_connection_state() 7 src/station.c:station_roam_state_clear() 7 src/netconfig.c:netconfig_event_handler() l_netconfig event 2 src/netconfig-commit.c:netconfig_commit_print_addrs() removing address: yyy.yyy.yyy.yyy src/resolve.c:resolve_systemd_revert() ifindex: 7 [DHCPv4] l_dhcp_client_stop:1264 Entering state: DHCP_STATE_INIT src/station.c:station_enter_state() Old State: connected, new state: disconnected src/station.c:station_enter_state() Old State: disconnected, new state: autoconnect_quick src/wiphy.c:wiphy_radio_work_insert() Inserting work item 5845 src/netdev.c:netdev_mlme_notify() MLME notification Cancel Remain on Channel(56) src/wiphy.c:wiphy_radio_work_done() Work item 5843 done src/wiphy.c:wiphy_radio_work_next() Starting work item 5844 "Program terminated with signal SIGSEGV, Segmentation fault.", "#0 0x0000565359ee3f54 in network_bss_find_by_addr ()", "#0 0x0000565359ee3f54 in network_bss_find_by_addr ()", "#1 0x0000565359ec9d23 in station_ft_work_ready ()", "#2 0x0000565359ec0af0 in wiphy_radio_work_next ()", "#3 0x0000565359f20080 in offchannel_mlme_notify ()", "#4 0x0000565359f4416b in received_data ()", "#5 0x0000565359f40d90 in io_callback ()", "#6 0x0000565359f3ff4d in l_main_iterate ()", "#7 0x0000565359f4001c in l_main_run ()", "#8 0x0000565359f40240 in l_main_run_with_signal ()", "#9 0x0000565359eb3888 in main ()"
2023-11-27erp: Fix buffer overflow for 32 byte SSIDsDenis Kenzior3-4/+10
ssid is declared as a 32 byte field in handshake_state, hence using it as a string which is assumed to be nul-terminated will fail for SSIDs that are 32 bytes long. Fixes: d938d362b212 ("erp: ERP implementation and key cache move") Fixes: 433373fe28a4 ("eapol: cache ERP keys on EAP success")
2023-11-27netdev: Fix buffer overflow with 32 character ssidsDenis Kenzior3-4/+7
ssid is declared as a 32 byte field in handshake_state, hence using it as a string which is assumed to be nul-terminated will fail for SSIDs that are 32 bytes long. Fixes: 1f1478285725 ("wiphy: add _generate_address_from_ssid") Fixes: 5a1b1184fca6 ("netdev: support per-network MAC addresses")
2023-11-27netdev: Do not leak l_genl_msg on errorDenis Kenzior1-8/+8
In netdev_retry_owe, if l_gen_family_send fails, the connect_cmd is never freed or reset. Fix that. While here, use a stack variable instead of netdev member, since the use of such a member is unnecessary and confusing.
2023-11-27netdev: Don't duplicate vendor_iesDenis Kenzior1-6/+1
vendor_ies stored in handshake_state are already added as part of netdev_populate_common_ies(), which is already invoked by netdev_build_cmd_connect(). Normally vendor_ies is NULL for OWE connections, so no IEs are duplicated as a result.
2023-11-27nl80211util: Move nl80211_append_rsn_attributesDenis Kenzior4-41/+47
2023-11-27ie: Move AKM suite converter from netdevDenis Kenzior3-46/+49
It is more logical to host this function inside ie.c than netdev.c. Particularly since ie_rsn_cipher_suite_to_cipher is already present in ie.c.
2023-11-27adhoc: Fix compilation on old systemsDenis Kenzior1-0/+1
CC src/adhoc.o In file included from src/adhoc.c:28:0: /usr/include/linux/if.h:234:19: error: field ‘ifru_addr’ has incomplete type struct sockaddr ifru_addr; ^ /usr/include/linux/if.h:235:19: error: field ‘ifru_dstaddr’ has incomplete type struct sockaddr ifru_dstaddr; ^ /usr/include/linux/if.h:236:19: error: field ‘ifru_broadaddr’ has incomplete type struct sockaddr ifru_broadaddr; ^ /usr/include/linux/if.h:237:19: error: field ‘ifru_netmask’ has incomplete type struct sockaddr ifru_netmask; ^ /usr/include/linux/if.h:238:20: error: field ‘ifru_hwaddr’ has incomplete type struct sockaddr ifru_hwaddr; ^
2023-11-23netdev: move power save disabling until after interface is upJames Prestwood1-42/+44
Very rarely on ath10k (potentially other ath cards), disabling power save while the interface is down causes a timeout when bringing the interface back up. This seems to be a race in the driver or firmware but it causes IWD to never start up properly since there is no retry logic on that path. Retrying is an option, but a more straight forward approach is to just reorder the logic to set power save off after the interface is already up. If the power save setting fails we can just log it, ignore the failure, and continue. From a users point of view there is no real difference in doing it this way as PS still gets disabled prior to IWD connecting/sending data. Changing behavior based on a buggy driver isn't something we should be doing, but in this instance the change shouldn't have any downside and actually isn't any different than how it has been done prior to the driver quirks change (i.e. use network manager, iw, or iwconfig to set power save after IWD starts). For reference, this problem is quite rare and difficult to say exactly how often but certainly <1% of the time: iwd[1286641]: src/netdev.c:netdev_disable_ps_cb() Disabled power save for ifindex 54 kernel: ath10k_pci 0000:02:00.0: wmi service ready event not received iwd[1286641]: Error bringing interface 54 up: Connection timed out kernel: ath10k_pci 0000:02:00.0: Could not init core: -110 After this IWD just sits idle as it has no interface to start using. This is even reproducable outside of IWD if you loop and run: ip link set <wlan> down iw dev <wlan> set power_save off ip link set <wlan> up Eventually the 'up' command will fail with a timeout. I've brought this to the linux-wireless/ath10k mailing list but even if its fixed in future kernels we'd still need to support older kernels, so a workaround/change in IWD is still required.
2023-11-19Release 2.92.9Marcel Holtmann2-1/+8
2023-11-19build: Require at least version 0.60 when building with external ELLMarcel Holtmann1-1/+1
2023-11-17dbus: add SharedCodeAgent interface to iwd-dbus.confJames Prestwood1-0/+1
2023-11-17doc: document additional NotSupported shared code returnJames Prestwood1-0/+2
2023-11-17dpp: fail early if multicast frame registration is unsupportedJames Prestwood1-0/+6
This is done already for DPP, do the same for PKEX. Few drivers (ath9k upstream, ath10k/11k in progress) support this which is unfortunate but since a configurator will not work without this capability its best to fail early.
2023-11-17json: fix comment typo, "json_object_is_valid"James Prestwood1-1/+1
This should be json_iter_is_valid.
2023-11-17auto-t: add checks for DPP 3rd party settingsJames Prestwood2-9/+6
Ensure the newly configured profile contains the additional SendHostname setting that the configurator sends.
2023-11-17dpp: include 3rd party settings in network profileJames Prestwood1-0/+6
If the configuration object contained IWD's 3rd party settings set those into the network profile.
2023-11-17dpp-util: add support for 3rd party JSON fieldsJames Prestwood2-3/+70
The DPP spec allows 3rd party fields in the DPP configuration object (section 4.5.2). IWD can take advantage of this (when configuring another IWD supplicant) to communicate additional profile options that may be required for the network. The new configuration member will be called "/net/connman/iwd" and will be an object containing settings specific to IWD. More settings could be added here if needed but for now only the following are defined: { send_hostname: true/false, hidden: true/false } These correspond to the following network profile settings: [IPv4].SendHostname [Settings].Hidden
2023-11-17dpp: use the config's SSID to process scan resultsJames Prestwood1-9/+8
The scan result handling was fragile because it assumed the kernel would only give results matching the requested SSID. This isn't something we should assume so instead keep the configuration object around until after the scan and use the target SSID to lookup the network.
2023-11-17dpp: use the new config->ssid memberJames Prestwood1-19/+12
This is now a NULL terminated string so it can be used directly.
2023-11-17dpp-util: store SSID as string, not raw bufferJames Prestwood1-1/+1
Nearly every use of the ssid member first has to memcpy it to a buffer and NULL terminate. Instead just store the ssid as a string when creating/parsing from JSON.
2023-11-16dpp: check that DPP is running in station watchJames Prestwood1-0/+3
This was causing unneeded WARNING prints because the DPP state was never checked. Fix this and bail out if DPP isn't running.
2023-11-16dpp: scan to pick up extra frequencies when enrollingJames Prestwood1-10/+88
The DPP-PKEX spec provides a very limited list of frequencies used to discover configurators, only 3 on 2.4 and 5GHz bands. Since configurators (at least in IWD's implementation) are only allowed on the current operating frequency its very unlikely an enrollee will find a configurator on these frequencies out of the entire spectrum. The spec does mention that the 3 default frequencies should be used "In lieu of specific channel information obtained in a manner outside the scope of this specification, ...". This allows the implementation some flexibility in using a broader range of frequencies. To increase the chances of finding a configurator shared code enrollees will first issue a scan to determine what access points are around, then iterate these frequencies. This is especially helpful when the configurators are IWD-based since we know that they'll be on the same channels as the APs in the area.
2023-11-16dpp: fix fragile scan/connecting logicJames Prestwood1-3/+41
The post-DPP connection was never done quite right due to station's state being unknown. The state is now tracked in DPP by a previous patch but the scan path in DPP is still wrong. It relies on station autoconnect logic which has the potential to connect to a different network than what was configured with DPP. Its unlikely but still could happen in theory. In addition the scan was not selectively filtering results by the SSID that DPP configured. This fixes the above problems by first filtering the scan by the SSID. Then setting the scan results into station without triggering autoconnect. And finally using network_autoconnect() directly instead of relying on station to choose the SSID.
2023-11-16dpp: add station watch to DPPJames Prestwood1-0/+75
DPP (both DPP and PKEX) run the risk of odd behavior if station decides to change state. DPP is completely unaware of this and best case would just result in a protocol failure, worst case duplicate calls to __station_connect_network. Add a station watch and stop DPP if station changes state during the protocol.
2023-11-16dpp: remove duplicate connected network checkJames Prestwood1-7/+1
2023-11-14netdev: Separate connect_failed and disconnected pathsDenis Kenzior1-12/+33
Commit c59669a366c5 ("netdev: disambiguate between disconnection types") introduced different paths for different types of disconnection notifications from netdev. Formalize this further by having netdev_connect_failed only invoke connect_cb. Disconnections that could be triggered outside of connection related events are now handled on a different code path. For this purpose, netdev_disconnected() is introduced.
2023-11-14netdev: Simplify netdev_auth_cb error logicDenis Kenzior1-12/+9
2023-11-14netdev: Remove improper use of netdev_connect_failedDenis Kenzior1-24/+11
When a roam event is received, iwd generates a firmware scan request and notifies its event filter of the ROAMING condition. In cases where the firmware scan could not be started successfully, netdev_connect_failed is invoked. This is not a correct use of netev_connect_failed since it doesn't actually disconnect the underlying netdev and the reflected state becomes de-synchronized from the underlying kernel device. The firmware scan request could currently fail for two reasons: 1. nl80211 genl socket is in a bad state, or 2. the scan context does not exist Since both reasons are highly unlikely, simply use L_WARN instead. The other two cases where netdev_connect_failed is used could only occur if the kernel message is invalid. The message is ignored in that case and a warning is printed. The situation described above also exists in netdev_get_fw_scan_cb. If the scan could not be completed successfully, there's not much iwd can do to recover. Have iwd remain in roaming state and print an error.
2023-11-14netdev: disambiguate between disconnection typesDenis Kenzior1-50/+76
There are generally three scenarios where iwd generates a disconnection command to the kernel: 1. Error conditions stemming from a connection related event. For example if SAE/FT/FILS authentication fails during Authenticate or Associate steps and the kernel doesn't disconnect properly. 2. Deauthentication after the connection has been established and not related to a connection attempt in progress. For example, SA Query processing that triggers an disconnect. 3. Disconnects that are triggered due to a handshake failure or if setting keys resulting from the handshake fails. These disconnects can be triggered as a result of a pending connection or when a connection has been established (e.g. due to rekeying). Distinguish between 1 and 2/3 by having the disconnect procedure take different paths. For now there are no functional changes since all paths end up in netdev_connect_failed(), but this will change in the future.
2023-11-14netdev: Move CMD_REKEY_OFFLOAD builder to nl80211utilDenis Kenzior3-25/+30
2023-11-14netdev: Move CMD_NEW_KEY RX-only builder to nl80211utilDenis Kenzior3-33/+38
2023-11-14netdev: Move pairwise NEW_KEY builder to nl80211utilDenis Kenzior3-24/+29
2023-11-14netdev: Move CMD_DEL_STATION builder to nl80211utilDenis Kenzior4-51/+35
While here, also get rid of netdev_del_station. The only user of this function was in ap.c and it could easily be replaced by invoking the new nl80211_build_del_station function. The callback used by netdev_build_del_station only printed an error and didn't do anything useful. Get rid of it for now.
2023-11-14netdev: Move CMD_DEAUTHENTICATE builder to nl80211utilDenis Kenzior3-16/+21
2023-11-14netdev: Move CMD_DISCONNECT builder to nl80211utilDenis Kenzior3-17/+20
2023-11-13netdev: Don't unnecessarily call netdev_connect_failedDenis Kenzior1-19/+11
netdev_begin_connection() already invokes netdev_connect_failed on error. Remove any calls to netdev_connect_failed in callers of netdev_begin_connection(). Fixes: 4165d9414f54 ("netdev: use wiphy radio work queue for connections")
2023-11-13netdev: Use CMD_DISCONNECT if OCI failsDenis Kenzior1-1/+1
If netdev_get_oci fails, a goto deauth is invoked in order to terminate the current connection and return an error to the caller. Unfortunately the deauth label builds CMD_DEAUTHENTICATE in order to terminate the connection. This was fine because it used to handle authentication protocols that ran over CMD_AUTHENTICATE and CMD_ASSOCIATE. However, OCI can also be used on FullMAC hardware that does not support them. Use CMD_DISCONNECT instead which works everywhere. Fixes: 06482b811626 ("netdev: Obtain operating channel info")
2023-11-13netdev: sa_query: Fix reason code handlingDenis Kenzior1-2/+1
The reason code field was being obtained as a uint8_t value, while it is actually a uint16_t in little-endian byte order. Fixes: f3cc96499c44 ("netdev: added support for SA Query")
2023-11-13netdev: Fix obtaining reason code from deauth framesDenis Kenzior1-1/+3
The reason code from deauthentication frame was being obtained as a uint8_t instead of a uint16_t. The value was only ever used in an informational statement. Since the value was in little endian, only the first 8 bits of the reason code were obtained. Fix that. Fixes: 2bebb4bdc7ee ("netdev: Handle deauth frames prior to association")
2023-11-13auto-t: get DPP PKEX test running reliablyJames Prestwood2-9/+48
Several tests do not pass due to some additional changes that have not been merged. Remove these cases and add some hardening after discovering some unfortunate wpa_supplicant behavior. - Disable p2p in wpa_supplicant. With p2p enabled an extra device is created which starts receiving DPP frames and printing confusing messages. - Remove extra asserts which don't make sense currently. These will be added back later as future additions to PKEX are upstreamed. - Work around wpa_supplicant retransmit limitation. This is described in detail in the comment in pkex_test.py
2023-11-13auto-t: add stop APIs and fix some issues wpas.pyJames Prestwood1-2/+12
- wait_for_event was returning a list in certain cases, not the event itself - The configurator ID was not being printed (',' instead of '%') - The DPP ID was not being properly waited for with PKEX
2023-11-13auto-t: make test timeout configurableJames Prestwood2-7/+12
With the addition of DPP PKEX autotests some of the timeouts are quite long and hit test-runners maximum timeouts. For UML we should allow this since time-travel lets us skip idle waits. Move the test timeout out of a global define and into the argument list so QEMU and UML can define it differently.
2023-11-11client: add client commands for shared code configurationJames Prestwood2-1/+316
The StartConfigurator() call was left out since there would be no functional difference to the user in iwctl. Its expected that human users of the shared code API provide the code/id ahead of time, i.e. use ConfigureEnrollee/StartEnrollee.
2023-11-11client: Add shared code DBus interfaceJames Prestwood1-0/+3
2023-11-11client: display_completion_matches add 0-byte checkFinn Behrens1-1/+1
Check that enough space for newline and 0-byte is left in line. This fixes a buffer overflow on specific completion results. Reported-By: Leona Maroni <dev@leona.is>
2023-11-09dpp: fix removed dpp_reset in Stop()James Prestwood1-0/+8
It seems in my patch reordering both stop methods lost the actual call to dpp_reset().
2023-11-09auto-t: add DPP PKEX testsJames Prestwood5-8/+231