Skip to content

Commit

Permalink
clean up trace
Browse files Browse the repository at this point in the history
  • Loading branch information
willamowius committed Mar 17, 2021
1 parent fc754c3 commit 4005ad5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 46 deletions.
58 changes: 23 additions & 35 deletions ProxyChannel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ WORD RTP_HeaderSize(const BYTE * buffer, WORD len)
WORD extension_len = ((int)buffer[header_size+2] * 256) + (int)buffer[header_size+3] + 1;
header_size += (extension_len * 4);
}
PTRACE(0, "JW extension=" << has_extension << " cc=" << cc << " header_size=" << header_size << " of len=" << len);
//PTRACE(0, "JW extension=" << has_extension << " cc=" << cc << " header_size=" << header_size << " of len=" << len);
if (header_size > len) {
PTRACE(1, "RTP\tError: RTP packet shorter than header");
return min(len, RTP_BASE_HEADER_LEN);
Expand Down Expand Up @@ -1981,9 +1981,8 @@ void CallSignalSocket::SetRemote(CallSignalSocket * socket)
UnmapIPv4Address(localAddr);
masqAddr = RasServer::Instance()->GetMasqAddress(peerAddr);
UnmapIPv4Address(masqAddr);
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr); // JWXM
if (m_call->GetEndpointIPMapping(peerAddr, masqAddr)) {
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
PTRACE(7, "JW RTP set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
}

SetHandler(socket->GetHandler());
Expand Down Expand Up @@ -4367,7 +4366,6 @@ void CallSignalSocket::OnSetup(SignalingMsg * msg)
WORD _peerPort = 0, _localPort = 0;
msg->GetPeerAddr(_peerAddr, _peerPort);
msg->GetLocalAddr(_localAddr, _localPort);
PTRACE(0, "JW Setup from " << _peerAddr << " on " << _localAddr);

// incompatible with 'explicit' routing
if (GkConfig()->GetBoolean(RoutedSec, "RedirectCallsToGkIP", false)) {
Expand Down Expand Up @@ -4881,8 +4879,8 @@ void CallSignalSocket::OnSetup(SignalingMsg * msg)
);
}
if (!rejectCall) {
PTRACE(0, "JW SetEndpointIPMapping " << _peerAddr << " <=> " << _localAddr);
m_call->SetEndpointIPMapping(_peerAddr, _localAddr); // JWXX
PTRACE(7, "JW RTP SetEndpointIPMapping " << _peerAddr << " <=> " << _localAddr);
m_call->SetEndpointIPMapping(_peerAddr, _localAddr);
}
if (!rejectCall && authData.m_callDurationLimit > 0)
m_call->SetDurationLimit(authData.m_callDurationLimit);
Expand Down Expand Up @@ -5242,8 +5240,8 @@ void CallSignalSocket::OnSetup(SignalingMsg * msg)
CallTable::Instance()->Insert(call);

