Commit Graph

483 Commits

Author SHA1 Message Date
Herbert Wolverson
433e7ac877 Consolidate hex string to u32 conversion
Rather than having lots of "cpu.replace("0x", "").str_radix(...)
calls around, move to a single, unit-tested function in lqos_utils
and use it repeatedly.
2023-03-03 14:17:31 +00:00
Robert Chacón
308453fecf
Update integrationSplynx.py 2023-03-02 21:21:40 -07:00
Robert Chacón
55ca0adcf0
Update integrationSplynx.py 2023-03-02 10:24:58 -07:00
Robert Chacón
765056f8be
Update integrationSplynx.py 2023-03-02 10:22:40 -07:00
Herbert Wolverson
dca743850a Fix redacting of individual IPs in web console. 2023-03-02 14:41:37 +00:00
Robert Chacón
cae04e1930
Update integrationSplynx.py 2023-03-01 19:34:03 -07:00
Robert Chacón
b33951a8fb
Update integrationSplynx.py 2023-03-01 17:54:51 -07:00
Robert Chacón
eb02c95688
Fix https://github.com/LibreQoE/LibreQoS/issues/273#issuecomment-1451049170 2023-03-01 17:51:59 -07:00
Herbert Wolverson
44ddde6cc5 After coffee, I realized the previous commit had a bug - this should take care of removing comments altogether by mistake. 2023-03-01 15:08:22 +00:00
Herbert Wolverson
ca2cb0dcec Update cargo.lock versions again 2023-03-01 14:51:39 +00:00
Herbert Wolverson
f4a92b59fd Oops - mark # as a char, not a string. 2023-03-01 14:43:20 +00:00
Herbert Wolverson
1467211158 Fix double interfaceA in setup generated configuration files.
This one was pretty funny. Any line that contained interfaceA in
ispConfig.example.py was transformed into an interfaceA statement.

I forgot to check for comments, so the comment on how to use
onAStick configuration *also* generated an interface statement.

It now just copies comments verbatim.
2023-03-01 14:42:05 +00:00
Robert Chacón
da42238332
Fix related to https://github.com/LibreQoE/LibreQoS/issues/273
Ensure client is active before attempting to pull plan info
2023-02-27 16:55:28 -07:00
Dave Taht
9b0313a942 build-rust to build_rust
Fixes: #276
2023-02-27 08:46:16 -08:00
Dave Taht
6671eb7c64 Updated copyrights to 2022-2023
Someday I hope something other than my amazing sed skills will be
of use in refactoring this project.
2023-02-25 15:46:32 -08:00
Herbert Wolverson
c73af2de89 Auto include a MOTD script to remind the user that they have installed LibreQoS and how to get to the web UI. 2023-02-24 18:55:44 +00:00
Herbert Wolverson
b98417282a Trim dependency list in .deb to not include development/build only dependencies, fix an oops with quoting an integer. 2023-02-24 18:19:25 +00:00
Herbert Wolverson
6eb9c80a3b Update Cargo.lock to latest versions 2023-02-24 17:41:51 +00:00
Herbert Wolverson
4ddf665e14 Fix name that should have been 2023-02-24 17:37:43 +00:00
Herbert Wolverson
2b8ed7ef1f Cleanup path error message (wasn't doing anything) from build_dpkg 2023-02-24 17:34:40 +00:00
Herbert Wolverson
1f5629a8c3 Tweak to previous commit: I didn't intend to filter out no-RTT
hosts from the top downloaders list, since they might be
non-TCP traffic.
2023-02-24 15:02:57 +00:00
Herbert Wolverson
6b82fd968e Fix RTT outliers
1) When calculating median latency, reject any entry that doesn't
   have at least 5 data points. From local testing, 5 appears
   to be the magic number (when combined with sampling time) that
   ignores the "idle" traffic from CPEs, routers and long-poll
   sessions on devices.

2) Filter out RTT 0 from best/worst reports.

3) Note that no data is discarded - it's just filtered for display.

This results in a much cleaner display of RTT times in the
reporting interface, giving a much better ability to "zero in"
on problem areas without being distracted by poor RTT - but
basically no traffic - hosts that are idle.
2023-02-24 14:53:47 +00:00
Herbert Wolverson
791ff97eef Update DPKG build script to use version numbering from date
to handle nightly or similar builds and always increase the
build number for upgrades.
2023-02-21 20:56:46 +00:00
Herbert Wolverson
3e9ff0c0f5 (Very alpha!) Add dpkg builder and initial configurator
* Adds a new Rust program, `lqos_setup`.
    * If no /etc/lqos.conf is found, prompts for interfaces and
      creates a dual-interface XDP bridge setup.
    * If no /opt/libreqos/src/ispConfig.py is found, prompts
      for bandwidth and creates one (using the interfaces also)
    * Same for ShapedDevices.csv and network.json
    * If no webusers are found, prompts to make one.
* Adds build_dbpkg.sh
    * Creates a new directory named `dist`
    * Builds the Rust components in a portable mode.
    * Creates a list of dependencies and DEBIAN directory
      with control and postinst files.
    * Handles PIP dependencies in postinst
    * Calls the new `lqos_setup` program for final
      configuration.
    * Sets up the daemons in systemd and enables them.

In very brief testing, I had a working XDP bridge with
1 fake user and a total bandwidth limit configured and
working after running:

dpkg -i 1.4-1.dpkg
apt -f install

