Commit graph

136 commits

Author SHA1 Message Date
Nick Hainke
e036905ae3 ci: fix workflow
OpenWrt switched to gcc-12.3.0.
2023-05-14 14:22:26 +02:00
Sviatoslav Sydorenko
9885d77a19 Swap broadcast/TCP port defaults in docs
This is a typo and the values are reversed in all other places in the code base.
2023-03-02 07:26:15 +01:00
Nick Hainke
51bb12caa2 network: remove outdated comment 2023-01-10 20:14:21 +01:00
Luca Passarella
a095a6f21d IP_MULTICAST_LOOP should be set to false/0
If IP_MULTICAST_LOOP is left to true/1 the dawn instance will send the packet out and then receive it itself, this will generate a 'Remote PROBE updated client / BSSID = XX:XX:XX:XX:XX:XX / YY:YY:YY:YY:YY:YY' after every 'Local PROBE used to update client / BSSID = XX:XX:XX:XX:XX:XX / YY:YY:YY:YY:YY:YY'
2023-01-10 20:12:51 +01:00
Nick Hainke
a2b1901000 ci: fix ci install packages and gcc version string
The package names changed to python3 and OpenWrt switched to gcc-12.
2023-01-10 13:49:00 +01:00
Flole998
da8d870d1e Network: Fix re-declaration of variable in smaller scope
Like this another variable is created and used within that if-block. The original final_msg stays NULL and sendto will always fail.
2022-11-02 12:30:59 +01:00
Flole998
15a6ce257f CONFIGURE.md: Fix spelling 2022-11-02 09:50:32 +01:00
Flole998
3646b1fac7 README.md: Fix spelling 2022-11-02 09:50:05 +01:00
Martin Matějek
3d09fe9cfa ubus: Rename "ubus_add_oject" function
Rename function `ubus_add_oject` -> `ubus_add_dawn_object` to avoid
confusion and potential collision with function `add_ubus_object` from
libubus.

Signed-off-by: Martin Matějek <martin.matejek@gmx.com>
2022-10-27 10:40:44 +02:00
Nick Hainke
9e8060ea09 network: rework network status callbacks
Exchange the code with the ustream example code:
https://git.openwrt.org/?p=project/ustream-ssl.git;a=blob;f=ustream-example-client.c;h=4fc99f0356bddef3a22b31bf64015579e8eea447;hb=HEAD#l72

Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-07-24 12:49:56 +02:00
Chen Minqiang
10fb04317b network: dump detail on ping pong received
This also fix a typo error on check_timeout on wrong list

Fixes: 47e98ef ("network: ping pong keepalive for tcp connections")

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2022-07-22 21:00:00 +02:00
Nick Hainke
bb362db2fa datastorage: fix ap_array_unlink_entry always returns NULL
For an unknown reason the entry that is returned in ap_array_unlink_entry
was always set to NULL. This commit changes the function so it returns the
ap that should be unlinked. This is needed to free the corresponding
memory that is allocated by the ap struct.

Thanks a lot to ptpt52 for reporting this issue.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-07-21 16:59:20 +02:00
Chen Minqiang
47e98efed6 network: ping pong keepalive for tcp connections
To make the tcp connections keepalive and better handle the timeout
of connections

con_timeout indicate the connection timeout and it is configurable

Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
2022-07-21 16:56:59 +02:00
Nick Hainke
eba03547a5 network: add timeout for client connections
Somtimes client connetions will not close therfore add a timeout. Add a
new timer that checks every 5s if we did not receive anything from a
client for (default) 60s. Can be configured via client_timeout.

Code is based on the work of ptpt52.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-07-21 16:56:59 +02:00
Eneas U de Queiroz
e596ff1317 ubus.c: only add nr entries matching our own SSID
The preferred neighbors list may have BSSIDs with different SSIDs.  Add
only those that match the interface's SSID.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
2022-07-18 17:50:50 +02:00
Nick Hainke
181549f7bb ubus: add missing lock for ubus hearing_map
In the build_hearing_map_sort_client there was a dawn_mutex_require
without having locked the mutex resulting in warnings:

  daemon.warn dawn: MUTEX require = 4226B8@ubus.c:2003[2012069248l] - appears to be UNLOCKED!
  daemon.warn dawn: MUTEX require = 4226B8@datastorage.c:694[2012069248l] - appears to be UNLOCKED!

