[PATCH] osmo-mgw[master]: protocol: allow wildcarded DLCX

dexter gerrit-no-reply at lists.osmocom.org
Wed Oct 18 09:49:24 UTC 2017


Hello Neels Hofmeyr, Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/4227

to look at the new patch set (#7).

protocol: allow wildcarded DLCX

In many cases it is simpler to instruct the mgcp-gw to drop all
connections at once instead of removing each connection
individually.

drop all connections and release the endpoint in when no connection
id is supplied with the DLCX command.

Change-Id: Ib5fcc72775bf72b489ff79ade36fb345d8d20736
---
M include/osmocom/mgcp_client/mgcp_client.h
M src/libosmo-mgcp/mgcp_protocol.c
2 files changed, 20 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/27/4227/7

diff --git a/include/osmocom/mgcp_client/mgcp_client.h b/include/osmocom/mgcp_client/mgcp_client.h
index 11680db..e91b190 100644
--- a/include/osmocom/mgcp_client/mgcp_client.h
+++ b/include/osmocom/mgcp_client/mgcp_client.h
@@ -36,7 +36,7 @@
 	char *body;
 	struct mgcp_response_head head;
 	uint16_t audio_port;
-        char audio_ip[INET_ADDRSTRLEN];
+	char audio_ip[INET_ADDRSTRLEN];
 };
 
 enum mgcp_verb {
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index c32f3d2..c5245ca 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -908,14 +908,31 @@
 		}
 	}
 
-	/* find the connection */
+	/* When no connection id is supplied, we will interpret this as a
+	 * wildcarded DLCX and drop all connections at once. (See also
+	 * RFC3435 Section F.7) */
+	if (!ci) {
+		LOGP(DLMGCP, LOGL_NOTICE,
+		     "DLCX: endpoint:%x missing ci (connectionIdentifier), will remove all connections at once\n",
+		     ENDPOINT_NUMBER(endp));
+
+		mgcp_release_endp(endp);
+
+		/* Note: In this case we do not return any statistics,
+		 * as we assume that the client is not interested in
+		 * this case. */
+		return create_ok_response(endp, 200, "DLCX", p->trans);
+	}
+
+	/* Parse the connection id */
 	if (mgcp_parse_ci(&conn_id, ci)) {
 		LOGP(DLMGCP, LOGL_ERROR,
-		     "DLCX: endpoint:%x insufficient parameters, missing ci (connectionIdentifier)\n",
+		     "DLCX: endpoint:%x insufficient parameters, invalid ci (connectionIdentifier)\n",
 		     ENDPOINT_NUMBER(endp));
 		return create_err_response(endp, 400, "DLCX", p->trans);
 	}
 
+	/* Find the connection */
 	conn = mgcp_conn_get_rtp(endp, conn_id);
 	if (!conn)
 		goto error3;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib5fcc72775bf72b489ff79ade36fb345d8d20736
Gerrit-PatchSet: 7
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: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list