3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 14:22:36 +01:00
Commit Graph

7268 Commits

Author SHA1 Message Date
James Prestwood
a7d8b9a068 client: separate property header and values into two functions
There are certain cases where we may not want to display the entire
header for a given set of properties. For example displaying a list
of proxy interfaces. Add finer control by separating out the header
and the prop/value display into two functions.
2024-08-12 12:10:50 -05:00
James Prestwood
b31e298df4 doc: document BasicServiceSet API 2024-08-12 12:10:47 -05:00
James Prestwood
a73b877c5b station: add ConnectedAccessPoint property
This property is a path that corresponds to a BasicServiceSet
object, the one the station is currently connected to.
2024-08-12 12:10:44 -05:00
James Prestwood
68e1d055dd network: remove network_bss_list_clear 2024-08-12 12:10:40 -05:00
James Prestwood
aca92df19b network: add ExtendedServiceSet DBus property
This contains a list of all BasicServiceSet objects (paths) that
exist for a network.
2024-08-12 12:10:28 -05:00
James Prestwood
560ad581ad station: use network_bss_{start,stop}_update
This will tell network the BSS list is being updated and it can
act accordingly as far as the BSS DBus registrations/unregistration.

In addition any scan_bss object needing to be freed has to wait
until after network_bss_stop_update() because network has to be able
to iterate its old list and unregister any BSS's that were not seen
in the scan results. This is done by pushing each BSS needing to be
freed into a queue, then destroying them after the BSS's are all
added.
2024-08-12 12:10:10 -05:00
James Prestwood
fe2a91ae11 network: Add BasicServiceSet object
This adds a new DBus object/interface for tracking BSS's for
a given network. Since scanning replaces scan_bss objects some
new APIs were added to avoid tearing down the associated DBus
object for each BSS.

network_bss_start_update() should be called before any new BSS's
are added to the network object. This will keep track of the old
list and create a new network->bss_list where more entries can
be added. This is effectively replacing network_bss_list_clear,
except it keeps the old list around until...

network_bss_stop_update() is called when all BSS's have been
added to the network object. This will then iterate the old list
and lookup if any BSS DBus objects need to be destroyed. Once
completed the old list is destroyed.
2024-08-12 12:01:57 -05:00
James Prestwood
cd1507620f dbus: Add net.connman.iwd.BasicServiceSet interface 2024-08-12 12:01:34 -05:00
Denis Kenzior
7ee7848a96 netdev: Simplify FILS handling in netdev_connect_common 2024-08-05 09:07:02 -05:00
Denis Kenzior
be7b19d587 fils: Ensure capability checks are consistent
iwd supports FILS only on softmac drivers.  Ensure the capability check
is consistent between wiphy and netdev, both the softmac and the
relevant EXT_FEATURE bit must be checked.

CMD_EXTERNAL_AUTH could potentially be used for FILS for FullMAC cards,
but no hardware supporting this has been identified yet.
2024-08-05 09:06:54 -05:00
Denis Kenzior
16f5bbc20a netdev: Create owe_sm for fullmac connections
Somehow this ability was lost in the refactoring.  OWE was intended to
be used on fullmac cards, but the state machine is only actually created
if the connection type ends up being softmac.

Fixes: 8b6ad5d3b9 ("owe: netdev: refactor to remove OWE as an auth-proto")
2024-08-05 09:06:43 -05:00
Denis Kenzior
8a27cff8c0 ie: Add IE_AKM_IS_OWE
Similarly to IE_AKM_IS_SAE, IE_AKM_IS_FILS, etc
2024-08-05 09:06:39 -05:00
Denis Kenzior
d43f05224d wiphy: Fix use of wiphy_has_feature
Features with the _EXT_ in the name must be queried using the
wiphy_has_ext_feature method.

