Commit Graph

109 Commits

Author SHA1 Message Date
David Bauer
fc158e0ec7 policy: only trigger roam-sm after client becomes roamable
Onky trigger the roaming-sm after a client becomes roamable. This is the
case when a STA is connected for longer than roam_trigger_interval.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-17 22:08:05 +02:00
David Bauer
837f144f6c usteer: add connected-since
Fetch the age of the association for STAs in order to implement minimum
intervals after which a STA is considered kickable.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-17 22:07:53 +02:00
David Bauer
9e6002d29a policy: improve readability
Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-17 22:07:42 +02:00
Stijn Tintel
041e884240 local_node: query client MBO support from hostapd
Query client MBO support from hostapd and display it in the output of
the connected_clients ubus method as "multi-band-operation".

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-08-16 10:40:28 +03:00
David Bauer
9059b9a537 ubus: derive RSSI from measurement report
Derive the RSSI of a measurement-report based on it's RCPI.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-07-21 00:31:46 +02:00
Stijn Tintel
87de1ab655 main: disable probe steering by default
As probe steering only makes sense in specific deployments, it should be
disabled by default.

Update the example config to reflect this change.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: David Bauer <mail@david-bauer.net>
2022-06-28 03:27:20 +03:00
Stijn Tintel
73c424b9e4 usteer: add option for probe steering
Probe suppression is mostly useful in high density deployments, where
all APs responding to all client probes would result in all channels
being saturated. It effectively hides APs from clients, and can cause
problems in normal density deployments.

Add an option for it, so it can be disabled.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: David Bauer <mail@david-bauer.net>
2022-06-28 03:27:13 +03:00
Stijn Tintel
fca4b87420 policy: improve readability
Increasing ev.type by one for these event types works due to the order
of the elements in enum uevent_type, but makes the code harder to
understand and debug. Imagine seeing the following event log:

Mon Jun 27 22:08:43 2022 user.info usteer: usteer event=probe_req_deny node=hostapd.wl24-iot sta=e4:5f:01:00:92:b6 reason=better_candidate signal=-79 assoc=1 load=27 select_reason=signal remote=fe80::b2a7:b9ff:fecb:eeba#hostapd.wl24-iot remote_signal=-39 remote_assoc=13 remote_load=20

Trying to find probe_req_deny (UEV_PROBE_REQ_DENY) in the code will not
yield any useful results. Assigning the enum element to ev.type makes it
much easier to find where exactly the above log event comes from.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: David Bauer <mail@david-bauer.net>
2022-06-28 03:27:08 +03:00
Stijn Tintel
80b0b652bc main: disable load balancing by default
As load-balancing only makes sense in specific deployments, it should be
disabled by default.

Update the example config to reflect this change.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: David Bauer <mail@david-bauer.net>
2022-06-28 03:27:02 +03:00
Stijn Tintel
5be681931f policy: allow disabling load balancing
Load-balancing only makes sense where multiple APs are deployed in the
same area. Enabling load-balancing between APs in different rooms might
steer clients to APs with a much lower signal strength, resulting in
lower data rates and inefficient use of airtime.

Allow disabling load balancing by setting the threshold to 0.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: David Bauer <mail@david-bauer.net>
2022-06-28 03:26:54 +03:00
Wojciech Dubowik
7afab9604b usteer: Fix better candidate not being set in policy
The candidate is never set in this loop. Fix it by setting it
to the first valid entry.

Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@westermo.com>
2022-05-17 16:21:14 +02:00
Stijn Tintel
d9b3877198 usteer: drop usteer_ubus_notify_client_disassoc
This function is no longer used.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: David Bauer <mail@david-bauer.net>
2022-05-09 15:27:19 +03:00
David Bauer
46539ae5b4 policy: abort kick process for missing candidate
Don't continue the kick process in case no candidate is found.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-05-05 23:42:04 +02:00
David Bauer
408bbcab6a policy: don't kick clients immediatly
The roam-kick-delay was not honored prior this patch. Because of this, a
client got kicked immediately.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-05-05 23:39:54 +02:00
David Bauer
444b233b05 policy: only send preferred candidate with transition request
Only send the preferred candidate with a BSS transition request.
Otherwise, unsuitable candidates might be included in the neighbor-list
of a transition request.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-05-05 23:39:42 +02:00
David Bauer
f88ac23903 local-node: periodically send link-measurement requests
Send link-measurement requests to every supporting local-sta in order to
acquire information to assess the link-quality bi-directional.