if (!rejectCall) {
PTRACE(0, "JW SetEndpointIPMapping " << _peerAddr << " <=> " << _localAddr);
m_call->SetEndpointIPMapping(_peerAddr, _localAddr); // JWXX
PTRACE(7, "JW RTP SetEndpointIPMapping " << _peerAddr << " <=> " << _localAddr);
m_call->SetEndpointIPMapping(_peerAddr, _localAddr);
}
if (!rejectCall && authData.m_callDurationLimit > 0)
m_call->SetDurationLimit(authData.m_callDurationLimit);
Expand Down Expand Up @@ -5731,13 +5729,13 @@ void CallSignalSocket::OnSetup(SignalingMsg * msg)
UnmapIPv4Address(localAddr);
masqAddr = RasServer::Instance()->GetMasqAddress(peerAddr);
UnmapIPv4Address(masqAddr);
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr); // JWXM
PTRACE(7, "JW RTP set masqAddr=" << masqAddr << " for " << peerAddr);
if (m_call && m_call->GetCalledParty() && m_call->GetCalledParty()->GetRasServerIP().IsValid()) {
PTRACE(0, "JW set masqAddr to called rasserverip=" << AsString(m_call->GetCalledParty()->GetRasServerIP()));
PTRACE(7, "JW RTP set masqAddr to called rasserverip=" << AsString(m_call->GetCalledParty()->GetRasServerIP()));
masqAddr = m_call->GetCalledParty()->GetRasServerIP();
}
if (m_call->GetEndpointIPMapping(peerAddr, masqAddr)) {
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
PTRACE(7, "JW RTP set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
}

m_call->SetCallSignalSocketCalling(this);
Expand Down Expand Up @@ -5888,13 +5886,12 @@ bool CallSignalSocket::CreateRemote(H225_Setup_UUIE & setupBody)
UnmapIPv4Address(localAddr);
masqAddr = RasServer::Instance()->GetMasqAddress(peerAddr);
UnmapIPv4Address(masqAddr);
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr); // JWXM
if (m_call && m_call->GetCalledParty() && m_call->GetCalledParty()->GetRasServerIP().IsValid()) {
PTRACE(0, "JW set masqAddr to called rasserverip=" << AsString(m_call->GetCalledParty()->GetRasServerIP()));
PTRACE(7, "JW RTP set masqAddr to called rasserverip=" << AsString(m_call->GetCalledParty()->GetRasServerIP()));
masqAddr = m_call->GetCalledParty()->GetRasServerIP();
}
if (m_call->GetEndpointIPMapping(peerAddr, masqAddr)) {
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
PTRACE(7, "JW RTP set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
}
}
// only rewrite sourceCallSignalAddress if we are proxying,
Expand Down Expand Up @@ -6055,9 +6052,8 @@ bool CallSignalSocket::CreateRemote(const H225_TransportAddress & addr)
UnmapIPv4Address(localAddr);
masqAddr = RasServer::Instance()->GetMasqAddress(peerAddr);
UnmapIPv4Address(masqAddr);
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr); // JWXM
if (m_call->GetEndpointIPMapping(peerAddr, masqAddr)) {
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
PTRACE(7, "JW RTP set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
}

#ifdef HAS_TLS
Expand Down Expand Up @@ -7944,13 +7940,12 @@ void CallSignalSocket::OnFacility(SignalingMsg * msg)
UnmapIPv4Address(localAddr);
masqAddr = RasServer::Instance()->GetMasqAddress(peerAddr);
UnmapIPv4Address(masqAddr);
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr); // JWXM
if (m_call->GetCallingParty() && m_call->GetCallingParty()->GetRasServerIP().IsValid()) {
PTRACE(0, "JW set masqAddr to calling rasserverip=" << AsString(m_call->GetCallingParty()->GetRasServerIP()));
PTRACE(7, "JW RTP set masqAddr to calling rasserverip=" << AsString(m_call->GetCallingParty()->GetRasServerIP()));
masqAddr = m_call->GetCallingParty()->GetRasServerIP();
}
if (m_call->GetEndpointIPMapping(peerAddr, masqAddr)) {
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
PTRACE(7, "JW RTP set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
}
callingSocket->remote = this;
// update localAddr and masqAddr in remote, now that we know their peerAddr
Expand All @@ -7961,15 +7956,12 @@ void CallSignalSocket::OnFacility(SignalingMsg * msg)
UnmapIPv4Address(callingSocket->localAddr);
callingSocket->masqAddr = RasServer::Instance()->GetMasqAddress(remote_peerAddr);
UnmapIPv4Address(callingSocket->masqAddr);
PTRACE(0, "JW set callingSocket->masqAddr=" << callingSocket->masqAddr << " for " << remote_peerAddr); // JWXM
if (m_call->GetCalledParty() && m_call->GetCalledParty()->GetRasServerIP().IsValid()) {
PTRACE(0, "JW set masqAddr to called rasserverip=" << AsString(m_call->GetCalledParty()->GetRasServerIP()));
PTRACE(7, "JW RTP set masqAddr to called rasserverip=" << AsString(m_call->GetCalledParty()->GetRasServerIP()));
callingSocket->masqAddr = m_call->GetCalledParty()->GetRasServerIP();
} else {
PTRACE(0, "JW calling NO rasserverip");
}
if (m_call->GetEndpointIPMapping(remote_peerAddr, callingSocket->masqAddr)) {
PTRACE(0, "JW set callingSocket->masqAddr=" << masqAddr << " for " << remote_peerAddr << " from IPMapping");
PTRACE(7, "JW RTP set callingSocket->masqAddr=" << masqAddr << " for " << remote_peerAddr << " from IPMapping");
}

callingSocket->SetConnected(true);
Expand Down Expand Up @@ -8582,9 +8574,8 @@ void CallSignalSocket::BuildSetupPDU(Q931 & SetupPDU, const H225_CallIdentifier
setup.m_conferenceID = callid.m_guid; // generate new: OpalGloballyUniqueID();
setup.m_callIdentifier.m_guid = setup.m_conferenceID;
masqAddr = RasServer::Instance()->GetMasqAddress(peerAddr);
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr); // JWXM
if (m_call->GetEndpointIPMapping(peerAddr, masqAddr)) {
PTRACE(0, "JW set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
PTRACE(7, "JW RTP set masqAddr=" << masqAddr << " for " << peerAddr << " from IPMapping");
}

setup.IncludeOptionalField(H225_Setup_UUIE::e_sourceCallSignalAddress);
Expand Down Expand Up @@ -12034,7 +12025,7 @@ ProxySocket::Result UDPProxySocket::ReceiveData()
}
}

