24 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
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
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
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
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
d0cd65b762 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>
2021-11-25 22:28:41 +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
6a20591b20 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>
2021-11-25 22:24:33 +01:00
David Bauer
681354256f 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>
2021-10-30 01:14:46 +02:00
David Bauer
d7833e14ef remote: fix compilation with glibc
Fixes builds for the arc target.

Signed-off-by: David Bauer <mail@david-bauer.net>
2021-10-30 01:14:11 +02:00
David Bauer
30f9ba7617 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>
2021-10-15 15:49:50 +02:00
David Bauer
fc1fadf5eb 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>
2021-09-21 19:48:16 +02:00
David Bauer
bee7c7e0df 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>
2021-09-21 19:47:56 +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
David Bauer
a52de0ff20 remote: use port macro for destination port
Signed-off-by: David Bauer <mail@david-bauer.net>
2021-09-21 14:58:23 +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
07a2f767e5 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>
2021-07-06 19:50:05 +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
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
d10731f806 usteer: Initial import
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2020-11-12 15:37:10 +01:00