Better warning printouts for illegal UDP datagrams

This commit is contained in:
Tobias Blomberg 2020-01-03 14:26:07 +01:00
parent 8ff599ade1
commit 2fd0d178f5
2 changed files with 9 additions and 5 deletions

View File

@ -398,21 +398,24 @@ void Reflector::udpDatagramReceived(const IpAddress& addr, uint16_t port,
ReflectorUdpMsg header;
if (!header.unpack(ss))
{
cout << "*** WARNING: Unpacking failed for UDP message header\n";
cout << "*** WARNING: Unpacking message header failed for UDP datagram "
"from " << addr << ":" << port << endl;
return;
}
ReflectorClientMap::iterator it = m_client_map.find(header.clientId());
if (it == m_client_map.end())
{
cerr << "*** WARNING: Incoming UDP packet has invalid client id" << endl;
cerr << "*** WARNING: Incoming UDP datagram from " << addr << ":" << port
<< " has invalid client id " << header.clientId() << endl;
return;
}
ReflectorClient *client = (*it).second;
if (addr != client->remoteHost())
{
cerr << "*** WARNING[" << client->callsign()
<< "]: Incoming UDP packet has the wrong source ip" << endl;
<< "]: Incoming UDP packet has the wrong source ip, "
<< addr << " instead of " << client->remoteHost() << endl;
return;
}
if (client->remoteUdpPort() == 0)
@ -424,7 +427,8 @@ void Reflector::udpDatagramReceived(const IpAddress& addr, uint16_t port,
{
cerr << "*** WARNING[" << client->callsign()
<< "]: Incoming UDP packet has the wrong source UDP "
"port number" << endl;
"port number, " << port << " instead of "
<< client->remoteUdpPort() << endl;
return;
}

View File

@ -37,4 +37,4 @@ DEVCAL=1.0.2.99.0
SVXSERVER=0.0.6
# Version for SvxReflector
SVXREFLECTOR=1.99.1
SVXREFLECTOR=1.99.2