Could still use some tweaking.
2023-02-21 20:26:34 +00:00
Jarosław Kłopotek - INTERDUO
71f75cc6c3 improvement: add +x for lqTools.py 2023-02-16 15:41:27 +01:00
Herbert Wolverson
da44d38888 Temporary: mark --updateonly as unavailable if OnAStick
The partial reload mechanism *really* doesn't work with OnAStick
configurations at present. There's a lot of work required to make
it function. In the meantime, warn the poor user that this
isn't going to work.

Affects ISSUE #129
2023-02-15 17:14:29 +00:00
Herbert Wolverson
e7d7429058 Fix partial reload in LibreQoS.py for NOT OnAStick mode
OnAStick mode is still broken for partial updates. The
`addDeviceIPsToFilter` function was referencing circuit
information (the class_id) that wasn't present in the
partially reloaded data.

Changed shell call to call `add_ip_mapping` which accesses
the bus directly, saving a shell call.

Part of ISSUE #239 - does not fix it for "on a stick"
configurations.
2023-02-15 17:04:29 +00:00
Herbert Wolverson
54d9fa99a5 Improve error messaged when parsing IPs for iphash_to_cpu/Python
Display the offending string as well as the general "Class id must
be in the format (major):(minor), e.g. 1:12.

May help with diagnosing #239 (since "Error: Class id..." is the
only visible error message.
2023-02-15 15:24:11 +00:00
Herbert Wolverson
f8f438e8d7 Add Python Version Check to Python Scripts
ISSUE #204 : Running on versions prior to 3.10 will fail, due to
the use of `match` statements. Other parts of the script assume
a recent Python also, and the system as a whole expects a recent
version of Ubuntu.

`pythonCheck.py` polls `sys.version_info` to detect the in-use
version of Python. If the version is prior to 3.10, it bails out
with the message "LibreQoS requires Python 3.10 or greater".

This should help with outdated OS detection in general.
2023-02-15 15:00:53 +00:00
Herbert Wolverson
85caa6be19 Stop using unicode extended characters in lqtop
Remove the up and down arrows that render strangely in fonts
that don't support full unicode graphics. Add text UP/DOWN
headings instead.

FIXES #266
2023-02-15 14:41:41 +00:00
Herbert Wolverson
088f608614 #229 - Run cargo fmt to format everything. 2023-02-14 22:06:57 +00:00
Herbert Wolverson
6fe97e97b6 an atomic compare_exchange. 2023-02-14 21:36:16 +00:00
Herbert Wolverson
dcb0ae8444 Add an additional NUM_CPUS atomic to store the actual size. CPU
utilization is updated in a lock-free array of atomics. Another
lock removed (and another unmeasurably small gain)
2023-02-14 21:27:37 +00:00
Herbert Wolverson
c0f83dbc51 Replace MEMORY_USED RwLock'd array with a pair of atomic u64s,
for a non-noticeable performance improvement.
2023-02-14 21:01:10 +00:00
Herbert Wolverson
8f7293760c Just directly initialize the atomic bool. 2023-02-14 20:41:43 +00:00
Herbert Wolverson
c096226665 ISSUE #229 - Change "reload required" from a lock with a bool inside
to a proper atomic bool, for a completely unnoticable performance
improvement.
2023-02-14 20:37:09 +00:00
Dave Taht
a58ce5cd0b Finished conversion to lqusers from webusers
Note that you will need to regenerate the webusers.toml file
after this.

Part of my motivation for this is that this file is not strictly
for governing web permissions in the future.
2023-02-09 15:26:27 +00:00
Dave Taht
8ba5aed14e lqusers: change name of web admin tool from webusers to lqusers
lqusers is consistent with the prefix used elsewhere in LibreQos.

