[MERGED] osmo-mgw[master]: protocol: check requested connection mode

2018-02-05 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: protocol: check requested connection mode
..


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
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 22 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 23c0c25..bfb8768 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -654,6 +654,17 @@
 
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_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;
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6ab01855d3b1faa36aebac357e7b97c563990678
Gerrit-PatchSet: 3
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-mgw[master]: protocol: check requested connection mode

2018-02-03 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6ab01855d3b1faa36aebac357e7b97c563990678
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-mgw[master]: protocol: check requested connection mode

2018-02-02 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6258

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

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
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/58/6258/2

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 2977fdf..05aefc1 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -654,6 +654,17 @@
 
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_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;
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6ab01855d3b1faa36aebac357e7b97c563990678
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-mgw[master]: protocol: check requested connection mode

2018-02-02 Thread dexter

Review at  https://gerrit.osmocom.org/6258

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
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 22 insertions(+), 0 deletions(-)


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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 2977fdf..05aefc1 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -654,6 +654,17 @@
 
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_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;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ab01855d3b1faa36aebac357e7b97c563990678
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter