Skip to content

Commit

Permalink
Add better validation of DG-ID for DSQ use.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Sep 17, 2017
1 parent 5fa3b8f commit 139be05
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions YSFControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,23 @@ bool CYSFControl::writeModem(unsigned char *data, unsigned int len)
if (valid)
m_lastFICH = fich;

// Validate the DSQ value if enabled
// Validate the DSQ/DG-ID value if enabled
if (m_sqlEnabled) {
bool sql = m_lastFICH.getSQL();
unsigned char value = m_lastFICH.getSQ();
unsigned char cm = m_lastFICH.getCM();
if (cm == YSF_CM_GROUP2) {
// Using the DG-ID value
unsigned char value = m_lastFICH.getSQ();

if (!sql || value != m_sqlValue)
return false;
if (value != m_sqlValue)
return false;
} else {
// Using the DSQ value
bool sql = m_lastFICH.getSQL();
unsigned char value = m_lastFICH.getSQ();

if (!sql || value != m_sqlValue)
return false;
}
}

// Stop repeater packets coming through, unless we're acting as a remote gateway
Expand Down

0 comments on commit 139be05

Please sign in to comment.