Add protocol-aware reflector definitions, TOML/UCI lists, validation and environment overrides. Resolve and select endpoint-aware measurement streams, honor configured ICMP timing and socket routing, and retain partial-set reselection behavior from the standalone fixes. Drive the managed IRTT task throughout its lifecycle, retry terminal targets without restarting healthy sessions, normalize blank HMAC keys and use effective RTT for latency fallback. Fold the reviewed configuration, resolution and measurement corrections into their implementation.
Summary
sqm‑autorate‑rust is a Rust re‑implementation of the original sqm‑autorate tool, which dynamically adjusts CAKE SQM bandwidth settings by measuring traffic load and latency – ideal for variable DOCIS/cable or LTE/wireless links where capacity fluctuates. This port preserves the original’s adaptive control logic while leveraging Rust’s type safety, performance, and concurrency primitives to deliver a more robust, maintainable codebase.
Features
- Adaptive rate control: continuously measures one‑way delay baselines and traffic load to tune both download and upload shaping rates in realtime .
- Multiple measurement types: prefers ICMP timestamps by default, but also supports ICMP echo requests as a fallback for networks where timestamps are blocked
- Concurrent architecture: separates packet sending, receiving, baselining, reflector reselection and rate‑controller loops into dedicated threads for maximum responsiveness .
- Configurable via environment or UCI: reads settings from environment variables or OpenWRT UCI, with sensible defaults and type‑safe parsing .
- Minimal dependencies: relies on Rust crates only (anyhow, socket2, neli, rustix), no external scripts .
Installation
You can install sqm‑autorate‑rust in two ways:
1. Native Rust build
-
Ensure you have the Rust toolchain (1.70+), Cargo, and
libnlheaders installed on your Linux host. -
Clone and build:
git clone https://github.com/Lochnair/sqm-autorate-rust.git cd sqm-autorate-rust cargo build --release -
The optimized binary is at
target/release/sqm-autorate-rust.
2. OpenWrt SDK build
You can also build an OpenWrt package to install in your images with the SDK:
-
Prepare the OpenWrt SDK
# Download and extract the matching SDK for your target platform tar xJf openwrt-sdk-*.tar.xz cd openwrt-sdk-* -
Add the
openwrt-feedsrepository# Add the feed to feeds.conf.default echo 'src-link lochnair https://github.com/Lochnair/openwrt-feeds.git' >> feeds.conf.default ./scripts/feeds update lochnair ./scripts/feeds install sqm-autorate-rust -
Configure and build the package
make menuconfig # navigate to Network → sqm-autorate-rust, enable it make package/sqm-autorate-rust/{clean,compile} V=s -
Install on your device
# Copy the generated .ipk from bin/packages/... to your router opkg install sqm-autorate-rust_*.ipk