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

6881 Commits

Author SHA1 Message Date
Andrew Zaborowski
a4c0515e0f netconfig: Add NetworkConfigurationAgent DBus API
Add a second netconfig-commit backend which, if enabled, doesn't
directly send any of the network configuration to the kernel or system
files but delegates the operation to an interested client's D-Bus
method as described in doc/agent-api.txt.  This backend is switched to
when a client registers a netconfig agent object and is swiched away
from when the client disconnects or unregisters the agent.  Only one
netconfig agent can be registered any given time.
2022-09-13 08:57:55 -05:00
Andrew Zaborowski
11bae53408 netconfig: Re-add FILS handling
Load the settings from FILS IE data into our l_netconfig instance when
appropriate.
2022-09-13 08:56:50 -05:00
Andrew Zaborowski
fbdd4471a1 netconfig: Handle l_netconfig events
Add netconfig_event_handler() that responds to events emitted by
the l_netconfig object by calling netconfig_commit, tracking whether
we're connected for either address family and emitting
NETCONFIG_EVENT_CONNECTED or NETCONFIG_EVENT_FAILED as necessary.

NETCONFIG_EVENT_FAILED is a new event as until now failures would cause
the netconfig state machine to stop but no event emitted so that
station.c could take action.  As before, these events are only
emitted based on the IPv4 configuration state, not IPv6.
2022-09-13 08:55:31 -05:00
Andrew Zaborowski
b79c7d49cd netconfig: Add netconfig-commit API
Add netconfig-commit.c whose main method, netconfig_commit actually sets
the configuration obtained by l_netconfig to the system netdev,
specifically it sets local addresses on the interface, adds routes to the
routing table, sets DNS related data and may add entries to the neighbor
cache.  netconfig-commit.c uses a backend-ops type structure to allow
for switching backends.  In this commit there's only a default backend
that uses l_netconfig_rtnl_apply() and a struct resolve object to write
the configuration.

netconfig_gateway_to_arp is moved from netconfig.c to netconfig-commit.c
(and renamed.)  The struct netconfig definition is moved to netconfig.h
so that both files can access the settings stored in the struct.
2022-09-13 08:51:29 -05:00
Andrew Zaborowski
a8b1139dcb netconfig: Store pointer to netdev instead of ifindex
To avoid repeated lookups by ifindex, replace the ifindex member in
struct netconfig with a struct netdev pointer.  A struct netconfig
always lives shorter than the struct netdev.
2022-09-13 08:51:13 -05:00
Andrew Zaborowski
98ba09562e netconfig: Clean up netconfig_get_static{4,6}_address
* make the error handling simpler,
 * make error messages more consistent,
 * validate address families,
 * for IPv4 skip l_rtnl_address_set_noprefixroute()
   as l_netconfig will do this internally as needed.
 * for IPv6 set the default prefix length to 64 as that's going to be
   used for the local prefix route's prefix length and is a more
   practical value.
2022-09-13 08:47:14 -05:00
Andrew Zaborowski
b0b1a46779 netconfig: Keep configuration directly in struct l_netconfig
Drop all the struct netconfig members where we were keeping the parsed
netconfig settings and add a struct l_netconfig object.  In
netconfig_load_settings load all of the settings once parsed directly
into the l_netconfig object.  Only preserve the mdns configuration and
save some boolean values needed to properly handle static configuration
and FILS.  Update functions to use the new set of struct netconfig
members.