I guess it was a typo, because before entering the
client_array_get_client function the mutex client_array_mutex needs to
be locked and not required.

Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-07-16 19:31:48 +02:00
Alexander Georgievskiy
4b7db09166 CONFIGURE.md: fix typo
[Nick: rephrase commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-07-07 08:04:40 +02:00
Nick Hainke
b3f61d4703 CONFIGURE.md: adjust documentation about log levels
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-07-04 14:43:00 +02:00
Nick Hainke
58861a1adb memory_utils: fix reallocation
Fixes errors in the form of:
  dawn: mem-audit: Releasing memory we hadn't registered (tcpsocket.c:142)...
  dawn: mem-audit: attempted to register memory already registered (M@tcpsocket.c:114)...

Fixes: 850a75c182 ("fix compilation with GCC12")

Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-13 22:51:28 +02:00
Ian Clowes
5d8df44a3a treewide: code and documentation cleanup
Tidy up a few bits of code - nothing very significant.
Documentation fixes and updates

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
8290138179 datastorage: Minor chnages to kicking algorithm to tidy up some handling.
[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
c212c5469f treewide: improve beacon/probe logging
Modifications to BEACON and PROBE handling to improve understanding of
RSSI and RCPI / RSNI values. Also address bugs in frequency / band handling.

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
92eac61d30 treewide: improve beacon request handling
Updated approach to sending BEACON REQUEST. Each AP asks every 802.11k
enabled client for the BEACON REPORT of a single other AP in the network
at N second intervals, where N is the refresh period / num-APs. N seconds
later the request is sent for the next AP.

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
359dd085aa datastorage/ubus: Add "soft" kicking algorithm
In addition to scored "hard" kick for all clients (inc. legacy), add a "soft"
kick for 802.11v aware clients by always asking them to  move if below
threshold RSSI, but with no mandatory disassociation.

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
d37a768766 treewide: RSSI / RCPI handling updates
Adjust how RSSI levels are shared and stored to help visibility of activity

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
c54cd95abe documentation: Parameter defaults and documentation
- Updated documentation files to describe parameters
- "Self-documenting" parameters added to code
- Parameter defaults revised
- Sample configuration file of defaults added

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
ba305bb2c2 treewide: cleanup code
- Remove some unused data fields
- Fix a few typos in comments, etc

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
8064e56899 scoring: improve scoring algorithm
- Simplify how score is tracked
- Streamline some code paths for scoring evaluation to reduce data searches, etc
- Allow more entries to be considered for AP NR

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
b7e3d6f34d treewide: cleanup code
- Revise some messages so meaning is clearer
- Fix some whitespace, etc
- Simplify a coiuple of small functions

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
829fa0faed kicking: improve kicking algorithm
- Tweak disassociate / kick NR code to reduce build overhead
- Add set_hostapd_nrdynamic == 2 to build of AP local station NR from what current clients hear elsewhere
- Tighten up hex string length usage for strncpy(), etc

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
60ea5b4daf treewide: improve mutex handling
- Add dawn_mutex_require() to indicate when code is accessing resources
- Use pthread_mutex_trylock() to actively test required mutex are locked

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
32d6d6d57d test: cleanup tests and add some test scripts
- Tighten up a bit of test path coding
- Add some test scripts (not fully revised for current code)

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
5b1eddc6f4 treewide: fix bugs from Coverity Scan
- Fix a couple of bugs in hardly ever (never?) used code paths that Coverity spotted
- Add comments for things that look a bit odd, but not sure if they are bugs

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
4a88222722 utils/storage: improve descriptions
Add messages that help users understand what PROBE and BEACON messages
are being used.
Remove a few things that are no longer needed: #includes, etc

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
39d7e838ae ubus: Simplify loops and scans in generating hearing map
[clean commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
be49c35686 treewide: rework mutex
Wrap mutex calls with traceable messages to help debugging resource locks.

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
0a962bea1f network: cleanup and improve network handling
- Merge encoded / plain messge handling to ensure fixes land in both
- Fix some potential resource leaks spotted by Coverity

[cleanup commit message]
[fix merge conflicts]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
0eca0fae0b utils: cleanup
- Simplify linked list search - code was unnecessarily complex for no benefit
- Refactored parse / kick logic to simplify functions

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
5d7f99dded utils/storage: cleanup
- New skipping linked list structure - possible bug in previous version
- Adjust some function names to better reflect what actually happens
- Remove redundant configurable sort elements
- Remove probe structure SSID field which is not set via BEACON, so is unreliable
- Adjust way the different fields from BEACON and PROBE reports are handled / merged
- Made client / BSSID paramater order consistent for probe / beacon functions to help avoid cut/ paste bugs
- Add RRM capability, RCPI and RSNI to client in hearing map (which is a summary of probe / beacon entries)

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
6bf3cd7754 ubus/datastorage/msghandler: cleanup
- Simplify linked list search - code was unnecessarily complex for no benefit
- AP record is uniquely identified by BSSID, so remove unnecessary search on SSID as well
- Change some data handling to simplify passing of records, pointers, etc
- Assure sort order to simplify generating network map
- Removed unused fields for collision domain and bandwidth

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
6e03e37ce8 datastorage: improve linked list
- Simplify linked list search - code was unnecessarily complex for no benefit
- Adjust some MAC address handling to simplify code

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
160ccf8917 ubus/datastorage: cleanup
- Remove the linked list of rejected auth / assoc as it was not used for any decision making
- Rename auth_req to client_req as it is also used by association requests

[cleanup commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
8bae43c811 utils: cleanup
Move some RRM utility functions around to simplify code structure / #includes.

[fix commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 20:27:20 +02:00
Ian Clowes
0e4fc507cb documentation: Heavily revised Markdown documentation files:
- README.md: Top level intro
- INSTALL.md: Typical user installation
- CONFIGURE.md: Detailed description of how parameters work together, and how to set each one
- DEVELOPER.md: How to build a local version, some notes on dev time "helpers", etc

[fix commit message]
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-11 19:36:31 +02:00
Rosen Penev
850a75c182 fix compilation with GCC12
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-06-09 07:59:49 +02:00
Nick Hainke
2ac7b9d408 workflow: fix workflow
Signed-off-by: Nick Hainke <vincent@systemli.org>
2022-06-09 07:57:27 +02:00
Stijn Tintel
2bfd7397e1 ubus: use bss_transition_request
OpenWrt's hostapd now supports the more generic "bss_transition_request"
method that allows initiating a BSS transition request with the
Disassociation Imminent bit not set. Use this new method instead of
"wnm_disassoc_imminent" so that the old method can be removed.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2022-05-09 15:53:04 +02:00
Ian Clowes
7a72674063 datastorage/ubus: rework kicking algorithm
Refresh of kicking algorithm to minimise messages and streamline some code.
Removed decide_function() which made some logic hard to follow.
Removed kick_client() function to streamline code.
Revised kicking algorithm code to give better user messages.

Signed-off-by: Ian Clowes <clowes_ian@hotmail.com>
2022-01-17 10:10:47 +01:00
Ian Clowes
877e2dc22f iwinfo: fix get_bandwidth_iwinfo
Bug that was preventing kicking working due to mishandling of bandwidth
discovery. Fixed bug in use of get_bandwidth_iwinfo() in AP kicking.
Fix rounding of transmission rate calculations in
get_bandwidth_iwinfo().
Restructure of get_bandwidth...() while finding bug.

Signed-off-by: Ian Clowes <clowes_ian@hotmail.com>
2022-01-17 10:10:47 +01:00
Ian Clowes
9ce01ecce5 datastorage: fix multi-SSID
Bug that could proably cause ineffciency or confusion in multi-SSID
environments.
Adjusted erroneus match test in ap_array_insert().

Signed-off-by: Ian Clowes <clowes_ian@hotmail.com>
2022-01-17 10:10:47 +01:00