Skip to content

Commit

Permalink
check signaled RTP source IP when doing port detection for H.239 (sim…
Browse files Browse the repository at this point in the history
…ilar to RTCP)
  • Loading branch information
willamowius committed Feb 27, 2024
1 parent b9f548b commit 9ee88f3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
27 changes: 20 additions & 7 deletions ProxyChannel.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,9 @@ class H245ProxyHandler : public H245Handler {
bool m_matchH239SessionsByType;
list<NetworkAddress> m_matchH239SessionsByIDOnly; // never match H.239 reverse channels by type on these networks (by source IP)
PIPSocket::Address m_callerSignaledRTCPSrcIP; // save the last originally signaled RTCP source IP from caller, only valid _during_ OLC processing
PIPSocket::Address m_callerSignaledRTPSrcIP; // save the last originally signaled RTP source IP from caller, only valid _during_ OLC processing
PIPSocket::Address m_calledSignaledRTCPSrcIP; // save the last originally signaled RTCP source IP from called, only valid _during_ OLC processing
PIPSocket::Address m_calledSignaledRTPSrcIP; // save the last originally signaled RTP source IP from called, only valid _during_ OLC processing
};


Expand Down Expand Up @@ -16412,7 +16414,6 @@ bool H245ProxyHandler::OnLogicalChannelParameters(H245_H2250LogicalChannelParame
}
if (h225Params->HasOptionalField(H245_H2250LogicalChannelParameters::e_mediaChannel)
&& (addr = GetH245UnicastAddress(h225Params->m_mediaChannel))) {
// TODO: check if we need to save the un-rewritten signaled IP here, same as for the mediaControlChannel

if (GetH245Port(*addr) != 0) {
lc->SetMediaChannelSource(*addr);
Expand All @@ -16423,25 +16424,27 @@ bool H245ProxyHandler::OnLogicalChannelParameters(H245_H2250LogicalChannelParame
lc->ZeroMediaChannelSource();
}
#endif
PIPSocket::Address ip = H245UnicastToSocketAddr(*addr);
// use the saved un-rewritten signaled IP here, same as for the mediaControlChannel
PIPSocket::Address signaledRTPSrcIP = IsCaller() ? m_callerSignaledRTPSrcIP : m_calledSignaledRTPSrcIP;
PTRACE(7, "JW RTCP addr sourceIP=" << AsString(sourceIP) << " signaledRTPSrcIP=" << AsString(signaledRTPSrcIP));
if (isUnidirectional) {
PTRACE(7, "JW RTP zero check 3: rtp src=" << AsString(ip));
if (m_ignoreSignaledIPs && IsPrivate(ip) && m_ignoreSignaledPrivateH239IPs) {
PTRACE(7, "JW RTP zero check 3: rtp src=" << AsString(signaledRTPSrcIP));
if (m_ignoreSignaledIPs && IsPrivate(signaledRTPSrcIP) && m_ignoreSignaledPrivateH239IPs) {
zeroIP = true;
}
if (m_ignoreSignaledIPs && m_ignoreSignaledAllH239IPs) {
zeroIP = true;
}
if (m_ignoreSignaledIPs && IsInNetworks(ip, m_ignorePublicH239IPs)) {
if (m_ignoreSignaledIPs && IsInNetworks(signaledRTPSrcIP, m_ignorePublicH239IPs)) {
zeroIP = true;
}
}
if (IsInNetworks(ip, m_keepSignaledIPs)) {
if (IsInNetworks(signaledRTPSrcIP, m_keepSignaledIPs)) {
PTRACE(7, "JW RTP don't zero due to m_keepSignaledIPs");
zeroIP = false;
}
if (IsInNetworks(sourceIP, m_keepSignaledIPsFrom)) {
PTRACE(7, "JW RTP don't zero due to m_keepSignaledIPsFrom");
PTRACE(7, "JW RTP don't zero due to m_keepSignaledIPsFrom sourceIP=" << AsString(sourceIP));
zeroIP = false;
}
if (zeroIP) {
Expand Down Expand Up @@ -16582,6 +16585,16 @@ bool H245ProxyHandler::HandleOpenLogicalChannel(H245_OpenLogicalChannel & olc, c
PTRACE(7, "JW RTP saving signaled RTCP addr from called = " << AsString(m_calledSignaledRTCPSrcIP));
}
}
if (h225Params && h225Params->HasOptionalField(H245_H2250LogicalChannelParameters::e_mediaChannel)
&& (addr = GetH245UnicastAddress(h225Params->m_mediaChannel)) ) {
if (IsCaller()) {
m_callerSignaledRTPSrcIP = H245UnicastToSocketAddr(*addr);
PTRACE(7, "JW RTP saving signaled RTP addr from caller = " << AsString(m_callerSignaledRTPSrcIP));
} else {
m_calledSignaledRTPSrcIP = H245UnicastToSocketAddr(*addr);
PTRACE(7, "JW RTP saving signaled RTP addr from called = " << AsString(m_calledSignaledRTPSrcIP));
}
}
}

if (hnat && !UsesH46019())
Expand Down
2 changes: 1 addition & 1 deletion changes.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Changes from 5.12 to 5.13
=========================
- BUGFIX(ProxyChannel.cxx) check signaled RTCP source IP when doing port detection for H.239
- BUGFIX(ProxyChannel.cxx) check signaled RTP/RTCP source IP when doing port detection for H.239

Changes from 5.11 to 5.12
=========================
Expand Down

0 comments on commit 9ee88f3

Please sign in to comment.