3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-31 17:19:22 +01:00
Commit Graph

6096 Commits

Author SHA1 Message Date
James Prestwood
f95e3a02e8 station: factor out logic for choosing FT 2021-05-12 18:04:30 -05:00
Andrew Zaborowski
e8eb05feea netdev: ensure DISCONNECT_BY_SME uses a reason_code
Station callbacks expect a reason code (as opposed to status codes) with
this event type.
2021-05-11 11:34:17 -05:00
Andrew Zaborowski
dfe57b8bb0 main: Add NetworkConfigurationEnabled to Daemon.GetInfo() 2021-05-11 10:08:51 -05:00
Andrew Zaborowski
48ddd52ced doc: Document NetworkConfigurationEnabled in Daemon.GetInfo() 2021-05-11 10:08:42 -05:00
Andrew Zaborowski
c0a1760f46 ap: Move sending CMD_START_AP to common function 2021-05-10 10:14:29 -05:00
James Prestwood
f9c2fa7bb2 test-runner: remove stale file after test
test-runner will print out if files were left behind after a
test which lets the developer know something was not cleaned
up. But in this case test-runner should also remove these files
so they are not left, and printed, for each subsequent test.
2021-05-10 10:12:48 -05:00
James Prestwood
b89720ca47 doc: document [General].RoamThreshold5G 2021-05-10 10:12:46 -05:00
James Prestwood
968584d3f0 netdev: introduce [General].RoamThreshold5G
This value sets the roaming threshold on 5GHz networks. The
threshold has been separated from 2.4GHz because in many cases
5GHz can perform much better at low RSSI than 2.4GHz.

In addition the BSS ranking logic was re-worked and now 5GHz is
much more preferred, even at low RSSI. This means we need a
lower floor for RSSI before roaming, otherwise IWD would end
up roaming immediately after connecting due to low RSSI CQM
events.
2021-05-10 10:05:21 -05:00
James Prestwood
7b26a87d7a ie: fix ie_parse_data_rates to handle NULL
The code was partially there to handle NULL IEs but not
quite. If NULL IEs are passed in base the data rate totally
on the basic rate RSSI table.
2021-05-10 10:04:32 -05:00
James Prestwood
f3d662db74 test: add test utility for Roam() method 2021-05-07 08:46:53 -05:00
James Prestwood
694ccf62d0 station: add Roam() diagnostics method
This is being added as a developer method and should not be used
in production. For testing purposes though, it is quite useful as
it forces IWD to roam to a provided BSS and bypasses IWD's roaming
and ranking logic for choosing a roam candidate.

To use this a BSSID is provided as the only parameter. If this
BSS is not in IWD's current scan results -EINVAL will be returned.
If IWD knows about the BSS it will attempt to roam to it whether
that is via FT, FT-over-DS, or Reassociation. These details are
still sorted out in IWDs station_transition_start() logic.
2021-05-07 08:45:42 -05:00
James Prestwood
174c14aefb main: add a --developer,-E option
This will enable developer features to be used. Currently the
only user of this will be StationDiagnostics.Roam() method which
should only be exposed in this mode.
2021-05-07 08:45:20 -05:00
Andrew Zaborowski
73d98d8875 doc: Daemon DBus interface documentation 2021-05-07 08:42:37 -05:00
Andrew Zaborowski
a8736b8df8 main: Add D-Bus Daemon.GetInfo method
Expose the state directory/storage directory path on D-Bus because it
can't be known to clients until IWD runs, and client might need to
occasionally fiddle with the network config files.  While there also
expose the IWD version string, similar to how some other D-Bus services
do.
2021-05-07 08:41:21 -05:00
James Prestwood
a3906272cc station: print reason why autoconnect failed 2021-05-04 10:30:55 -05:00
James Prestwood
751db56045 test-runner: increase RAM for valgrind
Certain tests like testAP spawn two IWD process in separate
namespaces. When --valrind is used this eats up quite a bit
of RAM and causes the VM to run out of memory and start
killing off processes.
2021-05-04 10:30:55 -05:00
Marcel Holtmann
c365cc1b8d Release 1.14 2021-05-04 15:00:17 +02:00
Marcel Holtmann
e1fc36966b build: Require at least version 0.40 when building with external ELL 2021-05-04 14:26:23 +02:00
James Prestwood
8606bd6435 adhoc: set operstate on Start/Stop
Similar to 06aa84cca set the operstate when AdHoc is started and
stopped as it is no longer always set by netdev (only for station/p2p
interface types)
2021-04-30 20:07:19 -05:00
Denis Kenzior
29dd246f5e ap: Fix invalid length argument to ap_build_beacon_pr_head
Previously resp was a simple array of bytes allocated on the stack.
This was changed to a dynamically allocated array, but the sizeof(resp)
argument to ap_build_beacon_pr_head() was never changed appropriately.

