Change in osmo-mgw[master]: osmux: Fix loopback for Osmux connections

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed May 15 21:55:00 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/14068


Change subject: osmux: Fix loopback for Osmux connections
......................................................................

osmux: Fix loopback for Osmux connections

Move code in RTP specific path to generic dispatch_rtp_cb. This way
loopback logic is applied both for Osmux and RTP connections.

Change-Id: Ia30f5a14f150e4d151eac4d1046ea834f1685a5f
---
M src/libosmo-mgcp/mgcp_network.c
1 file changed, 16 insertions(+), 15 deletions(-)



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

diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 650d4c0..bb29d2b 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1233,6 +1233,22 @@
 	 *  destination connection is known the RTP packet is sent via
 	 *  the destination connection. */
 
+
+	 /* Check if the connection is in loopback mode, if yes, just send the
+	 * incoming data back to the origin */
+	if (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->u.rtp.end.rtp_port == 0) {
+			conn->u.rtp.end.addr = addr->sin_addr;
+			conn->u.rtp.end.rtp_port = addr->sin_port;
+		}
+		return mgcp_send_rtp(proto, addr, buf,
+				     buf_size, &conn->u.rtp, &conn->u.rtp);
+	}
+
 	/* Find a destination connection. */
 	/* NOTE: This code path runs every time an RTP packet is received. The
 	 * function mgcp_find_dst_conn() we use to determine the detination
@@ -1319,21 +1335,6 @@
 
 	mgcp_conn_watchdog_kick(conn_src->conn);
 
-	/* 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);
-	}
-
 	/* If AMR is configured for the ingress connection a conversion of the
 	 * framing mode (octet-aligned vs. bandwith-efficient is explicitly
 	 * define, then we check if the incoming payload matches that

-- 
To view, visit https://gerrit.osmocom.org/14068
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia30f5a14f150e4d151eac4d1046ea834f1685a5f
Gerrit-Change-Number: 14068
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190515/f68363bf/attachment.html>


More information about the gerrit-log mailing list