Commit Graph

940 Commits

Author SHA1 Message Date
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
Herbert Wolverson
e64e41c96b Bus Client is more resilient to socket failure
* BusClient will survive creation without a successful connection.
* Attempting to use the BusClient without a connection will try to
  connect.
* Attempts to use the BusClient are gated by timeouts and error
  checking. Failures result in returning the client stream to
  "None" - triggering a reconnect attempt on the next use.
* Client programs have added the Tokio "time" feature, needed for
  timeout support.
* lqtop and lqos_node_manager have been tested to run without
  lqosd started, and with stop/start cycles triggering resumption.
2023-01-20 15:20:21 +00:00
Herbert Wolverson
adb8c1f471 Merge branch 'main' of https://github.com/LibreQoE/LibreQoS 2023-01-20 14:30:17 +00:00
Herbert Wolverson
fba591595b Move the socket from /tmp/lqos_bus to /run/lqos/bus and change permissions to match. 2023-01-20 14:27:37 +00:00
Dave Taht
fc07f502e0 Odd Events Operations Research and Logging
My largest desire in the data collection work so far is to be able
to compare "Saturday to Saturday, 8PM". There are always details
about given events that show up in the data, and the data gives
you details you might not have had at the time.

That "Replay" facility I started to describe is a means of doing that
from the historical data, although I kind of intended it to go up
against the bus. Also sampling rapidly some subset of devices all the
time, to compare against the longer period data, seems potentially useful.

Secondly, what is happening that we are *not* observing? When did it
start or end?

* Patch Tuesday
* DDOS attack
* Routing loop or broadcast storm
* Weather - a tower falls, how do you get in touch with the customer?
* New Counter Strike release (roughly the same as a DDOS)

So I added a filter for "Odd" - which is kind of fungible, and
"Log" to pull up a logbook from "somewhere" around that event.
An Odd filter could include "Silence" from week to week - why is this
device not online?
2023-01-20 14:12:58 +00:00
Dave Taht
2a3d71c5aa lqtop: Filter on my network or unshaped 2023-01-20 06:39:07 +00:00
Dave Taht
b89fd095e4 lqtop: more thinking 2023-01-20 05:33:32 +00:00
Dave Taht
e81d862e1e lqtop: still simulating 2023-01-20 05:14:03 +00:00
Dave Taht
381dcd1887 more ideas for lqtop 2023-01-20 03:55:06 +00:00
Dave Taht
45202ff3cf Rustfmt pass with the new defaults
Looks mildly better
2023-01-20 02:46:24 +00:00
Dave Taht
4f72d3ed69 Merge branch 'main' of LibreQoE/LibreQoS
I am not sure if we should default to rebasing, or this.
2023-01-20 01:02:57 +00:00
Dave Taht
01e6f10f22 DRAFT: lqtop keyboard input API
This is a draft attempt at working out what keystrokes and
functionality lqtop could gain for the beleaguered BOFH.

Presently functionality is stuck on:

* Capturing a screen resize event doesn't work
* Needing to be able to send a starting row to the bus
* More bus messages in general
* BOFH ignorance has to how to message the other thread
2023-01-20 00:58:39 +00:00
Herbert Wolverson
e857f20ea1 Roll back on the persistent bus client until reconnect is figured out 2023-01-19 22:42:23 +00:00
Herbert Wolverson
0e03d3bbba CSV reading of ShapedDevices correctly ignores lines starting with # 2023-01-19 20:27:47 +00:00
Herbert Wolverson
12e0f6e0bd Show correct plans on shaped.html 2023-01-19 20:17:25 +00:00
Herbert Wolverson
7a0f066c63 Display errors when loading ShapedDevices 2023-01-19 20:16:20 +00:00
Herbert Wolverson
3e12e95f66 Create lqos_utils as a repository for useful macros. Move the string table macro. Start working on some command wrappers for easier use. 2023-01-19 17:52:19 +00:00
Herbert Wolverson
c676b8a33f Add a standard format file, and use #[rustfmt::skip] to say 'stop formatting this block' 2023-01-19 16:40:36 +00:00
Herbert Wolverson
9c135e8b4f Preallocate ring buffer result size 2023-01-19 15:34:53 +00:00
Herbert Wolverson
d0dd559f1d config_control.rs: Eliminate vector reallocation from get_nic_list
Refactor the get_nic_list function to use iterators with a collect
at the end, ensuring that the result vector is allocated at exactly
the needed size.
2023-01-19 15:15:42 +00:00
Herbert Wolverson
7cb8f930d1 De-async two things that shouldn't have been async to begin with. 2023-01-19 14:59:12 +00:00
Herbert Wolverson
29a9985a5a Remove file that isn't needed anymore. 2023-01-19 14:51:01 +00:00
Dave Taht
d58115fd3d Create a interfaces to test against
Dummy interfaces are commonly used to test stuff like this.
Most Linuxes do support them. A more advanced approach