Fix this by introducing a new resp_len variable that holds the number of
bytes allocated for resp.  Also, move the allocation after the basic
sanity checks have been performed to avoid allocating/freeing memory
unnecessarily.

Fixes: 18a63f91fd ("ap: Write extra frame IEs from the user")
2021-04-30 16:37:19 -05:00
James Prestwood
e0f21ed293 netdev: set connected to false in netdev_reassociate
Commit 1fe5070 added a workaround for drivers which may send the
connect event prior to the connect callback/ack. This caused IWD
to fail to start eapol if reassociation was used due to
netdev_reassociate never setting netdev->connected = false.

netdev_reassociate uses the same code path as normal connections,
but when the connect callback came in connected was already set
to true which then prevents eapol from being registered. Then,
once the connect event comes in, there is no frame watch for
eapol and IWD doesn't respond to any handshake frames.
2021-04-30 16:21:35 -05:00
James Prestwood
d3d6090c32 auto-t: add FT-back to original AP on FT-PSK-roam 2021-04-30 15:33:48 -05:00
Denis Kenzior
767c2f61b4 AUTHORS: Mention Sean's contributions 2021-04-30 13:11:23 -05:00
Sean Anderson
1134e55150 client: Show WEP networks as unsupported
WEP networks are not supported by iwd. However, the only indication is the
message "Operation not supported" while trying to connect. It is not clear
enough that this is due to intentional lack of support (as opposed to some
kind of misconfiguration). This patch explicitly lists WEP networks shown
with get-networks as unsupported. Hopefully this will make it clearer for
those of us not as familiar with iwd.
2021-04-30 13:10:43 -05:00
James Prestwood
486c859ad6 ft: netdev: add return value to tx_associate
Prior to this, an error sending the FT Reassociation was treated
as fatal, which is correct for FT-over-Air but not for FT-over-DS.
If the actual l_genl_family_send call fails for FT-over-DS the
existing connection can be maintained and there is no need to
call netdev_connect_failed.

Adding a return to the tx_associate function works for both FT
types. In the FT-over-Air case this return will ultimately get
sent back up to auth_proto_rx_authenticate in which case will
call netdev_connect_failed. For FT-over-DS tx_associate is
actually called from the 'start' operation which can fail and
still maintain the existing connection.
2021-04-30 13:09:53 -05:00
James Prestwood
1b5a58233c station: separate FT-over-DS stages
FT-over-DS was refactored to separate the FT action frame and
reassociation. From stations standpoint IWD needs to call
netdev_fast_transition_over_ds_action prior to actually roaming.
For now these two stages are being combined and the action
roam happens immediately after the action response callback.
2021-04-30 13:09:13 -05:00
James Prestwood
c10b8d42e3 ft: netdev: refactor FT-over-DS into two stages
FT-over-DS followed the same pattern as FT-over-Air which worked,
but really limited how the protocol could be used. FT-over-DS is
unique in that we can authenticate to many APs by sending out
FT action frames and parsing the results. Once parsed IWD can
immediately Reassociate, or do so at a later time.

To take advantage of this IWD need to separate FT-over-DS into
two stages: action frame and reassociation.

The initial action frame stage is started by netdev. The target
BSS is sent an FT action frame and a new cache entry is created
in ft.c. Once the response is received the entry is updated
with all the needed data to Reassociate. To limit the record
keeping on netdev each FT-over-DS entry holds a userdata pointer
so netdev doesn't need to maintain its own list of data for
callbacks.

Once the action response is parsed netdev will call back signalling
the action frame sequence was completed (either successfully or not).
At this point the 'normal' FT procedure can start using the
FT-over-DS auth-proto.
2021-04-30 13:09:09 -05:00
Denis Kenzior
184b19c992 ap: Fix possible memleak of 'rates' 2021-04-30 11:38:04 -05:00
Denis Kenzior
d973c347be ap: Fix l_settings leak
l_settings is leaked if l_settings_load_from_file() fails.
2021-04-30 11:36:19 -05:00
Denis Kenzior
84ca680611 netdev: Refine error handling in roam_event 2021-04-30 11:31:22 -05:00
Denis Kenzior
f35a40c0c5 resolve: Simplify dbus_message error handling logic 2021-04-30 11:04:33 -05:00
James Prestwood
6c5fe246a7 netdev: separate over-air and over-ds netdev APIs 2021-04-30 09:59:46 -05:00
James Prestwood
0d45316891 ft: separate over-air from over-ds initializers 2021-04-30 09:59:31 -05:00
James Prestwood
37811a092c ft: create class for FT-over-DS targets
FT-over-DS is being separated into two independent stages. The
first of which is the processing of the action frame response.
This new class will hold all the parsed information from the action
frame and allowing it to be retrieved at a later time when IWD
needs to roam.