The link-measurement request is sent each configurable interval. It can
be disabled by configuring the interval to 0.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-04-04 17:08:07 +02:00
David Bauer
4473c6e6e6 measurement: add missing timeout-reset
If the timeout is not reset here, it will expire based on its initial
creation regardless whether it was updated in the meantime.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-04-04 17:04:15 +02:00
David Bauer
6d3314ca56 local-node: handle received link-measurement reports
Store link-measurement reports received from STAs as measurements.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-04-04 14:52:35 +02:00
David Bauer
7df969fd39 measurement: generalize measurement handling
Generalize measurement handling in a way that RCPi and RSNI are stored
regardless of the specific measurement type. This allows us to handle
link-measurement reports the same way as we already handle
beacon-reports.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-04-04 14:50:34 +02:00
David Bauer
bb61f2a598 local-node: enable link-measurement capability
Request hostap to enable the link-measurement capability in the BSS
beacons. Otherwise, STAs might reject link-measurement requests despite
being capable of performing such.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-04-04 14:48:58 +02:00
David Bauer
4458b6f1bf usteer: expose STA link measurement capability
Indicate STA capability for handling link-measurement requests in
connected_clients output.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-31 23:57:55 +02:00
David Bauer
f4e120c9a3 band-steering: add band-steering component
This adds a new band-steering component to usteer.

With band-steering enabled, usteer will attempt to move clients with a
consistently good SNR / signal from 2.4 GHz to the 5 GHz band.

In contrast to existing policies usteer tracks, band-steering is
non-invasive and will not lead to forceful connection termination.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-18 21:46:29 +01:00
David Bauer
439acc5d2b policy: add steer-reject-timeout
Add a timeout in case a STA rejected a transition request. For this
configurable timeframe, usteer will refrain from steering the client
another time.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-18 21:46:29 +01:00
David Bauer
648c6f3bc3 policy: make roam-steers client-rejectable
While usteer tries it's best to determine the availability of a better
node for a certain client, it might still attempt to direct the client
to a unsuitable AP.

Transition away from using BSS-Transition-Requests with the
disassoc-imminent bit set and instead unset this bit.

This way, the client can inform the AP it will not transition to a
different BSS but instead wishes to remain connected to the current AP.

usteer will still kick clients in case they either accepted the
BSS-transition-request and do not roam or ignore the request completely.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-18 21:42:33 +01:00
David Bauer
1fa3210a9d policy: update roam-state after hard-kicks
This prevents the roam-sm being triggered for clients which will be
deassociated in the first place.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-18 21:35:50 +01:00
David Bauer
c19c885b97 policy: move load-kick out of kick meta-function
Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-18 21:35:44 +01:00
David Bauer
96ef3a67f5 ubus: skip neighbors which exceed their assoc limit
Don't add neighbors which can not be associated to due to their
max-assoc limit.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-18 21:25:45 +01:00
David Bauer
86e72970e8 policy: export below_max_assoc
Export and rename below_max_assoc in preperation to use with
band-steering.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-18 21:25:45 +01:00
David Bauer
33a5acdee5 policy: make policy helpers more generic
Make the policy helpers generic in order to support client
measurements in the future.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-03-18 21:25:45 +01:00
Felix Fietkau
32fed79117 add local_mode config option
This prevents communication with other usteer nodes and allows it to be
used for purely local band steering / load balancing

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-03-17 10:05:56 +01:00
David Bauer
98247d1eda usteer: track RRM and BSS-TM support per connection
BSS transition management as well as RRM capabilities have to be
considered not for the STA but per STA connection.

Most prominently, a STA might not support BSS-TM when connected without
PMF.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-19 16:10:49 +01:00
David Bauer
6ec60fc370 ubus: add BSS-transition-management support
Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-19 16:10:34 +01:00
David Bauer
f462de04e4 local-node: fetch bss-transition-management support
Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-19 16:10:34 +01:00
David Bauer
c5242dda4d ubus: add supported beacon-measurement modes
Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-19 16:10:33 +01:00
David Bauer
0dd47b1434 local-node: convert kick-dely to absolute time
Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-16 22:59:59 +01:00
David Bauer
96976ba258 readme: add initial README 2022-02-07 21:05:14 +01:00
David Bauer
6aebb75cec local-node: check correct field
This causes segfaults on OpenWrt 21.02 which is missing the op-class
field.

