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

7017 Commits

Author SHA1 Message Date
James Prestwood
39ba0a9ebd test-runner: allow wpa_supplicant to be used in --hw mode
This lets test-runner's physical adapter pass-through to be used with
wpa_supplicant.
2021-10-26 17:16:34 -05:00
Denis Kenzior
4b1ce76549 client: Don't try to print addresses if not connected 2021-10-26 14:34:00 -05:00
Denis Kenzior
062fc7852a client: Only print daemon info in interactive mode 2021-10-26 07:48:33 -05:00
Denis Kenzior
93a06769c4 client: Print IP Addresses / hint about netconfig
When station 'show' is invoked, parse and print any IP addresses
associated with the interface.

If iwd network configuration is disabled and no IP addresses were
configured, print a hint to the user that a DHCP client might need to be
configured.
2021-10-25 17:25:18 -05:00
Denis Kenzior
48b0a95528 client: Print daemon information at startup 2021-10-25 17:24:51 -05:00
Denis Kenzior
6a477061c7 unit: Consistently use network-byte-order
Commit ed10b00afa ("unit: Fix eapol IP Allocation test failure")
did not convert all instances of IP allocation settings to network byte
order.

Fixes: 5c9de0cf23 ("eapol: Store IP address in network byte order")
2021-10-25 10:39:00 -05:00
Andrew Zaborowski
0971eb4d0c netconfig: Convert netconfig_load_settings to use _auto_
As requested do the cleanup in netconfig_load_settings using ell's
private _auto_() macro.
2021-10-22 12:12:17 -05:00
Andrew Zaborowski
f0a85ddeb4 netconfig: Track local domains lists
Cache the latest v4 and v6 domain string lists in struct netconfig state
to be able to more easily detect changes in those values in future
commits.  For that split netconfig_set_domains's code into this function,
which now only commits the values in netconfig->v{4,6}_domain{,s} to the
resolver, and netconfig_domains_update() which figures out the active
domains string list and saves it into netconfig->v{4,6}_domain{,s}.  This
probably saves some cycles as the callers can now decide to only
recalculate the domains list which may have changed.

While there simplify netconfig_set_domains return type to void as the
result was always 0 anyway and was never checked by callers.
2021-10-22 12:12:17 -05:00
Andrew Zaborowski
2b1b8cce54 netconfig: Track DNS address string lists
Cache the latest v4 and v6 DNS IP string lists in struct netconfig state
to be able to more easily detect changes in those values in future
commits.  For that split netconfig_set_dns's code into this function,
which now only commit the values in netconfig->dns{4,6}_list to the
resolver, and netconfig_dns_list_update() which figures out the active
DNS IP address list and saves it in netconfig->dns{4,6} list.  This
probably saves some cycles as the callers can now decide to only
recalculate the dns_list which may have changed.

While there simplify netconfig_set_dns return type to void as the result
was always 0 anyway and was never checked by callers.
2021-10-22 12:12:17 -05:00
Andrew Zaborowski
7e38962d59 netconfig: Track gateway address strings
Cache the latest v4 and v6 gateway IP string in struct netconfig state
to be able to more easily detect changes in those values in future
commits and perhaps to simplify the ..._routes_install functions.
netconfig_ipv4_get_gateway's out_mac parameter can now be NULL.  While
editing that function fix a small formatting annoyance.
2021-10-22 12:12:17 -05:00
Andrew Zaborowski
ec634ad2a7 netconfig: trivial: Fix double-empty space 2021-10-22 12:12:17 -05:00
Andrew Zaborowski
cfde6c3f55 netconfig: Refactor netconfig_ipv4_get_gateway
Use a separate fils variable to make the code a bit prettier.

