Change in osmo-mgw[master]: mgcp_protocol: add support for wildcarded DLCX

dexter gerrit-no-reply at lists.osmocom.org
Fri Jul 2 13:31:57 UTC 2021


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/24823 )


Change subject: mgcp_protocol: add support for wildcarded DLCX
......................................................................

mgcp_protocol: add support for wildcarded DLCX

At the moment osmo-mgw does not support wildcarded DLCX requests that
refer to the whole trunk, even though RFC3435 specifies it. However,
wildcarded DLCX requests would enable the BSC or the MSC to reset its
companioun osmo-mgw instance to a defined state after restart.

Change-Id: I0770cf46d93ab09efe9cafdd56d2e3f1132db189
---
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_ratectr.c
2 files changed, 20 insertions(+), 13 deletions(-)



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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 3014048..55c5370 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1263,9 +1263,10 @@
 	char stats[1048];
 	const char *conn_id = NULL;
 	struct mgcp_conn_rtp *conn = NULL;
+	unsigned int i;
 
 	LOGPENDP(endp, DLMGCP, LOGL_NOTICE,
-		 "DLCX: deleting connection ...\n");
+		 "DLCX: deleting connection(s) ...\n");
 
 	if (!mgcp_endp_avail(endp)) {
 		rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_DLCX_FAIL_AVAIL));
@@ -1274,15 +1275,7 @@
 		return create_err_response(NULL, 501, "DLCX", p->trans);
 	}
 
-	/* Prohibit wildcarded requests */
-	if (endp->wildcarded_req) {
-		LOGPENDP(endp, DLMGCP, LOGL_ERROR,
-			 "DLCX: wildcarded endpoint names not supported.\n");
-		rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_DLCX_FAIL_WILDCARD));
-		return create_err_response(endp, 507, "DLCX", p->trans);
-	}
-
-	if (llist_count(&endp->conns) <= 0) {
+	if (!endp->wildcarded_req && llist_count(&endp->conns) <= 0) {
 		LOGPENDP(endp, DLMGCP, LOGL_ERROR,
 			 "DLCX: endpoint is not holding a connection.\n");
 		rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_DLCX_FAIL_NO_CONN));
@@ -1344,9 +1337,23 @@
 		}
 	}
 
+	/* Handle wildcarded DLCX that refers to the whole trunk. This means
+	 * that we walk over all endpoints on the trank in order to drop all
+	 * connections on the trunk. (see also RFC3435 Annex F.7) */
+	if (endp->wildcarded_req) {
+		int num_conns = 0;
+		for (i = 0; i < endp->trunk->number_endpoints; i++) {
+			num_conns += llist_count(&endp->conns);
+			mgcp_endp_release(endp->trunk->endpoints[i]);
+		}
+		rate_ctr_add(rate_ctr_group_get_ctr(rate_ctrs, MGCP_DLCX_SUCCESS), num_conns);
+		return create_ok_response(endp, 200, "DLCX", p->trans);
+	}
+
 	/* 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) */
+	 * wildcarded DLCX that refers to the selected endpoint. This means
+	 * that we drop all connections on that specific endpoint at once.
+	 * (See also RFC3435 Section F.7) */
 	if (!conn_id) {
 		int num_conns = llist_count(&endp->conns);
 		LOGPENDP(endp, DLMGCP, LOGL_NOTICE,
diff --git a/src/libosmo-mgcp/mgcp_ratectr.c b/src/libosmo-mgcp/mgcp_ratectr.c
index 2868062..833cb19 100644
--- a/src/libosmo-mgcp/mgcp_ratectr.c
+++ b/src/libosmo-mgcp/mgcp_ratectr.c
@@ -105,7 +105,7 @@
 
 static const struct rate_ctr_desc mgcp_dlcx_ctr_desc[] = {
 	[MGCP_DLCX_SUCCESS] = { "dlcx:success", "DLCX command processed successfully." },
-	[MGCP_DLCX_FAIL_WILDCARD] = { "dlcx:wildcard", "wildcard names in DLCX commands are unsupported." },
+	[MGCP_DLCX_FAIL_WILDCARD] = { "dlcx:wildcard", "(deprecated)" },
 	[MGCP_DLCX_FAIL_NO_CONN] = { "dlcx:no_conn", "endpoint specified in DLCX command has no active connections." },
 	[MGCP_DLCX_FAIL_INVALID_CALLID] =
 	    { "dlcx:callid", "CallId specified in DLCX command mismatches endpoint's CallId ." },

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/24823
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I0770cf46d93ab09efe9cafdd56d2e3f1132db189
Gerrit-Change-Number: 24823
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210702/2fc6184c/attachment.htm>


More information about the gerrit-log mailing list