// save which destination IP on the gatekeeper is used by remote endpoint and use that to send! JWX
// save which destination IP on the gatekeeper is used by remote endpoint and use that to send!
if (!m_portDetectionDone) {
if (m_call && (*m_call)) {
(*m_call)->SetEndpointIPMapping(fromIP, localaddr);
Expand Down Expand Up @@ -12360,9 +12351,9 @@ ProxySocket::Result UDPProxySocket::ReceiveData()
ParseRTCP(*m_call, m_sessionID, fromIP, wbuffer, buflen);
PIPSocket::Address gkIP;
if ((*m_call)->GetEndpointIPMapping(m_multiplexDestination_A.GetIP(), gkIP)) {
H46019Session::Send(m_multiplexID_A, m_multiplexDestination_A, m_multiplexSocket_A, wbuffer, buflen, false, &gkIP); // JWX
H46019Session::Send(m_multiplexID_A, m_multiplexDestination_A, m_multiplexSocket_A, wbuffer, buflen, false, &gkIP);
} else {
H46019Session::Send(m_multiplexID_A, m_multiplexDestination_A, m_multiplexSocket_A, wbuffer, buflen, false, NULL); // JWX
H46019Session::Send(m_multiplexID_A, m_multiplexDestination_A, m_multiplexSocket_A, wbuffer, buflen, false, NULL);
}
return NoData; // already forwarded through multiplex socket
}
Expand All @@ -12371,9 +12362,9 @@ ProxySocket::Result UDPProxySocket::ReceiveData()
ParseRTCP(*m_call, m_sessionID, fromIP, wbuffer, buflen);
PIPSocket::Address gkIP;
if ((*m_call)->GetEndpointIPMapping(m_multiplexDestination_B.GetIP(), gkIP)) {
H46019Session::Send(m_multiplexID_B, m_multiplexDestination_B, m_multiplexSocket_B, wbuffer, buflen, false, &gkIP); // JWX
H46019Session::Send(m_multiplexID_B, m_multiplexDestination_B, m_multiplexSocket_B, wbuffer, buflen, false, &gkIP);
} else {
H46019Session::Send(m_multiplexID_B, m_multiplexDestination_B, m_multiplexSocket_B, wbuffer, buflen, false, NULL); // JWX
H46019Session::Send(m_multiplexID_B, m_multiplexDestination_B, m_multiplexSocket_B, wbuffer, buflen, false, NULL);
}
return NoData; // already forwarded through multiplex socket
}
Expand Down Expand Up @@ -12483,7 +12474,7 @@ ProxySocket::Result UDPProxySocket::ReceiveData()
GetSendAddress(toIP, toPort);
PIPSocket::Address gkIP;
if (m_call && (*m_call) && (*m_call)->GetEndpointIPMapping(toIP, gkIP)) {
UDPSendWithSourceIP(os_handle, wbuffer, buflen, toIP, toPort, &gkIP); // JWX add gkIP
UDPSendWithSourceIP(os_handle, wbuffer, buflen, toIP, toPort, &gkIP);
} else {
UDPSendWithSourceIP(os_handle, wbuffer, buflen, toIP, toPort, NULL);
}
Expand Down Expand Up @@ -13954,7 +13945,6 @@ bool H245ProxyHandler::OnLogicalChannelParameters(H245_H2250LogicalChannelParame

lc->SetMediaControlChannelSource(*addr);
*addr << GetMasqAddr() << (lc->GetPort() + 1); // old RTP assumption
PTRACE(0, "JW OnLogicalChannelParameters setting mediaControl to " << AsString(GetMasqAddr()));
#ifdef HAS_H46018
if (IsTraversalClient()) {
PTRACE(5, "H46018\tSetting control channel to 0");
Expand Down Expand Up @@ -13991,7 +13981,6 @@ bool H245ProxyHandler::OnLogicalChannelParameters(H245_H2250LogicalChannelParame
if (GetH245Port(*addr) != 0) {
lc->SetMediaChannelSource(*addr);
*addr << GetMasqAddr() << lc->GetPort();
PTRACE(0, "JW OnLogicalChannelParameters setting media to " << AsString(GetMasqAddr()));
#ifdef HAS_H46018
if (IsTraversalClient()) {
PTRACE(5, "H46018\tSetting media channel to 0");
Expand Down Expand Up @@ -14019,7 +14008,6 @@ bool H245ProxyHandler::OnLogicalChannelParameters(H245_H2250LogicalChannelParame
lc->ZeroMediaChannelSource();
};
} else {
PTRACE(0, "JW OnLogicalChannelParameters setting media to " << AsString(GetMasqAddr()));
*addr << GetMasqAddr() << (WORD)0;
}
changed = true;
Expand Down
4 changes: 2 additions & 2 deletions RasSrv.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2653,8 +2653,8 @@ bool RegistrationRequestPDU::Process()
return BuildRRJ(H225_RegistrationRejectReason::e_undefinedReason);
}
// remember which of our IPs the endpoint has sent the RRQ to (to keep all later signaling to this IP)
ep->SetRasServerIP(m_msg->m_localAddr); // JWX
PTRACE(0, "JW set rasserverip for " << m_msg->m_peerAddr << " to " << m_msg->m_localAddr);
ep->SetRasServerIP(m_msg->m_localAddr);
PTRACE(7, "JW RTP set rasserverip for " << m_msg->m_peerAddr << " to " << m_msg->m_localAddr);

#ifdef HAS_H46017
if (usesH46017) {
Expand Down
4 changes: 2 additions & 2 deletions RasTbl.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2659,7 +2659,7 @@ void H46019KeepAlive::SendKeepAlive(GkTimer * t)
ka_ptr = (char*)&multiplexedRtcpKeepAlive;
ka_size = sizeof(multiplexedRtcpKeepAlive);
}
size_t sent = UDPSendWithSourceIP(ossocket, ka_ptr, ka_size, dest, gkIPptr); // JWX
size_t sent = UDPSendWithSourceIP(ossocket, ka_ptr, ka_size, dest, gkIPptr);
if (sent != ka_size) {
PTRACE(1, "Error sending RTCP keepAlive " << timer);
SNMP_TRAP(10, SNMPError, Network, "Sending multiplexed RTCP keepAlive failed");
Expand Down Expand Up @@ -5218,7 +5218,7 @@ void CallRec::SetEndpointIPMapping(PIPSocket::Address epIP, PIPSocket::Address g

std::map<PIPSocket::Address, PIPSocket::Address>::iterator it = m_endpointIPMapping.find(epIP);
if (it == m_endpointIPMapping.end()) {
PTRACE(0, "JW add mapping " << AsString(epIP) << " <=> " << AsString(gkIP));
PTRACE(7, "JW RTP add mapping " << AsString(epIP) << " <=> " << AsString(gkIP));
m_endpointIPMapping[epIP] = gkIP;
}
}
Expand Down
1 change: 0 additions & 1 deletion RasTbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ class EndpointRec
PIPSocket::Address GetIP() const;
// for multi-homed servers: the IP that the endpoint sent his RAS messages to (needed for H.460.18 SCI)
PIPSocket::Address GetRasServerIP() const { return m_rasServerIP; } // caller need to check for IsValid()
//bool GetRasServerIP(PIPSocket::Address & ip) const { ip = m_rasServerIP; return m_rasServerIP.IsValid(); } // JWX
H225_EndpointIdentifier GetEndpointIdentifier() const;
H225_ArrayOf_AliasAddress GetAliases() const;
H225_EndpointType GetEndpointType() const;
Expand Down
6 changes: 0 additions & 6 deletions yasocket.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -665,36 +665,30 @@ int YaUDPSocket::os_recv(void * buf, int sz)
PIPSocket::Address raddr;
WORD rpt;
GetLastReceiveAddress(raddr, rpt);
PTRACE(0, "JW recvmsg=" << result << " ep ip=" << AsString(raddr, rpt));

for ( // iterate through all control headers
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&hdr);
cmsg != NULL;
cmsg = CMSG_NXTHDR(&hdr, cmsg))
{
#ifdef IP_PKTINFO
PTRACE(0, "JW found CMSG type=" << cmsg->cmsg_type << " IP_PKTINFO=" << IP_PKTINFO << " IPV6_PKTINFO=" << IPV6_PKTINFO);
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) {
struct in_pktinfo * pi = (struct in_pktinfo *)CMSG_DATA(cmsg);
// pi->ipi_addr is our IP that the endpoint sent to (in_addr)
lastDestAddress = pi->ipi_addr;
PTRACE(0, "JW IP_PKTINFO lastDestAddress=" << AsString(lastDestAddress));
}
#endif
#ifdef IP_RECVDSTADDR
PTRACE(0, "JW found CMSG type=" << cmsg->cmsg_type << " IP_RECVDSTADDR=" << IP_RECVDSTADDR);
if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_RECVDSTADDR) {
struct in_addr * i = (struct in_addr *)CMSG_DATA(cmsg);
lastDestAddress = *i;
PTRACE(0, "JW IP_RECVDSTADDR lastDestAddress=" << AsString(lastDestAddress));
}
#endif
#if defined(hasIPV6) && defined (IPV6_PKTINFO)
if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) {
struct in6_pktinfo * pi = (struct in6_pktinfo *)CMSG_DATA(cmsg);
// pi->ipi_addr is our IP that the endpoint sent to (in_addr)
lastDestAddress = pi->ipi6_addr;
PTRACE(0, "JW IPV6_PKTINFO lastDestAddress=" << AsString(lastDestAddress));
}
#endif
}
Expand Down

0 comments on commit 4005ad5

Please sign in to comment.