more tg-rewrite work
This commit is contained in:
parent
a275e77902
commit
105d18594a
|
@ -197,17 +197,18 @@ unsigned int DMRAccessControl::DstIdRewrite (unsigned int id, bool network)
|
|||
// record current time
|
||||
m_time = std::time(nullptr);
|
||||
// if the ID is a talkgroup, log and rewrite to TG9
|
||||
if (id < 4000 && id != 0) {
|
||||
if (id < 4000 && id > 0) {
|
||||
LogMessage("Rewrite DST ID (TG) of of inbound network traffic from %u to 9", id);
|
||||
return 9;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
// if less than 30 seconds has passed since we last saw traffic
|
||||
if (m_dstRewriteID == id && (m_time + 30) > currenttime && m_time) {
|
||||
// if less than 30 seconds has passed since we last saw traffic from network
|
||||
if (m_dstRewriteID == id && (m_time + 30) > currenttime) {
|
||||
LogMessage("Inbound DST ID (TG) rewrite seen in last 30 seconds");
|
||||
LogMessage("Rewrite DST ID (TG) of outbound network traffic from 9 to %u", id);
|
||||
m_time = std::time(nullptr);
|
||||
return(id);
|
||||
} else {
|
||||
return(0);
|
||||
|
|
|
@ -774,11 +774,11 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
|
||||
unsigned int did = m_netLC->getDstId();
|
||||
unsigned int id = m_netLC->getSrcId();
|
||||
if (!DMRAccessControl::validateAccess(id, did, m_slotNo, true))
|
||||
if (!DMRAccessControl::validateAccess(did, did, m_slotNo, true))
|
||||
return;
|
||||
|
||||
// Test dst rewrite
|
||||
unsigned int rw_id = DMRAccessControl::DstIdRewrite(id, true);
|
||||
unsigned int rw_id = DMRAccessControl::DstIdRewrite(did, true);
|
||||
if (rw_id) {
|
||||
LogMessage("Rewrite ID: %u", rw_id);
|
||||
m_netLC->setDstId(rw_id);
|
||||
|
|
Loading…
Reference in a new issue