Reported-by: John Crispin <john@phrozen.org>
Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-06 23:44:57 +01:00
David Bauer
f42bf2962e gitignore: add .orig files
Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-04 23:35:03 +01:00
David Bauer
3c0cd982d5 local-node: save latest bss-transition-response
Save the latest BSS-transition management response received from a STA.
This information can later be used to prevent kicking STAs when they
rejected a transition request.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-04 23:34:25 +01:00
David Bauer
1dc69d765f ubus: add get_connected_clients
Add a method to obtain local-host specific state data about usteers
internal logic for each connected STA.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-04 23:31:47 +01:00
David Bauer
04ef308f8c local-node: save beacon-reports
Add received beacon-reports from STAs to the measurement database.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-03 22:56:22 +01:00
David Bauer
b0dab90887 measurement: add handling of measurements
Add logic for saving measurement-reports from STAs.

This commit does not yet save the measurement-reports received from
clients but adds the necessary code to do so. Currently the codes can
only handle beacon-reports, but link measurements can be added to it in
the future.

It also adds the new config-key measurement_report_timeout which
controls how long measurements are saved upon they are received by a
STA.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-03 22:50:13 +01:00
David Bauer
76ccae62df node: add methods to access nodes by bssid
Add methods which returns a given node for a provided BSSID. This is
required to retrieve the node object from information available with
a neighbor report.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-03 22:44:14 +01:00
David Bauer
3b51bfbaf6 local-node: obtain channel + op-class
In order to send passive beacon-requests, channel and op-class of nodes
are required. Obtain this information per local-node from hostapd.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-03 22:43:37 +01:00
David Bauer
c7830b5319 policy: add min_snr_kick_delay
Currently the min_snr option will result in kicking clients the first
time their SNR dips below.

This might not be desirable, as drivers (notably ath10k) sometimes
report a much lower RSSI for a short timeframe after returning to
sensible values. Also, a device might be in the process of roaming just
to be kicked before.

Add the min_snr_kick_delay option. A client will be kicked after this
timeframe when it's SNR is below the min_snr threshold value over the
complete timeframe.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-02-01 18:41:57 +01:00
David Bauer
e36967f219 local-node: handle BSS transition queries
Make usteer handle incoming BSS-transition requests. Update with the
most active roaming neighbors like we already do for imminent
disassociations.

Create a new ubus method which calls hostapds bss_transition_request
method. This does not set the disassoc imminent bit, thus will not
automatically disassoc the requesting STA.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-01-31 23:40:52 +01:00
David Bauer
022635c9bd policy: don't track roam_scan_done
Don't determine a finished client scan based on whether the current node
has seen a beacon or not.

This works surprisingly bad on 5 GHz nodes, as clients may refuse to
perform active scanning on this frequency band. In case the clients does
refuse to scan the 5 GHz band but scans the 2.4 GHz band actively, we
might have a good indication about a better node on this band at least.

However, as the roam state-machine requires to have seen a probe request
from the client to direct him to a better node, thi process will not
continue, which either ends the node in being kicked due to exceeding
the number of max tries or the scan cooldown to kick in.

The solution to this is fairly simple: Don't track the roam_scan_done
state but instead just determine a better candidate after the scan
interval finished.

To ensure the indicated signal levels are as recent as 2 *
scan-interval, add a max_age parameter to find_better_candidate.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-01-23 20:55:41 +01:00
David Bauer
742236f30b policy: fix incurrect handling of scan-requests with disabled timeout
The logic guarding entering of the SCAN state of the roam state-machine
was incorrect in case the scan-timeout was not enabled.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-01-23 20:49:40 +01:00
David Bauer
9a78412ac5 policy: add roam-scan timeout
Add an optional timeout when a better roaming candidate is not found
after the scan-retry limit. The roam state-machine will not retry
scanning before this timeout has expired.

If the timeout is set to 0, the client is kicked instead, which
resembles the behavior prior this commit.

This is added, as without this patch, if a forced disconnect
is not desired before roam_scan_trigger is exceeded the client will
repeatedly be asked to return active beacon-reports. For battery powered
clients this can result in a noticeable battery drain.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-01-10 00:45:19 +01:00
David Bauer
7e999e0874 policy: don't select better candidate with bad signal
Don't select a node as a better candidate where a STA has insufficient
signal to. This is the case when the roam_trigger_snr is greater than
the projected signal of the client.

This stops clients from being selected to roam to a node where the
signal is not sufficient to maintain the connection. A selection might
otherwise happen e.g. due to better channel load on the remote node.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-01-09 02:09:26 +01:00