Add CLI listings for rate-limited flood adverts

List limited public-key prefixes, reasons, and wait times in bounded pages, with full-key details for targeted clearing. Queries preserve quotas and recovery timers.

Validated with 71 native tests, Full repeater and room-server builds, and a 909.500 MHz RF test covering 10 forwarded adverts, 2 blocked adverts, and forwarding after targeted clear.
This commit is contained in:
mikecarper committed 2026-09-10 04:18:17 -07:00
1 parent 602dbfe3d9
commit 00163f2c2b
9 files changed
+374 -1

No files matched your search

+35
View File
@@ -447,6 +447,41 @@ Elsewhere it replies `Err - neighbors not enabled in this build`. If a
## Statistics
### List Rate-Limited Flood Adverts
**Usage:** `get flood.advert [page]` or `get flood.advert key <index>`
Lists tracked advert origins currently subject to a forwarding limit. Page 1
is the default, with three entries per page so replies fit both USB and admin
LoRa CLI. Each row shows its index, the first 12 public-key hex characters,
the limit reason, and the minimum wait before another new advert can pass
the automatic limiter. Ordinary forwarding filters still apply.
```text
get flood.advert
get flood.advert 2
get flood.advert key 1
```
Reasons are `quota` (the prefix's three-hour forwarding allowance is spent),
`history` (distinct receive history is full), and `bad` (the full key is under
the stricter one-advert-per-12-hours rule). A `bad` key remains listed when
`wait=0s`: one forward is eligible, but its seven-day recovery is not complete.
If several limits apply, `bad` takes precedence over `history`, then `quota`;
the displayed wait accounts for all applicable limits.
The `key` form returns the complete 64-hex public key, reason, wait, shared
prefix forwarding count/quota, shortest received hop count, and remaining
bad-list recovery time. Different full keys with the same 12-hex prefix remain
separate entries. Indices refer to the current live list and can change as
history expires; read the full key before using a targeted clear.
Queries do not clear history, spend quota, or refresh abuse/recovery timers.
Elapsed history expires normally. Origins rejected only because every table
slot protects abuse history are not retained and cannot be enumerated.
Available on repeaters, room servers, and forwarding sensors through their
ordinary local/admin CLI. Companions do not have this table.
### Clear Automatic Flood Advert History
**Usage:** `clear flood.advert all` or `clear flood.advert <64-hex-full-public-key>`
+17
View File
@@ -69,6 +69,23 @@ physical distance.
abuse can therefore extend the restriction indefinitely; it does not expire
automatically seven days after the first offence.
### Inspect the current limits
Use `get flood.advert` to list rate-limited origins, three per page. Continue
with `get flood.advert 2`, etc. Rows show a 12-hex public-key prefix, the reason
(`quota`, `history`, or `bad`), and the wait before another new advert is
eligible under the automatic limiter. `get flood.advert key 1` shows the full
key and counters for row 1, including the remaining bad-list recovery time.
A bad-listed key remains visible with `wait=0s` when its next single forward
is due. Prefix collisions appear as separate full-key entries.
This is a live, read-only view: expiry can change row indices between queries,
but reading never resets quotas or extends recovery. Sources rejected solely
because the protected-history table is full are not retained, so they cannot
be listed. See the [CLI reference](cli_commands.md#list-rate-limited-flood-adverts).
### Clear history
All timers use rollover-safe uptime, so setting the clock forward or backward
cannot clear the restriction. This history is currently RAM-only: rebooting
the relay clears it, and time while powered off is not tracked. A manual clear