Change in osmo-mgw[master]: mgw: rx CRCX: Avoid sending dummy rtp if remote address not provided

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Jul 6 16:45:37 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/24862 )


Change subject: mgw: rx CRCX: Avoid sending dummy rtp if remote address not provided
......................................................................

mgw: rx CRCX: Avoid sending dummy rtp if remote address not provided

The following sequence of events was seen frequently in a osmo-mgw
instance running on the field with heavy traffic:
"""
endpoint:rtpbridge/1 at mgw CRCX: creating new connection ...
mgcp_network.c:236 endpoint:rtpbridge/1 at mgw CI:1C8CCFA9 Failed to send dummy RTP packet.
"""

Allegedly, that happens because at CRCX time the remote address may
still not be known, hence we end up trying to send a dummy rtp packet
to, for instance, host 0.0.0.0 port 0, which will of course fail.
Let's avoid sending it if the address is not yet known.

Similary, same issue could be seen during MDCX, since at MDCX we don't
necessarily need to have a valid addr+port (there could be several MDCX
and only last one set it).

Finally, the keepalive timer also needs the check, since it iterates
over all connections, and it could be that some is still not fully
configured.

Related: SYS#5498
Change-Id: I8ceafda691146823b12232b4a804b4ce74acbdc8
---
M include/osmocom/mgcp/mgcp_network.h
M src/libosmo-mgcp/mgcp_network.c
M src/libosmo-mgcp/mgcp_protocol.c
3 files changed, 11 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/62/24862/1

diff --git a/include/osmocom/mgcp/mgcp_network.h b/include/osmocom/mgcp/mgcp_network.h
index 1766f4a..643ed51 100644
--- a/include/osmocom/mgcp/mgcp_network.h
+++ b/include/osmocom/mgcp/mgcp_network.h
@@ -132,6 +132,8 @@
 	char local_addr[INET6_ADDRSTRLEN];
 };
 
+bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end);
+
 struct mgcp_rtp_tap {
 	/* is this tap active (1) or not (0) */
 	int enabled;
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 8de85b8..785b99e 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -77,7 +77,7 @@
 
 static int rx_rtp(struct msgb *msg);
 
-static bool addr_is_any(struct osmo_sockaddr *osa) {
+static bool addr_is_any(const struct osmo_sockaddr *osa) {
 	if (osa->u.sa.sa_family == AF_INET6) {
 		struct in6_addr ip6_any = IN6ADDR_ANY_INIT;
 		return memcmp(&osa->u.sin6.sin6_addr,
@@ -87,6 +87,11 @@
 	}
 }
 
+bool mgcp_rtp_end_remote_addr_available(const struct mgcp_rtp_end *rtp_end)
+{
+	return rtp_end->rtp_port && !addr_is_any(&rtp_end->addr);
+}
+
 /*! Determine the local rtp bind IP-address.
  *  \param[out] addr caller provided memory to store the resulting IP-Address.
  *  \param[in] endp mgcp endpoint, that holds a copy of the VTY parameters.
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 3014048..fd8c3d1 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -991,6 +991,7 @@
 	/* Send dummy packet, see also comments in mgcp_keepalive_timer_cb() */
 	OSMO_ASSERT(trunk->keepalive_interval >= MGCP_KEEPALIVE_ONCE);
 	if (conn->conn->mode & MGCP_CONN_RECV_ONLY
+	    && mgcp_rtp_end_remote_addr_available(&conn->end)
 	    && trunk->keepalive_interval != MGCP_KEEPALIVE_NEVER)
 		send_dummy(endp, conn);
 
@@ -1148,7 +1149,7 @@
 	/* check connection mode setting */
 	if (conn->conn->mode != MGCP_CONN_LOOPBACK
 	    && conn->conn->mode != MGCP_CONN_RECV_ONLY
-	    && conn->end.rtp_port == 0) {
+	    && mgcp_rtp_end_remote_addr_available(&conn->end)) {
 		LOGPCONN(conn->conn, DLMGCP, LOGL_ERROR,
 			 "MDCX: selected connection mode type requires an opposite end!\n");
 		error_code = 527;
@@ -1233,6 +1234,7 @@
 	/* Send dummy packet, see also comments in mgcp_keepalive_timer_cb() */
 	OSMO_ASSERT(endp->trunk->keepalive_interval >= MGCP_KEEPALIVE_ONCE);
 	if (conn->conn->mode & MGCP_CONN_RECV_ONLY
+	    && mgcp_rtp_end_remote_addr_available(&conn->end)
 	    && endp->trunk->keepalive_interval != MGCP_KEEPALIVE_NEVER)
 		send_dummy(endp, conn);
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/24862
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I8ceafda691146823b12232b4a804b4ce74acbdc8
Gerrit-Change-Number: 24862
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210706/cdc7ffa8/attachment.htm>


More information about the gerrit-log mailing list