Commit Graph
65 Commits
Author SHA1 Message Date
Audric 67e3712d02 Add port comments and CI workflow to trigger svxlink-docker rebuild
- Annotate docker-compose port mappings with their purpose
- Add GitHub Actions workflow that dispatches a rebuild event to
  audric/svxlink-docker on every push to master
2026-03-26 14:11:57 +01:00
Audric b8d0dd19af Add trunk TCP server for bidirectional peer connections
Previously TrunkLink only connected outbound — there was no server
listening on port 5302, so both reflectors got "Connection refused."

Changes:
- Reflector: add trunk TcpServer (default port 5302, configurable
  via TRUNK_LISTEN_PORT) that accepts inbound peer connections,
  authenticates via HMAC, and matches by secret + prefix
- TrunkLink: support both outbound and inbound directions with
  automatic conflict resolution (lower priority keeps outbound)
- Security: pre-auth frame size cap (4KB), max 5 pending connections,
  10s hello timeout, log-injection sanitization
- Docs: updated TRUNK_PROTOCOL.md, README.md, CLAUDE.md
2026-03-26 12:59:04 +01:00
Audric 53a9a6fc75 Support overlapping TG prefixes with longest-prefix-match routing
isSharedTG now finds the longest matching remote prefix and verifies
no other prefix in the mesh is more specific. Each TrunkLink receives
the full set of all prefixes at startup via setAllPrefixes().
initTrunkLinks is split into two passes: collect all prefixes first,
then create links with full knowledge.
2026-03-26 10:55:47 +01:00
Audric dda6ac5531 docs: clarify cluster TG subscription model and satellite TG filtering
Cluster TGs are a per-reflector subscription choice, not a mesh-wide
requirement. Document that satellites forward all TGs unconditionally
with no prefix or cluster TG filtering.
2026-03-24 16:59:42 +01:00
Audric b958a53ab3 Remove connection throttling from all TCP servers 2026-03-22 15:33:08 +01:00
Audric 3a9b147b92 Relax client and satellite server connection throttling to match HTTP server 2026-03-22 10:19:07 +01:00
Audric ddbf8fd228 Relax HTTP server connection throttling for monitoring
Increase bucket_max from 10 to 100 and bucket_inc from 0.1 to 10.0
to allow more frequent polling of the /status endpoint.
2026-03-21 22:28:02 +01:00
Audric 64697e61d7 Fix event loop blocking on DNS abort in CppDnsLookupWorker
abortLookup() called m_result.get() synchronously, blocking the entire
event loop while waiting for a potentially long getaddrinfo() call to
finish (~18s when the DNS server is unreachable). This caused the HTTP
/status endpoint and all other event loop processing to stall whenever
a TrunkLink reconnect cycle aborted a pending DNS lookup.

Move the future and thread context to a detached cleanup thread so the
event loop returns immediately.
2026-03-20 20:28:26 +01:00
Audric 9f5ed86196 docs: add network requirements section to README
Clarify that trunk links require mutual reachability (static IP +
open port on both sides) while satellite links only need the parent
to be reachable (satellites can run behind NAT).
2026-03-20 19:15:16 +01:00
Audric fa57db6e62 Fix satellite heartbeat timeout cleanup and /status blocking
Heartbeat timeout called m_con->disconnect() on a server-managed
connection, which didn't trigger TcpServer::clientDisconnected —
leaving dead satellites in the map forever. After timeout, the
unsigned rx counter wrapped to UINT_MAX preventing re-detection.
The timer also kept firing sendMsg() to the dead socket, blocking
the event loop and causing /status to stall for ~10s.

Fix: SatelliteLink emits linkFailed signal instead of calling
disconnect directly. Reflector handles cleanup via a deferred
zero-timer to avoid re-entrancy. The /status handler skips
satellites pending cleanup. Also disable ALSA in Docker build
(unused by the reflector).
2026-03-20 19:08:31 +01:00
Audric 195be03036 docs: remove redundant example in live reload section 2026-03-20 13:55:23 +01:00
Audric 551cfa70cd Implement satellite reflectors
Satellite reflectors are lightweight relay instances that connect to a
parent reflector instead of joining the full trunk mesh. Clients connect
to the satellite normally; it relays all TGs bidirectionally to the
parent. The parent forwards satellite events to local clients, trunk
peers, and other satellites.

New classes:
- SatelliteLink: parent-side handler for each inbound satellite
  connection (HMAC auth, heartbeat, all-TG relay)
- SatelliteClient: satellite-side outbound connection to parent

Wire protocol: MsgTrunkHello gains m_role field (ROLE_PEER=0,
ROLE_SATELLITE=1) to distinguish satellite handshakes.

Config:
- Parent: [SATELLITE] section with LISTEN_PORT and SECRET
- Satellite: SATELLITE_OF, SATELLITE_PORT, SATELLITE_SECRET in [GLOBAL]

HTTP /config endpoint now shows mode (reflector/satellite),
satellite_server config on parents, and satellite connection info.

Docs updated: README, DEPLOYMENT_ITALY, Italian translation.
2026-03-20 13:53:17 +01:00
Audric 166e57f445 Implement cluster TGs and /config HTTP endpoint
Cluster TGs (BrandMeister-style): talk groups broadcast to all trunk
peers regardless of prefix ownership. Configured via CLUSTER_TGS in
[GLOBAL]. Routing checks in TrunkLink now accept isSharedTG || isClusterTG
for all 8 inbound/outbound handlers. Validated at startup to not overlap
with any LOCAL_PREFIX or REMOTE_PREFIX.

New GET /config endpoint returns static configuration (local_prefix,
cluster_tgs, listen_port, http_port, trunk peers) for dashboard use.

Docs: cluster TG sections added to README, DEPLOYMENT_ITALY, and
Italian translation. Design doc for satellite reflectors and cluster
TGs added.
2026-03-20 12:41:26 +01:00
Audric e26b932223 docs: clarify that PTY config changes are in-memory only
Add a "Persisting across reboots" subsection to the live reload
documentation explaining that PTY CFG commands must be paired with
a config file edit to survive restarts.
2026-03-20 11:56:31 +01:00
Audric fca7c33794 Security hardening: fix 19 of 22 vulnerabilities found in audit
Critical:
- Trunk HMAC-SHA1 auth: MsgTrunkHello now carries nonce+digest,
  peer disconnected on secret mismatch (was loaded but never verified)

High:
- Pre-hello guard: reject all trunk messages before handshake completes
- CSPRNG for password generator: random.choice -> secrets.choice

Medium:
- Path traversal protection on callsign-based file operations
- Replace assert() on network-derived UDP data with error handling
- HTTP server connection throttling (matching main TCP server)
- try/catch on regex compilation in callsignOk()/emailOk()
- Per-link trunk talker tracking (clearAllTrunkTalkers scoped to peer)
- Regenerate priority nonce on each new trunk connection
- Cap active TGs and trunk talkers at 10000 each
- Don't reset heartbeat for unauthenticated client app messages
- Fix RENEW_AFTER integer division (2/3 -> 2.0/3.0)

Low:
- JSON-escape HTTP method in error response
- snprintf for pidfile error message
- MsgAuthResponse::digest() null check on empty vector
- Check unpack() return values in AsyncMsg.h vector/map/string
- Replace stack VLA with std::string; reserve+push_back vs resize
- Require TalkerStart before accepting trunk audio
2026-03-20 11:54:18 +01:00