Something one character shorter than that came to mind, but
I resisted.
2023-02-09 15:21:02 +00:00
Herbert Wolverson
51c369b9b5 Update dependencies. 2023-02-09 14:36:47 +00:00
Herbert Wolverson
32a75bde0f ISSUE #258 - Specifically ignore [idForCircuitsWithoutParentNodes] in queueingStrucutre.json 2023-02-09 14:15:56 +00:00
Herbert Wolverson
11644dd1f1 #258 - Unrecognized node in queueingStructure.json generates a warning and continues rather than aborting hard. This makes it a lot more tolerant of anything changing. 2023-02-09 14:15:06 +00:00
Herbert Wolverson
787344e8f4 Fix typo I noticed in #258 - incorrect file name referenced in error message. 2023-02-09 14:14:28 +00:00
Dave Taht
b1f2bfb053 fix Spelling error in example
Fixes: https://github.com/LibreQoE/LibreQoS/issues/262
2023-02-09 11:51:33 +00:00
Robert Chacón
fa8d67c554
Fix https://github.com/LibreQoE/LibreQoS/issues/252 2023-02-08 20:48:05 -07:00
Dave Taht
04f1f4c2cb webusers: correct usage message 2023-02-09 02:44:39 +00:00
Dave Taht
79db32ff99 Proper spelling and quoting 2023-02-08 19:52:28 +00:00
Dave Täht
679c5e9a3a
Merge pull request #260 from interduo/patch-28
improvement: add tuning of performance governor
2023-02-08 11:50:56 -08:00
Dave Taht
71988e6046 Updated copyright message: It is 2023 now
At least it was when last I looked
2023-02-08 15:56:09 +00:00
Interduo
1904fb4690
improvement: add tuning of performance governor 2023-02-08 16:22:56 +01:00
Trendal Toews
2ff6284a6b login page enter key action 2023-02-08 06:56:31 +00:00
Robert Chacón
46457878a0
Fix https://github.com/LibreQoE/LibreQoS/pull/257 2023-02-07 06:38:20 -07:00
Robert Chacón
20567736d7
Update TESTING-1.4.md 2023-02-07 06:29:04 -07:00
Robert Chacón
4caf9712cf
Fix https://github.com/LibreQoE/LibreQoS/issues/252 2023-02-07 06:24:49 -07:00
Dave Täht
f89e2d5847
Merge pull request #251 from interduo/patch-26
improvement: make systemd unit services managing by one command and n…
2023-02-07 04:52:47 -08:00
Robert Chacón
ff40478eee
Fix https://github.com/LibreQoE/LibreQoS/issues/255 2023-02-06 19:44:48 -07:00
Robert Chacón
dee2c465be
Fix https://github.com/LibreQoE/LibreQoS/issues/253 2023-02-06 19:22:51 -07:00
Robert Chacón
ab1de300b1
Fix https://github.com/LibreQoE/LibreQoS/issues/254 2023-02-06 18:43:51 -07:00
Interduo
41c6c3c3bb
improvement: make systemd unit services managing by one command and not three 2023-02-06 13:49:30 +01:00
Robert Chacón
ee30dc027e
Update TESTING-1.4.md 2023-02-04 20:00:40 -07:00
Robert Chacón
6e4d17679a
Switch to linear interpolation for better visualization 2023-02-04 19:32:56 -07:00
Robert Chacón
65a62c7a50
Update TESTING-1.4.md 2023-02-04 18:29:58 -07:00
Robert Chacón
1a5f7dc2b9
Update TESTING-1.4.md 2023-02-04 18:28:14 -07:00
Robert Chacón
79259f415d
Update TESTING-1.4.md 2023-02-04 18:25:30 -07:00
Robert Chacón
205ec17375
Use advanced scheduler by default 2023-02-04 11:27:28 -07:00
Robert Chacón
433ffe6a7b
Delete schedulerAdvanced.py 2023-02-04 11:26:39 -07:00
Robert Chacón
2e19535838
Update TESTING-1.4.md 2023-02-04 09:33:30 -07:00
Robert Chacón
10771625ed
Create lqos_scheduler.service.example 2023-02-04 08:50:06 -07:00
Robert Chacón
d007b54162
Fix 0 values not being sent 2023-02-04 03:37:25 -07:00
Robert Chacón
d22ac8a73b
Improve documentation of useBinPackingToBalanceCPU 2023-02-04 03:28:34 -07:00
Robert Chacón
d1fda9290a
Fix cases where Nodes >= CPU Cores
Previously, generated parent nodes aka generatedPNs (which hold ShapedDevices without a defined Parent Node) would reside on the last few cores of the CPU. A problem became apparent here where if an operator had more Top Level Parent Nodes defined in network.json than CPU cores, there were no CPU cores left to use for generatedPNs. With this change, generatedPNs are created for each CPU core. Additionally, to reduce verbosity of the console output, the warning "uploadMax of Circuit ID exceeded that of its parent node." has been changed to an info log.
2023-02-04 03:15:58 -07:00
Herbert Wolverson
d688522c13 Hide UI elements for features that aren't ready yet. 2023-02-03 15:51:59 +00:00
Herbert Wolverson
89b2eafda7 Fix node manager not letting you run bandwidth tests from child displays. 2023-02-03 14:38:35 +00:00
Herbert Wolverson
b2be48da8a Merge branch 'main' of https://github.com/LibreQoE/LibreQoS 2023-02-03 14:32:13 +00:00
Herbert Wolverson
08cc2f6415 Fix node manager not letting you run bandwidth tests from child displays. 2023-02-03 14:31:58 +00:00
Robert Chacón
b89f5254c6
Update graphInfluxDB.py 2023-02-02 21:46:24 -07:00
Robert Chacón
4acfb77ea8
Update scheduler.py 2023-02-02 21:45:45 -07:00
Dave Taht
f636cd9ff0 lqtop: make more room for large rtts
IPv6 is a max of 40 characters, so I cut the allowed space to 42.
That gave room to have multi-second long observable RTTs in the
RTT segment.

Compile tested only. A slightly better approach might be to
display time in ns/us/ms/s.
2023-02-02 20:40:45 +00:00
Herbert Wolverson
48b75a9b10 Fix spelling of 'Environment' 2023-02-02 18:03:31 +00:00
Herbert Wolverson
dc259fb5c8 Rework the file watcher to restart the watcher after firing.
Sometimes the watcher persists, sometimes it doesn't. This is
awful behavior. Work around by looping the watcher and returning
after it fires - restarting the watch process. This has the
added advantage of handling "file deleted" gracefully.

When ShapedDevices cannot be read, an empty set is loaded so
its obvious on the web UI that there is an issue.

In testing, I've been through a bunch of "break shaped devices",
"unbreak shaped devices" and seen the data come and go correctly
now.

ISSUE #239
2023-02-02 15:38:13 +00:00
Herbert Wolverson
7a18099587 Correct ordering of validation checks in LibreQoS.py
The Rust validator was running, and the very next line set the
result to success irregardless of the result. Move the validation
initialization to the top.

ISSUE #240
2023-02-02 14:29:21 +00:00
Herbert Wolverson
2926fa5c7a Add "trim(always)" to CSV decoder. Whitespace between comma
separated items will no longer cause validation issues - excess
whitespace is automatically trimmed at the beginning and end
of comma separated entries before parsing.