Initial info class should be created when the action frame is
being sent out. Once a response is received it can be parsed
with ft_over_ds_parse_action_response. This verifies the frame
and updates the ft_ds_info class with the parsed data.

ft_over_ds_prepare_handshake is the final step prior to
Reassociation. This sets all the stored IEs, anonce, and KH IDs
into the handshake and derives the new PTK.
2021-04-30 09:58:37 -05:00
James Prestwood
2c0234e161 ft: rework ft_parse_ies
This adds the RSNE verification to ft_parse_ies which will
be common between over-Air and over-DS. The MDE check was
also factored out into its own minimal function as to
retain the spec comment but allow reuse elsewhere.
2021-04-30 09:58:13 -05:00
Denis Kenzior
2697af428e nl80211cmd: Add additional command decoding 2021-04-29 21:37:38 -05:00
Denis Kenzior
d5aecc6ef4 linux: Update to the latest upstream uapi header 2021-04-29 21:37:38 -05:00
James Prestwood
4085aceb4a test-runner: fix verbose output with --valgrind
Since using --valgrind actually runs IWD using the valgrind
process the --verbose flag would only work if 'valgrind' was
also specified. This was taken into account with is_verbose
but the actual logic enabling stdout did not use that helper.
This was due, in part, to logging since is_verbose will always
return true if --log is used. To fix this a new flag was added
to is_verbose which omits the --log check to handle this
specific case.
2021-04-29 12:56:51 -05:00
Denis Kenzior
acbbedb9d3 netdev: Remove unused member 2021-04-29 12:56:51 -05:00
Marcel Holtmann
d87b580c20 build: Create directory for ell/useful.h 2021-04-29 10:16:32 +02:00
James Prestwood
0531e9ab08 station: remove diagnostic interface on station_free
If station gets removed ungracefully (e.g. rfkill/hotplug) it
may not have a chance to disconnect, meaning the diagnostic
interface would remain up.
2021-04-28 14:46:16 -05:00
James Prestwood
3b3f6d33fe station: tie diagnostic interface cleanup to DISCONNECTING
Prior to this the diagnostic interface was taken down when station
transitioned to DISCONNECTED. This worked but once station is in
a DISCONNECTING state it then calls netdev_disconnect(). Trying to
get any diagnostic data during this time may not work as its
unknown what state exactly the kernel is in. To be safe take the
interface down when station is DISCONNECTING.
2021-04-28 14:31:33 -05:00
Denis Kenzior
dcfd0e2ade treewide: Get rid of non-ASCII characters 2021-04-28 14:16:06 -05:00
James Prestwood
f4d515fc79 ft: expose ft_build_authenticate_ies
The building of the FT IEs for Action/Authenticate
frames will need to be shared between ft and netdev
once FT-over-DS is refactored.

The building was refactored to work off the callers
buffer rather than internal stack buffers. An argument
'new_snonce' was included as FT-over-DS will generate
a new snonce for the initial action frame, hence the
handshakes snonce cannot be used.
2021-04-28 13:49:35 -05:00
James Prestwood
f3e4266add ft: factor out various parsing routines
Break up the rather large code block which parses out IEs,
verifies, and sets into the handshake. FT-over-DS needs these
steps broken up in order to parse the action frame response
without modifying the handshake.
2021-04-28 13:46:31 -05:00
James Prestwood
07fe995a5d netdev: add user_data to netdev_send_action_frame[v]
This makes this internal API a bit more usable by removing the
restriction of always having netdev as the user_data.
2021-04-28 13:35:21 -05:00
Denis Kenzior
a0911ca778 station: Make sure roam_scan_id is always canceled
Under very rare circumstances the roaming scan triggered might not be
canceled properly.  This is because we issue the roam scan recursively
from within a scan callback and re-use the id of the scan for the
subsequent request.  The destroy callback is invoked right after the
callback and resets the id.  This leads to the scan not being canceled
properly in roam_state_clear().

