Commit Graph

9 Commits

Author SHA1 Message Date
Herbert "TheBracket
c17d269ad6 Rust licenses (#292)
* Add license specifier to all Cargo.toml files

Explicitly specify `license = "GPL-2.0-only"` in each Cargo.toml
file. The wording is from the SPX guidelines.

* Add shell script to check licenses of Rust projects

rust/check_licenses.sh automatically verifies all dependencies
for accidental usage of GPLv3. Since basically nobody in the
universe uses GPLv3, it tends not to do much.
2023-03-23 11:48:03 -07:00
Herbert Wolverson
2779cf20c9 Rearrange Heimdall
Refactor Heimdall into a more self-contained process, separate its
operation into its own thread rather than occupying the main
tick thread.
2023-03-22 14:39:32 +00:00
Herbert Wolverson
c70d01b3f6 VERY work in progress - do not try to use this. The good: creates a ringbuffer and successfully sends events to userspace. The bad: it's currently watching all packets, eats a lot of CPU and has a horrible lack of abstractions. 2023-03-22 14:33:48 +00:00
Herbert Wolverson
93e8afae71 Replace unsafe bpf_num_possible_cpus() with safe Rust function.
Port the C from `bpf_num_possible_cpus()` over to safe Rust,
with proper error handling and unit tests to ensure that it
is giving the correct answers. Change usages to the new safe
function.
2023-03-22 14:32:31 +00:00
Herbert Wolverson
130c888e22 Heimdall now only watches those who request to be watched by default. 2023-03-22 14:32:30 +00:00
Herbert Wolverson
38a2a78062 Finish Rust package update cycle per ISSUE #229 2023-02-01 19:13:23 +00:00
Herbert Wolverson
7548413165 Use Log and Env_log for output. Suppress kernel messages that confuse
people on startup.

Default to "warn" level of logging. You can override by setting
RUST_LOG to "info". (Environment variable)
2023-01-16 16:03:14 +00:00
Herbert Wolverson
fecb27c6bc Only show unknown IPs from the last 5 minutes.
IMPORTANT: run "remove_pinned_maps.sh" before you run the new
version of lqosd. The eBPF map structure has changed.

1) Add a "last_seen" value to the map_traffic eBPF map.
2) Whenever traffic is seen, update "last_seen" to equal the
   result of a bpf_ktime_get_boot_ns() call.
3) When retrieving the unknown IP list, perform a syscall to
   obtain the time since boot in nanoseconds and subtract
   five minutes.
4) Filter out any unknown IPs that exceed the 5 minute window.

This should solve the problem with "unknown IPs" filling up
on start, and gradually accumulating.
2023-01-13 17:48:20 +00:00
Herbert Wolverson
32597813e8 Add Rust source tree to the main repo.
Replaces the previously separate repo, merging the Rust
system into the mainline ready for 1.4.

The Rust system currently provides:

* lqos_bus: type definitions for localhost control bus.
* lqos_config: handler for configuration files.
* lqos_node_manager: local web-based monitor and manager.
* lqos_sys: eBPF program that handles all of the tracking,
  CPU assignment, VLAN redirect, TC queue assignment,
  and RTT tracking. Wrapped in a Rust core, providing
  consistent in-Rust building and mostly-safe wrappers
  to C code.
* lqosd: a daemon designed to run continually while
  LibreQoS is operating. On start, it parses the configuration
  files and sets up interface mapping (the Python code is still
  required to actually build queues). It then assigns the various
  eBPF programs to appropriate interfaces. The eBPF systems are
  removed when the daemon terminates.

  lqosd also provides a "bus", listening to requests for changes
  or information on localhost, providing a control plane for
  the rest of the project.
* lqtop: An example program demonstrating how to use the bus,
  acts like "top", showing current network traffic and mappings.
* xdp_iphash_to_cpu_cmdline: a Rust wrapper providing the same
  services as the cpumap originated tool of the same name. This is
  a "shim" - it will go away once the native Python library is
  ready.
* xdp_pping: also a shim, providing equivalent services to the
  cpumap service of the same name.

A helper shell script "remove_pinned_maps.sh" can be used to
remove all pinned eBPF maps from the system, allowing for eBPF
program upgrades that change persistent map structures without
a reboot.

Signed-off-by: Herbert Wolverson <herberticus@gmail.com>
2023-01-10 14:12:50 +00:00