First part of ISSUE #240
(Fixing the validation issue rather than the actual cause)
2023-02-02 14:26:57 +00:00
Herbert Wolverson
27debaf0f1 Update to latest rustc syntax. Since we're now updating Rust,
take advantage of some of the newer Rust syntax formats
(mostly syntax sugar on format! macros).
2023-02-02 14:17:59 +00:00
Herbert Wolverson
715829cc9a Add 'rustup update' to the build chain. 2023-02-02 14:10:06 +00:00
Herbert Wolverson
30a6a2c5c5 Revert my truly awful decision to try and run LibreQoS.py during
lqosd startup (after checking that config files existed). It
made startup unstable.
2023-02-02 14:08:20 +00:00
Herbert Wolverson
911f107f3f Add a delay when starting the polling thread in lqos_node_manager
to let the server finish starting.

The delay is in the polling thread, not global - so it doesn't
cause a stall, or affect data access. The ringbuffer will be
slightly delayed in starting (and show zeroes until then).

Testing shows no more logged messages on reboot.

ISSUE #235
2023-02-01 22:29:55 +00:00
Herbert Wolverson
cb3fa889fb ISSUE #229 - Use checked add with 0 default when adding packet counters. 2023-02-01 20:00:32 +00:00
Herbert Wolverson
e2508a6e57 ISSUE #229 - More saturating_sub instead of just subtracting to avoid underflows. 2023-02-01 19:54:53 +00:00
Herbert Wolverson
309b399a56 ISSUE #229 - Add division by zero guard to the busy_quantile function. 2023-02-01 19:51:15 +00:00
Herbert Wolverson
5d709da7b0 Fix lqtop compilation with new crossterm. 2023-02-01 19:23:02 +00:00
Herbert Wolverson
38a2a78062 Finish Rust package update cycle per ISSUE #229 2023-02-01 19:13:23 +00:00
Herbert Wolverson
8864ebab70 Work around stupid type implementation in the latest sysinfo version. 2023-02-01 19:07:28 +00:00
Herbert Wolverson
175b833d96 Fix build issue from new version of system, another try at CI. 2023-02-01 18:56:58 +00:00
Herbert Wolverson
d198c0feac Update Tokio and all dependency versions based on local run
of cargo audit and cargo outdated.

Part of ISSUE #229
2023-02-01 18:44:38 +00:00
Herbert Wolverson
7b1c285afa Adjust build_rust.sh to build to separate files and then move
into running files to avoid service interruption. The script
detects if you are using systemd (with the default names) and
will restart the services at the end of the process - for a
very brief interruption rather than several minutes.

Also suppresses pushd/popd output.

Related to ISSUE #208
2023-02-01 17:53:15 +00:00
Herbert Wolverson
9ad1de6ef5 Add safegaurd against running LibreQoS.py more than once at a time.
ISSUE #52

* Added file locking commands to the Python/Rust library.
* When LibreQoS.py starts, it checks that /var/run/libreqos.lock
  does not exist. If it does, it checks that it contains a PID
  and that PID is not still running with a python process.
* If the lock file exists and is valid, execution aborts.
* If the lock file exists and is invalid, it is cleaned.
* Cleans the lock on termination.
2023-02-01 17:09:42 +00:00
Herbert Wolverson
d71f41033c If ShapedDevices and ispConfig are in good shape, try to run LibreQoS.py when lqosd starts to avoid running with no queues. 2023-02-01 16:26:50 +00:00
Herbert Wolverson
3a9e72901b Correct issues with failing to collect data when started at
boot time. ISSUE #235 . Also relevant to ISSUE #209

* Discovered that the BOOT_TIME clock can fail if called
  immediately after boot.
* Refactored time fetching functions into `lqos_utils` with
  proper error wrapping.
* Adjusted unknown IP expiration to issue a bus response of
  "not ready yet" if the boot time clock is not available.
* Adjusted unknown IP expiration to handle 5-minutes in the
  past being a negative number.
* Adjusted queue collection to suggest that you run
  LibreQoS.py if queues don't exist - and fail gracefully,
  without causing a hitch.
2023-02-01 16:08:31 +00:00
Herbert Wolverson
d77fffe4f5 ISSUE #234
Remove the unused feature from notify. We actually moved notify
into a single crate (as opposed to all over the place) in
816ca7e651

As of this commit, build_rust runs without warnings.
2023-01-31 22:34:14 +00:00
Herbert Wolverson
dce8d76d9c Applied 'cargo fmt' to all files, forcing equal formatting for all. 2023-01-31 22:23:55 +00:00
Herbert Wolverson
51cf5d51fa ISSUE #209 General soundness check, assisted with clippy (linter).
* Corrected a lot of small issues like passing a string when a char
  will be (marginally) faster.
* Cleaned up single-arm match statements for the much more compiler
  friendly if let.
* Combined nested if statements.
* Cleaned all remaining unchecked unwrap() calls.
2023-01-31 22:22:05 +00:00
Herbert Wolverson
74101655d8 ISSUE #209 - Full error pass on lqos_queue_tracker module
* Replace every value unwrap with unwrap_or to not panic.
* Replace Anyhow errors with specific errors and log entries.
2023-01-31 21:31:03 +00:00
Herbert Wolverson
982e7314c1 Thorough error-handling pass on lqos_bus crate.
ISSUE #209

Replace "anyhow" with "thiserror". Add logging for all errors,
and only allow pass-through for errors that have already been
converted to a local error type and reported.
2023-01-31 19:33:22 +00:00
Herbert Wolverson
816ca7e651 Refactor the multiple "notify" systems into a single helper
structure.