src/netdev.c:netdev_mlme_notify() MLME notification Notify CQM(64)
src/station.c:station_roam_trigger_cb() 37
src/station.c:station_roam_scan() ifindex: 37
src/station.c:station_roam_trigger_cb() Using cached neighbor report for roam
...
src/scan.c:get_scan_done() get_scan_done
src/station.c:station_roam_failed() 37
src/station.c:station_roam_scan() ifindex: 37
src/scan.c:scan_request_triggered() Active scan triggered for wdev 22
^CTerminate
src/netdev.c:netdev_free() Freeing netdev wlan0[37]
src/device.c:device_free()
src/station.c:station_free()
...
Removing scan context for wdev 22
src/scan.c:scan_context_free() sc: 0x4a362a0
src/wiphy.c:wiphy_radio_work_done() Work item 14 done
==19542== Invalid write of size 4
==19542==    at 0x411500: station_roam_scan_destroy (station.c:2010)
==19542==    by 0x420B5B: scan_request_free (scan.c:156)
==19542==    by 0x410BAC: destroy_work (wiphy.c:294)
==19542==    by 0x410BAC: wiphy_radio_work_done (wiphy.c:1613)
==19542==    by 0x46C66E: l_queue_clear (queue.c:107)
==19542==    by 0x46C6B8: l_queue_destroy (queue.c:82)
==19542==    by 0x420BAE: scan_context_free (scan.c:205)
==19542==    by 0x424135: scan_wdev_remove (scan.c:2272)
==19542==    by 0x408754: netdev_free (netdev.c:847)
==19542==    by 0x40E18C: netdev_shutdown (netdev.c:5773)
==19542==    by 0x404756: iwd_shutdown (main.c:78)
==19542==    by 0x404756: iwd_shutdown (main.c:65)
==19542==    by 0x470E21: handle_callback (signal.c:78)
==19542==    by 0x470E21: signalfd_read_cb (signal.c:104)
==19542==    by 0x47166B: io_callback (io.c:120)
==19542==  Address 0x4d81f98 is 200 bytes inside a block of size 288 free'd
==19542==    at 0x48399CB: free (vg_replace_malloc.c:538)
==19542==    by 0x47F3E5: interface_instance_free (dbus-service.c:510)
==19542==    by 0x481DEA: _dbus_object_tree_remove_interface (dbus-service.c:1694)
==19542==    by 0x481F1C: _dbus_object_tree_object_destroy (dbus-service.c:795)
==19542==    by 0x40894F: netdev_free (netdev.c:844)
==19542==    by 0x40E18C: netdev_shutdown (netdev.c:5773)
==19542==    by 0x404756: iwd_shutdown (main.c:78)
==19542==    by 0x404756: iwd_shutdown (main.c:65)
==19542==    by 0x470E21: handle_callback (signal.c:78)
==19542==    by 0x470E21: signalfd_read_cb (signal.c:104)
==19542==    by 0x47166B: io_callback (io.c:120)
==19542==    by 0x47088C: l_main_iterate (main.c:478)
==19542==    by 0x47095B: l_main_run (main.c:525)
==19542==    by 0x47095B: l_main_run (main.c:507)
==19542==    by 0x470B6B: l_main_run_with_signal (main.c:647)
==19542==  Block was alloc'd at
==19542==    at 0x483879F: malloc (vg_replace_malloc.c:307)
==19542==    by 0x46AB2D: l_malloc (util.c:62)
==19542==    by 0x416599: station_create (station.c:3448)
==19542==    by 0x406D55: netdev_newlink_notify (netdev.c:5324)
==19542==    by 0x46D4BC: l_hashmap_foreach (hashmap.c:612)
==19542==    by 0x472F46: process_broadcast (netlink.c:158)
==19542==    by 0x472F46: can_read_data (netlink.c:279)
==19542==    by 0x47166B: io_callback (io.c:120)
==19542==    by 0x47088C: l_main_iterate (main.c:478)
==19542==    by 0x47095B: l_main_run (main.c:525)
==19542==    by 0x47095B: l_main_run (main.c:507)
==19542==    by 0x470B6B: l_main_run_with_signal (main.c:647)
==19542==    by 0x403EDB: main (main.c:490)
==19542==
2021-04-28 13:15:45 -05:00
James Prestwood
06aa84ccaf ap: set link/operstate on AP start/stop
Prior to this netdev_connect_ok set setting this which really
only applies to station mode. In addition this happens for each
new station that connects to the AP. Instead set the operstate /
link mode when AP starts and stops.
2021-04-28 11:29:51 -05:00
James Prestwood
e0ffd94832 netdev: only call connect_ok in station/p2p_client mode
netdev_connect_ok is only for station/p2p_client modes but AP
also ends up on the same code path. Check the iftype before
calling netdev_connect_ok.
2021-04-28 11:29:43 -05:00
Andrew Zaborowski
e148e1ea99 eap: Print a hint if Identity is likely wrong 2021-04-28 11:27:14 -05:00