From 385da379ccc08e2cf9a3c1f6972aebfa6af33dec Mon Sep 17 00:00:00 2001 From: Tom Early Date: Mon, 10 Apr 2023 09:28:02 -0700 Subject: [PATCH] URF default port is 10017 --- reflector/InterlinkMap.cpp | 6 +++--- reflector/URFProtocol.cpp | 23 +++++++++++++++++------ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/reflector/InterlinkMap.cpp b/reflector/InterlinkMap.cpp index 23e35ff..088e2ed 100644 --- a/reflector/InterlinkMap.cpp +++ b/reflector/InterlinkMap.cpp @@ -76,14 +76,14 @@ bool CInterlinkMap::LoadFromFile(const std::string &filename) if (token[2]) { - int port = 17000; + int port = 10017; if (token[3]) { port = std::atoi(token[2]); if (port < 1024 || port > 49000) { - std::cout << token[0] << " Port " << port << " is out of range, resetting to 17000." << std::endl; - port = 17000; + std::cout << token[0] << " Port " << port << " is out of range, resetting to 10017." << std::endl; + port = 10017; } m_InterlinkMap[token[0]] = CInterlinkMapItem(token[1], token[3], (uint16_t)port); } diff --git a/reflector/URFProtocol.cpp b/reflector/URFProtocol.cpp index 35a6985..b789c68 100644 --- a/reflector/URFProtocol.cpp +++ b/reflector/URFProtocol.cpp @@ -337,7 +337,7 @@ void CURFProtocol::HandlePeerLinks(void) else if ((std::string::npos == it->second.GetTCMods().find(c)) != (std::string::npos == g_Configure.GetString(g_Keys.modules.tcmodules).find(c))) { // are the transcoding states on both sides mismatched? ok = false; - std::cerr << "The encryption states for module '" << c << "' don't match for this reflector and " << it->first << std::endl; + std::cerr << "The transcode states for module '" << c << "' don't match for this reflector and " << it->first << std::endl; } } } @@ -348,7 +348,7 @@ void CURFProtocol::HandlePeerLinks(void) // send connect packet to re-initiate peer link EncodeConnectPacket(&buffer, it->second.GetModules().c_str()); Send(buffer, it->second.GetIp(), it->second.GetPort()); - std::cout << "Sending connect packet to URF peer " << cs << " @ " << it->second.GetIp() << " for modules " << it->second.GetModules() << std::endl; + std::cout << "Sent connect packet to URF peer " << cs << " @ " << it->second.GetIp() << " for modules " << it->second.GetModules() << std::endl; #ifndef NO_DHT } } @@ -441,17 +441,28 @@ bool CURFProtocol::IsValidKeepAlivePacket(const CBuffer &Buffer, CCallsign *call bool CURFProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *callsign, char *modules, CVersion *version) { - bool valid = false; + std::cout << "Checking for valid CONN packet\n"; + bool valid; uint8_t magic[] = { 'C','O','N','N' }; if ((Buffer.size() == 40) && (0 == Buffer.Compare(magic, 4)) && (Buffer.data()[36] == 0)) { callsign->CodeIn(Buffer.data()+4); valid = callsign->IsValid(); + std::cout << "Callsign '" << callsign->GetCS() << " is " << (valid ? "valid" : "not valid") << std::endl; *version = CVersion(Buffer.at(37), Buffer.at(38), Buffer.at(39)); - memcpy(modules, Buffer.data()+10, 27); - for ( unsigned i = 0; i < strlen(modules); i++ ) + std::cout << *callsign << " version: " << *version << std::endl; + if (valid) { - valid = valid && (g_Reflector.IsValidModule (modules[i])); + memcpy(modules, Buffer.data()+10, 27); + for ( unsigned i = 0; i < strlen(modules); i++ ) + { + auto moduleok = g_Reflector.IsValidModule(modules[i]); + if (! moduleok) + { + valid = false; + std::cout << "Requested module '" << modules[i] << "' is not confgured\n"; + } + } } } return valid;