* Creates FileWatcher, in lqos_utils.
* Removes "notify" dependency from other crates.

FileWatcher is designed to watch a file. If the file doesn't exist,
then an optional callback is called - and the watcher waits,
periodically checking to see if the file has appeared yet. When the
file appears, another optional callback is executed.

Once the file exists, a `notify` system is started (it uses Linux's
`inotify` system internally) for that file. When the file changes,
the process sleeps briefly and then executes an `on_change` callback.
Further messages are then suppressed for a short period to avoid
duplicates.

All uses of notify have been updated to use this system. Errors are
handled cleanly, per ISSUE #209.
2023-01-31 17:52:35 +00:00
Herbert Wolverson
3e4e7ebe64 Another chicken/egg issue:
* ShapedDevices.csv may not exist on first run.
* This previously caused lqos_node_manager to emit a hard error
  and not show any shaped devices at all.

To rectify this:

* ShapedDevices in-memory starts as an empty set.
* When the "watcher" spawns, if the file exists then ShapedDecices
  is loaded.
* If the "watcher" can't find ShapedDevices, it sleeps periodically
  looking for the file to be created. Once created, it loads it
  and starts the change monitor.
2023-01-31 16:26:54 +00:00
Herbert Wolverson
c911d8c190 Fix a chicken & egg problem with queueingStructure.json monitor
ISSUE #209

Using the inode watcher on a file that doesn't exist fails, and
was previously failing silently! This would result in queue
mappings not updating when LibreQoS.py was executed - even though
the queueingStructure.json file became available.

* Replace "anyhow" with specific errors.
* Track and log each step of the file monitor process for
  queueingStructure.json
* If the watcher cannot start because the file doesn't exist,
  the watcher loop sleeps for 30 seconds at a time (to keep
  load very low) and checks if the file exists yet. If it does,
  it loads it and then commences watching.
2023-01-31 15:49:29 +00:00
Herbert Wolverson
6f00386d61 Rename function to match what it does (copy/paste issue) 2023-01-31 15:22:23 +00:00
Interduo
5e02885c5b
improvement: allow easily to turn on debugging 2023-01-31 16:12:30 +01:00
Interduo
bd7f9a4a12
improvement: allow easily to turn on debugging mode 2023-01-31 16:11:32 +01:00
Herbert "TheBracket
bb9b911491
Merge pull request #232 from interduo/patch-22
bugfix: propper path and remove many sudo
2023-01-31 06:32:41 -08:00
Interduo
670d3dafe3
improvement: its better to use one sudo here
(than many times sudo inside script remove_pinned_maps.sh)
2023-01-31 14:46:46 +01:00
Interduo
ebc2162efe
lqos_node_manager systemd unit file add require and after lqosd 2023-01-31 11:48:01 +01:00
Herbert Wolverson
39e2689707 ISSUE #209: CSV ShapedDevices reader now uses this_error format for more specific errors and contains more logging. 2023-01-30 22:44:22 +00:00
Herbert Wolverson
e5500cf528 ISSUE #209: add detailed errors and logging to the program control system in lqos_config. Some errors should be impossible. 2023-01-30 22:10:54 +00:00
Herbert Wolverson
bfe9394faa ISSUE #209: add detailed errors and logging to theauthentication manager in lqos_config. 2023-01-30 22:05:12 +00:00
Herbert Wolverson
2735419320 ISSUE #209 : Add full error checking and custom error types to libre_qos_config.rs 2023-01-30 18:28:45 +00:00
Herbert Wolverson
a29391c25c ISSUE #209 : Add full error checking and custom error type to EtcLqos load system. 2023-01-30 17:57:15 +00:00
Herbert Wolverson
ee20023027 Refactor fd timer wait into a "periodic" function in lqos_utils,
only available for non-async use at this time. Adjust the two
non-async usages of timer-fd based timers to use the more
canonical setup.
2023-01-30 17:45:17 +00:00
Herbert Wolverson
7d32c720f0 Rocket web server's ring-buffer update timer is now a Linux
file descriptor.

* Remove the Tokio timer system.
* Replace with Linux's timer fd system.
* Add a watchdog to alert if we've somehow overrun the timer.
2023-01-30 17:22:28 +00:00
Herbert Wolverson
5aa90ee692 Switch bandwidth monitor thread to use linux timer file descriptors
* Replace Tokio timers in the bandwidth/throughput monitor with
  Linux timer file descriptors API.
* Instead of spawning a Tokio process, spawn an independent
  thread for the bandwidth monitor.
2023-01-30 17:09:29 +00:00
Herbert Wolverson
cc7f845f82 Remove info log for no queues to track, it's the normal expected behavior. 2023-01-30 17:04:14 +00:00
Herbert Wolverson
6b6bdc1395 Improved queue watching system
* Queue timing is now provided by Linux "timer file descriptors"
  instead of Tokio timers.