Fixes: bc7b12d1a4 ("wiphy: handle FILS AKMs")
2024-08-05 09:06:31 -05:00
Denis Kenzior
96492483ee monitor: Mask flags from attribute identifier
Certain flags (for example, NLA_F_NESTED) are ORed with the netlink
attribute type identifier prior to being sent on the wire.  Such flags
need to be masked off and not taken into consideration when attribute
type is being compared against known values.
2024-08-05 09:06:25 -05:00
Denis Kenzior
194d8a3052 monitor: Decode RMNet Mux Identifier 2024-08-05 09:06:20 -05:00
James Prestwood
d500a44ff3 station: improve zero oper class neighbor report workaround
The workaround for Cisco APs reporting an operating class of zero
is still a bug that remains in Cisco equipment. This is made even
worse with the introduction of 6GHz where the channel numbers
overlap with both 2.4 and 5GHz bands. This makes it impossible to
definitively choose a frequency given only a channel number.

To improve this workaround and cover the 6GHz band we can calculate
a frequency for each band and see what is successful. Then append
each frequency we get to the list. This will result in more
frequencies scanned, but this tradeoff is better than potentially
avoiding a roam to 6GHz or high order 5ghz channel numbers.
2024-08-05 09:05:49 -05:00
Denis Kenzior
faa6a392e4 monitor: Update to the new ell l_netlink_send API 2024-07-26 17:37:29 -05:00
Denis Kenzior
e33fa63243 netdev: Update to the new l_netlink_send API 2024-07-26 17:37:29 -05:00
Denis Kenzior
d7f669dd7c wired: Update to the new l_netlink_send API 2024-07-26 17:37:29 -05:00
Denis Kenzior
993e48cab2 qemu: Remove unsupported command line arguments
[denkenz@archdev ~]$ qemu-system-x86_64 --version
QEMU emulator version 9.0.1
Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers

QEMU now seems to complain that 'no-hpet' and 'no-acpi' command line
arguments are unrecognized.
2024-07-26 10:06:13 -05:00
Denis Kenzior
9762c61b4d monitor: Use genl APIs instead of open coding
l_genl class has nice ways of discovering and requesting families.  The
genl functionality has been added after the iwmon skeleton was created,
but it is now time to migrate to using these APIs.
2024-07-26 10:04:05 -05:00
James Prestwood
d8803b309d monitor: fix the CQM RSSI threshold attribute
This attribute is actually an array of signed 32 bit integers and it
was being treated as a single integer. This would work until more
than one threshold was set, then it would fail to parse it.
2024-07-26 09:52:25 -05:00
James Prestwood
f9a55e3728 auto-t: fix several DPP tests after station state changes
After the station state changes in DPP setting autoconnect=True was
causing DPP to stop prior to being able to scan for the network.
Instead we can start autoconnect earlier so we aren't toggling the
property while DPP is running.
2024-07-24 15:26:57 -05:00
James Prestwood
a63fd6abb9 auto-t: add DPP tests for state change checks 2024-07-24 15:26:55 -05:00
James Prestwood
eff2a2afcf dpp: explicitly disconnect station if enrollee is started
Prior to now the DPP state was required to be disconnected before
DPP would start. This is inconvenient for the user since it requires
extra state checking and/or DBus method calls. Instead model this
case like WSC and issue a disconnect to station if DPP is requested
to start.

The other conditions on stopping DPP are also preserved and no
changes to the configurator role have been made, i.e. being
disconnected while configuring still stops DPP. Similarly any
connection made during enrolling will stop DPP.

