[PATCH] osmo-mgw[master]: protocol: fix problem with line break and OSMUX

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
Mon Jan 22 11:08:05 UTC 2018


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

protocol: fix problem with line break and OSMUX

The SDP parameter block must be detached from the regular parameters
using an additional line break (empty line). At the moment this works
because the empty OSMOX variable is added and by this also adds a
line break. It breaks as soon as OSMUX is used again.

- Make clear that no OSMUX variable is added when OSMUX is not in
  use.

- Add the extra line break independently

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


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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index daedc8d..49c4c3c 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -226,7 +226,7 @@
 	struct msgb *sdp;
 	int rc;
 	struct msgb *result;
-	char osmux_extension[strlen("\nX-Osmux: 255") + 1];
+	char osmux_extension[strlen("X-Osmux: 255") + 1];
 	char local_ip_addr[INET_ADDRSTRLEN];
 
 	sdp = msgb_alloc_headroom(4096, 128, "sdp record");
@@ -239,7 +239,7 @@
 	}
 
 	if (conn->osmux.state == OSMUX_STATE_NEGOTIATING) {
-		sprintf(osmux_extension, "\nX-Osmux: %u", conn->osmux.cid);
+		sprintf(osmux_extension, "X-Osmux: %u", conn->osmux.cid);
 		conn->osmux.state = OSMUX_STATE_ACTIVATING;
 	} else {
 		osmux_extension[0] = '\0';
@@ -252,9 +252,15 @@
 			goto error;
 	}
 
-	rc = msgb_printf(sdp, "%s\n", osmux_extension);
-	if (rc < 0)
-		goto error;
+	/* Attach optional OSMUX parameters */
+	if (conn->osmux.state == OSMUX_STATE_NEGOTIATING) {
+		rc = msgb_printf(sdp, "%s\n", osmux_extension);
+		if (rc < 0)
+			goto error;
+	}
+
+	/* Attach line break to separate the parameters from the SDP block */
+	rc = msgb_printf(sdp, "\n");
 
 	rc = mgcp_write_response_sdp(endp, conn, sdp, addr);
 	if (rc < 0)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6261971040db527b96fe79676520ccd7794bd327
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