* Added an atomic bool to track "we're going faster than we should"
  (it's true while executing), skip cycles if we ran out of time and
  issue a warning.
* Queue tracking is no longer async, but is locked to its very own
  thread.
* Queue watcher is now more verbose about any issues it encounters.
* Queue structures with children will now correctly track all the
  children, avoiding the blank queue data issue.
2023-01-30 16:55:42 +00:00
Interduo
2e25acc086
bugfix: propler path and remove many sudo
As It could be replaced by only one command: sudo remove_pinned_maps.sh
2023-01-30 17:54:17 +01:00
Herbert Wolverson
2486355c1d Remove unused variable (and warning) in lqtop 2023-01-30 15:29:10 +00:00
Herbert Wolverson
234697bc29 Fix warning in json.rs benchmark. 2023-01-30 15:28:49 +00:00
Herbert Wolverson
ec5baaf866 Move netlink-testing out of main - it's in a branch, where it belongs. 2023-01-30 15:28:23 +00:00
Robert Chacón
55d85d302b
Update lqos.example 2023-01-29 21:17:05 -07:00
Robert Chacón
0fe7e28ce8
Update TESTING-1.4.md 2023-01-29 20:50:05 -07:00
Dave Taht
4e68ecc205 Some notes regarding good error handling
Bug #209, among others.
2023-01-29 19:45:36 -08:00
Dave Taht
7c18da1953 A few other thoughts 2023-01-29 19:31:47 -08:00
Dave Taht
4b097defa9 More comments wanted on and in lqos.conf.new.discuss 2023-01-29 19:12:47 -08:00
Dave Taht
6c7548c77e More fixes for how the conf file should work.
It was hilarious that I already missed the new "bridge"
section in my first attempt. Imagine what it is like for the
users?

Pithy notes:

I think this is an artifact of history, as a bool.

disable_rxvlan = true
disable_txvlan = true

There are a zillion other options in ethtool -h for
coalesing things, besides this.

disable_offload = [ "gso", "tso", "lro", "sg", "gro" ]
2023-01-29 18:22:42 -08:00
Dave Taht
6c81a2a8c1 Trying to unify configuration variables somewhat
We have a lot of configuration stuff, written in several very
different styles. We have hidden knowledge (like port numbers)
buried elsewhere. We have overly wordy variables names, and not
clear separation of each concept. We have a need to keep some
data secure (passwords to the apis), and others, need to be common.

Ideally there would be more of a secrets file for secrets to
point to, on the security case.

Having one file to rule them all is not exactly the right way
forward, but parsing one file *format* might prove simpler.

Please, everyone, think about how to best to express oneself,
I took a stab at it via this commit.
2023-01-29 09:52:58 -08:00
Robert Chacón
8d59d0594d
Solved https://github.com/LibreQoE/LibreQoS/issues/206 2023-01-29 07:44:58 -07:00
Dave Taht
ea40e6293c Put arrows in the summary spans
Still would like a format like

LIBREQOS MONITOR UP OTHER STATUS INFO and the summary down/up stats to
line up with the table below it.
2023-01-29 07:10:11 +00:00
Dave Taht
e175f15845 lqos_utils: Scale bits/s relative to gbit/s etc
Essentially right justify these functions.
2023-01-28 18:33:53 -08:00
Herbert Wolverson
0e97e6a868 Attempting to resolve issues with lqos_node_manager not seeing
statistics, while lqtop still works.

1) Add warning and error logging to lqos_node_manager if any
   part of the statistics gathering process fails.
2) (Hopefully temporarily) use the non-persistent bus client,
   again logging any issues.
3) Improve the statistics gathering timer code.
2023-01-27 19:47:19 +00:00
Herbert Wolverson
fcad4fa90a Remove warnings from lqtop 2023-01-26 20:50:12 +00:00
Herbert Wolverson
6e92a07a00 Fix panic in LibreQoS.py on update if an IP address mapping needed
deleting.

* Adjust the Python integration `delete_ip_mapping` function to
  not require a secondary "upload" parameter - because the
  Python code is unaware of whether there needs to be a
  separation of the two at this point.
* Change ENOEXIST return code in BPF map delete to NOT be an
  error - it indicates that there was nothing to do, rather
  than something not working.
2023-01-25 22:59:06 +00:00
Herbert Wolverson
a88dd8fe5e #183 - Hide memory status panel on sizes smaller than 'large' 2023-01-25 17:34:48 +00:00
Herbert Wolverson
74116e97e8 Fix crash when queuingStructure.json contains [children] entries.
Affects ISSUE #206

* Add a blank node for [children] in the QueueNode parser.
* Add two unit tests to cover loading content with and without
  [children] entries.
2023-01-25 17:03:21 +00:00
Robert Chacón
9e0725c02c
Merge pull request #227 from LibreQoE/attemptFix3235
Fix for #214
2023-01-25 08:32:05 -07:00
Robert Chacón
92047e9f0a
Omit refreshLatencyGraphs() until reintroduced later 2023-01-25 05:10:40 -07:00
Robert Chacón
aacf6b058e
Update LibreQoS.py 2023-01-25 05:01:18 -07:00
Robert Chacón
e2bd517881
Fix bug: import logging module 2023-01-24 20:24:09 -07:00
Robert Chacón
d25dfd1b87
Resurrect lqTools.py. Not yet compatible with OnAStick mode. https://github.com/LibreQoE/LibreQoS/issues/52 2023-01-24 20:19:14 -07:00
Herbert Wolverson
ecdf4e3baf Python linter caught an error - should be fixed (oddly, it ran). 2023-01-24 18:35:06 +00:00
Herbert Wolverson
4632839177 Merge branch 'main' of https://github.com/LibreQoE/LibreQoS 2023-01-24 18:32:40 +00:00
Herbert Wolverson
8fc4aed48b * Adds a bus call to ask Rust to validate the CSV file. If it can't read it,
it returns readable error messages explaining where it encountered a problem.
* Adds the bus call to the Python-Rust bridge.
* Adjusts LibreQoS.py to call the new bridge code and alert if Rust can't
  read the ShapedDevices.csv file.
