115 Commits

Author SHA1 Message Date
Christian Marangi
e218150979 remote: close file on usteer_init_local_id fread fail
Fix Coverity Scan CID 1521041 reporting a not closed FILE on fread fail.
Correctly close the FILE on fread fail to fix this leak.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-05-29 19:27:02 +02:00
David Bauer
7d2b17c91b ubus: optimize connected_clients output format
- Drop seen / last-connected as the list only contains currently
   connected clients
 - Convert past timestamps to relative age
 - Include current roam-sm state

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-18 15:32:31 +02:00
David Bauer
8b10a4b296 policy: don't alter stats when remaining idle
Don't alter roam-sm stats when remaining idle. Previously, a
roam-sm-event was registered when keeping the idle-state.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-18 15:31:31 +02:00
David Bauer
3cc0f456f0 policy: count kick total
Always increase the kick-counter when usteer de-associates a STA. This
was previously exclusively done when kicking clients due to insufficient
SNR.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-18 15:30:28 +02:00
David Bauer
aadc562dcb policy: make steering ability evaluation uniform
Usteer imposes minimum intervals for steering actions in order to avoid
creating endless roam-kick loops due to the decentral aspect of usteer.

Make these basic limits to roamsteering usable across band-steering and
signal-based roam-steering.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-17 23:00:42 +02:00
David Bauer
17c558d4b9 ubus: include SSID in node dump
Include a nodes SSID into the ubus dump.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-08-17 22:57:33 +02:00
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