Also make sure that the out_mac parameter is not NULL prior to storing
the gateway_mac in it.
2021-10-22 12:12:17 -05:00
Andrew Zaborowski
927a3dc322 netconfig: Cache the IPv6 l_rtnl_address object
For symmetry with netconfig->v4_address add a netconfig->v6_address
so that we can track what the current address is at any time.
2021-10-22 12:12:17 -05:00
Denis Kenzior
d702e037c0 main: Simplify away l_dbus_message_builder use
Since the dictionary attributes are static, l_dbus_message_set_arguments
can be used instead.
2021-10-22 12:12:17 -05:00
Andrew Zaborowski
23799d0cb4 treewide: Parse EnableNetworkConfiguration in one place
Add netconfig_enabled() and use that in all places that want to know
whether network configuration is enabled.  Drop the enable_network_config
deprecated setting, which was only being handled in one of these 5 or so
places.
2021-10-22 12:12:02 -05:00
Andrew Zaborowski
04773eaa2c doc: Update agent-api.txt to match code and clarify 2021-10-22 12:10:48 -05:00
James Prestwood
e782911d33 auto-t: use tearDownClass in hidden network test
A failure in this test could leave stale network profiles, which
may cause future tests to fail.
2021-10-20 16:52:18 -05:00
James Prestwood
e4b78d83d6 network: fix autoconnect for Open networks
This code path was never tested and used to ensure a OWE transition
candidate gets selected over an open one (e.g. if all the BSS's are
blacklisted). But this logic was incorrect and the path was being
taken for BSS's that did not contain the owe_trans element, basically
all BSS's. For RSN's this was somewhat fine since the final check
would set a candidate, but for open BSS's the loop would start over
and potentially complete the loop without ever returning a candidate.
If fallback was false, NULL would be returned.

To fix this only take the OWE transition path if its an OWE transition
BSS, i.e. inverse the logic.
2021-10-20 16:52:16 -05:00
James Prestwood
2dec023f63 auto-t: fix testConnectAutoconnect
There was no open ssid provisioning file, which was fine as the
first test should have created one. But to be safe, include one
explicitly and use the proper setUp/tearDown functions.
2021-10-20 16:51:58 -05:00
James Prestwood
6a4fffe6da auto-t: update blacklist test to use 'enable' on rules 2021-10-20 16:44:28 -05:00
Denis Kenzior
3dc724d734 rrm: Consider requests w/ Beacon Reporting
Normally Beacon Reporting subelements are present only if repeated
measurements are requested.  However, an all-zero Beacon Reporting
subelement is included by some implementations.  Handle this case
similarly to the absent case.
2021-10-20 11:49:13 -05:00
Denis Kenzior
ae0ee89d72 rrm: relax Reporting Detail subelement length check
Since Reporting Detail subelement is listed as 'extensible', make sure
that the length check is not overly restrictive.  We only interpret the
first field.
2021-10-20 11:48:26 -05:00
James Prestwood
42ab82c20c station: disable OCV if offloading is supported
It was seen during testing that several offload-capable cards
were not including the OCI in the 4-way handshake. This made
any OCV capable AP unconnectable.

To be safe disable OCV on any cards that support offloading.
2021-10-19 17:04:42 -05:00
James Prestwood
747cb00c31 wiphy: add wiphy_can_offload
This is a convenience method for detecting any supported offload
extended features (4way/1x/SAE).
2021-10-19 17:04:39 -05:00
James Prestwood
2b88840316 station: don't enable OCV unless MFPC is supported 2021-10-19 15:41:16 -05:00
Denis Kenzior
659a63ae20 netdev: Print if SA Query is in progress 2021-10-19 15:40:26 -05:00
James Prestwood
bec0cabde4 auto-t: add missing ocv option and wait to testChannelSwitch
This should have been added to the original test
2021-10-19 15:29:26 -05:00
James Prestwood
b16621b9ee auto-t: Add channel switch test 2021-10-19 13:33:54 -05:00
James Prestwood
74e7e341fd auto-t: hostapd.py: add chan_switch()
Forces hostapd to channel switch
2021-10-19 13:33:51 -05:00
James Prestwood
4b88607b19 netdev: start SA Query on channel switch event
802.11 requires an STA initiate the SA Query procedure on channel
switch events. This patch refactors sending the SA Query into its
own routine and starts the procedure when the channel switch event
comes in.

