Christian Marangi [Mon, 29 May 2023 17:25:32 +0000 (19:25 +0200)]
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>
David Bauer [Wed, 17 Aug 2022 22:28:49 +0000 (00:28 +0200)]
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>
David Bauer [Wed, 17 Aug 2022 22:51:32 +0000 (00:51 +0200)]
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>
David Bauer [Wed, 17 Aug 2022 22:41:41 +0000 (00:41 +0200)]
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>
David Bauer [Wed, 17 Aug 2022 20:18:55 +0000 (22:18 +0200)]
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>
David Bauer [Mon, 15 Aug 2022 23:44:22 +0000 (01:44 +0200)]
ubus: include SSID in node dump
Include a nodes SSID into the ubus dump.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Wed, 17 Aug 2022 00:22:48 +0000 (02:22 +0200)]
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>
David Bauer [Wed, 17 Aug 2022 00:17:40 +0000 (02:17 +0200)]
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>
David Bauer [Wed, 17 Aug 2022 00:06:08 +0000 (02:06 +0200)]
policy: improve readability
Signed-off-by: David Bauer <mail@david-bauer.net>
Stijn Tintel [Thu, 11 Aug 2022 09:53:01 +0000 (12:53 +0300)]
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>
David Bauer [Sun, 22 May 2022 23:12:38 +0000 (01:12 +0200)]
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>
Stijn Tintel [Mon, 27 Jun 2022 19:48:59 +0000 (22:48 +0300)]
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>
Stijn Tintel [Mon, 27 Jun 2022 19:26:02 +0000 (22:26 +0300)]
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>
Stijn Tintel [Mon, 27 Jun 2022 19:05:12 +0000 (22:05 +0300)]
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>
Stijn Tintel [Mon, 27 Jun 2022 13:19:41 +0000 (16:19 +0300)]
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>
Stijn Tintel [Mon, 27 Jun 2022 13:16:21 +0000 (16:16 +0300)]
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>
Wojciech Dubowik [Tue, 17 May 2022 12:12:41 +0000 (14:12 +0200)]
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>
Stijn Tintel [Mon, 9 May 2022 12:24:05 +0000 (15:24 +0300)]
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>
David Bauer [Thu, 5 May 2022 21:42:01 +0000 (23:42 +0200)]
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>
David Bauer [Wed, 4 May 2022 23:07:14 +0000 (01:07 +0200)]
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>
David Bauer [Wed, 4 May 2022 22:33:52 +0000 (00:33 +0200)]
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>
David Bauer [Sat, 26 Mar 2022 21:58:15 +0000 (22:58 +0100)]
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>
David Bauer [Mon, 4 Apr 2022 14:27:04 +0000 (16:27 +0200)]
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>
David Bauer [Thu, 31 Mar 2022 22:27:28 +0000 (00:27 +0200)]
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>
David Bauer [Thu, 31 Mar 2022 22:19:59 +0000 (00:19 +0200)]
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>
David Bauer [Thu, 31 Mar 2022 22:05:33 +0000 (00:05 +0200)]
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>
David Bauer [Wed, 30 Mar 2022 22:45:08 +0000 (00:45 +0200)]
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>
David Bauer [Tue, 15 Mar 2022 21:56:14 +0000 (22:56 +0100)]
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>
David Bauer [Wed, 23 Feb 2022 22:44:57 +0000 (23:44 +0100)]
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>
David Bauer [Wed, 23 Feb 2022 22:34:12 +0000 (23:34 +0100)]
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>
David Bauer [Tue, 22 Feb 2022 22:13:33 +0000 (23:13 +0100)]
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>
David Bauer [Tue, 22 Feb 2022 22:08:10 +0000 (23:08 +0100)]
policy: move load-kick out of kick meta-function
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Wed, 16 Mar 2022 22:13:54 +0000 (23:13 +0100)]
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>
David Bauer [Wed, 16 Mar 2022 22:08:03 +0000 (23:08 +0100)]
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>
David Bauer [Tue, 1 Feb 2022 19:08:39 +0000 (20:08 +0100)]
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>
Felix Fietkau [Thu, 17 Mar 2022 09:00:12 +0000 (10:00 +0100)]
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>
David Bauer [Sat, 19 Feb 2022 00:07:47 +0000 (01:07 +0100)]
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>
David Bauer [Fri, 18 Feb 2022 23:04:17 +0000 (00:04 +0100)]
ubus: add BSS-transition-management support
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Fri, 18 Feb 2022 23:03:51 +0000 (00:03 +0100)]
local-node: fetch bss-transition-management support
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Fri, 18 Feb 2022 22:45:58 +0000 (23:45 +0100)]
ubus: add supported beacon-measurement modes
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Mon, 7 Feb 2022 22:24:59 +0000 (23:24 +0100)]
local-node: convert kick-dely to absolute time
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Mon, 7 Feb 2022 20:05:14 +0000 (21:05 +0100)]
readme: add initial README
David Bauer [Sun, 6 Feb 2022 22:44:30 +0000 (23:44 +0100)]
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>
David Bauer [Fri, 4 Feb 2022 22:34:57 +0000 (23:34 +0100)]
gitignore: add .orig files
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sun, 23 Jan 2022 20:39:55 +0000 (21:39 +0100)]
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>
David Bauer [Mon, 24 Jan 2022 02:30:14 +0000 (03:30 +0100)]
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>
David Bauer [Fri, 21 Jan 2022 21:31:49 +0000 (22:31 +0100)]
local-node: save beacon-reports
Add received beacon-reports from STAs to the measurement database.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Fri, 21 Jan 2022 20:27:39 +0000 (21:27 +0100)]
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>
David Bauer [Wed, 29 Dec 2021 20:14:25 +0000 (21:14 +0100)]
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>
David Bauer [Sat, 8 Jan 2022 22:26:03 +0000 (23:26 +0100)]
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>
David Bauer [Sun, 23 Jan 2022 13:15:53 +0000 (14:15 +0100)]
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>
David Bauer [Mon, 20 Dec 2021 14:40:54 +0000 (15:40 +0100)]
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>
David Bauer [Wed, 22 Dec 2021 21:28:49 +0000 (22:28 +0100)]
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>
David Bauer [Sun, 23 Jan 2022 16:27:09 +0000 (17:27 +0100)]
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>
David Bauer [Tue, 21 Dec 2021 14:30:14 +0000 (15:30 +0100)]
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>
David Bauer [Tue, 21 Dec 2021 13:09:15 +0000 (14:09 +0100)]
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>
David Bauer [Mon, 20 Dec 2021 21:32:00 +0000 (22:32 +0100)]
policy: export snr_to_signal to other source files
Export snr_to_signal to other source files. This will be necessary to
determine reported signal strengths from beacon-report throughout the
code base.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Fri, 31 Dec 2021 20:46:14 +0000 (21:46 +0100)]
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>
David Bauer [Sat, 1 Jan 2022 17:00:45 +0000 (18:00 +0100)]
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>
David Bauer [Tue, 21 Dec 2021 12:24:14 +0000 (13:24 +0100)]
policy: only select candidates with better load
When kicking clients due to high channel load, explicitly only select
new candidates in case their channel load is an improvement over the
current node.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sun, 28 Nov 2021 22:20:48 +0000 (23:20 +0100)]
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>
David Bauer [Sat, 11 Dec 2021 11:48:10 +0000 (12:48 +0100)]
sta: remove duplicate code
Move the sta frequency-seen logic to usteer_sta_info_update.
This method is called on every occurence the seen frequency
is set now, thus removing the duplicate code.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sat, 25 Dec 2021 16:36:39 +0000 (17:36 +0100)]
policy: remove redundant candidate evaluation
It is not necessary to check if the candidate is not considered
reverse-better, as this is already done inside is_better_candidate for
all relevant criteria.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sat, 25 Dec 2021 16:25:38 +0000 (17:25 +0100)]
policy: fix not selecting better candidate on request
A unset bitmask leads to the candidate selection always return no
candidate, even if there is one.
To select a better candidate regardless of it's classification, provide
a bitmask containing all selection criteria.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Thu, 9 Dec 2021 22:13:39 +0000 (23:13 +0100)]
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>
David Bauer [Fri, 26 Nov 2021 00:36:43 +0000 (01:36 +0100)]
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>
David Bauer [Sun, 31 Oct 2021 09:59:31 +0000 (10:59 +0100)]
node: skip neighbors exceeding assoc-limit
When creating the list of neighbor reports, skip nodes which can't
handle additional STAs.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Mon, 18 Oct 2021 11:30:18 +0000 (13:30 +0200)]
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>
David Bauer [Fri, 15 Oct 2021 13:46:06 +0000 (15:46 +0200)]
policy: only select nodes with better signal when roaming
When determining a new node within the roam state machine, require the
destination node to have a better reported signal from the client.
Otherwise, the roam state machine might trigger a roam action for a
unsuitable destination node.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Mon, 25 Oct 2021 19:49:05 +0000 (21:49 +0200)]
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>
David Bauer [Mon, 25 Oct 2021 13:09:52 +0000 (15:09 +0200)]
local-node: update STA RRM capabilites
Save the RRM capabilities of STAs when updating clients from hostapd.
This is required to determine which measurement modes a STA supports.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Wed, 29 Sep 2021 17:17:11 +0000 (19:17 +0200)]
node: determine roamability when selecting neighbors
Currently, the neighbor report list is sorted based on the total amount
of roam actions to and from the specific foreign nodes.
This does not take into account that nodes might not be created at the
same time. When a popular neighbor node reboots, it's roam actions are
reset and it's ranking might not recover for a long amount of time
depending on how long the local node is already running.
Change this shotcoming to take into account the timestamp at which a
node was created. This way, the ranking depends on the amount of roam
actions relative to the nodes uptime / seen-time.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Wed, 29 Sep 2021 17:05:44 +0000 (19:05 +0200)]
node: save created time for node
Save the timestamp of the node creation. This is required to optimize
the selection of most-roamed to neighbors relative to their creation
time.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Fri, 1 Oct 2021 09:13:04 +0000 (11:13 +0200)]
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>
David Bauer [Tue, 28 Sep 2021 22:42:37 +0000 (00:42 +0200)]
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>
David Bauer [Mon, 27 Sep 2021 19:48:58 +0000 (21:48 +0200)]
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>
David Bauer [Mon, 27 Sep 2021 18:56:41 +0000 (20:56 +0200)]
sta-info: add last_connected field
Add a last_connected field to the sta_info struct. This field can be
used to determine, if and when a client was last connected to a given
node. This way, other nodes can determine where a client roamed to or
from.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sat, 23 Oct 2021 22:40:55 +0000 (00:40 +0200)]
remote: always re-schedule update timeout
This commit fixes updates not triggering due to a race-condition in
usteer.
When usteer does not yet have local-nodes when loading config, the
scheduled remote-update is not re-scheduled, leading to usteer only
exchanging node-messages on STA-events, leading to expiring remotes on
other remote nodes in low-event scenarios.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Fri, 29 Oct 2021 23:13:34 +0000 (01:13 +0200)]
remote: fix compilation with glibc
Fixes builds for the arc target.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Mon, 25 Oct 2021 12:52:59 +0000 (14:52 +0200)]
sta: schedule sta_info timeout on creation
The codes looks to have a race-condition, where disconnected sta_infos
are created without scheduling a timeout.
As sta_infos are not connected by default, schedule the timeout upon
sta_info creation.
Fixes spurious spamming of "Refuse to add an already expired station
entry" on remote nodes.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Mon, 18 Oct 2021 11:25:52 +0000 (13:25 +0200)]
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>
David Bauer [Mon, 18 Oct 2021 11:21:39 +0000 (13:21 +0200)]
ubus: introduce enum for beacon measurement mode
This improves code readability.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Fri, 15 Oct 2021 21:24:30 +0000 (23:24 +0200)]
policy: use correct reference signal
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sun, 3 Oct 2021 13:53:25 +0000 (15:53 +0200)]
policy: avoid creating kick loop for client
When checking whether a client is allowed to associate to a node, the
lower ceiling for kicking clients was not taken into account when
assoc-steering is disabled.
The problem behind this is, that a configured lower barrier for
disassociating clients (kicking) would kick the client immediatly after
association. In the worst scenario the client immediatly associates
again to the station and ends up in a kick loop.
Don't allow associating when a min_snr is configured and the client
signal is below this value.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Mon, 27 Sep 2021 17:35:55 +0000 (19:35 +0200)]
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>
David Bauer [Tue, 21 Sep 2021 14:41:23 +0000 (16:41 +0200)]
remote: include node BSSID into messages
Add the node BSSID to messages exchanged between usteer hosts. This way,
a foreign node can determine the node reported by a STA using beacon
reports.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Tue, 21 Sep 2021 14:02:16 +0000 (16:02 +0200)]
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>
David Bauer [Sun, 5 Sep 2021 16:05:49 +0000 (18:05 +0200)]
remote: fix memory leak on host removal
The host address is allocated on the heap, hence it has to be freed when
freeing the containing struct.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sun, 5 Sep 2021 16:03:21 +0000 (18:03 +0200)]
remote: fix incorrect use of strcmp result
When checking if the hostaddresses match up, the result returned from
strcmp was incorrectly evaluated. strcmp returns 0 in case both strings
match.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Tue, 7 Sep 2021 18:55:51 +0000 (20:55 +0200)]
gitignore: add .patch files
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sun, 5 Sep 2021 00:44:32 +0000 (02:44 +0200)]
gitignore: add vscode directory
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Sun, 15 Nov 2020 20:48:32 +0000 (21:48 +0100)]
contrib: add libpcap build dependency
Add a build dependency for libpcap, as it is required for the monitor
utility but not usteer itself. Use a build-dependency, as the monitor
utility executable is not packaged.
Signed-off-by: David Bauer <mail@david-bauer.net>
David Bauer [Tue, 21 Sep 2021 16:51:57 +0000 (18:51 +0200)]
local-node: don't read pointer after clear
The name pointer provided by ubus get's cleared after the first call to
ubus_register_subscriber in usteer_get_node. The leads to an incorrect
ifindex returned by if_nametoindex due to the 0 characters long string.
Work around this issue by reusing the interface name already stored in
the local node struct.
Fixes querying the wrong interface with netlink, resulting in incorrect
SSIDs used for the nodes.
Signed-off-by: David Bauer <mail@david-bauer.net>
Jan Braun [Sun, 5 Sep 2021 00:43:59 +0000 (02:43 +0200)]
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>
David Bauer [Wed, 8 Sep 2021 07:53:26 +0000 (09:53 +0200)]
remote: use port macro for destination port
Signed-off-by: David Bauer <mail@david-bauer.net>
Felix Fietkau [Wed, 7 Jul 2021 09:37:50 +0000 (11:37 +0200)]
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>
Felix Fietkau [Tue, 6 Jul 2021 17:50:02 +0000 (19:50 +0200)]
config: reduce remote node timeout to 10 update intervals
Even when there are network issues, we shouldn't keep stale data
around for so long
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Tue, 6 Jul 2021 17:44:01 +0000 (19:44 +0200)]
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>
Felix Fietkau [Tue, 6 Jul 2021 17:23:59 +0000 (19:23 +0200)]
ubus: add support for getting a list of remote hosts
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Felix Fietkau [Tue, 6 Jul 2021 17:14:36 +0000 (19:14 +0200)]
remote: track remote hosts as a separate data structure
Will be used to track host info
Signed-off-by: Felix Fietkau <nbd@nbd.name>