These booleans mirroring the l_netconfig state could be replaced by
adding l_netconfig getters for settings which currently only have
setters.
2022-09-13 08:46:05 -05:00
Andrew Zaborowski
ce36d2fb15 netconfig: Drop dhcp, dhcp6 and acd client instances
In anticipation of switching to use the l_netconfig API, which
internally handles DHCPv4, DHCPv6, ACD, etc., drop pointers to
instances of l_dhcp_client, l_dhcp6_client and l_acd from struct
netconfig.  Also drop all code used for handling events from these
APIs, including code to commit the received configurations to the
system.  Committing the final settings to the system netdevs is going to
be handled by a new set of utilities in a new file.
2022-09-13 08:45:43 -05:00
Andrew Zaborowski
49d098b434 doc: Update Netconfig Agent API doc
Update ConfigureIPv{4,6}() parameters to simplify mapping our sets of
addresses and routes directly to D-Bus dictionaries.  Split Cancel()
into CancelIPv{4,6}().
2022-09-13 08:44:02 -05:00
James Prestwood
f079444c6c manager: add support for [General].Country
This lets the user set a country as the global regulatory
domain if the kernel/driver isn't doing it on its own.
2022-09-09 09:13:00 -05:00
James Prestwood
c5874c9ab0 doc: document [General].Country main.conf option
This lets the user set a country code explicitly.
2022-09-09 09:12:56 -05:00
James Prestwood
15c7379b4d rrm: constrain scan frequency before scanning
The RRM module was blindly scanning using the requested
frequency which may or may not be possible given the hardware.
Instead check that the frequency will work and if not reject
the request.

This was reported by a user seeing the RRM scan fail which was
due to the AP requesting a scan on 5GHz when the adapter was
2.4GHz only.
2022-09-09 09:11:17 -05:00
James Prestwood
0e72ce8861 auto-t: add more checks to testRRM
The hostapd events for RRM come regardless of success
so they need to be checked as such. In addition one more
RRM request was added to scan on a frequency which is
disabled (operating class 82, channel 14).
2022-09-09 09:11:15 -05:00
James Prestwood
483d4f2e61 netdev: remove 'req' from netdev_mac_change_failed
The request object was never being used
2022-09-07 15:45:59 -05:00
James Prestwood
45f95ecf35 netdev: allow powered address change
Support for MAC address changes while powered was recently added to
mac80211. This avoids the need to power down the device which both
saves time as well as preserves any allowed frequencies which may
have been disabled if the device powered down.

The code path for changing the address was reused but now just the
'up' callback will be provided directly to l_rtnl_set_mac. Since
there aren't multiple stages of callbacks the rtnl_data structure
isn't strictly needed, but the code looks cleaner and more
consistent between the powered/non-powered code paths.

The comment/debug error print was also updated to be more general
between the two MAC change code paths.
2022-09-07 15:45:03 -05:00
James Prestwood
f10bac5ff5 Update nl80211.h (wireless-next/main) 2022-09-07 15:44:57 -05:00
Marcel Holtmann
881807d14b Release 1.30 2022-09-07 20:41:20 +02:00
Marcel Holtmann
7fd712ec96 build: Require at least version 0.53 when building with external ELL 2022-09-07 20:30:12 +02:00
Denis Kenzior
e8d2d80266 netconfig: Fix documentation of MulticastDNS setting
Documentation for MulticastDNS setting suggests it should be part of the
main iwd configuration file.  See man iwd.config.  However, in reality
the setting was being pulled from the network provisioning file instead.
The latter actually makes more sense since systemd-resolved has its own
set of global defaults.  Fix the documentation to reflect the actual
implementation.
2022-08-24 11:09:45 -05:00
Andrew Zaborowski
e28243a584 autotests: Test ACD failure during connect
Previously we had an ACD failure scenario where a new client forces its
IP to create an IP conflict and an already-connected client detects the
conflict and reacts.  Now first test a scenario where a newly connecting
IWD client runs ACD before setting its statically configured IP, detects
a conflict and refuses to continue, then run the second scenario where
the newly connecting DHCP-configured client ignores the conflict and
starts ACD in defend-indefinitely mode and the older client in
defent-once mode gives up its IP.
2022-08-23 15:47:06 -05:00
Andrew Zaborowski
818ec70549 autotests: Fix class variables that should be object vars
Due to those variables being global (IWD class variables) calling either
unregister_psk_agent or del on one IWD class instance would unregister
all agents on all instances.  Move .psk_agents and two other class
variables to the object.  They were already referenced using "self."
as if they were object variables throughout the class.
2022-08-23 15:47:06 -05:00
Andrew Zaborowski
f6a890f5cb autotests: Fix testNetconfig ACD test
Part of static_test.py starts a second IWD instance and tries to make
it connect to the AP with the same IP address as the first IWD instance
which is already connected, to produce an IP conflict.  For this, the
second instance uses DHCP and the test expects the DHCP server to offer
the address 192.168.1.10 to it.  However in the current setup the DHCP
server manages to detect that 192.168.1.10 is in use and offers .11
instead.  Break the DHCP server's conflict detection by disabling ICMP
ping replies in order to fix the test.