In addition the OCI needs to be verified, so the channel info is
parsed and set into the handshakes chandef.
2021-10-19 13:28:18 -05:00
James Prestwood
8f036c229e nl80211cmd: make CH_SWITCH_STARTED_NOTIFY name unique
There are several events for channel switching, and nl80211cmd was
naming two of them "Channel Switch Notify". Change
CH_SWITCH_STARTED_NOTIFY to "Channel Switch Started Notify" to
distinguish the two events.
2021-10-19 13:28:07 -05:00
James Prestwood
850d2c7ea8 auto-t: add OCV to testSAQuery-spoofing 2021-10-19 13:28:03 -05:00
James Prestwood
1c86327029 auto-t: SAQuery-spoofing replace sleep with condition wait
By sleeping for 4 seconds IWD had plenty of time to fully disconnect
and reconnect in time to pass the final "connected" check. Instead
use wait_for_object_condition to wait for disconnected and expect
this to fail. This will let the test fail if IWD disconnects.
2021-10-19 13:27:59 -05:00
James Prestwood
bf5afa52e5 netdev: add OCI elements to SA Query request/response frames
SA query is the final protocol that requires OCI inclusion and
verification. The OCI element is now included and verified in
both request and response frames as required by 802.11.
2021-10-19 13:26:57 -05:00
James Prestwood
7fed9f758f ie: add ie_parse_oci
This is a very minimal parser, more or less to put the type
and length checks into a single location.
2021-10-19 13:26:49 -05:00
Denis Kenzior
224721e7f0 netconfig: Make sure gw is not NULL
strcmp behavior is undefined if one of the parameters is NULL.
Server-id is a mandatory value and cannot be NULL.  Gateway can be NULL
in DHCP, so check that explicitly.

Reported-by: Andrew Zaborowski <andrew.zaborowski@intel.com>
2021-10-18 10:43:41 -05:00
Denis Kenzior
2135a4f845 netconfig: Try to put gateway mac into ARP cache
In certain situations, it is possible for us to know the MAC of the
default gateway when DHCP finishes.  This is quite typical on many home
network and small network setups.  It is thus possible to pre-populate
the ARP cache with the gateway MAC address to save an extra round trip
at connection time.

Another advantage is during roaming.  After version 4.20, linux kernel
flushes ARP caches by default whenever netdev encounters a no carrier
condition (as is the case during roaming).  This can prevent packets
from going out after a roam for a significant amount of time due to
lost/delayed ARP responses.
2021-10-15 16:43:42 -05:00
Denis Kenzior
5d9e0401fc build: Add cleanup.h 2021-10-14 16:54:58 -05:00
Denis Kenzior
b6fd028fe7 ap: Use _u32 dhcp_lease getters 2021-10-13 17:56:51 -05:00
Denis Kenzior
f1b2bca6bd netconfig: Use l_dhcp_lease_get_prefix_length 2021-10-13 17:56:49 -05:00
Denis Kenzior
6b71a71e19 ap: Use l_dhcp_lease_get_prefix_length 2021-10-13 17:56:46 -05:00
James Prestwood
219e18323f station: limit extended key IDs to CCMP ciphers 2021-10-13 10:34:55 -05:00
James Prestwood
a205afe2de netdev: set TK index to zero for FT
Since FT re-uses the handshake the active TK index may be set to a
non-zero value.
2021-10-08 14:13:56 -05:00
Denis Kenzior
3d736d4c20 station: Only set our OCVC if the AP supports it 2021-10-08 13:33:11 -05:00
James Prestwood
adceab280b auto-t: Add test for extended key IDs 2021-10-08 13:28:04 -05:00
James Prestwood
1ec6c46a1d station: set extended key capability
If wiphy and the AP suppor it, set the Extended Key ID capability
bit in the RSN info.
2021-10-08 13:27:52 -05:00
James Prestwood
5ff7d113b9 netdev: support extended key IDs
This implements the new handshake callback for setting a TK with
an extended key ID. The procedure is different from legacy zero
index TKs.

First the new TK is set as RX only. Then message 4 should be sent
out (so it uses the existing TK). This poses a slight issue with
PAE sockets since message order is not guaranteed. In this case
the 4th message is stored and sent after the new TK is installed.
Then the new TK is modified using SET_KEY to both send and
receive.

In the case of control port over NL80211 the above can be avoided
and we can simply install the new key, send message 4, and modify
the TK as TX + RX all in sequence, without waiting for any callbacks.
2021-10-08 13:27:14 -05:00
James Prestwood
ec2c060b75 unit: update tests with new TK install arguments 2021-10-08 13:27:00 -05:00
James Prestwood
80135367cf handshake: update TK installer/builder to take key index 2021-10-08 13:26:25 -05:00
Denis Kenzior
a001740506 manager: Initialize all default interfaces
When UseDefaultInterface is set, iwd doesn't attempt to destroy and
recreate any default interfaces it detects.  However, only a single
default interface was ever remembered & initialized.  This is fine for
most cases since the kernel would typically only create a single netdev
by default.

However, some drivers can create multiple netdevs by default, if
configured to do so.  Other usecases, such as tethering, can also
benefit if iwd initialized & managed all default netdevs that were
detected at iwd start time or device hotplug.
2021-10-08 13:23:36 -05:00