[MERGED] osmo-mgw[master]: network: fix rtp packet length

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Nov 8 19:12:02 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: network: fix rtp packet length
......................................................................


network: fix rtp packet length

When sending rtp packets sizeof(buf) is used as length. This causes
all RTP packets to be the size of the buffer (4096) containing the
rtp payload and random excess data from previoes memory usage

Use the actual length of the received RTP data, rather then the
full buffer size.

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

Approvals:
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 7876b33..28d1fed 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1054,7 +1054,7 @@
 
 	char buf[RTP_BUF_SIZE];
 	int proto;
-	int rc;
+	int len;
 
 	conn_src = (struct mgcp_conn_rtp *)fd->data;
 	OSMO_ASSERT(conn_src);
@@ -1065,20 +1065,20 @@
 	     ENDPOINT_NUMBER(endp), mgcp_conn_dump(conn_src->conn));
 
 	/* Receive packet */
-	rc = mgcp_recv(&proto, &addr, buf, sizeof(buf), fd);
-	if (rc < 0)
+	len = mgcp_recv(&proto, &addr, buf, sizeof(buf), fd);
+	if (len < 0)
 		return -1;
 
 	/* 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) {
 		return mgcp_send_rtp(proto, &addr, buf,
-				     sizeof(buf), conn_src, conn_src);
+				     len, conn_src, conn_src);
 	}
 
 	/* Execute endpoint specific implementation that handles the
 	 * dispatching of the RTP data */
-	return endp->type->dispatch_rtp_cb(proto, &addr, buf, sizeof(buf),
+	return endp->type->dispatch_rtp_cb(proto, &addr, buf, len,
 					   conn_src->conn);
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I47a15701f9a7e7a492df183b67ec971f5be61069
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list