Change in osmo-mgw[master]: mgw, mgcp-li: Handle X-Osmux param name as case insensitive

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue May 14 14:25:03 UTC 2019


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


Change subject: mgw, mgcp-li: Handle X-Osmux param name as case insensitive
......................................................................

mgw, mgcp-li: Handle X-Osmux param name as case insensitive

RFC3435 states most text (except SDP) must be handled as case
insensitive.

Change-Id: Iac073f1db46569b46eddeaecc9934a2986bd50f1
---
M src/libosmo-mgcp-client/mgcp_client.c
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_protocol.c
3 files changed, 8 insertions(+), 6 deletions(-)



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

diff --git a/src/libosmo-mgcp-client/mgcp_client.c b/src/libosmo-mgcp-client/mgcp_client.c
index d65a799..7074328 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -403,12 +403,12 @@
 	int osmux_cid;
 
 
-	if (strstr(line + 2, "Osmux: *")) {
+	if (strcasecmp(line + 2, "Osmux: *") == 0) {
 		LOGP(DLMGCP, LOGL_DEBUG, "Parsed wilcard Osmux CID\n");
 		return -1;
 	}
 
-	if (sscanf(line + 2, "Osmux: %u", &osmux_cid) != 1) {
+	if (sscanf(line + 2 + 7, "%u", &osmux_cid) != 1) {
 		LOGP(DLMGCP, LOGL_ERROR, "Failed parsing Osmux in MGCP msg line: %s\n",
 		     line);
 		return -2;
@@ -602,7 +602,8 @@
 				goto exit;
 			break;
 		case 'X':
-			if (strncmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
+		case 'x':
+			if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
 				rc = mgcp_parse_osmux_cid(line);
 				if (rc < 0) {
 					/* -1: we don't want wildcards in response. -2: error */
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index a31bff4..59e0e91 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -360,12 +360,12 @@
 	int osmux_cid;
 
 
-	if (strstr(line + 2, "Osmux: *")) {
+	if (strcasecmp(line + 2, "Osmux: *") == 0) {
 		LOGP(DLMGCP, LOGL_DEBUG, "Parsed wilcard Osmux CID\n");
 		return -1;
 	}
 
-	if (sscanf(line + 2, "Osmux: %u", &osmux_cid) != 1) {
+	if (sscanf(line + 2 + 7, "%u", &osmux_cid) != 1) {
 		LOGP(DLMGCP, LOGL_ERROR, "Failed parsing Osmux in MGCP msg line: %s\n",
 		     line);
 		return -2;
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 0831abb..6fd991d 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -816,7 +816,8 @@
 			mode = (const char *)line + 3;
 			break;
 		case 'X':
-			if (strncmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
+		case 'x':
+			if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
 				/* If osmux is disabled, just skip setting it up */
 				if (!p->endp->cfg->osmux)
 					break;

-- 
To view, visit https://gerrit.osmocom.org/14043
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: Iac073f1db46569b46eddeaecc9934a2986bd50f1
Gerrit-Change-Number: 14043
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/20190514/08f691e7/attachment-0001.html>


More information about the gerrit-log mailing list