2023-01-24 18:30:52 +00:00
Dave Täht
b504237c56
Merge pull request #220 from interduo/patch-17
improvement: put warning in README and add some MD formatting tags
2023-01-24 09:59:03 -08:00
Dave Täht
f96bad8c54
Merge pull request #223 from interduo/patch-20
add rust/remove_pinned_maps.sh command to readme
2023-01-24 08:07:26 -08:00
Robert Chacón
66549e4245
Reduce console verbosity https://github.com/LibreQoE/LibreQoS/issues/225 2023-01-24 09:04:01 -07:00
Dave Täht
cd6dccce10
Merge pull request #219 from interduo/patch-16
improvement: bump version in comment
2023-01-24 08:02:53 -08:00
Robert Chacón
1c2086e7a8
Attempt fix for https://github.com/LibreQoE/LibreQoS/issues/214 2023-01-24 08:50:17 -07:00
Interduo
37c6161ca3
add rust/remove_pinned_maps.sh command to readme 2023-01-24 15:43:53 +01:00
Herbert "TheBracket
2a240c5090
Merge pull request #222 from interduo/patch-19
bugfix: set proper path
2023-01-24 06:36:38 -08:00
Interduo
f6927c3c27
bugfix: set propper path 2023-01-24 15:31:00 +01:00
Interduo
64d47268ac
bugfix: propper path 2023-01-24 15:27:49 +01:00
Interduo
b93b944cb0
improvement: put warning in README and add some MD formatting tags 2023-01-24 14:46:57 +01:00
Interduo
55fbf8a444
improvement: bump version in comment 2023-01-24 12:58:21 +01:00
Robert Chacón
d72e27b171
Merge pull request #215 from interduo/patch-12
bugfix: slowly ubuntu starting when one of network interface is not up
2023-01-23 15:13:50 -07:00
Herbert Wolverson
c9810f93b6 Merge branch 'main' of https://github.com/LibreQoE/LibreQoS 2023-01-23 22:01:05 +00:00
Herbert Wolverson
11428f65e7 Fix "lqosd is running" error when it clearly isn't.
* Fix the Python code to actually call `is_lqosd_alive()` instead of just
checking that it exists (`is_lqosd_alive`).
* Fix the os.exit command syntax.
* Cleanup the blocking Tokio/lqosd request handler to pass better messages.
* Catch the "file not found" and replace it with a nicer message.
2023-01-23 21:59:02 +00:00
Interduo
49b3e046e9
bugfix: unit files needs to be enabled 2023-01-23 16:31:06 +01:00
Interduo
6da4820f1a
Update TESTING-1.4.md 2023-01-23 15:11:41 +01:00
Interduo
9653e40943
Update TESTING-1.4.md 2023-01-23 15:09:19 +01:00
Dave Täht
c329304fea
Merge pull request #210 from interduo/patch-10
improvement: add autostart systemd unit files
2023-01-23 05:33:27 -08:00
Dave Täht
07fce55540
Merge pull request #213 from interduo/patch-11
bugfix: change sqm mode to ack-filter was impossible
2023-01-23 05:31:57 -08:00
Dave Täht
6783b9beac
Merge pull request #211 from interduo/patch-8
bugfix: propper path
2023-01-23 05:28:45 -08:00
Interduo
f5b3163c81
Update config.html 2023-01-23 14:13:38 +01:00
Interduo
e19a6f8c23
improvement: add autostart systemd unit files 2023-01-23 14:02:57 +01:00
Interduo
5d01b78492
bugfix: propper path in lqosd 2023-01-23 13:55:41 +01:00
Interduo
378dc6860f
bugfix: propper path 2023-01-23 13:35:21 +01:00
Dave Taht
6fc1c89c0c Use .json extension for json files
I exclude .json from my rg searches, and when going through code
via things like "rg" - having the json show up is kind of painful.

use .txt for text, .json for .json, .whatever.gz for compressed.
2023-01-23 11:50:55 +00:00
Dave Taht
ca01c363c1 Add BestRtt for the sake of example
Also rustfmt engaged and made this bigger than I wanted.
2023-01-23 00:30:31 +00:00
Robert Chacón
43315d5f56
Update TESTING-1.4.md 2023-01-22 12:46:09 -07:00
Robert Chacón
dd1ebea185
Update TESTING-1.4.md 2023-01-22 12:34:41 -07:00
Dave Taht
145d9d9a27 Convert /etc/lqos to /etc/lqos.conf globally
Too much chance of someone putting /etc/lqos as a directory.
2023-01-22 19:29:18 +00:00
Dave Taht
75950be5fc Add Bandwidth test to the circuit_queue html page 2023-01-21 21:08:36 +00:00
Dave Taht
79d13718f4 Added Run Bandwidth Test to the Shaped.html page 2023-01-21 21:05:29 +00:00
Dave Taht
40758ffe6b lq_utils: Move packet scaling routines to library
This moves the packet scaling routines for g/m/k gps and
g/m/k bytes to a shared library.
2023-01-21 20:41:37 +00:00
Dave Taht
b2cf27ea9a lqtop: Reorder summary to use same order of result
The default total summar was the opposite of the table below,
and confusing.

Ideally the layout of the topmost bar should be:

LibreQos 'NOT CONNECTED' 'OTHER STATUS' 'down bps' 'up bps' 'pps' 'pps'

But my table-fu failed me.
2023-01-21 20:06:07 +00:00
Dave Taht
20727d44ca lqtop: Consistently right justify most output
By using the handy fmt macros this is feasible if the cell width
is known, via "{:>11}" for example.

