protocol: check requested connection mode

The connection mode setting (e.g. recvonly) is not checked on CRCX
and MDCX. This allows requests that set the connection mode to
sendrecv or sendonly without ever configuring the remote end of
the connection (half-open connection).

- reject sendrecv or sendonly on half open connections

See also TTCN3 Test:
MGCP_Test.TC_crcx_early_bidir_mode

Change-Id: I6ab01855d3b1faa36aebac357e7b97c563990678
Related: OS#2652
This commit is contained in:
Philipp Maier 2018-02-02 12:58:42 +01:00
parent b911b879d8
commit c3cc654add
1 changed files with 22 additions and 0 deletions

View File

@ -654,6 +654,17 @@ mgcp_header_done:
mgcp_rtp_end_config(endp, 0, &conn->end);
/* check connection mode setting */
if (conn->conn->mode != MGCP_CONN_LOOPBACK
&& conn->conn->mode != MGCP_CONN_RECV_ONLY
&& conn->end.rtp_port == 0) {
LOGP(DLMGCP, LOGL_ERROR,
"CRCX: endpoint:%x selected connection mode type requires an opposite end!\n",
ENDPOINT_NUMBER(endp));
error_code = 527;
goto error2;
}
if (allocate_port(endp, conn) != 0) {
goto error2;
}
@ -812,6 +823,17 @@ mgcp_header_done:
mgcp_set_audio_info(p->cfg, &conn->end.codec,
PTYPE_UNDEFINED, endp->local_options.codec);
/* check connection mode setting */
if (conn->conn->mode != MGCP_CONN_LOOPBACK
&& conn->conn->mode != MGCP_CONN_RECV_ONLY
&& conn->end.rtp_port == 0) {
LOGP(DLMGCP, LOGL_ERROR,
"MDCX: endpoint:%x selected connection mode type requires an opposite end!\n",
ENDPOINT_NUMBER(endp));
error_code = 527;
goto error3;
}
if (setup_rtp_processing(endp, conn) != 0)
goto error3;