Don't ignores unknown sender/source port, due to a possibility of port re-mapping done by router or ISP the source port might be different.

This commit is contained in:
ANR2ME 2021-08-20 14:53:38 +07:00
parent fa92cda23d
commit 2bb5453dc6

View file

@ -7250,7 +7250,8 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi
context->socketlock->unlock(); context->socketlock->unlock();
// Received Data from a Sender that interests us // Received Data from a Sender that interests us
if (recvresult == 0 && rxbuflen > 0 && context->port == senderport) // Note: There are cases where the sender port might be re-mapped by router or ISP, so we shouldn't check the source port.
if (recvresult == 0 && rxbuflen > 0)
{ {
// Log Receive Success // Log Receive Success
if (context->rxbuf[0] > 1) { if (context->rxbuf[0] > 1) {
@ -7303,10 +7304,6 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi
// Ignore Incoming Trash Data // Ignore Incoming Trash Data
} }
else if (recvresult == 0 && rxbuflen > 0) {
WARN_LOG(SCENET, "InputLoop[%d]: Unknown Port[%s:%u] (Recved=%i, Length=%i)", matchingId, mac2str(&sendermac).c_str(), senderport, recvresult, rxbuflen);
host->NotifyUserMessage(std::string(n->T("Data from incorrect Port")) + std::string(" [") + mac2str(&sendermac) + std::string("]:") + std::to_string(senderport) + std::string(" -> ") + std::to_string(context->port) + std::string(" (") + std::to_string(portOffset) + std::string(")"), 1.0, 0x0080ff);
}
// Handle Peer Timeouts // Handle Peer Timeouts
handleTimeout(context); handleTimeout(context);