Linux interfaces have a 15 character limit.

This implementation presently does not remove the created interface
and is a sterling example of how "side effects" in the OS itself
often need to be accounted for.
2023-01-19 14:44:50 +00:00
Herbert Wolverson
4d569e698c Add doc tags and general cleanup 2023-01-19 14:36:09 +00:00
Herbert Wolverson
a5fc96abc9 The lqos_node_manager cache manager uses a persistent BusClient 2023-01-18 23:39:12 +00:00
Herbert Wolverson
2633974839 Missed file from previous commit 2023-01-18 23:29:58 +00:00
Herbert Wolverson
3cb2799beb Still a work in progress, needs work - but adds a persistent client option for the bus. It currently won't work well without a pause between request/replies - but it works well enough for lqtop. More improvements needed. 2023-01-18 23:15:09 +00:00
Herbert Wolverson
da6a8f08a2 Move the socketserver into the bus crate also, makes more sense there. 2023-01-18 22:28:15 +00:00
Herbert Wolverson
2b573708ac Remove auth cookie from bus. Benchmarks show a tiny improvement in overall performance. 2023-01-18 22:18:16 +00:00
Herbert Wolverson
58c692425b Benchmark suite includes local socket round-trip. 2023-01-18 22:01:58 +00:00
Herbert Wolverson
e3b2b71289 Add benches and start benchmarking parts of the client/server setup 2023-01-18 21:46:20 +00:00
Herbert Wolverson
6c52fceb7f WIP - Use a UNIX stream socket rather than TCP for local bus communications. 2023-01-18 21:21:42 +00:00
Herbert Wolverson
0d81df6031 Merge branch 'main' of https://github.com/LibreQoE/LibreQoS 2023-01-18 21:14:46 +00:00
Dave Taht
0f16137c59 Fix comment to clarify tc_handle is calling c func
It was unclear until I read it that it was not shelling.
2023-01-18 19:03:55 +00:00
Herbert Wolverson
ea39de92c0 Fix stale comment 2023-01-18 15:35:30 +00:00
Robert Chacón
f9efbb7be7
Update README.md 2023-01-17 19:55:11 -07:00
Robert Chacón
66a4f9c763
Update README.md 2023-01-17 19:54:50 -07:00
Robert Chacón
b2531fb6dd
Improve documentation for CPU requirements 2023-01-17 19:40:50 -07:00
Dave Taht
0888d3d6da Goofed on /vendor 2023-01-17 17:02:52 -08:00
Dave Taht
3d6e214616 Add defer option to all html
If this actually breaks anything, we can revert.
2023-01-17 17:00:30 -08:00
Dave Taht
0a0248a534 Modern javascript supports the defer option
Move the javascript at the bottom of the file to the top.

Also it seems a matter of luck that vendor/bla worked when
/vendor/bla was needed.
2023-01-17 16:55:07 -08:00
Dave Taht
931b0d8d22 Move Run Bandwidth Test to left of configuration
Basic design principle for muscle memory: always put the same menu
items in the same places as often as you can.
2023-01-17 16:46:58 -08:00
Dave Taht
9bd1d876ab HTB shrunk a little 2023-01-17 16:08:19 -08:00
Dave Taht
e251ef09e3 Forgot to import the right things
Also compiling from the top of the tree doesn't recurse. curses
2023-01-17 16:08:19 -08:00
Dave Taht
c5947fff56 Get rid of 3 more Strings from tc cake parser
DiffServ had a missing (underused) option
AckFilter &
FlowMode now use the nifty dashyenum thing
Bandwidth unlimited is all that we are using cake for today

Only FWmark left to go (which is in hex and I do not know how to
parse with and without the 0x prefix)
2023-01-17 15:33:04 -08:00
Herbert Wolverson
e0552ec55b Break dash-supporting enum into its own macro. 2023-01-17 22:01:56 +00:00
Herbert Wolverson
c6661520dd Support dashes in generated enums by replacing - with _ during
the match phase. Enum options have to replace minus with underscore.

E.g. `ack-filter` becomes `ack_filter`.

So you can do:

`string_table_enum!(DashingEnum, option_1, option2);`

And read `DashingEnum::from_str("option-1")`
2023-01-17 21:42:33 +00:00
Herbert Wolverson
d83c1dc852 Merge branch 'main' of https://github.com/LibreQoE/LibreQoS 2023-01-17 21:15:00 +00:00