Fix trunk receive-side TG filtering and add integration test suite
The receive-side handlers (handleMsgTrunkTalkerStart, handleMsgTrunkAudio, etc.) used isSharedTG() which only checks the remote peer's prefix. This caused non-cluster TGs to be silently dropped on the receiving reflector — e.g. a client on reflector-a talking on TG 40001 (owned by reflector-b) would never reach reflector-b because reflector-b checked the TG against reflector-a's prefix instead of its own. Add isOwnedTG() that accepts TGs matching either the local or remote prefix, and use it in all four receive handlers. The send-side still uses isSharedTG() (remote prefix only) which is correct. Also add a Docker-based integration test suite (tests/) with 11 automated tests covering handshake, routing, cross-reflector audio delivery, cluster TGs, heartbeat, disconnect cleanup, and trunk-to-trunk isolation. An interactive mode lets users test arbitrary TG numbers with routing verified via reflector logs. Topology is defined once in tests/topology.py. Fix Dockerfile to copy built shared libraries to the runtime image.
This commit is contained in:
1 parent
3b7831c307
commit
685d7253ff
12 files changed
+1501
-16
No files matched your search
@@ -80,7 +80,7 @@ Similar to `TrunkLink` but with different semantics:
|
||||
| Aspect | TrunkLink (peer-to-peer) | SatelliteLink |
|
||||
|--------|-------------------------|---------------|
|
||||
| Topology | Symmetric mesh peers | Asymmetric — parent is authority |
|
||||
| TG routing | Prefix-based (`isSharedTG`) + cluster (`isClusterTG`) | **No filtering** — all TGs forwarded unconditionally |
|
||||
| TG routing | Prefix-based (`isSharedTG`/`isOwnedTG`) + cluster (`isClusterTG`) | **No filtering** — all TGs forwarded unconditionally |
|
||||
| Talker arbitration | Nonce tie-break | Parent always wins |
|
||||
| Who initiates | Both sides connect to each other | Satellite connects to parent |
|
||||
| Audio path | Only prefix-matched + cluster TGs | All TGs active on either side |
|
||||
@@ -260,11 +260,12 @@ void TrunkLink::onLocalTalkerStart(uint32_t tg, const std::string& callsign)
|
||||
}
|
||||
```
|
||||
|
||||
Similarly for inbound: `handleMsgTrunkTalkerStart` currently checks
|
||||
`isSharedTG`. Add `|| isClusterTG`:
|
||||
Similarly for inbound: `handleMsgTrunkTalkerStart` and the other receive
|
||||
handlers use `isOwnedTG` (checks both local and remote prefix) instead of
|
||||
`isSharedTG`, combined with `|| isClusterTG`:
|
||||
|
||||
```cpp
|
||||
if (!isSharedTG(tg) && !m_reflector->isClusterTG(tg))
|
||||
if (!isOwnedTG(tg) && !m_reflector->isClusterTG(tg))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
+2
-1
@@ -64,7 +64,8 @@ TRUNK_2: Trunk hello from peer 'TRUNK_1' local_prefix=2 priority=3847291042
|
||||
| 5300 | TCP | SvxLink client connections |
|
||||
| 5300 | UDP | SvxLink client audio |
|
||||
| 5302 | TCP | Server-to-server trunk links |
|
||||
| 8080 | TCP | HTTP `/status` endpoint (optional) |
|
||||
| 5303 | TCP | Satellite connections (optional) |
|
||||
| 8080 | TCP | HTTP `/status` and `/config` endpoints (optional) |
|
||||
|
||||
If you do not set `HTTP_SRV_PORT` in the config, remove the `8080` port mapping
|
||||
from `docker-compose.yml`.
|
||||
|
||||
+13
-7
@@ -95,18 +95,24 @@ forwarded to **all** trunk peers regardless of `LOCAL_PREFIX` or `REMOTE_PREFIX`
|
||||
The routing decision in `TrunkLink` is:
|
||||
|
||||
```
|
||||
if isClusterTG(tg) → forward (regardless of prefix)
|
||||
else if isSharedTG(tg) → forward (prefix match)
|
||||
else → drop silently
|
||||
Sending: if isClusterTG(tg) or isSharedTG(tg) → send to peer
|
||||
Receiving: if isClusterTG(tg) or isOwnedTG(tg) → accept from peer
|
||||
Otherwise: drop silently
|
||||
```
|
||||
|
||||
This check is applied **independently on both sides** of each trunk link:
|
||||
This check is applied **independently on both sides** of each trunk link,
|
||||
using different prefix checks appropriate to each direction:
|
||||
|
||||
- **Sending side:** `TrunkLink::onLocalTalkerStart`, `onLocalAudio`, and
|
||||
`onLocalFlush` check `isSharedTG(tg) || isClusterTG(tg)` before sending.
|
||||
`isSharedTG` matches the TG against the **remote** peer's prefix — i.e. it
|
||||
only forwards TGs that belong to the peer.
|
||||
- **Receiving side:** `TrunkLink::handleMsgTrunkTalkerStart`,
|
||||
`handleMsgTrunkAudio`, and `handleMsgTrunkFlush` perform the same check
|
||||
before accepting.
|
||||
`handleMsgTrunkAudio`, and `handleMsgTrunkFlush` check
|
||||
`isOwnedTG(tg) || isClusterTG(tg)` before accepting. `isOwnedTG` matches
|
||||
the TG against both the **local** prefix (TG belongs to us — a peer's client
|
||||
is talking on one of our TGs) and the **remote** prefix (TG belongs to the
|
||||
peer — the peer is reporting its own talker state).
|
||||
|
||||
Each reflector owner chooses which cluster TGs to subscribe to. A reflector
|
||||
only sends and accepts traffic for cluster TGs listed in its own `CLUSTER_TGS`.
|
||||
@@ -123,7 +129,7 @@ directions:
|
||||
|
||||
| Aspect | Trunk link | Satellite link |
|
||||
|--------|-----------|----------------|
|
||||
| Prefix filtering (`isSharedTG`) | Yes | No |
|
||||
| Prefix filtering (`isSharedTG`/`isOwnedTG`) | Yes | No |
|
||||
| Cluster filtering (`isClusterTG`) | Yes | No |
|
||||
| What is forwarded | Only prefix-matched + cluster TGs | All TGs |
|
||||
| `CLUSTER_TGS` config needed | Yes, on both sides | No |
|
||||
|
||||
Reference in new issue
Block a user