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
238 lines
6.9 KiB
Markdown
238 lines
6.9 KiB
Markdown
# GeuReflector
|
|
|
|
GeuReflector is a fork of [SvxReflector](https://github.com/sm0svx/svxlink)
|
|
extended with a **server-to-server trunk protocol** that lets multiple reflector
|
|
instances share talk groups (TGs) as independent parallel voice channels —
|
|
analogous to telephone trunk lines between telephone exchanges.
|
|
|
|
Original SvxReflector by Tobias Blomberg / SM0SVX.
|
|
Trunk extension by IW1GEU.
|
|
|
|
---
|
|
|
|
## Why trunking?
|
|
|
|
A standard SvxReflector is a single centralized server. Without trunking, a
|
|
multi-site national deployment has two unsatisfying options:
|
|
|
|
- **One national server** — only one TG can be active at a time across the
|
|
entire network; one outage takes everyone down.
|
|
- **Independent regional servers bridged by SvxLink instances** — technically
|
|
possible, but each bridge instance handles only one TG at a time and one
|
|
instance is needed per pair of servers. For 20 regions in full mesh that is
|
|
190 SvxLink bridge processes for a single shared TG, multiplied by the number
|
|
of TGs to share. Unmanageable at scale.
|
|
|
|
GeuReflector solves this: each region runs its own independent reflector
|
|
(resilience, local autonomy) and the trunk links connect them so they can share
|
|
TGs selectively. All regional TGs can carry simultaneous independent QSOs while
|
|
a national TG remains available to all. Talker arbitration is handled
|
|
automatically.
|
|
|
|
---
|
|
|
|
## What it adds over SvxReflector
|
|
|
|
- **Prefix-based TG ownership** — each reflector is authoritative for all TGs
|
|
whose decimal representation starts with a configured digit string (e.g.
|
|
`LOCAL_PREFIX=1` → owns TGs 1, 10, 100, 1000, 12345 …). Both `LOCAL_PREFIX`
|
|
and `REMOTE_PREFIX` accept comma-separated lists for reflectors that own
|
|
multiple prefix groups (e.g. `LOCAL_PREFIX=11,12,13`)
|
|
- **Server-to-server trunk links** — persistent TCP connections between pairs of
|
|
reflectors carry talker state and audio for shared TGs
|
|
- **Full-mesh topology** — any number of reflectors can be trunked together; each
|
|
pair has a direct link so no multi-hop routing is needed
|
|
- **Unlimited concurrent conversations** — the trunk TCP connection multiplexes
|
|
all active TGs simultaneously; the only per-TG rule is one talker at a time
|
|
- **Independent talker arbitration** — each reflector arbitrates its own clients;
|
|
the trunk adds a tie-breaking layer (random priority nonce) for simultaneous
|
|
claims
|
|
- **HTTP `/status` endpoint** — existing JSON status now includes a `trunks`
|
|
object with per-link state and active talkers
|
|
- SvxLink client nodes are **unmodified** — they connect to their local
|
|
reflector as normal and are unaware of the trunk
|
|
|
|
---
|
|
|
|
## How TG ownership works
|
|
|
|
TG numbers work like telephone numbers. The reflector that owns a TG prefix is
|
|
the authoritative home for every TG in that prefix group:
|
|
|
|
```
|
|
Reflector 1 (LOCAL_PREFIX=1) → TGs 1, 10, 11, 100, 1000, 12345, …
|
|
Reflector 2 (LOCAL_PREFIX=2) → TGs 2, 20, 21, 200, 2000, 25000, …
|
|
Reflector 3 (LOCAL_PREFIX=3) → TGs 3, 30, …
|
|
```
|
|
|
|
When a client on Reflector 1 joins TG 25, Reflector 1 forwards the conversation
|
|
over its trunk to Reflector 2 (which owns the "2" prefix). Clients on both
|
|
reflectors hear the same audio on TG 25 with no extra configuration.
|
|
|
|
---
|
|
|
|
## Build
|
|
|
|
Requires the same dependencies as SvxReflector: libsigc++, OpenSSL, libjsoncpp,
|
|
libpopt. Optional: libopus, libgsm, libspeex.
|
|
|
|
```bash
|
|
cd geureflector
|
|
cmake -S src -B build -DLOCAL_STATE_DIR=/var
|
|
cmake --build build
|
|
# binary at build/bin/svxreflector
|
|
```
|
|
|
|
---
|
|
|
|
## Configuration
|
|
|
|
GeuReflector uses the same `svxreflector.conf` format as SvxReflector with two
|
|
additions.
|
|
|
|
### 1. Declare this reflector's TG prefix
|
|
|
|
Add `LOCAL_PREFIX` to the `[GLOBAL]` section. A comma-separated list is accepted
|
|
when a single reflector owns multiple prefix groups:
|
|
|
|
```ini
|
|
[GLOBAL]
|
|
LISTEN_PORT=5300
|
|
LOCAL_PREFIX=1 # owns TGs 1, 10, 100, 1000, ...
|
|
# LOCAL_PREFIX=11,12,13 # multiple prefixes on one instance
|
|
```
|
|
|
|
### 2. Add a trunk section per peer
|
|
|
|
```ini
|
|
[TRUNK_2]
|
|
HOST=reflector-b.example.com
|
|
PORT=5302 # trunk port (default 5302, separate from client port 5300)
|
|
SECRET=shared_secret
|
|
REMOTE_PREFIX=2 # peer owns TGs 2, 20, 200, 2000, ...
|
|
# REMOTE_PREFIX=11,12,13 # comma-separated list accepted here too
|
|
```
|
|
|
|
Repeat for each peer (`[TRUNK_3]`, `[TRUNK_4]`, …).
|
|
|
|
### Full-mesh example — three reflectors
|
|
|
|
**Reflector A** — owns prefix "1":
|
|
```ini
|
|
[GLOBAL]
|
|
LOCAL_PREFIX=1
|
|
|
|
[TRUNK_2]
|
|
HOST=reflector-b.example.com
|
|
SECRET=secret_ab
|
|
REMOTE_PREFIX=2
|
|
|
|
[TRUNK_3]
|
|
HOST=reflector-c.example.com
|
|
SECRET=secret_ac
|
|
REMOTE_PREFIX=3
|
|
```
|
|
|
|
**Reflector B** — owns prefix "2":
|
|
```ini
|
|
[GLOBAL]
|
|
LOCAL_PREFIX=2
|
|
|
|
[TRUNK_1]
|
|
HOST=reflector-a.example.com
|
|
SECRET=secret_ab
|
|
REMOTE_PREFIX=1
|
|
|
|
[TRUNK_3]
|
|
HOST=reflector-c.example.com
|
|
SECRET=secret_bc
|
|
REMOTE_PREFIX=3
|
|
```
|
|
|
|
**Reflector C** — owns prefix "3":
|
|
```ini
|
|
[GLOBAL]
|
|
LOCAL_PREFIX=3
|
|
|
|
[TRUNK_1]
|
|
HOST=reflector-a.example.com
|
|
SECRET=secret_ac
|
|
REMOTE_PREFIX=1
|
|
|
|
[TRUNK_2]
|
|
HOST=reflector-b.example.com
|
|
SECRET=secret_bc
|
|
REMOTE_PREFIX=2
|
|
```
|
|
|
|
Both sides of each trunk must point at each other and share the same `SECRET`.
|
|
|
|
---
|
|
|
|
## HTTP Status
|
|
|
|
Enable with `HTTP_SRV_PORT=8080` in `[GLOBAL]`. The `/status` endpoint returns
|
|
JSON that now includes a `trunks` key. `local_prefix` and `remote_prefix` are
|
|
returned as arrays to reflect multi-prefix support:
|
|
|
|
```json
|
|
{
|
|
"nodes": { ... },
|
|
"trunks": {
|
|
"TRUNK_2": {
|
|
"host": "reflector-b.example.com",
|
|
"port": 5302,
|
|
"connected": true,
|
|
"local_prefix": ["1"],
|
|
"remote_prefix": ["2"],
|
|
"active_talkers": {
|
|
"25": "SM0ABC",
|
|
"200": "LA8PV"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
`active_talkers` lists only TGs with an active remote talker at query time.
|
|
|
|
---
|
|
|
|
## Live user/password reload
|
|
|
|
New users and passwords written to `svxreflector.conf` are picked up **without
|
|
restarting** via the command PTY interface (enabled by default):
|
|
|
|
```bash
|
|
# Reload users list
|
|
echo "CFG USERS section_name key value" > /dev/shm/reflector_ctrl
|
|
|
|
# Or reload passwords
|
|
echo "CFG PASSWORDS section_name key value" > /dev/shm/reflector_ctrl
|
|
```
|
|
|
|
The PTY path is set by `COMMAND_PTY` in `[GLOBAL]` (default
|
|
`/dev/shm/reflector_ctrl`).
|
|
|
|
---
|
|
|
|
## Documentation
|
|
|
|
- [`docs/INSTALL.md`](docs/INSTALL.md) — how to build and install GeuReflector
|
|
as a drop-in replacement for an existing SvxReflector installation
|
|
- [`docs/DOCKER.md`](docs/DOCKER.md) — running GeuReflector in a Docker container
|
|
as a drop-in replacement for an existing SvxReflector installation
|
|
- [`docs/TRUNK_PROTOCOL.md`](docs/TRUNK_PROTOCOL.md) — full wire protocol
|
|
specification: message format, handshake sequence, talker arbitration
|
|
tie-breaking, heartbeat, and the complete message type table
|
|
- [`docs/DEPLOYMENT_ITALY.md`](docs/DEPLOYMENT_ITALY.md) — complete national
|
|
deployment example for Italy (20 regions, full mesh)
|
|
- [`docs/DEPLOYMENT_ITALY_IT.md`](docs/DEPLOYMENT_ITALY_IT.md) — same document
|
|
in Italian
|
|
|
|
---
|
|
|
|
## License
|
|
|
|
GNU General Public License v2 or later — same as SvxLink upstream.
|