satellite: honor SATELLITE_FILTER on parent and satellite legs

Adds optional SATELLITE_FILTER in [GLOBAL] on the satellite side using
TgFilter grammar (exact, "24*" prefix, "2427-2438" range, comma-separated).

Flow:
  - SatelliteClient parses SATELLITE_FILTER at init and applies it to its
    own outbound (onLocalTalkerStart/Stop/Audio/Flush): events for TGs
    outside the filter are not forwarded to the parent.
  - After authenticating, the satellite sends the filter to the parent via
    MsgTrunkFilter (type 122, already defined in ReflectorMsg.h and
    reserved for this use).
  - SatelliteLink (parent side) dispatches MsgTrunkFilter and stores a
    TgFilter. Every parent->satellite send is gated by filterPassesTg();
    empty filter = pass-all (pre-existing behavior).

Backwards compatible: older satellites never send the message; older
parents silently ignore unknown message types. The patched parent keeps
forwarding all TGs until it receives a MsgTrunkFilter.

Fixes the bug where a satellite could not restrict the TGs it received
from its parent — prior to this change SatelliteLink explicitly relayed
ALL TGs bidirectionally regardless of any local filter.
This commit is contained in:
Jens DJ1JAY authored and Audric committed 2026-04-20 14:05:32 +02:00
1 parent ba5d03e491
commit 719aa3e37c
5 files changed
+91 -1

No files matched your search

+8 -1
View File
@@ -9,6 +9,8 @@
#include <AsyncFramedTcpConnection.h>
#include <AsyncTimer.h>
#include "TgFilter.h"
class Reflector;
class ReflectorMsg;
@@ -16,7 +18,9 @@ class ReflectorMsg;
@brief Handles one inbound satellite connection on the parent reflector
A SatelliteLink is created for each satellite that connects to the parent's
satellite port. It relays ALL TGs bidirectionally (no prefix filtering).
satellite port. By default it relays ALL TGs bidirectionally. When the
satellite sends a MsgTrunkFilter (type 122), the parent applies the filter
to outbound traffic — only matching TGs are forwarded to this satellite.
The parent always wins talker arbitration over satellites.
*/
class SatelliteLink : public sigc::trackable
@@ -64,6 +68,7 @@ class SatelliteLink : public sigc::trackable
unsigned m_hb_tx_cnt;
unsigned m_hb_rx_cnt;
std::set<uint32_t> m_sat_active_tgs;
TgFilter m_tg_filter;
void onFrameReceived(Async::FramedTcpConnection* con,
std::vector<uint8_t>& data);
@@ -73,6 +78,8 @@ class SatelliteLink : public sigc::trackable
void handleMsgTrunkAudio(std::istream& is);
void handleMsgTrunkFlush(std::istream& is);
void handleMsgTrunkHeartbeat(void);
void handleMsgTrunkFilter(std::istream& is);
bool filterPassesTg(uint32_t tg) const;
void sendMsg(const ReflectorMsg& msg);
void heartbeatTick(Async::Timer* t);
};