51 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
1c5a738272 ubus: only request beacon-report for current SSID
This reduces the return traffic from clients by only responding with
beacon reports for the current SSID.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-01-09 02:09:26 +01:00
David Bauer
5610aceea5 config: make remote_node_timeout configurable
The logic for customizing the remote_node_timeout config option was
missing. The default value of 10 could not be altered by a user.

Add the required logic and a short explanation of the config-option to
the default configuration.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-01-09 02:09:26 +01:00
David Bauer
55e98d852c sta: uniform disconnect state handling
Logic for handling STA transition to disconnected state is
present multiple times. Create a new method to remove
duplicate code.

Signed-off-by: David Bauer <mail@david-bauer.net>
2022-01-09 01:59:53 +01:00
David Bauer
8e7b1ffc26 ubus: skip current node for transition candidate list
Don't add the node the client is forced to leave as a potential
transition candidate.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-12-10 17:30:45 +01:00
David Bauer
e51ea7ac1a node: move roam-events to dedicated struct
Move the roam event counters to a dedicated struct.

Update the ubus output to represent this new organization.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-11-28 13:47:53 +01:00
David Bauer
7bf79a237c ubus: set scan duration to roam scan interval
Some clients seem to ignore scan requests with unreasonably high
measurement durations. This was observed with a Google Pixel 4A as well
as a Xiaomi Mi 10T.

Advertise a scan duration which closely matches the roam scan-interval.
This triggers scans more reliably with the aformentioned devices.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-11-25 23:20:18 +01:00
David Bauer
5d5a0be202 ubus: don't request measurement from unsupported STAs
Don't request measurements from STAs which do not support the specific
measurement mode. Otherwise, hostapd complains in the syslog about
unsupported measurement modes.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-11-25 23:04:56 +01:00
David Bauer
a5c21aec7a ubus: prioritize neighbor reports on bss transition
Apply the same logic for selecting the most relevant neighbors also when
sending transition requests to STAs.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-11-25 22:28:28 +01:00
David Bauer
532a48d23e local-node: prioritize neighbor candidates
Prioritize neighbor candidates installed to hostapd. Add a new config
option to set a limit for neighbor reports installed to hostapd. This is
due to the fact, most devices will only evaluate a certain amount of
neighbor reports. Furthermore, the number of neighbor reports possible
is limited by the maximum frame size.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-11-25 22:28:04 +01:00
David Bauer
4862080de7 node: keep track of roam-sources and roam-destinations
Keep track of STA journeys between multiple nodes. When a new STA is
reported from a foreign node, check whether this STA was previously
associated with a local node.

Vice versa, check upon association whether or not the STA was previously
associated with a foreign node.

Keep track of these roaming transactions using two new (local) fields of
the node struct.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-11-25 22:26:08 +01:00
David Bauer
ae32cb9632 ubus: fix channel for active probing
The IEEE802.11-2016 specification says:

[...] a Channel Number field value of 255 indicates a request
to make iterative measurements for all supported channels in the
current operating class listed in the latest AP Channel Report
received from the serving AP.

The problem with this is, no AP Channel report is sent to the STA with
the measurement request.

To scan the whole Operating class, a channel number of 0 is desired:

[...] Channel Number field value of 0 indicates a request to make
iterative measurements for all supported channels in the operating
class [...]

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-10-29 19:28:14 +02:00
David Bauer
8dc07533a8 ubus: introduce enum for beacon measurement mode
This improves code readability.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-10-29 19:28:08 +02:00
David Bauer
d3ff0d59da sta: add sta_connection_state enum
Make the connection state of a sta-info more readable by introducing an
enum for the STA connection state.

Also switch come comparison cases to use the explicit enum values to
make the code more readable.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-10-15 15:50:25 +02:00
David Bauer
8af7b6cb06 usteer: add BSSID to node struct
Add the node BSSID to the usteer_node struct. This will be helpful in
the future when evaluating beacon reports from STAs.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-10-15 15:49:34 +02:00
Jan Braun
e4ea2045eb usteer: add support for IPv6 remote exchange
This adds optional support for message exchange using IPv6 multicast
messaging. This has the ability for routers and switches between nodes
to route traffic between usteer nodes multicast-aware.

By default, IPv4 is used. IPv6 can be enabled by configuring the ipv6
option to 1.

Signed-off-by: Jan Braun <keksgesicht23@gmail.com>
[squash commits - adapt usock usage]
Signed-off-by: David Bauer <mail@david-bauer.net>
2021-09-21 14:58:41 +02:00
Felix Fietkau
ab4d89e742 main: add a command line option for dumping remote node data
Run for a given number of seconds and dump all found remote hosts/nodes as
JSON data

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-07-07 11:37:51 +02:00
Felix Fietkau
e685db7fa7 add support for defining global host info
Change the '*' in the node info update cmd to refer to host info instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-07-06 19:44:02 +02:00
Felix Fietkau
0029f3ce2e ubus: add support for getting a list of remote hosts
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-07-06 19:23:59 +02:00
Felix Fietkau
8be33b596b remote: track remote hosts as a separate data structure
Will be used to track host info

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-07-06 19:14:40 +02:00
Felix Fietkau
e9641c4657 rename script_data to node_info
It's a more descriptive name, and we will have host_info later as well

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-07-06 14:35:40 +02:00
Felix Fietkau
e0cd9522dc rename a few functions in preparation for renaming script_data to node_info
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-07-06 14:28:28 +02:00
Felix Fietkau
831b46a705 ubus: add api for modifying node script data
This is replicated across nodes

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-07-06 11:10:47 +02:00
Felix Fietkau
7f52d413f2 ubus: display script data when dumping node info
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-07-06 11:10:47 +02:00
Felix Fietkau
0aab299c54 make list of steering-enabled SSIDs configurable
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-05-13 16:09:29 +02:00
Felix Fietkau
2b1c740ce3 rework log handling
- make logging events more structured
- add fine grained control over log events
- make it possible to receive more detailed events via ubus

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-16 14:55:57 +02:00
Felix Fietkau
47794506ce policy: always accept assoc requests by default
Only steer using probe responses to avoid connection issues

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2021-04-12 12:15:28 +02:00