Jason Huebert f1d4f9e6db fix: refuse patterns the regex engine cannot decide deterministically
An adversarial pass over the pattern layer (differential fuzzing against the
vendored engine, an exhaustive history-dependence sweep, and a CLI fuzz)
turned up a pre-existing engine defect that makes a rule decide packets at
random:

re_compile() never fills in the `ch` byte of BEGIN/END/quantifier symbols, and
matchone() compares that byte whenever such a symbol is used as an operand.
Every pattern up to length 5 was enumerated over a metacharacter alphabet:
16,999 of 1,240,085 pattern/subject combinations answered differently depending
on which pattern had been compiled before them. `sender=*Bot`, `sender=a**` and
`sender=A^B` all match — or don't — according to the previous packet's rule. In
a filter that either leaks the traffic a drop rule was meant to stop or silences
it when it should not.

Fixed in the wrapper, which already owns structural validation, rather than in
the vendored engine (which stays byte-identical):

- "nothing to repeat" — a '*', '+' or '?' with no repeatable symbol before it,
  including a quantifier on an anchor ('^*') and stacked quantifiers ('a**').
- "^ and $ must be at the pattern edges" — an anchor away from the edges of its
  own alternative. Per alternative, so '^a|b$' is fine.

As with the empty alternative, both are add-time rules that matching also
honours: a stored rule carrying such a pattern now matches nothing rather than
guessing, and the reply names the offending field.

The same fuzzing caught a bug in the new checker itself — it tested for the
class end before the escape, so '[\]]' closed the class early and diverged from
the engine's parse. Fixed, and the escape now takes precedence exactly as in
splitAlternatives().

Tests: 220 filter cases (was 215). New NothingToRepeatRejected,
AnchorsMustBeAtPatternEdges, AddRejectsPatternsTheEngineCannotDecide,
StoredUndecidablePatternNeverMatches, and
PatternMatchDeterminism.VerdictDoesNotDependOnEarlierPatterns, which primes the
shared engine state and pins a stable verdict for every pattern in the table.

Verified: full suite clean under ASan+UBSan; 479,676 differential cases with no
unexplained disagreement; 1,240,085-case history-dependence sweep with zero
escapes; 300k-line CLI fuzz with no overrun, bad reply or rule-list drift; all
34 patterns the guide shows still accepted; Xiao_S3_WIO_repeater builds (RAM
unchanged at 20.6%).

Fixing this at the source would mean a fourth documented modification to
TinyRegex.cpp (have matchone() treat non-consuming symbols as non-matching
instead of comparing that byte). Left alone pending a decision.
2026-10-02 22:16:33 -05:00
2026-04-28 21:39:34 +10:00
2026-09-20 15:25:18 -04:00
2025-01-13 14:07:48 +11:00
2025-06-05 20:35:40 +12:00
2026-02-03 13:47:43 +13:00
2026-03-23 14:26:56 +01:00
2025-01-20 10:20:42 +11:00
2025-01-25 23:09:09 +11:00
2026-03-31 00:51:15 +13:00
2025-03-03 18:08:00 +13:00
2026-06-05 21:25:25 +12:00

MeshCore — Repeater Firmware with a Remote-Configurable Packet Filter

This is a feature fork of MeshCore. It tracks upstream automatically (synced weekly) and adds two repeater-focused capabilities on top of stock firmware. Everything else — supported boards, clients, protocols, build system — is identical to upstream; see the upstream README for the general project, hardware support, and getting-started guide.

What this fork adds

📡 Packet filter

A remote-configurable drop-rule engine for the simple_repeater firmware. Rules match on packet type, route type, region, hop count, channel, and — on decrypted payloads — channel identity and sender/text patterns. Rules are managed over the repeater CLI, locally via serial or remotely over the mesh by an authenticated admin. No rebuild, no physical access.

Independently of the rules, flood-route adverts can be rate-limited per originating node: each node's advert is forwarded at most once per window (up to 30 days), taming advert storms on busy channels while every node stays discoverable.

→ Full guide, including the complete predicate reference and CLI commands: FILTER.md

🔋 Battery gate

A configurable low-battery cut-off: below a set voltage the repeater stops forwarding (but stays reachable and keeps advertising); when the battery recovers it resumes automatically. Debounce + hysteresis keep it from flapping, and the admin can check voltage and tune thresholds over the mesh.

→ Full guide: BATTERY.md

Why run this instead of stock repeater firmware?

Stock repeaters forward everything they hear, until the battery dies. This fork is for operators who want policy and resilience at the node:

  • Shared / community nodes — mute noisy senders or channels that eat your airtime, without asking anyone to change their setup.
  • OpenHop-style policy, nothing extra to run — the rule engine is modelled after the policy filters in OpenHop and lives entirely in the repeater firmware, so you get about the same functionality with just the node itself — no computer, companion app, or other hardware needed.
  • Solar / off-grid sites — the node goes quiet while it can still answer you, instead of disappearing dark, and wakes itself when there's sun again.

Getting the firmware

Prebuilt binaries for all supported boards are on the Releases page. Two channels:

Channel Branch Based on Tags
dev repeater-filter upstream dev (merged weekly by CI) filter-v*-dev.N
stable repeater-filter-stable upstream main releases filter-v*

Flash as you would stock firmware, then follow FILTER.md to set your first rules over the CLI.

S
Description
No description provided
Readme MIT
21 MiB
0 Stars 1 Watchers 0 Forks
Languages
C++ 52.7%
C 44.3%
Python 1.9%
Shell 1%