mirror of https://github.com/LX3JL/xlxd.git
REGRESSION FIXED Yaesu radios in System Fusion V/D mode transmit the operator's selected DG-ID (Digital Group ID) in the FICH SQ field. xlxd previously (2021, upstream commitspull/268/head32c9e0c+e752b76by narspt) allowed a native YSF client to switch which reflector module they were linked to by dialling the DG-ID on their radio. That feature was silently removed in upstream commit27f5678-- part of a large multi-protocol peering rewrite -- and stayed removed through the recent hardening work in this fork. Current behaviour before this fix: every YSF native client was pinned to whichever module they auto-linked or Wires-X CONN_REQ'd to, with no way to switch mid-session. This restores the DG-ID mechanism with the correct scope and the gatekeeper-bypass fix that narspt applied in the second 2021 commit. DESIGN Three-part change in cysfprotocol.cpp, no other files touched. 1. Task() -- new DG-ID stamping block between the isPeer check (lines 139-158) and the gatekeeper check (lines 213+): if ( !isPeer ) { unsigned char sq = Fich.getSQ(); char dgidModule; if ( (sq >= 10) && (sq < 10 + NB_OF_MODULES) ) { dgidModule = 'A' + (char)(sq - 10); } else { dgidModule = clientModule; // client's current module } Header->SetRpt2Module(dgidModule); } DG-ID values 10..(10 + NB_OF_MODULES - 1) map to modules A..(letter). Values outside that range (typically 0..9 for "no DG-ID intent", or above the module range) leave the client on their currently- linked module. Applied to native clients ONLY (isPeer gate). Peers represent external reflectors whose module identity is fixed by interlink config -- a peer's upstream user's DG-ID must not move the peer's own link. 2. Task() -- gatekeeper call at line 215 changed from passing `clientModule` (client's current module) to passing `Header->GetRpt2Module()` (the DG-ID destination if applicable, otherwise the client's current module). This closes the gatekeeper bypass narspt fixed in 2021: without this, a callsign muted on module A could dial DG-ID for module B and transmit under B's (unmuted) rules because MayTransmit was checking module A's whitelist / loop-suppress state instead of module B's. 3. OnDvHeaderPacketIn -- unconditional `Header->SetRpt2Module(client->GetReflectorModule())` at line 422-423 replaced with peer-vs-native branching: if ( client->IsPeer() ) { // Peer traffic: always use peer's assigned link module. Header->SetRpt2Module(client->GetReflectorModule()); } else { // Native client: apply DG-ID module switch if the module // stamped by Task() differs from the client's current one. char headerModule = Header->GetRpt2Module(); bool validModule = (headerModule >= 'A') && (headerModule < 'A' + NB_OF_MODULES); if ( validModule && (headerModule != client->GetReflectorModule()) ) { std::cout << "YSF client " << client->GetCallsign() << " linking on module " << headerModule << " (DG-ID)" << std::endl; client->SetReflectorModule(headerModule); } if ( !validModule ) { Header->SetRpt2Module(client->GetReflectorModule()); } } The validModule test is sentinel-agnostic -- it accepts only real module letters A..(A+NB_OF_MODULES-1). The parser's 'G' default and any accidental ' ' value both fail the test and trigger the fallback. This decouples the OnDvHeader logic from whatever sentinel the parser uses for "unset" -- if the parser default changes later, this code doesn't need updating. PEER EXCLUSION -- three independent layers Layer 1: Task() DG-ID stamping is gated on !isPeer, where isPeer comes from FindPeerByIpPort at existing lines 143-144. Peer packets never have DG-ID mapped to rpt2 in the first place. Layer 2: OnDvHeaderPacketIn's client->IsPeer() branch unconditionally overwrites rpt2 with the peer's assigned ReflectorModule. Belt-and-braces against any future code path that might stamp rpt2 for peer traffic. Layer 3: Class hierarchy. CYsfPeerClient::IsPeer() returns true (cysfpeerclient.h:48); CYsfClient (native user) inherits CClient::IsPeer() returning false (cclient.h:90). Peer and native clients are physically different types -- no runtime state can make one look like the other. WIRE-LEVEL SAFETY -- confirmed no DG-ID propagation The three outgoing FICH builders in cysfprotocol.cpp (lines 1067, 1122, 1217) all set setSQ(0) hardcoded on every outbound packet. The source's DG-ID is consumed on ingress (in the Fich local at RxTask() line 94) and discarded when RxTask() returns; the CDvHeaderPacket/CDvFramePacket objects that traverse xlxd's internal packet routing carry no FICH bytes and no SQ field. TX FICH is rebuilt from scratch with SQ=0 on the other end. Consequence: DG-ID is a purely receive-side, per-reflector decision. No cross-reflector propagation is possible even if DG-ID handling malfunctioned upstream. DG-ID MAPPING DG-ID | Module | Behaviour -------|--------|-------------------------------------------------- 0..9 | - | No DG-ID intent -- keep client's current module 10 | A | Switch client to module A (if not already there) 11 | B | Switch client to module B ... | | 10+N-1 | (nth) | Switch client to nth module (default 10 modules: A..J) 36+ | - | Out of range -- keep client's current module The 10-offset avoids collision with the SQ values a Yaesu radio typically emits for non-DG-ID situations (0..9 span the "no group set" states). EXPLICITLY OUT OF SCOPE - Parser default at IsValidDvHeaderPacket line 862-863 (`rpt2.SetModule('G')`) is unchanged. - Dead ysfModule peer-lookup at lines 848-856 is unchanged. - Pre-existing peer-classification gap where a peer packet arriving on a mismatched source port could be misclassified by Task()'s FindPeerByIpPort as !isPeer, while OnDvHeaderPacketIn's IsPeer()-based fallback correctly identifies it. In that divergent case: Task() would run the native-client DG-ID path (potentially stamping a wrong rpt2) and MayTransmit path (running the wrong gate). Layer 2 in OnDvHeaderPacketIn still correctly forces the peer's module. Not addressed in this commit.
parent
a86b16ad9a
commit
e34b0e0282
Loading…
Reference in new issue