[PATCH] osmo-mgw[master]: network: use originating RTP packet address for loopback

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/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Dec 12 15:36:10 UTC 2017


Review at  https://gerrit.osmocom.org/5298

network: use originating RTP packet address for loopback

When a connection is created in loopback mode all incoming
packets should be reflected back to their origin. If the
user did not supply a destination address with the CRCX
command all incoming packets will be tossed because no
destination address is officially known yet.

If there is no destination address set and the connection
is in loopback mode. Then use the originating address of
the incoming packet as destination address.

Change-Id: I3d1abe56d016e28c97f60635eb574679d36e2c52
---
M src/libosmo-mgcp/mgcp_network.c
1 file changed, 9 insertions(+), 0 deletions(-)


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

diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index eb44f9b..aac3e51 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1077,7 +1077,16 @@
 
 	/* Check if the connection is in loopback mode, if yes, just send the
 	 * incoming data back to the origin */
+
 	if (conn_src->conn->mode == MGCP_CONN_LOOPBACK) {
+		/* When we are in loopback mode, we loop back all incoming
+		 * packets back to their origin. We will use the originating
+		 * address data from the UDP packet header to patch the
+		 * outgoing address in connection on the fly */
+		if (conn_src->end.rtp_port == 0) {
+			conn_src->end.addr = addr.sin_addr;
+			conn_src->end.rtp_port = addr.sin_port;
+		}
 		return mgcp_send_rtp(proto, &addr, buf,
 				     len, conn_src, conn_src);
 	}

-- 
To view, visit https://gerrit.osmocom.org/5298
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d1abe56d016e28c97f60635eb574679d36e2c52
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list