It should also be noted that station's autoconfigure setting is also
preserved and set back to its original value upon DPP completing.
2024-07-24 15:25:31 -05:00
James Prestwood
5cdad6ab86 station: add station_get_autoconnect
Gets the current autoconenct setting. This is not the current
autoconnect state. Will be used in DPP to reset station's autoconnect
setting back to what it was prior to DPP, in case of failure.
2024-07-24 15:25:28 -05:00
James Prestwood
30ca00d2c4 dpp: factor out PKEX/DPP start prep into function
In order to slightly rework the DPP state machine to handle
automatically disconnecting (for enrollees) functions need to be
created that isolate everything needed to start DPP/PKEX in case
a disconnect needs to be done first.
2024-07-24 15:25:25 -05:00
James Prestwood
fbf8ed4140 auto-t: don't print valgrind log if there was no error
If valgrind didn't report any issues, don't dump the logs. This
makes the test run a lot easier to look at without having to scroll
through pages of valgrind logs that provide no value.
2024-07-24 09:14:09 -05:00
James Prestwood
64d68b4f08 scan: fix invalid read when canceling an ongoing scan
When the survey code was added it neglected to add the same
cancelation logic that existed for the GET_SCAN call, i.e. if
a scan was canceled and there was a pending GET_SURVEY to the
kernel that needs to be canceled, and the request cleaned up.

Fixes: 35808debae ("scan: use GET_SURVEY for SNR calculation in ranking")
2024-07-24 09:12:42 -05:00
Yuki Sireneva
91f7253ae1 client: use display_table_row for IPv6 in station
IPv6 address entry was not updated to use display_table_row which led to
a shifted line in table, as shown below:

    $ iwctl station wlan0 show | head | sed 's| |.|g'
    .................................Station:.wlan0................................
    --------------------------------------------------------------------------------
    ..Settable..Property..............Value..........................................
    --------------------------------------------------------------------------------
    ............Scanning..............no...............................................
    ............State.................connected........................................
    ............Connected.network.....Clannad.Legacy...................................
    ............IPv4.address..........192.168.1.12.....................................
    ............IPv6.address........fdc3:541d:864f:0:96db:c9ff:fe36:b15............
    ............ConnectedBss..........cc:d8:43:77:91:0e................................

This patch aligns IPv6 address line with other lines in the table.

Fixes: 35dd2c0821 (client: update station to use display_table_row, 2022-07-07)
2024-07-23 18:52:51 -05:00
James Prestwood
06c8080664 auto-t: a few random autotest fixes
testEncryptedProfiles:
 - This would occationally fail because the test is expecting
   to explicitly connect but after the first failed connection
   autoconnect takes over and its a race to connect.
testPSK-roam:
 - Several rules were not being cleaned up which could cause
   tests afterwards to fail
 - The AP roam test started failing randomly because of the SNR
   ranking changes. It appears that with hwsim _sometimes_ the
   SNR is able to be determined which can effect the ranking. This
   test assumed the two BSS's would be the same ranking but the
   SNR sometimes causes this to not be true.
2024-07-18 16:08:46 -05:00
James Prestwood
b7da34a5d2 auto-t: Add deauth during the 4-way handshake test
This test will fail with current upstream as IWD hangs when the
deauthenticate event arrives. Once this is fixed the test should
pass.
2024-07-18 16:08:43 -05:00
James Prestwood
a972b77dc2 auto-t: add reason/test arguments to hostapd deauthenticate
The reason code is obvious, but the test argument is actually a
toggle to send the frame encrypted or unencrypted.
2024-07-18 16:08:40 -05:00
James Prestwood
d27de1b111 auto-t: add clear_events() to IWD class
The wait_for_event() function allows past events to cause this
function to return immediately. This behavior is known, and
relied on for some tests. But in some cases you want to only
handle _new_ events, so we need a way to clear out prior events.
2024-07-18 16:08:36 -05:00
James Prestwood
d2cda84383 station: add handshake-started debug event 2024-07-18 16:08:32 -05:00
James Prestwood
af1b017003 eapol: move HANDSHAKE_STARTED_EVENT to eapol_start()
This event is not used anywhere and can be leveraged in autotesting.
Move the event to eapol_start() so it gets called unconditionally
when the 4-way handshake is started.
2024-07-18 16:08:17 -05:00
James Prestwood
556f90ec28 netdev: handle disconnect event during a connection
If a disconnect arrives at any point during the 4-way handshake or
key setting this would result in netdev sending a disconnect event
to station. If this is a reassociation this case is unhandled in
station and causes a hang as it expects any connection failure to
be handled via the reassociation callback, not a random disconnect
event.

