[EXPERIMENTAL] experimental change for @faultywarrior, make V24 UDP respond back to whatever the source port that sent a request was;

pull/86/head
Bryan Biedenkapp 11 months ago
parent 3798c52b54
commit de02fdd445

@ -60,6 +60,8 @@ V24UDPPort::V24UDPPort(uint32_t peerId, const std::string& address, uint16_t mod
m_controlAddr(),
m_addrLen(0U),
m_ctrlAddrLen(0U),
m_remoteAddr(),
m_remoteAddrLen(0U),
m_buffer(2000U, "UDP Port Ring Buffer"),
m_fscInitiator(fscInitiator),
m_timeoutTimer(1000U, 45U),
@ -88,6 +90,9 @@ V24UDPPort::V24UDPPort(uint32_t peerId, const std::string& address, uint16_t mod
m_ctrlAddrLen = 0U;
if (m_ctrlAddrLen > 0U) {
m_remoteAddr = m_controlAddr;
m_remoteAddrLen = m_remoteAddrLen;
std::string ctrlAddrStr = udp::Socket::address(m_controlAddr);
LogWarning(LOG_HOST, "SECURITY: Remote modem expects V.24 control channel IP address; %s for remote modem control", ctrlAddrStr.c_str());
}
@ -463,7 +468,7 @@ void* V24UDPPort::threadedCtrlNetworkRx(void* arg)
::memset(buffer, 0x00U, FSCACK::LENGTH);
ackResp.encode(buffer);
network->m_ctrlFrameQueue->write(buffer, FSCACK::LENGTH, network->m_controlAddr, network->m_ctrlAddrLen);
network->m_ctrlFrameQueue->write(buffer, FSCACK::LENGTH, req->address, req->addrLen);
break;
}
@ -485,6 +490,9 @@ void* V24UDPPort::threadedCtrlNetworkRx(void* arg)
network->m_fscState = CS_CONNECTED;
network->m_reqConnectionTimer.stop();
network->m_remoteAddr = req->address;
network->m_remoteAddrLen = req->addrLen;
if (connMessage->getHostHeartbeatPeriod() > 30U)
LogWarning(LOG_MODEM, "V.24 UDP, DFSI FSC Connection, requested heartbeat of %u, reduce to 30 seconds or less", connMessage->getHostHeartbeatPeriod());
@ -509,7 +517,7 @@ void* V24UDPPort::threadedCtrlNetworkRx(void* arg)
::memset(buffer, 0x00U, FSCACK::LENGTH + 3U);
ackResp.encode(buffer);
network->m_ctrlFrameQueue->write(buffer, FSCACK::LENGTH + 3U, network->m_controlAddr, network->m_ctrlAddrLen);
network->m_ctrlFrameQueue->write(buffer, FSCACK::LENGTH + 3U, req->address, req->addrLen);
}
break;
@ -526,7 +534,7 @@ void* V24UDPPort::threadedCtrlNetworkRx(void* arg)
::memset(buffer, 0x00U, FSCACK::LENGTH);
ackResp.encode(buffer);
network->m_ctrlFrameQueue->write(buffer, FSCACK::LENGTH, network->m_controlAddr, network->m_ctrlAddrLen);
network->m_ctrlFrameQueue->write(buffer, FSCACK::LENGTH, req->address, req->addrLen);
}
break;
@ -557,7 +565,7 @@ void* V24UDPPort::threadedCtrlNetworkRx(void* arg)
::memset(buffer, 0x00U, FSCACK::LENGTH + 5U);
ackResp.encode(buffer);
network->m_ctrlFrameQueue->write(buffer, FSCACK::LENGTH + 5U, network->m_controlAddr, network->m_ctrlAddrLen);
network->m_ctrlFrameQueue->write(buffer, FSCACK::LENGTH + 5U, req->address, req->addrLen);
}
break;
@ -744,7 +752,7 @@ void V24UDPPort::writeHeartbeat()
FSCHeartbeat hb = FSCHeartbeat();
hb.encode(buffer);
m_ctrlFrameQueue->write(buffer, FSCHeartbeat::LENGTH, m_controlAddr, m_ctrlAddrLen);
m_ctrlFrameQueue->write(buffer, FSCHeartbeat::LENGTH, m_remoteAddr, m_remoteAddrLen);
}
/* Generate RTP message. */

@ -145,6 +145,9 @@ namespace modem
uint32_t m_addrLen;
uint32_t m_ctrlAddrLen;
sockaddr_storage m_remoteAddr;
uint32_t m_remoteAddrLen;
RingBuffer<uint8_t> m_buffer;
bool m_fscInitiator;

Loading…
Cancel
Save

Powered by TurnKey Linux.