diff --git a/README.md b/README.md index 6a30194..4f2bb49 100644 --- a/README.md +++ b/README.md @@ -182,7 +182,7 @@ it immediately. ### 4. Add a trunk section per peer ```ini -[TRUNK_2] +[TRUNK_AB] HOST=reflector-b.example.com PORT=5302 # trunk port (default 5302, separate from client port 5300) SECRET=shared_secret @@ -190,7 +190,13 @@ 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]`, …). +Repeat for each peer (`[TRUNK_AC]`, `[TRUNK_AD]`, …). + +**Important:** The `[TRUNK_x]` section name must be **identical on both sides** of +the link. Both sysops must agree on a shared section name before configuring the +link. For example, if reflectors A and B want to link, both configs must use the +same name (e.g. `[TRUNK_AB]`). A connection from a peer whose section name does +not match any local section will be rejected. ### Network requirements @@ -222,12 +228,12 @@ run behind NAT, just like a regular SvxLink client node. [GLOBAL] LOCAL_PREFIX=1 -[TRUNK_2] +[TRUNK_AB] HOST=reflector-b.example.com SECRET=secret_ab REMOTE_PREFIX=2 -[TRUNK_3] +[TRUNK_AC] HOST=reflector-c.example.com SECRET=secret_ac REMOTE_PREFIX=3 @@ -238,12 +244,12 @@ REMOTE_PREFIX=3 [GLOBAL] LOCAL_PREFIX=2 -[TRUNK_1] +[TRUNK_AB] HOST=reflector-a.example.com SECRET=secret_ab REMOTE_PREFIX=1 -[TRUNK_3] +[TRUNK_BC] HOST=reflector-c.example.com SECRET=secret_bc REMOTE_PREFIX=3 @@ -254,18 +260,20 @@ REMOTE_PREFIX=3 [GLOBAL] LOCAL_PREFIX=3 -[TRUNK_1] +[TRUNK_AC] HOST=reflector-a.example.com SECRET=secret_ac REMOTE_PREFIX=1 -[TRUNK_2] +[TRUNK_BC] 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`. +Both sides of each trunk link must use the **same section name** and share the +same `SECRET`. The sysops of both reflectors agree on the section name and +secret when setting up the link. ### Satellite reflectors diff --git a/docs/DEPLOYMENT_ITALY.md b/docs/DEPLOYMENT_ITALY.md index 0f43654..a59f7c7 100644 --- a/docs/DEPLOYMENT_ITALY.md +++ b/docs/DEPLOYMENT_ITALY.md @@ -122,115 +122,115 @@ CLUSTER_TGS=222 HTTP_SRV_PORT=8080 COMMAND_PTY=/dev/shm/reflector_ctrl -[TRUNK_02] +[TRUNK_01_02] HOST=svxref-sardegna.example.it PORT=5302 SECRET=IT_01_02 REMOTE_PREFIX=02 -[TRUNK_03] +[TRUNK_01_03] HOST=svxref-umbria.example.it PORT=5302 SECRET=IT_01_03 REMOTE_PREFIX=03 -[TRUNK_11] +[TRUNK_01_11] HOST=svxref-liguria.example.it PORT=5302 SECRET=IT_01_11 REMOTE_PREFIX=11 -[TRUNK_12] +[TRUNK_01_12] HOST=svxref-piemonte.example.it PORT=5302 SECRET=IT_01_12 REMOTE_PREFIX=12 -[TRUNK_13] +[TRUNK_01_13] HOST=svxref-valledaosta.example.it PORT=5302 SECRET=IT_01_13 REMOTE_PREFIX=13 -[TRUNK_21] +[TRUNK_01_21] HOST=svxref-lombardia.example.it PORT=5302 SECRET=IT_01_21 REMOTE_PREFIX=21 -[TRUNK_31] +[TRUNK_01_31] HOST=svxref-friuli.example.it PORT=5302 SECRET=IT_01_31 REMOTE_PREFIX=31 -[TRUNK_32] +[TRUNK_01_32] HOST=svxref-trentino.example.it PORT=5302 SECRET=IT_01_32 REMOTE_PREFIX=32 -[TRUNK_33] +[TRUNK_01_33] HOST=svxref-veneto.example.it PORT=5302 SECRET=IT_01_33 REMOTE_PREFIX=33 -[TRUNK_41] +[TRUNK_01_41] HOST=svxref-emilia.example.it PORT=5302 SECRET=IT_01_41 REMOTE_PREFIX=41 -[TRUNK_51] +[TRUNK_01_51] HOST=svxref-toscana.example.it PORT=5302 SECRET=IT_01_51 REMOTE_PREFIX=51 -[TRUNK_61] +[TRUNK_01_61] HOST=svxref-abruzzo.example.it PORT=5302 SECRET=IT_01_61 REMOTE_PREFIX=61 -[TRUNK_62] +[TRUNK_01_62] HOST=svxref-marche.example.it PORT=5302 SECRET=IT_01_62 REMOTE_PREFIX=62 -[TRUNK_71] +[TRUNK_01_71] HOST=svxref-puglia.example.it PORT=5302 SECRET=IT_01_71 REMOTE_PREFIX=71 -[TRUNK_81] +[TRUNK_01_81] HOST=svxref-basilicata.example.it PORT=5302 SECRET=IT_01_81 REMOTE_PREFIX=81 -[TRUNK_82] +[TRUNK_01_82] HOST=svxref-calabria.example.it PORT=5302 SECRET=IT_01_82 REMOTE_PREFIX=82 -[TRUNK_83] +[TRUNK_01_83] HOST=svxref-campania.example.it PORT=5302 SECRET=IT_01_83 REMOTE_PREFIX=83 -[TRUNK_84] +[TRUNK_01_84] HOST=svxref-molise.example.it PORT=5302 SECRET=IT_01_84 REMOTE_PREFIX=84 -[TRUNK_91] +[TRUNK_01_91] HOST=svxref-sicilia.example.it PORT=5302 SECRET=IT_01_91 @@ -238,8 +238,12 @@ REMOTE_PREFIX=91 ``` All other regional configs follow the same pattern: set `LOCAL_PREFIX` to the -region's 2-digit code and add one `[TRUNK_xx]` section for each of the other -19 regions, using the matching `SECRET` from the convention above. +region's 2-digit code and add one `[TRUNK_xx_yy]` section for each of the other +19 regions, where `xx` and `yy` are the sorted pair of region codes (lower code +first). Both sides of a trunk link must use the **same section name** — for +example, the link between regions 02 and 21 is named `[TRUNK_02_21]` on both +the SARDEGNA and LOMBARDIA reflectors. Use the matching `SECRET` from the +convention above. --- @@ -313,7 +317,7 @@ SATELLITE_SECRET=lazio_satellite_secret SATELLITE_ID=sat-roma ``` -The satellite does not set `LOCAL_PREFIX`, `REMOTE_PREFIX`, or any `[TRUNK_xx]` +The satellite does not set `LOCAL_PREFIX`, `REMOTE_PREFIX`, or any `[TRUNK_xx_yy]` sections. It only needs `LISTEN_PORT=5300` for its local SvxLink clients. Also open port `5303` inbound on the regional reflector firewall. @@ -322,7 +326,9 @@ open port `5303` inbound on the regional reflector firewall. ## Per-region config checklist 1. Set `LOCAL_PREFIX` to the 2-digit code from the table above. -2. Add one `[TRUNK_xx]` section for **every other region** (19 sections total). +2. Add one `[TRUNK_xx_yy]` section for **every other region** (19 sections total), + where `xx` and `yy` are the sorted pair of region codes (lower first). Both + sides of a trunk link must use the **same** `[TRUNK_xx_yy]` section name. 3. Use the same `SECRET` value as the matching section on the peer — mismatched secrets will prevent the trunk from connecting. 4. Open TCP port `5302` inbound in the firewall (trunk) and `5300` inbound (clients). diff --git a/docs/DEPLOYMENT_ITALY_IT.md b/docs/DEPLOYMENT_ITALY_IT.md index 4621346..3a982b3 100644 --- a/docs/DEPLOYMENT_ITALY_IT.md +++ b/docs/DEPLOYMENT_ITALY_IT.md @@ -125,115 +125,115 @@ CLUSTER_TGS=222 HTTP_SRV_PORT=8080 COMMAND_PTY=/dev/shm/reflector_ctrl -[TRUNK_02] +[TRUNK_01_02] HOST=svxref-sardegna.example.it PORT=5302 SECRET=IT_01_02 REMOTE_PREFIX=02 -[TRUNK_03] +[TRUNK_01_03] HOST=svxref-umbria.example.it PORT=5302 SECRET=IT_01_03 REMOTE_PREFIX=03 -[TRUNK_11] +[TRUNK_01_11] HOST=svxref-liguria.example.it PORT=5302 SECRET=IT_01_11 REMOTE_PREFIX=11 -[TRUNK_12] +[TRUNK_01_12] HOST=svxref-piemonte.example.it PORT=5302 SECRET=IT_01_12 REMOTE_PREFIX=12 -[TRUNK_13] +[TRUNK_01_13] HOST=svxref-valledaosta.example.it PORT=5302 SECRET=IT_01_13 REMOTE_PREFIX=13 -[TRUNK_21] +[TRUNK_01_21] HOST=svxref-lombardia.example.it PORT=5302 SECRET=IT_01_21 REMOTE_PREFIX=21 -[TRUNK_31] +[TRUNK_01_31] HOST=svxref-friuli.example.it PORT=5302 SECRET=IT_01_31 REMOTE_PREFIX=31 -[TRUNK_32] +[TRUNK_01_32] HOST=svxref-trentino.example.it PORT=5302 SECRET=IT_01_32 REMOTE_PREFIX=32 -[TRUNK_33] +[TRUNK_01_33] HOST=svxref-veneto.example.it PORT=5302 SECRET=IT_01_33 REMOTE_PREFIX=33 -[TRUNK_41] +[TRUNK_01_41] HOST=svxref-emilia.example.it PORT=5302 SECRET=IT_01_41 REMOTE_PREFIX=41 -[TRUNK_51] +[TRUNK_01_51] HOST=svxref-toscana.example.it PORT=5302 SECRET=IT_01_51 REMOTE_PREFIX=51 -[TRUNK_61] +[TRUNK_01_61] HOST=svxref-abruzzo.example.it PORT=5302 SECRET=IT_01_61 REMOTE_PREFIX=61 -[TRUNK_62] +[TRUNK_01_62] HOST=svxref-marche.example.it PORT=5302 SECRET=IT_01_62 REMOTE_PREFIX=62 -[TRUNK_71] +[TRUNK_01_71] HOST=svxref-puglia.example.it PORT=5302 SECRET=IT_01_71 REMOTE_PREFIX=71 -[TRUNK_81] +[TRUNK_01_81] HOST=svxref-basilicata.example.it PORT=5302 SECRET=IT_01_81 REMOTE_PREFIX=81 -[TRUNK_82] +[TRUNK_01_82] HOST=svxref-calabria.example.it PORT=5302 SECRET=IT_01_82 REMOTE_PREFIX=82 -[TRUNK_83] +[TRUNK_01_83] HOST=svxref-campania.example.it PORT=5302 SECRET=IT_01_83 REMOTE_PREFIX=83 -[TRUNK_84] +[TRUNK_01_84] HOST=svxref-molise.example.it PORT=5302 SECRET=IT_01_84 REMOTE_PREFIX=84 -[TRUNK_91] +[TRUNK_01_91] HOST=svxref-sicilia.example.it PORT=5302 SECRET=IT_01_91 @@ -242,8 +242,11 @@ REMOTE_PREFIX=91 Tutte le altre configurazioni regionali seguono lo stesso schema: impostare `LOCAL_PREFIX` al codice a 2 cifre della propria regione e aggiungere una sezione -`[TRUNK_xx]` per ciascuna delle altre 19 regioni, usando il `SECRET` corrispondente -secondo la convenzione sopra indicata. +`[TRUNK_xx_yy]` per ciascuna delle altre 19 regioni, dove `xx` e `yy` sono la +coppia ordinata di codici regionali (il minore per primo). I nomi delle sezioni +devono essere identici su entrambi i lati del link — ad esempio il collegamento +tra Sardegna (02) e Umbria (03) si chiama `[TRUNK_02_03]` su entrambi i reflector. +Usare il `SECRET` corrispondente secondo la convenzione sopra indicata. --- @@ -321,7 +324,7 @@ SATELLITE_ID=sat-roma ``` Il satellite non imposta `LOCAL_PREFIX`, `REMOTE_PREFIX` o alcuna sezione -`[TRUNK_xx]`. Necessita solo di `LISTEN_PORT=5300` per i propri client SvxLink +`[TRUNK_xx_yy]`. Necessita solo di `LISTEN_PORT=5300` per i propri client SvxLink locali. Aprire anche la porta `5303` in ingresso sul firewall del reflector regionale. @@ -330,7 +333,7 @@ regionale. ## Lista di controllo per ogni regione 1. Impostare `LOCAL_PREFIX` al codice a 2 cifre dalla tabella sopra. -2. Aggiungere una sezione `[TRUNK_xx]` per **ciascuna delle altre regioni** (19 sezioni in totale). +2. Aggiungere una sezione `[TRUNK_xx_yy]` per **ciascuna delle altre regioni** (19 sezioni in totale), dove `xx` e `yy` sono la coppia ordinata di codici regionali. I nomi delle sezioni devono essere identici su entrambi i lati del link. 3. Usare lo stesso valore di `SECRET` della sezione corrispondente sul peer — secret non corrispondenti impediranno la connessione del trunk. 4. Aprire la porta TCP `5302` in ingresso nel firewall (trunk) e la porta `5300` (client). diff --git a/docs/DESIGN_SATELLITE_AND_CLUSTER.md b/docs/DESIGN_SATELLITE_AND_CLUSTER.md index 7ccd376..80f37b9 100644 --- a/docs/DESIGN_SATELLITE_AND_CLUSTER.md +++ b/docs/DESIGN_SATELLITE_AND_CLUSTER.md @@ -47,7 +47,7 @@ On the **parent reflector** (existing reflector, no role change needed): LOCAL_PREFIX=01 # Existing trunk config unchanged -[TRUNK_02] +[TRUNK_01_02] HOST=reflector-02.example.com SECRET=secret_01_02 REMOTE_PREFIX=02 @@ -330,7 +330,7 @@ each trunk link's `active_talkers`: { "cluster_tgs": [222, 2221, 91], "trunks": { - "TRUNK_02": { + "TRUNK_01_02": { "active_talkers": { "222": "IW1GEU", "25": "SM0ABC" diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 6248094..3c869a8 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -108,15 +108,17 @@ LOCAL_PREFIX=11,12,13 At the end of the config file, add one `[TRUNK_x]` section per peer reflector: ```ini -[TRUNK_2] +[TRUNK_1_2] HOST=reflector-b.example.com PORT=5302 SECRET=a_strong_shared_secret REMOTE_PREFIX=2 ``` +- **The section name must be identical on both sides.** Both sysops must agree + on a shared name (e.g. `TRUNK_1_2` for the link between prefix 1 and 2). - `PORT` defaults to `5302` if omitted. -- Both sides of each trunk must use the same `SECRET`. +- Both sides must use the same `SECRET`. - `REMOTE_PREFIX` also accepts a comma-separated list. ### 6c. Optional: enable the HTTP status endpoint @@ -170,8 +172,8 @@ journalctl -u svxreflector -f A successful trunk connection looks like: ``` -TRUNK_2: Connected to reflector-b.example.com:5302 -TRUNK_2: Trunk hello from peer 'TRUNK_1' local_prefix=2 priority=3847291042 +TRUNK_1_2: Connected to reflector-b.example.com:5302 +TRUNK_1_2: Trunk hello from peer 'TRUNK_1_2' local_prefix=2 priority=3847291042 ``` If `HTTP_SRV_PORT` is set, query the status endpoint: diff --git a/docs/TRUNK_PROTOCOL.md b/docs/TRUNK_PROTOCOL.md index 2b42234..194b3a4 100644 --- a/docs/TRUNK_PROTOCOL.md +++ b/docs/TRUNK_PROTOCOL.md @@ -13,10 +13,17 @@ reflector configured with `LOCAL_PREFIX=1` is authoritative for TG 1, 10, 100, (country codes, area codes). Multiple reflectors can be trunked together in a full mesh. Each pair of -reflectors has one `[TRUNK_x]` section per side. Each TG has exactly one +reflectors shares one `[TRUNK_x]` section name on both sides. Each TG has exactly one authoritative home reflector (the one whose prefix matches); all other reflectors are transparent proxies for that TG. +> **Important:** Both reflectors in a trunk link **must use the same `[TRUNK_x]` +> section name**. The section name is transmitted in the `MsgTrunkHello` +> handshake and both sides must agree on it for the connection to be matched to +> the correct `TrunkLink` instance. The convention is to use sorted pair +> identifiers — for example, the link between reflector 1 and reflector 2 uses +> `[TRUNK_1_2]` on **both** sides. + Clients (SvxLink nodes) connect to their local reflector as normal and are completely unaware of the trunk. When a remote talker is active on a TG whose prefix belongs to another reflector, local clients receive a standard @@ -215,7 +222,8 @@ is rejected. Outbound reconnection is handled automatically by ### `MsgTrunkHello` fields -- `id` — the config section name (e.g. `TRUNK_2`), used for logging +- `id` — the config section name (e.g. `TRUNK_1_2`), used for logging and + connection matching — both sides must use the same section name - `local_prefix` — the sender's authoritative TG prefix (e.g. `"1"`) - `priority` — random 32-bit nonce, regenerated per connection, used for talker arbitration tie-breaking @@ -358,7 +366,7 @@ The `/status` JSON endpoint includes a `trunks` object alongside `nodes`: { "nodes": { ... }, "trunks": { - "TRUNK_2": { + "TRUNK_1_2": { "host": "reflector-b.example.com", "port": 5302, "connected": true, @@ -395,11 +403,14 @@ TRUNK_LISTEN_PORT=5302 # trunk server port (default 5302, optional) ### Per-trunk section -Add one `[TRUNK_x]` section per peer. `REMOTE_PREFIX` declares which TG prefix -the peer owns: +Add one `[TRUNK_x]` section per peer. Both reflectors in a link **must use the +same section name** — the name is exchanged during the handshake and used to +match connections. The convention is to use sorted pair identifiers (e.g. +`[TRUNK_1_2]` for the link between reflector 1 and reflector 2). +`REMOTE_PREFIX` declares which TG prefix the peer owns: ```ini -[TRUNK_2] +[TRUNK_1_2] HOST=reflector-b.example.com # peer hostname or IP PORT=5302 # peer trunk port (default 5302) SECRET=change_this_secret # shared secret @@ -410,12 +421,12 @@ REMOTE_PREFIX=2 # peer owns TGs 2, 20, 200, 2000, ... **Reflector 1** (`LOCAL_PREFIX=1`): ```ini -[TRUNK_2] +[TRUNK_1_2] HOST=reflector-b.example.com SECRET=secret_ab REMOTE_PREFIX=2 -[TRUNK_3] +[TRUNK_1_3] HOST=reflector-c.example.com SECRET=secret_ac REMOTE_PREFIX=3 @@ -423,12 +434,12 @@ REMOTE_PREFIX=3 **Reflector 2** (`LOCAL_PREFIX=2`): ```ini -[TRUNK_1] +[TRUNK_1_2] HOST=reflector-a.example.com SECRET=secret_ab REMOTE_PREFIX=1 -[TRUNK_3] +[TRUNK_2_3] HOST=reflector-c.example.com SECRET=secret_bc REMOTE_PREFIX=3 @@ -436,12 +447,12 @@ REMOTE_PREFIX=3 **Reflector 3** (`LOCAL_PREFIX=3`): ```ini -[TRUNK_1] +[TRUNK_1_3] HOST=reflector-a.example.com SECRET=secret_ac REMOTE_PREFIX=1 -[TRUNK_2] +[TRUNK_2_3] HOST=reflector-b.example.com SECRET=secret_bc REMOTE_PREFIX=2 diff --git a/src/svxlink/reflector/svxreflector.conf.in b/src/svxlink/reflector/svxreflector.conf.in index 1829120..6172cf6 100644 --- a/src/svxlink/reflector/svxreflector.conf.in +++ b/src/svxlink/reflector/svxreflector.conf.in @@ -88,15 +88,18 @@ CERT_CA_HOOK=@SVX_SHARE_INSTALL_DIR@/ca-hook.py # Add LOCAL_PREFIX to the [GLOBAL] section, then add one [TRUNK_x] section # per peer. REMOTE_PREFIX declares which TG prefix the peer owns. # +# IMPORTANT: The [TRUNK_x] section name must be identical on both sides. +# Both sysops must agree on a shared name and secret for each link. +# # Example for a two-reflector mesh: -# Reflector A: LOCAL_PREFIX=1, [TRUNK_2] with REMOTE_PREFIX=2 -# Reflector B: LOCAL_PREFIX=2, [TRUNK_1] with REMOTE_PREFIX=1 +# Reflector A: LOCAL_PREFIX=1, [TRUNK_AB] with REMOTE_PREFIX=2 +# Reflector B: LOCAL_PREFIX=2, [TRUNK_AB] with REMOTE_PREFIX=1 # #LOCAL_PREFIX=1 #TRUNK_LISTEN_PORT=5302 #TRUNK_DEBUG=0 # verbose trunk logging (high log volume — disable after diagnosis) -#[TRUNK_2] +#[TRUNK_AB] #HOST=reflector-b.example.com #PORT=5302 #SECRET=change_this_shared_secret