Commit Graph
230 Commits
Author SHA1 Message Date
Audric 238126ab33 docs(concepts): note that ROUTABLE_PREFIXES=* forwards unowned TGs
CONCEPTS.md stated that a TG matching no mesh prefix is "never sent over
any trunk". That is false on a link configured with ROUTABLE_PREFIXES=*:
the wildcard is a zero-length match in TrunkLink::isSharedTG, so when no
real prefix matches it still claims the TG and the audio is forwarded up
the uplink. The peer then drops it (it matches neither its LOCAL_PREFIX
nor the link's REMOTE_PREFIX), so nobody hears it -- but it does cross
the wire, which matters for a TG intended to stay private.

Qualify both places that promised local-only behaviour, and point at an
explicit ROUTABLE_PREFIXES list as the way to keep a TG from egressing.
2026-07-13 10:52:44 +02:00
Audric 76a7f3dce0 docs(topology): document LOCAL_ALIASES, fix stale and incorrect claims
The PDF is built from docs/topology_pdf/ (HTML + Graphviz), not from
TOPOLOGY_EXAMPLES.md, so the two prose copies had drifted. Resync them
and correct several claims that no longer matched the code.

- Add a LOCAL_ALIASES overlay section (+ diagram 6): re-home a short local
  TG under an owned prefix so the mesh routes the long number while local
  clients keep dialing the short one. Translation happens at the trunk
  boundary only -- clients and satellites see the short number.

- Peer interest: MsgPeerTgInterest (type 129) lets a passive listener
  register interest without keying. The HTML still claimed the owner
  cannot fan a TG back until the peer transmits; corrected in the
  Background, the section-2 return leg, and the Properties list.

- Satellite trust model: per-satellite SECRET_<id> is implemented
  (Reflector::resolveSatelliteSecret); drop the "future work" note.

- SATELLITE_FILTER: filter entries are exact unless suffixed with "*"
  (TgFilter::parse), so the documented bare 2222/2224 values matched only
  those literal TGs. Use 2222* and document the syntax.

- Zones are no longer drawn as satellites. A satellite owns no prefix and
  inherits its parent's identity, so a prefix-owning Zone cannot be one.
  Zones now hang off IT 222 as sub-trunks (REMOTE_PREFIX supports a
  comma-separated list), shown with a mix of owned, local-only and aliased
  TGs. Note that ROUTABLE_PREFIXES=* forwards unowned TGs to the uplink,
  where the peer drops them.

- Merge the old section 3 into section 2 as a "sub-trunk star" variant --
  it was the same two-domain topology with a star instead of a full mesh.
  Satellite becomes section 3, twin section 4.

- Disable code-font ligatures: JetBrains Mono rendered SECRET_<id>= as
  SECRET_<id>= with the ">" swallowed by a ">=" ligature.
2026-07-13 10:26:23 +02:00
Audric IW1GEU a9b622b2c7 Merge pull request #12 from audric/feature/status-routable-prefixes
feat(status): expose per-trunk routable_prefixes and routable_wildcard
2026-07-03 21:27:37 +02:00
Audric 0885352b1c feat(status): expose per-trunk routable_prefixes and routable_wildcard
Surface the ROUTABLE_PREFIXES configuration in the trunk /status JSON (and
therefore the MQTT retained status and Redis snapshots) so operators can see,
per trunk, which pass-through prefixes the link carries and whether it is a
default (*) route. Read-only exposure of existing state — no routing change.

- routable_prefixes: gateway-routed prefixes reachable via the peer but not
  owned by it (from m_routable_prefixes).
- routable_wildcard: true when the link is configured as a * default route.

Documented in docs/PEER_PROTOCOL.md.
2026-07-03 19:11:47 +02:00
Audric IW1GEU 67f5c6683f Merge pull request #11 from audric/feature/local-alias
feat(alias): re-home short local TGs under an owned prefix (LOCAL_ALIASES)
2026-07-03 18:59:02 +02:00
Audric 5da075f150 feat(alias): add LOCAL_ALIASES to re-home short local TGs under an owned prefix
Re-home a short local talk group (e.g. 8) under the reflector's own owned
prefix as a globally-unique number (e.g. 2620008) via a single [GLOBAL]
LOCAL_ALIASES entry, so it routes across the trunk mesh like any owned TG
while local users keep dialing the short number.

- Config: LOCAL_ALIASES=localTG:aliasTG[/dir] (dir in|out, omitted = two-way);
  aliasTG must be owned by a LOCAL_PREFIX. Rejects unowned alias, an owned
  short side, duplicate short keys, and numeric overflow.
- Boundary rewrite: prefix routing / owner-relay / peer-interest run on the
  long owned number; local delivery and talker arbitration run on the short
  number, bridged in the four inbound trunk handlers.
- Rewrite-on-select folds a client that dials the long number onto the short
  number (select + monitor), so the two are one conversation locally and on
  the mesh.
- Twin: external-talker notify uses the short number to match the audio
  mirror; disconnect cleanup folds to short so an aliased TG cannot wedge.
- /status exposes local_aliases; satellite nodes warn that the setting is
  ignored (a local alias belongs on the mesh parent that owns the prefix).
- Docs (PEER_PROTOCOL, CONCEPTS, conf template) and integration tests
  (tests/test_alias.py): two-way / in / out, rewrite-on-select, status,
  validation, disconnect-wedge, and duplicate-key coverage.
2026-07-03 18:17:16 +02:00
Audric 7e625dd514 docs: note [SERVER_CERT] COMMON_NAME is required to start
Verified by building the Docker image and running it: a reflector with no
SERVER_CERT/COMMON_NAME aborts at startup ('SERVER_CERT/COMMON_NAME is unset
... Initialization failed') and, under restart: unless-stopped, crash-loops.
Setting COMMON_NAME lets it auto-generate its CA + server cert and start
cleanly (/status responds). The earlier minimal configs omitted it.

- README quick start: add [SERVER_CERT] COMMON_NAME to the minimal config with
  a 'required — aborts without it' note.
- docs/DOCKER.md: flag COMMON_NAME as required in step 1 and note the
  crash-loop failure mode.
2026-06-17 18:26:55 +02:00
Audric 594eee2056 docs: fix Docker quick starts and document routable-prefix intl reach
README:
- Quick start: drop the Docker command block. The repo ships no ready-to-run
  svxreflector.conf (only the .conf.in template) and the compose bind-mount
  hits the 'auto-create a directory' trap, so the inline 'docker compose up'
  steps fail for a newcomer. Point step 1 at the template and step 2 at
  INSTALL.md / DOCKER.md instead.
- Section 5 routable example: use real countries with ISO-alphabetical section
  names (TRUNK_DE_IT, TRUNK_DE_FR) per the naming standard, plus a clearly
  sub-national name for the regional uplink; real MCCs (IT 222, DE 262, FR 208).

docs/DOCKER.md:
- Rewrite step 1: you must create config/svxreflector.conf before first start;
  warn about the bind-mount directory trap and how to recover; copy from the
  .conf.in template; link the README quick start and INSTALL.md.

docs/DEPLOYMENT_ITALY.md + _IT.md:
- Add a 'Reaching international TGs' section (EN + IT): the national mesh needs
  an international gateway plus ROUTABLE_PREFIXES on each region's gateway trunk
  to reach foreign TGs; notes on '*' for a single-uplink leaf and BLACKLIST
  precedence.
2026-06-17 18:04:40 +02:00
Audric ab7ab031e9 chore: drop local-tooling references from tracked files
- tests/test_satellite_secrets.py: remove a stale internal spec path from the
  module docstring; describe the per-satellite secret resolver rule directly.
- .gitignore: drop local-only working-artifact patterns and their headings;
  those paths are now ignored via the untracked .git/info/exclude so no tracked
  file names them. Kept the neutral .worktrees/ rule.
2026-06-17 17:39:00 +02:00
Audric 0f83a25e50 docs(topology): explain ROUTABLE_PREFIXES for Zone->international reach
The gateway example (section 2) only traced the foreign->Zone direction,
which works via gateway prefix routing because the gateway holds the direct
trunk. The reverse — a regional Zone client calling an international TG —
does NOT work by default: the Zone's prefix table has only 222 + Zone
prefixes, so a foreign TG matches nothing and stays local. Without
ROUTABLE_PREFIXES a regional reflector can never call an international TG.

Add a subsection to section 2 (in both TOPOLOGY_EXAMPLES.md and the PDF
source topology.html) showing the Zone uplink config
(ROUTABLE_PREFIXES=262,240 alongside REMOTE_PREFIX=222), the explicit-prefix
rule for a multi-trunk Zone vs the '*' default route for a single-uplink
leaf, and the multi-trunk '*' warning. Cross-links to README section 5 and
CONCEPTS.md. Rebuilt TOPOLOGY_EXAMPLES.pdf.
2026-06-17 17:33:05 +02:00
Audric e35cf42b27 docs: clarify that local TG numbering is opt-in and routing follows the number
A reflector does not impose the prefix convention on its nodes. Make explicit
the third routing case (previously undocumented): a TG matching no prefix in
the mesh has no owner and stays local-only (relayed among the reflector's own
nodes, never trunked), exactly like stock SvxReflector.

Routing is decided solely by longest-prefix-match on the number itself,
regardless of length: a conforming number is routable wherever its prefix
points *if that prefix is owned by a reflector in the mesh* (e.g. 22210->222
Italy, 26201->262 Germany); a non-matching number (e.g. short 1-199 in a
typical MCC scheme) stays local and is unreachable by international traffic.
Conversely a 'local' number that happens to match a configured prefix will be
routed to that owner.

Use real in-repo MCC examples (222/262) instead of unassigned 201/401, and
state the 'if owned in the mesh' precondition. Updated README (How TG
ownership works), CONCEPTS.md (section 2), and TOPOLOGY_EXAMPLES.md; rebuilt
TOPOLOGY_EXAMPLES.pdf from the matching topology.html change.
2026-06-17 17:28:42 +02:00
Audric 70de93f19e docs: state the international trunk section-name standard
International trunk sections are named TRUNK_<ISO>_<ISO> using each
country's ISO 3166-1 alpha-2 code with the two codes in alphabetical order
(e.g. TRUNK_DE_FR, TRUNK_DE_IT). Sorting alphabetically makes the name
deterministic so both sysops independently arrive at the same section name
with no 'my country first' dispute.

This convention was already used and explained in WW_DEPLOYMENT.md but was
only a passing 'readable convention' note in INSTALL.md and absent from the
README section-name rule (the most-read spot). State it as the standard in
README section 4 and INSTALL.md section 6b, with the rationale.
2026-06-17 17:18:41 +02:00
Audric 09db2b5326 docs(troubleshooting): correct ROUTABLE_PREFIXES per-link/per-direction semantics
ROUTABLE_PREFIXES is read and applied locally per link (matchesRoutable /
isSharedTG / collectAllTrunkPrefixes); it is never sent on the wire
(absent from ReflectorMsg.h / MsgPeerHello) and is not validated against the
peer. It therefore does NOT need to be identical on both ends of a link -
only the section name and SECRET must match. The previous wording implied
forward-path symmetry and that the return leg relies solely on interest;
both were imprecise. Clarify the per-direction model and the return-leg
options (downstream ROUTABLE_PREFIXES or peer interest; * leaf via interest
+ wildcard accept).
2026-06-17 17:15:36 +02:00
Audric 53749ffec0 docs: add CONCEPTS and TROUBLESHOOTING guides, plus README navigation
Additive newcomer docs building on the onboarding intro:

- docs/CONCEPTS.md: the bridge between the README glossary and the wire-level
  PEER_PROTOCOL.md. Explains TG-ownership/longest-prefix-match, owner-relay,
  peer interest (+10-min timeout), cluster TGs (single-hop), and talker
  arbitration (lower nonce wins), with a worked three-way-QSO walkthrough.
- docs/TROUBLESHOOTING.md: symptom-first checklists (trunk won't connect,
  audio won't cross, one-way audio, satellite/twin issues, flapping links),
  grounded in the real connect/routing rules and pointing at /status + logging.
- README: add a Contents TOC, a 'Which setup fits my deployment?' table that
  surfaces the topology decision guide near the top, and index both new docs.

All in-page anchors and cross-doc links verified.
2026-06-17 17:11:07 +02:00
Audric 3c7a2dc521 docs(readme): index TWIN_PROTOCOL and MCC_COUNTRY_CODES in Documentation
Both docs existed but were absent from the README Documentation list:
TWIN_PROTOCOL.md was only mentioned in a feature bullet, and
MCC_COUNTRY_CODES.md was only reachable via a link inside INSTALL.md.
Every docs/*.md is now indexed from the README.
2026-06-17 17:03:15 +02:00
Audric 35b263a8f3 docs(tests): document the routable suite as phase 3 of run_tests.sh
test_routable.py is now wired into run_tests.sh (commit bdba042), so the
suite no longer runs on a 'separate stack'. Update TESTS.md: two phases ->
three phases (89 tests), add the routable run step, fix the orchestrator
summary and the file-table entry (it uses unittest, not pytest), and
reword the twin/routable section headers that called them 'separate'.
2026-06-17 17:00:40 +02:00
Audric a6010f7dc1 docs(readme): add newcomer onboarding intro, glossary, and quickstart
The README opened assuming the reader already runs SvxReflector, with no
plain-language explanation of what a reflector or talk group is and no
zero-prerequisite path to a running instance.

- Add a 'New to SvxLink reflectors? Start here' section: a four-bullet
  plain-language overview plus an 8-term glossary (node, reflector, talk
  group, trunk, prefix, cluster TG, satellite, twin). Existing operators
  get a skip-ahead link.
- Add a 'Quick start - one standalone reflector' section making clear that
  trunking is optional, with a minimal accurate config snippet and a
  three-step Docker run.
- Fix stale facts: test count 18 -> 89 across six suites; /status example
  version 1.0.0 -> 1.3.99.13+trunk.twin2.
2026-06-17 16:49:03 +02:00
Audric bdba042604 test: wire test_routable.py into run_tests.sh
The routable-prefix suite (added with the ROUTABLE_PREFIXES feature) had a
test file and docker-compose.routable.yml but was never invoked by the
runner, so it was silently skipped. Add a ROUTABLE phase after the TWIN
tests (generate --topology routable, bring up the dedicated mesh, run
test_routable.py, tear it down) and extend the cleanup trap to down the
routable compose file on interrupt.

Full suite now runs 89 tests: 52 trunk + 7 mqtt + 5 satellite-secrets
+ 6 logging + 17 twin + 2 routable.
2026-06-17 16:48:37 +02:00
Audric IW1GEU 54493eb459 Merge pull request #10 from audric/feature/routable-prefixes
feat(trunk): static routable prefixes for multi-hop / hierarchical routing
2026-06-17 15:35:00 +02:00
Audric 66f88a2f00 docs(routable): fix README link section-name match; note restart semantics; tighten wildcard wording 2026-06-15 21:49:19 +02:00
Audric 013040d1fb docs(routable): fix routing example, delegation note, return-leg accept, test refs
- Replace wrong "ownership caveat" in all three files with a neutral
  delegation note: a more specific routable prefix intentionally delegates
  that sub-range via longest-prefix-match; point it at the reflector that
  actually owns those TGs.
- Fix the README example: align it with the actual test topology
  (leaf 222100 → natlit 222 → natlde 262 → far 263, two transit nodes,
  three trunk links); every REMOTE_PREFIX now equals the peer's LOCAL_PREFIX
  with no collisions; add the natlde return-path trunk section.
- Add a sentence in both README and PEER_PROTOCOL.md explaining that the
  *-leaf accepts returning audio via matchesRoutable on its inbound-accept
  gate (hasPrefixRoute cannot serve this role since * is not in m_all_prefixes).
- Fix tests/TESTS.md: remove non-existent topology_routable.py reference
  (routable topology lives in topology.py/ROUTABLE_REFLECTORS, generated by
  python3 generate_configs.py → docker-compose.routable.yml); correct
  "two hops away" to "two transit nodes away (three trunk links)".
2026-06-15 21:42:28 +02:00
Audric b18f3e8141 docs(routable): document ROUTABLE_PREFIXES across conf, README, protocol, tests 2026-06-15 19:48:30 +02:00
Audric bf7c82b3ae feat(trunk): warn when ROUTABLE_PREFIXES='*' set on a multi-trunk reflector 2026-06-15 18:33:07 +02:00
Audric 92c8284b7c feat(trunk): accept inbound for routable/transit TGs (hasPrefixRoute || matchesRoutable) 2026-06-15 17:24:52 +02:00
Audric ce08a9886c feat(reflector): explicit routable prefixes join m_all_prefixes for transit (excludes *) 2026-06-15 17:07:00 +02:00
Audric 1e1d477957 feat(trunk): routable prefixes feed isSharedTG send/interest gate (* = zero-length) 2026-06-15 16:57:10 +02:00
Audric 4b55d69bd6 feat(trunk): parse ROUTABLE_PREFIXES (members + initialize + reload) 2026-06-15 16:48:43 +02:00
Audric 46979c1f8b test(routable): clarify return-path docs; drop dead test scaffolding
Document both forward and return legs of the 263xx transit chain in
topology.py ROUTABLE_REFLECTORS comment block, making clear that
natlde's routable entry toward natlit is the return-path hop and that
the natlit→leaf final hop is carried by peer-interest (not a routable
entry).  Add inline note on natlde's entry.

Drop ROUTABLE_NAMES from topology.py (dead — test files define their own
sorted() locals, matching the REFLECTOR_NAMES/TWIN_NAMES convention).
Remove duplicate sys.path.insert and unused COMPOSE_FILE/TESTS_DIR
constants from test_routable.py.  Add clarifying comment above the
per-peer routable/blacklist injection in generate_configs.py.

Generated configs are byte-identical; no topology routing changes.
2026-06-15 16:34:18 +02:00
Audric 2e0e501ca5 test(routable): add transit-chain topology + failing routable-prefix tests
Adds an isolated 4-node chain topology (leaf → natlit → natlde → far) to
exercise the planned ROUTABLE_PREFIXES feature. TG 26305 is owned by `far`
(prefix 263) which is unreachable from `leaf` without transit; test_01
asserts forward + return audio delivery and fails until the C++ feature lands.
test_02 asserts that BLACKLIST_TGS=26307 on leaf's uplink vetoes that specific
TG while leaving 26305 unaffected.

Files added/modified:
  tests/topology.py          — ROUTABLE_REFLECTORS dict + port/secret helpers
  tests/generate_configs.py  — generate_routable_reflector_conf/docker_compose +
                               ROUTABLE_PREFIXES/BLACKLIST_TGS emission in
                               per-peer trunk loop; routable in default run
  tests/test_routable.py     — new test file (mirrors test_twin.py pattern)
  tests/docker-compose.routable.yml — generated chain compose (4 services)
2026-06-15 11:59:46 +02:00
Audric c65ab7309f feat(status): show trunk/twin/satellite panels in svxreflector-status
Extend the curses status monitor to render the fork-specific /status
sections below the node table:
- TRUNKS: endpoint, connection direction, local/remote prefixes,
  active talkers, node and muted counts
- TWIN: endpoint, direction, priority/peer-priority, node count
- SATELLITES: id, auth state, active TGs, node count, optional filter

Up links render green, down links red; absent sections are omitted.
Columns size to content and shrink to fit the terminal width, and the
node table auto-caps so the panel always fits.
2026-06-11 13:53:13 +02:00
Audric 729bed79e1 docs(tests): record monitoredTGs roster trim + fix test_trunk count
Add table rows for test_21b (filter trims node roster) and test_21c
(filter trims monitoredTGs in the status blob), and correct the
test_trunk.py count from 50 to 52 in all three places. The count was
already a step behind: 7cf6589 added test_21b without updating TESTS.md.
2026-05-27 13:16:29 +02:00
Audric 88739d160b feat(trunk): apply per-link TG filter to monitoredTGs in peer roster
The roster trim added in 7cf6589 dropped a peer node entirely when its
*selected* TG was filtered, but a kept node (selected on a permitted TG)
still carried its full monitoredTGs list verbatim in the status blob, so
blacklisted / non-ALLOW_TGS TGs it was only monitoring leaked into
/status.trunks[<section>].nodes[*].monitoredTGs and the MQTT/Redis mirrors.

Filter each entry's monitoredTGs array in TrunkLink::handleMsgPeerNodeList
with the same composite gate as the selected TG and the audio receive path
(isBlacklisted(tg) || isBlacklisted(mapTgIn(tg)) || !isAllowed(tg)), so
TG_MAP translation is honoured and the blacklist wins over an allow-prefix.
Non-permitted and malformed (non-uint) entries are dropped; the array may
become empty. Visibility-only: m_partner_nodes feeds statusJson() and
onPeerNodeList() (MQTT/Redis), never routing.

Adds test_21c_filter_trims_monitored_tgs_in_blob and documents the
monitor-list trim in PEER_PROTOCOL.md.
2026-05-27 13:06:23 +02:00
Audric 7cf6589a3b feat(trunk): apply per-link TG filter to peer node roster on ingest
BLACKLIST_TGS / ALLOW_TGS previously gated only audio and active-talker traffic on a trunk link; the full client roster (MsgPeerNodeList) was stored verbatim, so a peer node parked on a filtered TG still appeared in /status.trunks[<section>].nodes and the MQTT/Redis mirrors.

Filter each node-list entry in TrunkLink::handleMsgPeerNodeList using the same composite gate as the audio receive path (isBlacklisted(tg) || isBlacklisted(mapTgIn(tg)) || !isAllowed(tg)), so TG_MAP translation is honoured. Filtered entries are dropped entirely. Safe because m_partner_nodes feeds only statusJson() and onPeerNodeList() (MQTT/Redis) -- no routing depends on it.

Adds test_21b_filter_drops_nodes_from_roster and documents the receive-side trim in PEER_PROTOCOL.md and svxreflector.conf.in.
2026-05-25 20:43:09 +02:00
Audric e3b0b6f3df docs: refresh test docs and complete MsgTrunk* -> MsgPeer* rename
- TWIN_PROTOCOL.md: note that the trunk->twin mirror delivers to selected
  AND monitoring clients (the composite selected-OR-monitor filter),
  pairing with the TwinLink fix in f1d4afd; complete the MsgTrunk* ->
  MsgPeer* rename in the steady-state message table and design narrative.
- TESTS.md: bring in line with the current suite — trunk 35->50, twin
  11->17. Document test_trunk 33-47 (satellite cross-visibility, prefix
  routing/cluster fanout, monitor-TG fanout, trunk resilience) and the
  test_twin X1-X5 series including the new X5 monitor regression; add the
  mqtt-deltas, satellite-secrets, and logging suites to the run sequence;
  update the five-client roster.
- Rename stale MsgTrunk* references to MsgPeer* (wire IDs unchanged, per
  18d92a2) across README, DEPLOYMENT_ITALY{,_IT}, WW_DEPLOYMENT,
  JAY-additions, and DESIGN_SATELLITE_AND_CLUSTER. PEER_PROTOCOL.md keeps
  its two MsgTrunk* mentions — they document the rename itself.
2026-05-24 12:42:53 +02:00
Audric f1d4afd032 fix(twin): deliver mirrored trunk audio to monitor-only twin clients
TwinLink::handleMsgPeerAudio and handleMsgPeerFlush broadcast to local
clients with a selected-only TgFilter, whereas the sibling receive paths
(TrunkLink, SatelliteLink, SatelliteClient) use the composite
selected-OR-(passive-observer monitor) filter. TwinLink was the lone
outlier — the bare filter was copied in when the trunk->twin mirror was
added (6a6cfad) without the monitor arbitration the other paths already had.

When a PAIRED external peer that OWNS a TG fans audio into a twin pair it
picks a single sticky socket, so the non-sticky twin only receives that
audio via the trunk->twin mirror. A monitor-only listener on the non-sticky
twin was silently dropped, while a selecting listener there (and any
listener on the sticky twin, which gets the direct trunk path) heard fine.
Reported in the field on a 255/256 twin+single deployment: clients
monitoring the single peer's TG were silent on one twin and fine on the other.

- TwinLink::handleMsgPeerAudio / handleMsgPeerFlush: use the same composite
  selected-OR-monitor filter as TrunkLink, preserving the passive-observer /
  earliest-monitor-talker arbitration.
- tests: test_X5_paired_inbound_owner_tg_reaches_monitoring_twin_clients —
  mirror image of test_X4 (TG owned by the remote PAIRED peer; selecting and
  monitoring receivers on both twins). Red before the fix, green after.
- topology.py: add two test users (N0FOUR, N0FIVE) so the test can place
  five distinct callsigns.
2026-05-24 12:03:53 +02:00
Audric b268bfe595 fix(trunk): guard inbound send paths against closed sockets; clean up on heartbeat timeout
A non-paired trunk link could abort the reflector (assert sock >= 0 in
AsyncTcpConnection::write) when an inbound peer was timed out by the
heartbeat. disconnect() closes the socket but does not emit the disconnected
signal, so onInboundDisconnected never runs and m_inbound_con /
m_ib_hello_received stay set. isInboundReady() then reports the dead link as
ready, and the next send — e.g. a MsgPeerTgInterest scheduled by a client
publishing its monitored-TG list — falls through to sendMsgOnInbound and
writes to the closed socket. Reproduces the production abort seen on v1.3.12;
TrunkLink is unchanged through v1.3.13.

- sendMsgOnInbound / isInboundReady: bail when the inbound socket is closed.
- inbound heartbeat timeout: drive the full cleanup (onInboundDisconnected +
  drop the dead connection from the reflector inbound map) so the link
  self-heals and /status is honest, instead of leaving a phantom inbound that
  makes acceptInboundConnection reject every reconnect until restart.
- defense in depth: same isConnected() guard on sendMsgOnOutbound and
  SatelliteLink::sendMsg (currently unreachable, but never write to a closed
  socket regardless).
- tests: test_46 (no crash on timeout + TG-interest send), test_47 (inbound
  recovers after a timeout).
2026-05-21 14:27:27 +02:00
Audric 8f00196821 warn when [SATELLITE] section is set on a satellite node
A satellite (SATELLITE_OF set) returns early from Reflector::initialize()
before initSatelliteServer() runs, so any [SATELLITE] block is silently
ignored. Child satellites then get connection-refused with nothing in
the parent's log explaining why. Emit a warn at startup so the misconfig
surfaces immediately.
2026-05-19 14:48:02 +02:00
Audric edd188b457 docs(topology): expand international mesh diagrams to 5 countries
- §1 (01_intl_mesh.dot): full mesh now includes ES (214), SE (240),
  DE (262), IT (222), UA (255) — 5-node pentagon with 10 edges.
- §2 (02_flat_mesh.dot): international side likewise widened to the
  5-country full mesh; IT 222 stays as the rightmost gateway vertex.
  National-side Zones spread into a 2x2 block mirroring the
  international layout so the 10 national edges have room to breathe.
- ASCII art in TOPOLOGY_EXAMPLES.md §1 and §2 updated to match.
- TOPOLOGY_EXAMPLES.pdf rebuilt via docs/build_topology_pdf.sh.
2026-05-17 13:26:21 +02:00
Audric de7e4648ea docs: add MCC country-codes reference; MCC-anchor remaining bare prefix examples
- New docs/MCC_COUNTRY_CODES.md: 25-country table with ISO codes and
  MCC(s), notes on countries with multiple MCC allocations, and a
  pointer to the ITU-T E.212 source for everything else.
- INSTALL.md §6a/6b: replace toy single-digit LOCAL_PREFIX/REMOTE_PREFIX
  examples with MCC-anchored ones (LOCAL_PREFIX=262, REMOTE_PREFIX=240,
  TRUNK_DE_SE) plus a cross-reference to the new MCC table.
- DESIGN_SATELLITE_AND_CLUSTER.md: MCC-anchor the two stale config
  snippets (LOCAL_PREFIX 01->22201, REMOTE_PREFIX 02->22202) so the
  historical design doc no longer teaches the bare-regional-digit
  anti-pattern.
2026-05-17 13:26:15 +02:00
Audric 61aafc1c0c docs(italy): MCC-prefix LOCAL_PREFIX and REMOTE_PREFIX with 222
Bare 2-digit regional codes (e.g. LOCAL_PREFIX=01) carried no country
namespace and would collide with any other country picking the same
regional digits. Prefix every LOCAL_PREFIX and REMOTE_PREFIX with the
Italy MCC (222), so each value sits inside the 222 prefix space
(e.g. Lazio = 22201, Lombardia = 22221). Section names
[TRUNK_xx_yy] and SECRET=IT_xx_yy keep the 2-digit form as readable
identifiers — only the prefix values themselves are MCC-anchored.
Inventory table, prose explanation, complete Lazio config block,
per-region checklist, and the parallel Italian translation all
updated in lockstep.
2026-05-17 11:14:11 +02:00
Audric a9691cdf4e docs: remove handoff doc — contained third-party private chat 2026-05-17 10:56:45 +02:00
Audric f9bd1bd3cf docs: drop stale provenance line from monitor-tg handoff doc 2026-05-17 10:55:15 +02:00
Audric 28525b03d5 docs(satellite): document per-id SECRET_<id>= across deployment and design docs
- WW_DEPLOYMENT.md, DEPLOYMENT_ITALY.md (+ IT translation): add the
  per-id SECRET_<id>= snippet alongside the existing single-secret
  example so operators see both forms.
- TOPOLOGY_EXAMPLES.md: rewrite the obsolete 'future work:
  per-satellite secrets' callout in §3 to reflect the shipped feature;
  touch up §4 reference to the parent's SECRET.
- DESIGN_SATELLITE_AND_CLUSTER.md: preserve the original design body;
  add a brief postscript pointing readers to the per-id form in the
  README.
2026-05-17 10:55:13 +02:00
Audric a679ab28db docs(satellite): document per-id SECRET_<id>= in README 2026-05-17 02:24:37 +02:00
Audric d757384c9c fix(satellite): defer heartbeat until auth; reject hello triggers cleanup
SatelliteLink's heartbeat timer was constructed with the default
enabled=true, so it started ticking at connect time. When a hello was
rejected, m_con->disconnect() closed the socket but the timer kept
running; at the t=10s tx tick it called sendMsg, which hit
assert(sock >= 0) in TcpConnection::write and crashed the reflector.

TcpConnection::disconnect() intentionally does not emit the
disconnected signal (header comment), so the TcpServer's
clientDisconnected handler never ran -- the SatelliteLink stayed in
m_satellite_con_map with no path to cleanup. TrunkLink avoids this
by constructing its heartbeat with enabled=false and enabling it only
after auth (TrunkLink.cpp:197); SatelliteLink just missed the pattern.

Mirror TrunkLink: construct the heartbeat disabled, enable it after
successful authentication in handleMsgPeerHello. On all four rejection
branches, fire linkFailed(this) after m_con->disconnect() so the
existing onSatelliteLinkFailed -> processSatelliteCleanup path deletes
the leaked link.

Add test_rejection_does_not_crash_parent regression test that sends
a hello with a wrong-for-pinned-id secret, waits past the 10s
heartbeat threshold, and confirms /status still responds and shows
no phantom satellite entry.
2026-05-17 02:20:50 +02:00
Audric f51ead2d7b test(satellite): use dash in per-id satellite ids to match charset
Underscores are not in the configured per-id charset [A-Za-z0-9-]+,
so SECRET_SAT_PINNED= was correctly rejected as malformed at startup.
Switch SAT_PINNED -> SAT-PINNED (and same for SAT_UNPINNED) so the
test fixture matches the spec.
2026-05-17 02:19:13 +02:00
Audric c76802df2f docs(satellite): document per-id SECRET_<id>= in conf template 2026-05-17 01:13:01 +02:00
Audric 93c396eef9 feat(satellite): resolve secret per-id in MsgPeerHello handler 2026-05-17 01:04:25 +02:00
Audric 5ded17fd24 feat(satellite): add resolveSatelliteSecret helper 2026-05-17 00:58:43 +02:00
Audric d6110f91cb feat(satellite): parse per-id SECRET_<id>= entries in [SATELLITE] 2026-05-17 00:49:43 +02:00