Previously this has worked because the AP's and the DHCP server's
network interface is in the same network namespace as the first IWD
instance's network interface meaning that pings between the two
interfaces shouldn't work (a known Linux kernel routing quirk...).
I am not sure why those pings currently do work but take no chances and
disable ICMP pings.
2022-08-23 15:47:06 -05:00
Denis Kenzior
f56d01d25e netdev: constify struct scan_bss use
netdev does not keep any pointers to struct scan_bss arguments that are
passed in.  Make this explicitly clear by modifying the API definitions
and mark these as const.
2022-08-23 11:24:04 -05:00
James Prestwood
950624761c auto-t: remove bringing up lo interface
Several tests were setting lo up which is already done by
test-runner.
2022-08-22 12:53:16 -05:00
James Prestwood
4545f80e58 auto-t: update tests to use set_address/group_neighbors
This reduces the big blocks of copied code with a few function calls.
2022-08-22 12:53:16 -05:00
James Prestwood
3439d09817 auto-t: hostapd: add set_address/group_neighbors
This adds a few utilities for setting up an FT environment. All the
roaming tests basically copy/paste the same code for setting up the
hostapd instances and this can cause problems if not done correctly.

set_address() sets the MAC address on the device, and restarts hostapd
group_neighbors() takes a list of HostapdCLI objects and makes each a
    neighbor to the others.

The neighbor report element requires the operating class which isn't
advertised by hostapd. For this we assume operating class 81 but this
can be set explicitly if it differs. Currently no roaming tests use
5/6GHz frequencies, and just in case an exception will be thrown if
the channel is greater than 14 and the op_class didn't change.
2022-08-22 12:53:16 -05:00
James Prestwood
90dc2e5547 test-runner: double RAM for --valgrind
It seems 256MB was right on the edge if valgrind was being used and
sometimes the test would fail with OOM exceptions.
2022-08-22 12:53:16 -05:00
James Prestwood
41ce56bf0d auto-t: fix unreliable behavior in testPSK-roam
The packet loss test had a few problems. First being that the RSSI for
the original BSS was not low enough to change the rank. This meant any
roam was just lucky that the intended BSS was first in the results.

The second problem is timing related, and only happens on UML. Disabling
the rules after the roaming condition sometimes allows IWD to fully
roam and connect before the next state change checks.
2022-08-22 12:53:16 -05:00
James Prestwood
fb76a4ef13 auto-t: add packet loss test to testPSK-roam
A new test which blocks all data frames once connected, then tries
to send 100 packets. This should result in the kernel sending a
packet loss event to userspace, which IWD should react to and roam.
2022-08-16 15:30:03 -05:00
James Prestwood
1e1a6d6754 auto-t: add generic tx_packet function
This sends data over the raw sockets similar to test_ifaces_connected
2022-08-16 15:29:59 -05:00
James Prestwood
77c366ba2e netdev: handle packet loss notification
This attribute was already handled and simply printed. Now a
netdev event will be sent to notify any listeners.
2022-08-16 15:29:52 -05:00
James Prestwood
103eeb2cc6 station: react to (new) netdev packet loss event
This adds a new netdev event for packet loss notifications from
the kernel. Depending on the scenario a station may see packet
loss events without any other indications like low RSSI. In these
cases IWD should still roam since there is no data flowing.
2022-08-16 15:29:28 -05:00
James Prestwood
69e9945ef7 device: command: remove default device concept
There was quite a bit of framework behind setting/resetting a default
device, which is now no longer needed.
2022-08-11 15:47:20 -05:00
James Prestwood
fce1bb60a8 client: fix station autocomplete with multiple phys
The limitations of readline required that the autocompletion choose
a 'default' device. With multiple phys this doesn't work. Now the
readline limitation has been worked around and station can look up
the device for the command completion.
2022-08-11 15:47:15 -05:00
James Prestwood
be02c3fa3d client: add station-debug command interface
This lets iwctl call methods on .StationDebug. The command
name is called 'debug'. This can only be used when IWD is
in developer mode
2022-08-11 15:47:08 -05:00
James Prestwood
9aefec6124 client: allow entity name to be passed to completion
There is a limitation of libreadline where no context/userdata
can be passed to completion functions. Thi affects iwctl since
the entity value isn't known to completion functions.