However my intuitive thought that this was a "Constraint",
that you could apply to a Cell or Span, and it isn't. There are
multiple calls on the github for this. Until such a day, fmt
goes to 11.
2023-01-21 19:30:27 +00:00
Dave Taht
ee055cc322 H for histograms
Outlining features faster than they can be implemented...

... or considered if they are a good idea or not. More letters
to come!
2023-01-21 18:04:38 +00:00
Herbert Wolverson
37355189b9 Work in progress: transmute netlink cake stats to readable data. Currently uses bytemuck, should be using zerocopy. 2023-01-21 03:31:48 +00:00
Herbert Wolverson
25742c25f6 Remember to add the files... 2023-01-20 21:55:01 +00:00
Herbert Wolverson
14e49ce183 Super incomplete hacking away at netlink access for queues. 2023-01-20 21:52:56 +00:00
Herbert Wolverson
fc8b3ca9e4 Allow paging on TOP-N queries
Change BusRequest::GetTopNDownloaders and GetWorstRtt to accept
a start and end field, rather than just "n_rows".
2023-01-20 21:18:19 +00:00
Herbert Wolverson
f742acafda Merge branch 'main' of https://github.com/LibreQoE/LibreQoS 2023-01-20 19:29:04 +00:00
Herbert Wolverson
922ddd602f A bit of a hybrid commit, sorry. Provides various default pre-allocations that seem reasonable, and fixup on bus permissions. 2023-01-20 19:28:54 +00:00
Dave Taht
3c6f438e06 queue_tracker: use info_once on new fields
Modern linuxes add fields all the time. On a kernel upgrade we
shouldn't crash just because there's a new json field.

Also there are some further optimizations to represent the kernel
structures themselves. Some fields can overflow which would lead
to some surprizing behaviors in polling the json over time.

FIXME - always check for overflow elsewhere, in packets, overlimits
etc. Could that be a trait?
2023-01-20 18:37:23 +00:00
Herbert Wolverson
287ddb6e10 Global allocator and compilation flags update
On systems that support it, `jemallocator` will replace the default
allocator for `lqosd` and `lqos_node_manager`. The Jem allocator
is a LOT more friendly to Rust's preferred vector allocation patterns,
and actually cares about your cache.

Enable "fat" Link-Time Optimization. This slows down compilation a lot,
but results in smaller binaries and permits the LLVM optimizer to
cross crate boundaries when inlining, optimizing tail calls and a
few other optimizations.
2023-01-20 18:06:41 +00:00
Dave Taht
1742232eaf Made tc_fq_codel actually compile
Running cargo build in that dir did not detect the compile issue
cargo build --all from the root dir, did.
2023-01-20 17:54:03 +00:00
Dave Taht
a8cb399630 Shrink fq_codel structures to match the kernel API
FIXME: We need, in general, to check for wrapping in long term runs

* FIXME: Need a test to ensure fq_codel is still parsing
* Still want a size before and after test.

Lastly...

Newer versions of the kernel now have newer options for fq_codel
such as ce_threshold. The present implementation will spam the log
on encountering a newer kernel and tc.
2023-01-20 17:44:10 +00:00
Herbert Wolverson
ff5ad10240 LqTop can use full screen size for data
Added a note for where `n_rows` gains the current terminal size.
`tui` turns out to consume the `Event::Resize` event, so it's
never received - instead, we have to calculate it from the
creation of the UI "chunks".

The rendering length turned out to be an artefact of forgetting
to remove a height constraint from a UI chunk that was tested
and never used. (It briefly contained some graph data).
2023-01-20 17:21:55 +00:00
Herbert Wolverson
d83b8d23e8 Missing documentation tags 2023-01-20 17:17:10 +00:00
Herbert Wolverson
e2f09d14fa Persistent BusClient offers "is_connected"
* At any time, you can ask a BusClient if it is connected.
* If `lqtop` loses connectivity while running, it displays NOT
  CONNECTED in red on the title bar.
* If `lqtop` can't reach the daemon on start, it bails out with
  an error message.
2023-01-20 17:05:58 +00:00
Herbert Wolverson
2deb98a4c1 Fix permissions on creating lock file 2023-01-20 16:46:57 +00:00
Herbert Wolverson
ed07a4666b Add file locking to lqosd
The file locking is "smart": it checks to see if a lock is
valid before refusing to run (and updates the lock if
it can run anyway).

The locking mechanism will fail if you manually create
the lock file and dump random data into it that doesn't
readily convert to an i32.

Affects issue #54 and issue #52

* Add a new structure `FileLock` to `lqosd`.
* FileLock first checks /run/lqos/lqosd.lock. If it exists,
  it opens it and attempts to read a PID from it. If that PID
  is running and the associated name includes "lqosd", the
  FileLock returns an error.
* If no lock exists, then a file is created in
  /run/lqos/lqosd.lock containing the running PID.
* Includes Drop and signal termination support.
2023-01-20 16:05:55 +00:00
Herbert Wolverson
357bec9ad2 Forgot to remove a debug line 2023-01-20 16:04:50 +00:00
Herbert Wolverson
dbe0b3bdfd Provide explicit cleanup of the lqos_bus socket on signals.
Since guarantying the execution of Drop traits on process
termination from signals is now "unsound" in the Rust specs,
provide an explicit clean-up path for `lqosd`, called when
a termination signal is processed. This removes the Unix
stream socket on termination.
2023-01-20 15:31:21 +00:00