Reject incoming YCS audio with the incorrect DG-Id.

This commit is contained in:
Jonathan Naylor 2020-09-25 12:02:50 +01:00
parent 4457fb8e9e
commit d25f13822d
2 changed files with 14 additions and 1 deletions

View file

@ -152,7 +152,7 @@ Debug=0
# Local IMRS System Fusion Network
Type=IMRS
Name=South Coast
Destination=100,44.131.4.1
Destination=75,44.131.4.1
Destination=75,44.131.4.2
#RFHangTime=240
#NetHangTime=240

View file

@ -18,6 +18,7 @@
#include "YSFDefines.h"
#include "YCSNetwork.h"
#include "YSFFICH.h"
#include "Utils.h"
#include "Log.h"
@ -223,6 +224,18 @@ void CYCSNetwork::clock(unsigned int ms)
m_socket.write(m_info, 80U, m_addr, m_addrLen);
}
if (::memcmp(buffer, "YSFD", 4U) == 0) {
CYSFFICH fich;
bool valid = fich.decode(buffer + 35U);
if (!valid)
return;
// Reject any audio which doesn't match our requested DG-Id
unsigned char dgId = fich.getDGId();
if (dgId != m_dgId)
return;
}
unsigned char len = length;
m_buffer.addData(&len, 1U);