Workarounds such as getting the default device are employed but
its not a great solution.

Instead hack around this limitation by parsing the prompt to
extract the entity (second arg). Then use a generic match function
given to readline which can call the actual match function and
include the entity.
2022-08-11 15:47:02 -05:00
James Prestwood
8091d5a53d station: add debug method GetNetworks
This gets all networks but includes individual entries for each
BSS.
2022-08-11 15:46:50 -05:00
James Prestwood
9ae4b959a2 doc: add documentation for StationDebug 2022-08-11 15:46:35 -05:00
James Prestwood
fa56dcfe91 client: add STATION_DEBUG_INTERFACE definition 2022-08-11 09:45:48 -05:00
James Prestwood
99a71ee819 station: check for matching SSID in Roam()
This is a debug method, but still should verify the SSID in the
target matches the current BSS.
2022-08-11 09:10:47 -05:00
James Prestwood
143b346a4b network: make network const in network_bss_list_get_entries
No reason for this to not be const.
2022-08-11 09:10:40 -05:00
James Prestwood
85dd94dfcf monitor: add support for HE element
Support for the HE IE.
2022-08-09 15:48:28 -05:00
James Prestwood
3940453ad2 monitor: print out type of unknown element
This changes the string from "Reserved" to "Unknown" which feels
more fitting, and also prints out the NL type of the unknown
element.
2022-08-09 15:48:24 -05:00
James Prestwood
0fdc5e87d1 monitor: add better array type support
The ATTR_ARRAY type was quite limited, only supporting u16/u32 and
addresses. This changes the union to a struct so nested/function
can be defined along with array_type.
2022-08-09 15:48:21 -05:00
James Prestwood
e67169337f monitor: parse RNR element 2022-08-09 15:47:37 -05:00
James Prestwood
5374e44354 station: re-try OWE if buggy AP is detected
Some APs use an older hostapd OWE implementation which incorrectly
derives the PTK. To work around this group 19 should be used for
these APs. If there is a failure (reason=2) and the AKM is OWE
set force default group into network and retry. If this has been
done already the behavior is no different and the BSS will be
blacklisted.
2022-08-08 13:37:23 -05:00
James Prestwood
7e99f1343c network: add setter/getter/flag for forcing default OWE group
If a OWE network is buggy and requires the default group this info
needs to be stored in network in order for it to set this into the
handshake on future connect attempts.
2022-08-08 13:37:17 -05:00
James Prestwood
b094f734e4 owe: allow OWE to force group 19
Similarly with SAE, some AP's either don't do group negotiations
right, or specifically with OWE, incorrectly derive the PTK unless
group 19 is used.
2022-08-08 13:37:08 -05:00
James Prestwood
38ed5e5039 handshake: add force_default_owe_group flag
Indicates the OWE SM should only use the default group
2022-08-08 13:37:05 -05:00
James Prestwood
d6b3d6d730 scan: watch for regdom updates to enable 6GHz
This functionality works around the kernel's behavior of allowing
6GHz only after a regulatory domain update. If the regdom updates
scan.c needs to be aware in order to split up periodic scans, or
insert 6GHz frequencies into an ongoing periodic scan. Doing this
allows any 6GHz BSS's to show up in the scan results rather than
needing to issue an entirely new scan to see these BSS's.
2022-08-05 13:38:26 -05:00