From 0885352b1c7f503066d3d1351803a5f678f3b81a Mon Sep 17 00:00:00 2001 From: Audric Date: Fri, 3 Jul 2026 19:11:47 +0200 Subject: [PATCH] feat(status): expose per-trunk routable_prefixes and routable_wildcard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- docs/PEER_PROTOCOL.md | 6 ++++++ src/svxlink/reflector/TrunkLink.cpp | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/docs/PEER_PROTOCOL.md b/docs/PEER_PROTOCOL.md index dca75e4..479b253 100644 --- a/docs/PEER_PROTOCOL.md +++ b/docs/PEER_PROTOCOL.md @@ -721,6 +721,8 @@ The `/status` JSON endpoint includes a `trunks` object alongside `nodes`: "connected": true, "local_prefix": "1", "remote_prefix": "2", + "routable_prefixes": ["24"], + "routable_wildcard": false, "active_talkers": { "25": "SM0ABC", "200": "LA8PV" @@ -736,6 +738,10 @@ The `/status` JSON endpoint includes a `trunks` object alongside `nodes`: `active_talkers` contains only TGs with an active remote talker at the moment of the request. It is empty when no trunk conversations are in progress. +`routable_prefixes` lists extra TG prefixes reachable *via* this peer (gateway +routing) but not owned by it; `routable_wildcard` is `true` when the link is +configured as a default (`*`) route. + `local_aliases` is keyed by the short local TG and lists every configured `LOCAL_ALIASES` entry: `alias` is the long, mesh-routable number it is re-homed under, and `direction` is `"two-way"`, `"in"`, or `"out"` (see diff --git a/src/svxlink/reflector/TrunkLink.cpp b/src/svxlink/reflector/TrunkLink.cpp index d1e77c7..9f459ec 100644 --- a/src/svxlink/reflector/TrunkLink.cpp +++ b/src/svxlink/reflector/TrunkLink.cpp @@ -588,6 +588,14 @@ Json::Value TrunkLink::statusJson(void) const for (const auto& p : m_remote_prefix) remote_arr.append(p); obj["remote_prefix"] = remote_arr; + // Extra prefixes reachable VIA this peer (gateway routing). These are not + // owned by the peer (that's remote_prefix) but are forwarded onward toward + // it; "*" is a default route, surfaced separately as routable_wildcard. + Json::Value routable_arr(Json::arrayValue); + for (const auto& p : m_routable_prefixes) routable_arr.append(p); + obj["routable_prefixes"] = routable_arr; + obj["routable_wildcard"] = m_routable_wildcard; + // active_talkers: per-peer active TGs (already post-TG_MAP remap). // We use m_peer_active_tgs directly instead of filtering the global // trunk-talker map by isSharedTG, because a TG_MAP entry can remap a