From f4c0e373524c6856a33e7c30cb4e354e105ecce2 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 11 Oct 2017 16:06:45 +0200 Subject: [PATCH] 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 --- src/libosmo-mgcp/mgcp_protocol.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c index 6c611f7f7..9c92c65b8 100644 --- a/src/libosmo-mgcp/mgcp_protocol.c +++ b/src/libosmo-mgcp/mgcp_protocol.c @@ -910,14 +910,31 @@ static struct msgb *handle_delete_con(struct mgcp_parse_data *p) } } - /* 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;