To handle this case we can utilize netdev_disconnected() along with
the new NETDEV_RESULT_DISCONNECTED result to ensure the connect
callback gets called if it exists (indicating a pending connection)

Below are logs showing the "Unexpected disconnect event" which
prevents IWD from cleaning up its state and ultimately results in a
hang:

Jul 16 18:16:13: src/station.c:station_transition_reassociate()
Jul 16 18:16:13: event: state, old: connected, new: roaming
Jul 16 18:16:13: src/wiphy.c:wiphy_radio_work_done() Work item 65 done
Jul 16 18:16:13: src/wiphy.c:wiphy_radio_work_next() Starting work item 66
Jul 16 18:16:13: src/netdev.c:netdev_mlme_notify() MLME notification Del Station(20)
Jul 16 18:16:13: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Jul 16 18:16:13: src/netdev.c:netdev_mlme_notify() MLME notification Deauthenticate(39)
Jul 16 18:16:13: src/netdev.c:netdev_deauthenticate_event()
Jul 16 18:16:13: src/netdev.c:netdev_mlme_notify() MLME notification New Station(19)
Jul 16 18:16:13: src/station.c:station_netdev_event() Associating
Jul 16 18:16:13: src/netdev.c:netdev_mlme_notify() MLME notification Authenticate(37)
Jul 16 18:16:13: src/netdev.c:netdev_authenticate_event()
Jul 16 18:16:13: src/netdev.c:netdev_mlme_notify() MLME notification Associate(38)
Jul 16 18:16:13: src/netdev.c:netdev_associate_event()
Jul 16 18:16:13: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Jul 16 18:16:13: src/netdev.c:netdev_mlme_notify() MLME notification Connect(46)
Jul 16 18:16:13: src/netdev.c:netdev_connect_event()
Jul 16 18:16:13: src/netdev.c:netdev_connect_event() aborting and ignore_connect_event not set, proceed
Jul 16 18:16:13: src/netdev.c:netdev_connect_event() expect_connect_failure not set, proceed
Jul 16 18:16:13: src/netdev.c:parse_request_ies()
Jul 16 18:16:13: src/netdev.c:netdev_connect_event() Request / Response IEs parsed
Jul 16 18:16:13: src/netdev.c:netdev_get_oci()
Jul 16 18:16:13: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Jul 16 18:16:13: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Jul 16 18:16:13: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Jul 16 18:16:13: src/netdev.c:netdev_get_oci_cb() Obtained OCI: freq: 5220, width: 3, center1: 5210, center2: 0
Jul 16 18:16:13: src/eapol.c:eapol_start()
Jul 16 18:16:13: src/netdev.c:netdev_unicast_notify() Unicast notification Control Port Frame(129)
Jul 16 18:16:13: src/netdev.c:netdev_control_port_frame_event()
Jul 16 18:16:13: src/eapol.c:eapol_handle_ptk_1_of_4() ifindex=6
Jul 16 18:16:13: src/netdev.c:netdev_mlme_notify() MLME notification Control Port TX Status(139)
Jul 16 18:16:14: src/netdev.c:netdev_mlme_notify() MLME notification Notify CQM(64)
Jul 16 18:16:14: src/netdev.c:netdev_cqm_event() Signal change event (above=1 signal=-60)
Jul 16 18:16:17: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Jul 16 18:16:17: src/netdev.c:netdev_mlme_notify() MLME notification Del Station(20)
Jul 16 18:16:17: src/netdev.c:netdev_mlme_notify() MLME notification Deauthenticate(39)
Jul 16 18:16:17: src/netdev.c:netdev_deauthenticate_event()
Jul 16 18:16:17: src/netdev.c:netdev_mlme_notify() MLME notification Disconnect(48)
Jul 16 18:16:17: src/netdev.c:netdev_disconnect_event()
Jul 16 18:16:17: Received Deauthentication event, reason: 15, from_ap: true
Jul 16 18:16:17: src/wiphy.c:wiphy_radio_work_done() Work item 66 done
Jul 16 18:16:17: src/station.c:station_disconnect_event() 6
Jul 16 18:16:17: Unexpected disconnect event
Jul 16 18:16:17: src/netdev.c:netdev_link_notify() event 16 on ifindex 6
Jul 16 18:16:17: src/wiphy.c:wiphy_reg_notify() Notification of command Reg Change(36)
Jul 16 18:16:17: src/wiphy.c:wiphy_update_reg_domain() New reg domain country code for (global) is XX
2024-07-18 16:07:41 -05:00
James Prestwood
22f238706c station: update logic for handshake failure
After adding the NETDEV_RESULT_DISCONNECTED enum, handshake failures
initiated by the AP come in via this result so the existing logic
to call network_connect_failed() was broken. We could still get a
handshake failure generated internally, so that has been preserved
(via NETDEV_RESULT_HANDSHAKE_FAILED) but a check for a 4-way
handshake timeout reason code was also added.
2024-07-18 16:06:41 -05:00
James Prestwood
906afefbf3 station: handle NETDEV_RESULT_DISCONNECTED
This new event is sent during a connection if netdev recieves a
disconnect event. This patch cleans up station to handle this
case and leave the existing NETDEV_EVENT_DISCONNECTED_BY_{AP,SME}
handling only for CONNECTED, NETCONFIG, and FW_ROAMING states.
2024-07-18 16:05:37 -05:00
James Prestwood
38c36ff145 netdev: add NETDEV_RESULT_DISCONNECTED
This new result is meant to handle cases where a disconnect
event (deauth/disassoc) was received during an ongoing connection.
Whether that's during authentication, association, the 4-way
handshake, or key setting.
2024-07-18 16:05:14 -05:00
James Prestwood
9ea0117dc4 station: print unknown channel number in neighbor report
If the channel number resulted in a failure to parse the neighbor
report entry, print it for debugging.
2024-07-18 16:05:01 -05:00
Kasper Kantz
4f81953338 p2putil: remove static from const strlen
src/p2putil.c: In function 'p2p_get_random_string':
 src/p2putil.c:2641:37: error: initializer element is not constant     2641 |
        static const int set_size = strlen(CHARSET);         |
                     ^~~~~~
2024-07-12 16:24:00 -05:00
Steve Schrock
ffc6d6325d main: update usage with logger option 2024-07-12 11:58:51 -05:00
Steve Schrock
6d46698494 main: set the identity in the logger
This causes "iwd" to be output in each message sent to syslog to help
quickly identify iwd messages.
2024-07-11 17:13:43 -05:00
Marcel Holtmann
b54dcafa80 Release 2.19 2024-07-08 22:12:42 +02:00
Marcel Holtmann
ac0f13798b build: Add test-nl80211util binary to ignore list 2024-07-08 22:12:20 +02:00
Marcel Holtmann
51771694cd build: Require at least version 0.67 when building with external ELL 2024-07-08 22:11:24 +02:00
James Prestwood
9232991e25 auto-t: add test for a deauth coming in during an FT-roam 2024-06-26 09:38:06 -05:00
James Prestwood
71dc347582 station: add debug event prior to sending an FT-auth frame 2024-06-26 09:38:06 -05:00
James Prestwood
31b18a8c8b auto-t: add test for deauth after authentication
This code path is not exercised in the autotest but commonly does
happen in the real world. There is no associated bug with this, but
its helpful to have this event triggered in case something got
introduced in the future.
2024-06-26 09:38:06 -05:00