[PATCH] osmo-mgw[master]: cosmetic: move mgcp_release_endp() to mgcp_ep.c

2018-02-02 Thread dexter
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6008

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

cosmetic: move mgcp_release_endp() to mgcp_ep.c

- move mgcp_release_endp() to mgcp_ep.c since it is clearly
  an endpoint sicific function.

Change-Id: I0a65b6e906c52a9e7cd75c88c4cbe1bf473b866b
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/mgcp_ep.h
M src/libosmo-mgcp/mgcp_ep.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_vty.c
M src/osmo-mgw/mgw_main.c
6 files changed, 28 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/08/6008/4

diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h
index 0d156c6..bdc8f87 100644
--- a/include/osmocom/mgcp/mgcp.h
+++ b/include/osmocom/mgcp/mgcp.h
@@ -222,7 +222,6 @@
  enum mgcp_role role);
 int mgcp_vty_init(void);
 int mgcp_endpoints_allocate(struct mgcp_trunk_config *cfg);
-void mgcp_release_endp(struct mgcp_endpoint *endp);
 void mgcp_trunk_set_keepalive(struct mgcp_trunk_config *tcfg, int interval);
 
 /*
diff --git a/include/osmocom/mgcp/mgcp_ep.h b/include/osmocom/mgcp/mgcp_ep.h
index 74b3a9e..915f542 100644
--- a/include/osmocom/mgcp/mgcp_ep.h
+++ b/include/osmocom/mgcp/mgcp_ep.h
@@ -25,6 +25,7 @@
 
 struct sockaddr_in;
 struct mgcp_conn;
+struct mgcp_endpoint;
 
 /* Callback type for RTP dispatcher functions
(e.g mgcp_dispatch_rtp_bridge_cb, see below) */
@@ -48,3 +49,5 @@
 
 /*! static MGCP endpoint typeset (pre-initalized, read-only) */
 extern const struct mgcp_endpoint_typeset ep_typeset;
+
+void mgcp_release_endp(struct mgcp_endpoint *endp);
diff --git a/src/libosmo-mgcp/mgcp_ep.c b/src/libosmo-mgcp/mgcp_ep.c
index 72ca691..68e36da 100644
--- a/src/libosmo-mgcp/mgcp_ep.c
+++ b/src/libosmo-mgcp/mgcp_ep.c
@@ -30,3 +30,26 @@
.rtp.max_conns = 2,
.rtp.dispatch_rtp_cb = mgcp_dispatch_rtp_bridge_cb
 };
+
+/*! release endpoint, all open connections are closed.
+ *  \param[in] endp endpoint to release */
+void mgcp_release_endp(struct mgcp_endpoint *endp)
+{
+   LOGP(DLMGCP, LOGL_DEBUG, "Releasing endpoint:0x%x\n",
+ENDPOINT_NUMBER(endp));
+
+   /* Normally this function should only be called when
+* all connections have been removed already. In case
+* that there are still connections open (e.g. when
+* RSIP is executed), free them all at once. */
+   mgcp_conn_free_all(endp);
+
+   /* Reset endpoint parameters and states */
+   talloc_free(endp->callid);
+   endp->callid = NULL;
+   talloc_free(endp->local_options.string);
+   endp->local_options.string = NULL;
+   talloc_free(endp->local_options.codec);
+   endp->local_options.codec = NULL;
+   endp->wildcarded_crcx = false;
+}
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 3f1594f..9fe30f8 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -1236,29 +1236,6 @@
return 0;
 }
 
-/*! release endpoint, all open connections are closed.
- *  \param[in] endp endpoint to release */
-void mgcp_release_endp(struct mgcp_endpoint *endp)
-{
-   LOGP(DLMGCP, LOGL_DEBUG, "Releasing endpoint:0x%x\n",
-ENDPOINT_NUMBER(endp));
-
-   /* Normally this function should only be called when
-* all connections have been removed already. In case
-* that there are still connections open (e.g. when
-* RSIP is executed), free them all at once. */
-   mgcp_conn_free_all(endp);
-
-   /* Reset endpoint parameters and states */
-   talloc_free(endp->callid);
-   endp->callid = NULL;
-   talloc_free(endp->local_options.string);
-   endp->local_options.string = NULL;
-   talloc_free(endp->local_options.codec);
-   endp->local_options.codec = NULL;
-   endp->wildcarded_crcx = false;
-}
-
 static int send_agent(struct mgcp_config *cfg, const char *buf, int len)
 {
return write(cfg->gw_fd.bfd.fd, buf, len);
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 7043527..99780c8 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
diff --git a/src/osmo-mgw/mgw_main.c b/src/osmo-mgw/mgw_main.c
index a2714e0..8e956e4 100644
--- a/src/osmo-mgw/mgw_main.c
+++ b/src/osmo-mgw/mgw_main.c
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I0a65b6e906c52a9e7cd75c88c4cbe1bf473b866b
Gerrit-PatchSet: 4
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-mgw[master]: protocol: reject DLCX/CRCX/MDCX on unsupported parameters

2018-02-02 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6255

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

protocol: reject DLCX/CRCX/MDCX on unsupported parameters

When an unsupported MGCP parameter (e.g. N) is used, then this
parameter is ignored and the command execution continues. However,
an MGCP command that contains an unsupported parameter should
be rejected.

- Make sure that MGCP commands DLCX, CRCX and MDCX are rejected,
  when they contain unsupported parameters.

Change-Id: I8cd5987fc6befcd53a7c4916f77b1a24c904ba48
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index b0d9943..7fed8c3 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -535,6 +535,7 @@
LOGP(DLMGCP, LOGL_NOTICE,
 "CRCX: endpoint:%x unhandled option: '%c'/%d\n",
 ENDPOINT_NUMBER(endp), *line, *line);
+   return create_err_response(NULL, 539, "CRCX", p->trans);
break;
}
}
@@ -768,6 +769,7 @@
LOGP(DLMGCP, LOGL_NOTICE,
 "MDCX: endpoint:0x%x Unhandled MGCP option: 
'%c'/%d\n",
 ENDPOINT_NUMBER(endp), line[0], line[0]);
+   return create_err_response(NULL, 539, "CRCX", p->trans);
break;
}
}
@@ -918,6 +920,7 @@
LOGP(DLMGCP, LOGL_NOTICE,
 "DLCX: endpoint:0x%x Unhandled MGCP option: 
'%c'/%d\n",
 ENDPOINT_NUMBER(endp), line[0], line[0]);
+   return create_err_response(NULL, 539, "CRCX", p->trans);
break;
}
}

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

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


[PATCH] osmo-mgw[master]: protocol: fix tagging of wildcarded requests

2018-02-02 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6259

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

protocol: fix tagging of wildcarded requests

When a wildcarded CRCX is done flag "wildcarded_crcx" is set in the
endpoint struct. The flag tells other part of the code whether the
request was wildcarded or not since in some cases the behaviour
might be different for wildcarded requests. The implementation of
this mechanism is not entirely correct. The flag is set on wildcarded
requests but on non wildcarded requests it is not reset. Also the
name is misleading.

- rename wildcarded_crcx to wildcarded_req

- ensure the flag is refreshed with every new request

Change-Id: Ia5063ec65f5bc3a8a0943d1fd823aaeee20b8637
---
M include/osmocom/mgcp/mgcp_endp.h
M src/libosmo-mgcp/mgcp_endp.c
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_protocol.c
4 files changed, 18 insertions(+), 9 deletions(-)


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

diff --git a/include/osmocom/mgcp/mgcp_endp.h b/include/osmocom/mgcp/mgcp_endp.h
index c0fd9ff..a486dcd 100644
--- a/include/osmocom/mgcp/mgcp_endp.h
+++ b/include/osmocom/mgcp/mgcp_endp.h
@@ -89,7 +89,7 @@
 
/*!< Memorize if this endpoint was choosen by the MGW (wildcarded, true)
 *   or if the user has choosen the particular endpoint explicitly. */
-   bool wildcarded_crcx;
+   bool wildcarded_req;
 };
 
 /*! Extract endpoint number for a given endpoint */
diff --git a/src/libosmo-mgcp/mgcp_endp.c b/src/libosmo-mgcp/mgcp_endp.c
index 581c12c..fa2dd28 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -52,5 +52,5 @@
endp->local_options.string = NULL;
talloc_free(endp->local_options.codec);
endp->local_options.codec = NULL;
-   endp->wildcarded_crcx = false;
+   endp->wildcarded_req = false;
 }
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index 89046c0..8d22cc5 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -143,6 +143,7 @@
char *rest = NULL;
struct mgcp_trunk_config *tcfg;
int trunk, endp;
+   struct mgcp_endpoint *endp_ptr;
 
trunk = strtoul(mgcp + 6, , 10);
if (rest == NULL || rest[0] != '/' || trunk < 1) {
@@ -179,7 +180,9 @@
return NULL;
}
 
-   return >endpoints[endp];
+   endp_ptr = >endpoints[endp];
+   endp_ptr->wildcarded_req = false;
+   return endp_ptr;
 }
 
 /* Find an endpoint that is not in use. Do this by going through the endpoint
@@ -197,7 +200,7 @@
LOGP(DLMGCP, LOGL_DEBUG,
 "endpoint:0x%x found free endpoint\n",
 ENDPOINT_NUMBER(endp));
-   endp->wildcarded_crcx = true;
+   endp->wildcarded_req = true;
return endp;
}
}
@@ -263,8 +266,11 @@
return endp;
}
gw = strtoul(endpoint_number_str, , 16);
-   if (gw < cfg->trunk.number_endpoints && endptr[0] == '@')
-   return >trunk.endpoints[gw];
+   if (gw < cfg->trunk.number_endpoints && endptr[0] == '@') {
+   endp = >trunk.endpoints[gw];
+   endp->wildcarded_req = false;
+   return endp;
+   }
}
 
/* Deprecated method without prefix */
@@ -272,8 +278,11 @@
 "Addressing virtual trunk without prefix (deprecated), please use 
%s: '%s'\n",
 MGCP_ENDPOINT_PREFIX_VIRTUAL_TRUNK, mgcp);
gw = strtoul(mgcp, , 16);
-   if (gw < cfg->trunk.number_endpoints && endptr[0] == '@')
-   return >trunk.endpoints[gw];
+   if (gw < cfg->trunk.number_endpoints && endptr[0] == '@') {
+   endp = >trunk.endpoints[gw];
+   endp->wildcarded_req = false;
+   return endp;
+   }
 
LOGP(DLMGCP, LOGL_ERROR, "Not able to find the endpoint: '%s'\n", mgcp);
*cause = -500;
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 05aefc1..337aa9b 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -199,7 +199,7 @@
int rc;
 
/* NOTE: Only in the virtual trunk we allow dynamic endpoint names */
-   if (endp->wildcarded_crcx
+   if (endp->wildcarded_req
&& endp->tcfg->trunk_type == MGCP_TRUNK_VIRTUAL) {
rc = msgb_printf(msg, "Z: %s%x@%s\r\n",
 MGCP_ENDPOINT_PREFIX_VIRTUAL_TRUNK,

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia5063ec65f5bc3a8a0943d1fd823aaeee20b8637
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master

[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, >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, >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 


[PATCH] osmo-mgw[master]: protocol: prohibit wildcarded requests for MDCX and DLCX

2018-02-02 Thread dexter

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

protocol: prohibit wildcarded requests for MDCX and DLCX

When a wildcarded request is made with a DLCX or MDCX command
the MGW will search for a free endpoint and continues the command
execution with that endpoint.

- Catch the wildcarded request early on DLCX and MDCX and return
  with an error code.

See also TTCN3 testcases:
MGCP_Test.TC_mdcx_wildcarded
MGCP_Test.TC_dlcx_wildcarded

Change-Id: Ia77d44a6a86083e62338e5845b553e5cf13ebd10
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 16 insertions(+), 0 deletions(-)


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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 337aa9b..5fbea10 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -739,6 +739,14 @@
 
LOGP(DLMGCP, LOGL_NOTICE, "MDCX: modifying existing connection ...\n");
 
+   /* Prohibit wildcarded requests */
+   if (endp->wildcarded_req) {
+   LOGP(DLMGCP, LOGL_ERROR,
+"DLCX: endpoint:0x%x wildcarded endpoint names not 
supported.\n",
+ENDPOINT_NUMBER(endp));
+   return create_err_response(endp, 507, "DLCX", p->trans);
+   }
+
if (llist_count(>conns) <= 0) {
LOGP(DLMGCP, LOGL_ERROR,
 "MDCX: endpoint:0x%x endpoint is not holding a 
connection.\n",
@@ -912,6 +920,14 @@
 "DLCX: endpoint:0x%x deleting connection ...\n",
 ENDPOINT_NUMBER(endp));
 
+   /* Prohibit wildcarded requests */
+   if (endp->wildcarded_req) {
+   LOGP(DLMGCP, LOGL_ERROR,
+"DLCX: endpoint:0x%x wildcarded endpoint names not 
supported.\n",
+ENDPOINT_NUMBER(endp));
+   return create_err_response(endp, 507, "DLCX", p->trans);
+   }
+
if (llist_count(>conns) <= 0) {
LOGP(DLMGCP, LOGL_ERROR,
 "DLCX: endpoint:0x%x endpoint is not holding a 
connection.\n",

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

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


[PATCH] osmo-ttcn3-hacks[master]: MCGP_Test: Add tests for wildcarded CRCX

2018-02-02 Thread dexter

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

MCGP_Test: Add tests for wildcarded CRCX

The wildcarded CRCX is not tested yet.

- Add a test function that executes a single wildcarded CRCX
  request

- Add a test function that exchausts all MGW resources using
  wildcarded CRCX requests

Change-Id: I70cf486dc21aef19e4199289f5a5509f6927713e
---
M mgw/MGCP_Test.cfg
M mgw/MGCP_Test.ttcn
2 files changed, 72 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/62/6262/1

diff --git a/mgw/MGCP_Test.cfg b/mgw/MGCP_Test.cfg
index af59a7c..6eeb9c2 100644
--- a/mgw/MGCP_Test.cfg
+++ b/mgw/MGCP_Test.cfg
@@ -26,6 +26,8 @@
 MGCP_Test.TC_crcx_missing_mode
 MGCP_Test.TC_crcx_unsupp_packet_intv
 MGCP_Test.TC_crcx_sdp
+MGCP_Test.TC_crcx_wildcarded
+MGCP_Test.TC_crcx_wildcarded_exhaust
 MGCP_Test.TC_mdcx_without_crcx
 MGCP_Test.TC_dlcx_without_crcx
 MGCP_Test.TC_crcx_and_dlcx_ep_callid_connid
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index bc3f72e..9cd 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -391,6 +391,74 @@
setverdict(pass);
}
 
+   /* test valid wildcarded CRCX */
+   testcase TC_crcx_wildcarded() runs on dummy_CT {
+   var template MgcpCommand cmd;
+   var MgcpResponse resp;
+   var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain;
+   var MgcpCallId call_id := '1234'H;
+   var MgcpEndpoint ep_assigned;
+   f_init();
+
+   /* create the connection on the MGW */
+   cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id);
+   resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK);
+   extract_conn_id(resp);
+
+   /* extract endpoint name we got assigned by the MGW */
+   var MgcpMessage resp_msg := {
+   response := resp
+   }
+   if (f_mgcp_find_param(resp_msg, "Z", ep_assigned) == false) {
+   setverdict(fail, "No SpecificEndpointName in MGCP 
response", resp);
+   }
+
+   /* clean-up */
+   f_dlcx_ok(ep_assigned, call_id);
+
+   setverdict(pass);
+   }
+
+   /* test valid wildcarded CRCX */
+   testcase TC_crcx_wildcarded_exhaust() runs on dummy_CT {
+   const integer n_endpoints := 32;
+   var integer i;
+   var template MgcpCommand cmd;
+   var MgcpResponse resp;
+   var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain;
+   var MgcpCallId call_id := '1234'H;
+   var MgcpEndpoint ep_assigned[n_endpoints];
+   f_init();
+
+   /* Exhaust all endpoint resources on the virtual trunk */
+   for (i := 0; i < n_endpoints; i := i+1) {
+   cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", 
call_id);
+   resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK);
+
+   /* Make sure we got a connection id */
+   extract_conn_id(resp);
+
+   var MgcpMessage resp_msg := {
+   response := resp
+   }
+   if (f_mgcp_find_param(resp_msg, "Z", ep_assigned[i]) == 
false) {
+   setverdict(fail, "No SpecificEndpointName in 
MGCP response", resp);
+   }
+   }
+
+   /* Try to allocate one more endpoint, which should fail */
+   cmd := ts_CRCX(get_next_trans_id(), ep, "recvonly", call_id);
+   var template MgcpResponse rtmpl := tr_MgcpResp_Err("403");
+   resp := mgcp_transceive_mgw(cmd, rtmpl);
+   setverdict(pass);
+
+   /* clean-up */
+   for (i := 0; i < n_endpoints; i := i+1) {
+   f_dlcx_ok(ep_assigned[i], call_id);
+   }
+   setverdict(pass);
+   }
+
/* TODO: various SDP related bits */
 
 
@@ -612,6 +680,8 @@
execute(TC_crcx_unsupp_packet_intv());
execute(TC_crcx_illegal_double_lco());
execute(TC_crcx_sdp());
+   execute(TC_crcx_wildcarded());
+   execute(TC_crcx_wildcarded_exhaust());
execute(TC_mdcx_without_crcx());
execute(TC_dlcx_without_crcx());
execute(TC_crcx_and_dlcx_ep_callid_connid());

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I70cf486dc21aef19e4199289f5a5509f6927713e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] osmo-ttcn3-hacks[master]: mgw: add constants for mgw endpoint and domain name

2018-02-02 Thread dexter

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

mgw: add constants for mgw endpoint and domain name

The testcase for osmo-mgw hardcodes the mgw domain and also lacks
an endpoint identifier, which was deprecated recently.

- replace the hardcoded occurrences of the mgw domain name with
  a constant

- add a constant for the rtpbridge endpoint identifier

- add a testcase that still uses the old method without prefix
  on the endpoint identifier.

Change-Id: If4455c4cb521270b2fe24881ade9b578a5132205
---
M mgw/MGCP_Test.cfg
M mgw/MGCP_Test.ttcn
2 files changed, 38 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/61/6261/1

diff --git a/mgw/MGCP_Test.cfg b/mgw/MGCP_Test.cfg
index 00e3d7c..af59a7c 100644
--- a/mgw/MGCP_Test.cfg
+++ b/mgw/MGCP_Test.cfg
@@ -18,6 +18,7 @@
 [EXECUTE]
 #MGCP_Test.TC_selftest
 MGCP_Test.TC_crcx
+MGCP_Test.TC_crcx_noprefix
 MGCP_Test.TC_crcx_unsupp_mode
 MGCP_Test.TC_crcx_early_bidir_mode
 MGCP_Test.TC_crcx_unsupp_param
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 516944a..bc3f72e 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -10,6 +10,9 @@
import from RTP_Endpoint all;
import from IPL4asp_Types all;
 
+   const charstring c_mgw_domain := "mgw";
+   const charstring c_mgw_ep_rtpbridge := "rtpbridge/";
+
/* any variables declared in the component will be available to
 * all functions that 'run on' the named component, similar to
 * class members in C++ */
@@ -75,7 +78,7 @@
 
testcase TC_selftest() runs on dummy_CT {
const charstring c_auep := "AUEP 158663169 
ds/e1-1/2@172.16.6.66 MGCP 1.0\r\n";
-   const charstring c_mdcx3 := "MDCX 18983215 1@mgw MGCP 1.0\r\n";
+   const charstring c_mdcx3 := "MDCX 18983215 " & 
c_mgw_ep_rtpbridge & "1@" & c_mgw_domain & " MGCP 1.0\r\n";
const charstring c_mdcx3_ret := "200 18983215 OK\r\n" &
"I: 1\n" &
"\n" &
@@ -87,7 +90,7 @@
"m=audio 0 RTP/AVP 126\r\n" &
"a=rtpmap:126 AMR/8000\r\n" &
"a=ptime:20\r\n";
-   const charstring c_mdcx4 := "MDCX 18983216 1@mgw MGCP 
1.0\r\n" &
+   const charstring c_mdcx4 := "MDCX 18983216 " & 
c_mgw_ep_rtpbridge & "1@" & c_mgw_domain & " MGCP 1.0\r\n" &
"M: sendrecv\r" &
"C: 2\r\n" &
"I: 1\r\n" &
@@ -115,8 +118,8 @@
log(c_mdcx4);
log(dec_MgcpCommand(c_mdcx4));
 
-   log(ts_CRCX("23", "42@mgw", "sendrecv", '1234'H));
-   log(enc_MgcpCommand(valueof(ts_CRCX("23", "42@mgw", "sendrecv", 
'1234'H;
+   log(ts_CRCX("23", c_mgw_ep_rtpbridge & "42@" & c_mgw_domain, 
"sendrecv", '1234'H));
+   log(enc_MgcpCommand(valueof(ts_CRCX("23", c_mgw_ep_rtpbridge & 
"42@" & c_mgw_domain, "sendrecv", '1234'H;
 
log(c_crcx510_ret);
log(dec_MgcpResponse(c_crcx510_ret));
@@ -221,11 +224,10 @@
f_dlcx(ep, ?, *, call_id, conn_id);
}
 
-   /* test valid CRCX without SDP */
-   testcase TC_crcx() runs on dummy_CT {
+   function f_crcx(charstring ep_prefix) runs on dummy_CT {
+   var MgcpEndpoint ep := ep_prefix & "2@" & c_mgw_domain;
var template MgcpCommand cmd;
var MgcpResponse resp;
-   var MgcpEndpoint ep := "2@mgw";
var MgcpCallId call_id := '1234'H;
 
f_init(ep);
@@ -237,7 +239,17 @@
 
/* clean-up */
f_dlcx_ok(ep, call_id);
+   }
 
+   /* test valid CRCX without SDP */
+   testcase TC_crcx() runs on dummy_CT {
+   f_crcx(c_mgw_ep_rtpbridge);
+   setverdict(pass);
+   }
+
+   /* test valid CRCX without SDP (older method without endpoint prefix) */
+   testcase TC_crcx_noprefix() runs on dummy_CT {
+   f_crcx("");
setverdict(pass);
}
 
@@ -245,7 +257,7 @@
testcase TC_crcx_unsupp_mode() runs on dummy_CT {
var template MgcpCommand cmd;
var MgcpResponse resp;
-   var MgcpEndpoint ep := "2@mgw";
+   var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "2@" & c_mgw_domain;
var MgcpCallId call_id := '1233'H;
var template MgcpResponse rtmpl := tr_MgcpResp_Err("517");
 
@@ -262,7 +274,7 @@
testcase TC_crcx_early_bidir_mode() runs on dummy_CT {
var template MgcpCommand cmd;
var MgcpResponse resp;
-   var MgcpEndpoint ep := "2@mgw";
+   var MgcpEndpoint 

[PATCH] osmo-ttcn3-hacks[master]: MGCP_Test: Clean up after TC_crcx_sdp

2018-02-02 Thread dexter

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

MGCP_Test: Clean up after TC_crcx_sdp

The testcase TC_crcx_sdp does not clean up the connection it
created. This can cause subsequent tests to fail.

- Use f_dlcx_ok() to clean up the connection once the test
  is done.

Change-Id: I4e0f5ce218fadc5debe0bbf548b69919584ab66c
---
M mgw/MGCP_Test.ttcn
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/63/6263/1

diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 9cd..6c47e27 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -388,6 +388,10 @@
  { valueof(ts_SDP_rtpmap(98, "AMR/8000")),
valueof(ts_SDP_ptime(20)) });
resp := mgcp_transceive_mgw(cmd, tr_CRCX_ACK);
+
+   /* clean-up */
+   f_dlcx_ok(ep, call_id);
+
setverdict(pass);
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e0f5ce218fadc5debe0bbf548b69919584ab66c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] osmo-ttcn3-hacks[master]: MGCP_Test: test illegal wildcarded DLCX and MDCX

2018-02-02 Thread dexter

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

MGCP_Test: test illegal wildcarded DLCX and MDCX

- Add tests to check the behaviour on wildcarded DLCX and MDCX,
  both commands not supported by the MGW and should fail.

Change-Id: I140c6d9e337cd16d6147bb582a9474cf76b5170b
---
M mgw/MGCP_Test.cfg
M mgw/MGCP_Test.ttcn
2 files changed, 56 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/64/6264/1

diff --git a/mgw/MGCP_Test.cfg b/mgw/MGCP_Test.cfg
index 6eeb9c2..da45761 100644
--- a/mgw/MGCP_Test.cfg
+++ b/mgw/MGCP_Test.cfg
@@ -30,6 +30,8 @@
 MGCP_Test.TC_crcx_wildcarded_exhaust
 MGCP_Test.TC_mdcx_without_crcx
 MGCP_Test.TC_dlcx_without_crcx
+MGCP_Test.TC_mdcx_wildcarded
+MGCP_Test.TC_dlcx_wildcarded
 MGCP_Test.TC_crcx_and_dlcx_ep_callid_connid
 MGCP_Test.TC_crcx_and_dlcx_ep_callid
 MGCP_Test.TC_crcx_and_dlcx_ep
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 6c47e27..9632e79 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -518,6 +518,58 @@
setverdict(pass);
}
 
+   /* test valid wildcarded MDCX */
+   testcase TC_mdcx_wildcarded() runs on dummy_CT {
+/* Note: A wildcarded MDCX is not allowed, so we expect the
+ * MGW to reject this request */
+   var template MgcpCommand cmd;
+   var MgcpResponse resp;
+   var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain;
+   var MgcpCallId call_id := '1225'H;
+   var template MgcpResponse rtmpl := {
+   line := {
+   /* TODO: accept/enforce better error? */
+   code := "507",
+   string := ?
+   },
+   params:= { },
+   sdp := omit
+   };
+
+   f_init(ep);
+
+   cmd := ts_MDCX(get_next_trans_id(), ep, "sendrecv", call_id, 
call_id);
+   cmd.sdp := ts_SDP("127.0.0.1", "127.0.0.2", "23", "42", 2344, { 
"98" },
+ { valueof(ts_SDP_rtpmap(98, "AMR/8000")),
+   valueof(ts_SDP_ptime(20)) });
+   resp := mgcp_transceive_mgw(cmd, rtmpl);
+   setverdict(pass);
+   }
+
+   /* test valid wildcarded DLCX */
+   testcase TC_dlcx_wildcarded() runs on dummy_CT {
+/* Note: A wildcarded DLCX is specified, but our MGW does not
+ * support this feature so we expect the MGW to reject the
+ * request */
+   var template MgcpCommand cmd;
+   var MgcpResponse resp;
+   var MgcpEndpoint ep := c_mgw_ep_rtpbridge & "*@" & c_mgw_domain;
+   var template MgcpResponse rtmpl := {
+   line := {
+   code := "507",
+   string := ?
+   },
+   params:= { },
+   sdp := omit
+   };
+
+   f_init(ep);
+
+   cmd := ts_DLCX(get_next_trans_id(), ep, '41234'H);
+   resp := mgcp_transceive_mgw(cmd, rtmpl);
+   setverdict(pass);
+   }
+
/* Test (valid) CRCX followed by (valid) DLCX containig 
EP+CallId+ConnId */
testcase TC_crcx_and_dlcx_ep_callid_connid() runs on dummy_CT {
var template MgcpCommand cmd;
@@ -688,6 +740,8 @@
execute(TC_crcx_wildcarded_exhaust());
execute(TC_mdcx_without_crcx());
execute(TC_dlcx_without_crcx());
+   execute(TC_mdcx_wildcarded());
+   execute(TC_dlcx_wildcarded());
execute(TC_crcx_and_dlcx_ep_callid_connid());
execute(TC_crcx_and_dlcx_ep_callid());
execute(TC_crcx_and_dlcx_ep());

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I140c6d9e337cd16d6147bb582a9474cf76b5170b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] osmo-mgw[master]: protocol: exit cleanly when local cx options check fails

2018-02-02 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6256

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

protocol: exit cleanly when local cx options check fails

When set_local_cx_options() returns an error code the MGCP command
execution is aborted and and the error code is returned, but on
CRCX the already seized eindpoint is not released.

- Do not generate the error response on the spot, jump to the
  respective label and let the already existing error handling
  do its work.

This patch is a follow-up page to:
Change-Id I02aaa3042f2a0e32eb4ec6b8753deab7082947a0

Change-Id: Iaef4ea6c6a2f24ac8b276966bda72d0b30f25cd5
Related: OS#2654
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 7fed8c3..2977fdf 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -604,7 +604,8 @@
LOGP(DLMGCP, LOGL_ERROR,
 "CRCX: endpoint:%x inavlid local connection options!\n",
 ENDPOINT_NUMBER(endp));
-   return create_err_response(endp, rc, "CRCX", p->trans);
+   error_code = rc;
+   goto error2;
}
 
snprintf(conn_name, sizeof(conn_name), "%s", callid);
@@ -803,7 +804,8 @@
LOGP(DLMGCP, LOGL_ERROR,
 "MDCX: endpoint:%x inavlid local connection options!\n",
 ENDPOINT_NUMBER(endp));
-   return create_err_response(endp, rc, "MDCX", p->trans);
+   error_code = rc;
+   goto error3;
}
 
if (!have_sdp && endp->local_options.codec)

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iaef4ea6c6a2f24ac8b276966bda72d0b30f25cd5
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
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, >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, >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]: cosmetic: rename mgcp_ep.c/h to mgcp_endp.c/h

2018-02-02 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6246

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

cosmetic: rename mgcp_ep.c/h to mgcp_endp.c/h

The short term of endpoint has always been "endp" througout the whole
project and not "ep".

- rename mcgp_ep.c to mgcp_endp.c

- rename mgcp_ep.h to mgcp_endp.h

Change-Id: Id52047bb2d0407655ac272c858ed3412b8ae9e6d
---
M include/osmocom/mgcp/Makefile.am
R include/osmocom/mgcp/mgcp_endp.h
M src/libosmo-mgcp/Makefile.am
M src/libosmo-mgcp/mgcp_conn.c
R src/libosmo-mgcp/mgcp_endp.c
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_network.c
M src/libosmo-mgcp/mgcp_osmux.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_sdp.c
M src/libosmo-mgcp/mgcp_vty.c
M src/osmo-mgw/mgw_main.c
M tests/mgcp/mgcp_test.c
13 files changed, 12 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/46/6246/3

diff --git a/include/osmocom/mgcp/Makefile.am b/include/osmocom/mgcp/Makefile.am
index d706807..7e297e4 100644
--- a/include/osmocom/mgcp/Makefile.am
+++ b/include/osmocom/mgcp/Makefile.am
@@ -3,7 +3,7 @@
mgcp_msg.h \
mgcp_conn.h \
mgcp_stat.h \
-   mgcp_ep.h \
+   mgcp_endp.h \
mgcp_sdp.h \
debug.h \
$(NULL)
diff --git a/include/osmocom/mgcp/mgcp_ep.h b/include/osmocom/mgcp/mgcp_endp.h
similarity index 100%
rename from include/osmocom/mgcp/mgcp_ep.h
rename to include/osmocom/mgcp/mgcp_endp.h
diff --git a/src/libosmo-mgcp/Makefile.am b/src/libosmo-mgcp/Makefile.am
index a785d62..fbb1a2e 100644
--- a/src/libosmo-mgcp/Makefile.am
+++ b/src/libosmo-mgcp/Makefile.am
@@ -42,7 +42,7 @@
mgcp_msg.c \
mgcp_conn.c \
mgcp_stat.c \
-   mgcp_ep.c \
+   mgcp_endp.c \
$(NULL)
 
 libosmo_mgcp_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(MGCP_LIBVERSION)
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 33c4165..62cbdba 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
diff --git a/src/libosmo-mgcp/mgcp_ep.c b/src/libosmo-mgcp/mgcp_endp.c
similarity index 97%
rename from src/libosmo-mgcp/mgcp_ep.c
rename to src/libosmo-mgcp/mgcp_endp.c
index efa15a0..581c12c 100644
--- a/src/libosmo-mgcp/mgcp_ep.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -22,7 +22,7 @@
  */
 
 #include 
-#include 
+#include 
 
 /* Endpoint typeset definition */
 const struct mgcp_endpoint_typeset ep_typeset = {
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index 034b64f..f533d55 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -28,7 +28,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 /*! Display an mgcp message on the log output.
  *  \param[in] message mgcp message string
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 4e22e63..6923b97 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -39,7 +39,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #define RTP_SEQ_MOD(1 << 16)
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 1bb7aa6..1d3cab3 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 static struct osmo_fd osmux_fd;
 
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index c6beaa4..b0d9943 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -38,7 +38,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 struct mgcp_request {
diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index 1dffbfc..52b4df4 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 5378931..14ecd17 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -27,7 +27,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
diff --git a/src/osmo-mgw/mgw_main.c b/src/osmo-mgw/mgw_main.c
index 4452ae3..f95a1c7 100644
--- a/src/osmo-mgw/mgw_main.c
+++ b/src/osmo-mgw/mgw_main.c
@@ -37,7 +37,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 4d39bda..38a0a46 100644
--- a/tests/mgcp/mgcp_test.c
+++ b/tests/mgcp/mgcp_test.c
@@ -25,7 +25,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: 

[PATCH] osmo-mgw[master]: mgcp: fix use-after-free and add callback for endpoint cleanup

2018-02-02 Thread dexter
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6006

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

mgcp: fix use-after-free and add callback for endpoint cleanup

Since we will support multiple different types of endpoints in the
future, all these endpoints will handle connections slightly different
and there will be possibly state that needs to be kept consistant
when a connection is deleted.

In mgcp_network.c where we implement the callback that is used to
create an rtp-bride-endpoint. In that callback we cache the pointer
of the connection we where we want to bride to (opposite connection).
When one of the connections is deleted using a DLCX operation, the
pointer is still there and the next incoming packet causes a use-
after-free segfault.

- introduce an endpoint specific callback function that is executed
  before removing the connection.

- implement the endpoint specific callback for rtp bridge endpoints,
  so that the use-after-free is prevented.

Change-Id: I921d9bbe58be1c3298e164a37f3c974880b3759f
---
M include/osmocom/mgcp/mgcp_ep.h
M include/osmocom/mgcp/mgcp_internal.h
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_ep.c
M src/libosmo-mgcp/mgcp_network.c
5 files changed, 38 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/06/6006/5

diff --git a/include/osmocom/mgcp/mgcp_ep.h b/include/osmocom/mgcp/mgcp_ep.h
index 915f542..7b4ccee 100644
--- a/include/osmocom/mgcp/mgcp_ep.h
+++ b/include/osmocom/mgcp/mgcp_ep.h
@@ -33,6 +33,13 @@
 char *buf, unsigned int buf_size,
 struct mgcp_conn *conn);
 
+/* Callback type for endpoint specific cleanup actions. This function
+ * is automatically executed when a connection is freed (see mgcp_conn_free()
+ * in mgcp_conn.c). Depending on the type of the endpoint there may be endpoint
+ * specific things to take care of once a connection has been removed. */
+typedef void (*mgcp_cleanup_cp) (struct mgcp_endpoint *endp,
+struct mgcp_conn *conn);
+
 /*! MGCP endpoint properties */
 struct mgcp_endpoint_type {
/*!< maximum number of connections */
@@ -40,6 +47,9 @@
 
/*!< callback that defines how to dispatch incoming RTP data */
mgcp_dispatch_rtp_cb dispatch_rtp_cb;
+
+   /*!< callback that implements endpoint specific cleanup actions */
+   mgcp_cleanup_cp cleanup_cb;
 };
 
 /*! MGCP endpoint typeset */
diff --git a/include/osmocom/mgcp/mgcp_internal.h 
b/include/osmocom/mgcp/mgcp_internal.h
index c0ee556..5de28ee 100644
--- a/include/osmocom/mgcp/mgcp_internal.h
+++ b/include/osmocom/mgcp/mgcp_internal.h
@@ -285,6 +285,7 @@
 int mgcp_send_dummy(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn);
 int mgcp_dispatch_rtp_bridge_cb(int proto, struct sockaddr_in *addr, char *buf,
unsigned int buf_size, struct mgcp_conn *conn);
+void mgcp_cleanup_rtp_bridge_cb(struct mgcp_endpoint *endp, struct mgcp_conn 
*conn);
 int mgcp_bind_net_rtp_port(struct mgcp_endpoint *endp, int rtp_port,
   struct mgcp_conn_rtp *conn);
 void mgcp_free_rtp_port(struct mgcp_rtp_end *end);
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index a136fda..33c4165 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -201,6 +201,12 @@
if (!conn)
return;
 
+   /* Run endpoint cleanup action. By this we inform the endpoint about
+* the removal of the connection and allow it to clean up its inner
+* state accordingly */
+   if (endp->type->cleanup_cb)
+   endp->type->cleanup_cb(endp, conn);
+
switch (conn->type) {
case MGCP_CONN_TYPE_RTP:
osmux_disable_conn(>u.rtp);
diff --git a/src/libosmo-mgcp/mgcp_ep.c b/src/libosmo-mgcp/mgcp_ep.c
index 68e36da..e23d0f1 100644
--- a/src/libosmo-mgcp/mgcp_ep.c
+++ b/src/libosmo-mgcp/mgcp_ep.c
@@ -28,7 +28,8 @@
 const struct mgcp_endpoint_typeset ep_typeset = {
/* Specify endpoint properties for RTP endpoint */
.rtp.max_conns = 2,
-   .rtp.dispatch_rtp_cb = mgcp_dispatch_rtp_bridge_cb
+   .rtp.dispatch_rtp_cb = mgcp_dispatch_rtp_bridge_cb,
+   .rtp.cleanup_cb = mgcp_cleanup_rtp_bridge_cb
 };
 
 /*! release endpoint, all open connections are closed.
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 6cecbb0..4e22e63 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1043,6 +1043,25 @@
 
 }
 
+/*! cleanup an endpoint when a connection on an RTP bridge endpoint is removed.
+ *  \param[in] endp Endpoint on which the connection resides.
+ *  \param[in] conn Connection that is about to be removed (ignored).
+ *  \returns 0 on success, -1 on ERROR. */
+void mgcp_cleanup_rtp_bridge_cb(struct mgcp_endpoint *endp, struct 

[PATCH] osmo-mgw[master]: cosmetic: rename mgcp_release_endp to mgcp_endp_release

2018-02-02 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6245

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

cosmetic: rename mgcp_release_endp to mgcp_endp_release

In order to allow clean prefixes for future endpoint related
functions the "rlease" should be moved to the end of the
function name.

- rename mgcp_release_endp to mgcp_endp_release

Change-Id: I22e938e702f57ad76d38c9f4a1370b110ac1ba11
---
M include/osmocom/mgcp/mgcp_ep.h
M src/libosmo-mgcp/mgcp_ep.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_vty.c
M src/osmo-mgw/mgw_main.c
M tests/mgcp/mgcp_test.c
6 files changed, 13 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/45/6245/3

diff --git a/include/osmocom/mgcp/mgcp_ep.h b/include/osmocom/mgcp/mgcp_ep.h
index 2b7a5d6..c0fd9ff 100644
--- a/include/osmocom/mgcp/mgcp_ep.h
+++ b/include/osmocom/mgcp/mgcp_ep.h
@@ -95,4 +95,5 @@
 /*! Extract endpoint number for a given endpoint */
 #define ENDPOINT_NUMBER(endp) abs((int)(endp - endp->tcfg->endpoints))
 
-void mgcp_release_endp(struct mgcp_endpoint *endp);
+void mgcp_endp_release(struct mgcp_endpoint *endp);
+
diff --git a/src/libosmo-mgcp/mgcp_ep.c b/src/libosmo-mgcp/mgcp_ep.c
index c2bf78e..efa15a0 100644
--- a/src/libosmo-mgcp/mgcp_ep.c
+++ b/src/libosmo-mgcp/mgcp_ep.c
@@ -34,7 +34,7 @@
 
 /*! release endpoint, all open connections are closed.
  *  \param[in] endp endpoint to release */
-void mgcp_release_endp(struct mgcp_endpoint *endp)
+void mgcp_endp_release(struct mgcp_endpoint *endp)
 {
LOGP(DLMGCP, LOGL_DEBUG, "Releasing endpoint:0x%x\n",
 ENDPOINT_NUMBER(endp));
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 9fe30f8..c6beaa4 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -583,7 +583,7 @@
if (tcfg->force_realloc)
/* This is not our call, toss everything by releasing
 * the entire endpoint. (rude!) */
-   mgcp_release_endp(endp);
+   mgcp_endp_release(endp);
else {
/* This is not our call, leave everything as it is and
 * return with an error. */
@@ -673,7 +673,7 @@
LOGP(DLMGCP, LOGL_NOTICE,
 "CRCX: endpoint:0x%x CRCX rejected by policy\n",
 ENDPOINT_NUMBER(endp));
-   mgcp_release_endp(endp);
+   mgcp_endp_release(endp);
return create_err_response(endp, 400, "CRCX", p->trans);
break;
case MGCP_POLICY_DEFER:
@@ -703,7 +703,7 @@
 ENDPOINT_NUMBER(endp));
return create_response_with_sdp(endp, conn, "CRCX", p->trans, true);
 error2:
-   mgcp_release_endp(endp);
+   mgcp_endp_release(endp);
LOGP(DLMGCP, LOGL_NOTICE,
 "CRCX: endpoint:0x%x unable to create connection resource error\n",
 ENDPOINT_NUMBER(endp));
@@ -954,7 +954,7 @@
 "DLCX: endpoint:0x%x missing ci (connectionIdentifier), 
will remove all connections at once\n",
 ENDPOINT_NUMBER(endp));
 
-   mgcp_release_endp(endp);
+   mgcp_endp_release(endp);
 
/* Note: In this case we do not return any statistics,
 * as we assume that the client is not interested in
@@ -981,7 +981,7 @@
/* When all connections are closed, the endpoint will be released
 * in order to be ready to be used by another call. */
if (llist_count(>conns) <= 0) {
-   mgcp_release_endp(endp);
+   mgcp_endp_release(endp);
LOGP(DLMGCP, LOGL_DEBUG,
 "DLCX: endpoint:0x%x endpoint released\n",
 ENDPOINT_NUMBER(endp));
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 99780c8..5378931 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -1048,7 +1048,7 @@
}
 
endp = >endpoints[endp_no];
-   mgcp_release_endp(endp);
+   mgcp_endp_release(endp);
return CMD_SUCCESS;
 }
 
diff --git a/src/osmo-mgw/mgw_main.c b/src/osmo-mgw/mgw_main.c
index 8e956e4..4452ae3 100644
--- a/src/osmo-mgw/mgw_main.c
+++ b/src/osmo-mgw/mgw_main.c
@@ -190,7 +190,7 @@
/* Walk over all endpoints and trigger a release, this will 
release all
 * endpoints, possible open connections are forcefully dropped 
*/
for (i = 1; i < reset_trunk->number_endpoints; ++i)
-   mgcp_release_endp(_trunk->endpoints[i]);
+   mgcp_endp_release(_trunk->endpoints[i]);
}
 
return 0;
diff --git a/tests/mgcp/mgcp_test.c b/tests/mgcp/mgcp_test.c
index 1790444..4d39bda 100644
--- a/tests/mgcp/mgcp_test.c

[PATCH] osmo-mgw[master]: protocol: fix tagging of wildcarded requests

2018-02-02 Thread dexter

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

protocol: fix tagging of wildcarded requests

When a wildcarded CRCX is done flag "wildcarded_crcx" is set in the
endpoint struct. The flag tells other part of the code whether the
request was wildcarded or not since in some cases the behaviour
might be different for wildcarded requests. The implementation of
this mechanism is not entirely correct. The flag is set on wildcarded
requests but on non wildcarded requests it is not reset. Also the
name is misleading.

- rename wildcarded_crcx to wildcarded_req

- ensure the flag is refreshed with every new request

Change-Id: Ia5063ec65f5bc3a8a0943d1fd823aaeee20b8637
---
M include/osmocom/mgcp/mgcp_endp.h
M src/libosmo-mgcp/mgcp_endp.c
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_protocol.c
4 files changed, 18 insertions(+), 9 deletions(-)


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

diff --git a/include/osmocom/mgcp/mgcp_endp.h b/include/osmocom/mgcp/mgcp_endp.h
index c0fd9ff..a486dcd 100644
--- a/include/osmocom/mgcp/mgcp_endp.h
+++ b/include/osmocom/mgcp/mgcp_endp.h
@@ -89,7 +89,7 @@
 
/*!< Memorize if this endpoint was choosen by the MGW (wildcarded, true)
 *   or if the user has choosen the particular endpoint explicitly. */
-   bool wildcarded_crcx;
+   bool wildcarded_req;
 };
 
 /*! Extract endpoint number for a given endpoint */
diff --git a/src/libosmo-mgcp/mgcp_endp.c b/src/libosmo-mgcp/mgcp_endp.c
index 581c12c..fa2dd28 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -52,5 +52,5 @@
endp->local_options.string = NULL;
talloc_free(endp->local_options.codec);
endp->local_options.codec = NULL;
-   endp->wildcarded_crcx = false;
+   endp->wildcarded_req = false;
 }
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index 89046c0..8d22cc5 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -143,6 +143,7 @@
char *rest = NULL;
struct mgcp_trunk_config *tcfg;
int trunk, endp;
+   struct mgcp_endpoint *endp_ptr;
 
trunk = strtoul(mgcp + 6, , 10);
if (rest == NULL || rest[0] != '/' || trunk < 1) {
@@ -179,7 +180,9 @@
return NULL;
}
 
-   return >endpoints[endp];
+   endp_ptr = >endpoints[endp];
+   endp_ptr->wildcarded_req = false;
+   return endp_ptr;
 }
 
 /* Find an endpoint that is not in use. Do this by going through the endpoint
@@ -197,7 +200,7 @@
LOGP(DLMGCP, LOGL_DEBUG,
 "endpoint:0x%x found free endpoint\n",
 ENDPOINT_NUMBER(endp));
-   endp->wildcarded_crcx = true;
+   endp->wildcarded_req = true;
return endp;
}
}
@@ -263,8 +266,11 @@
return endp;
}
gw = strtoul(endpoint_number_str, , 16);
-   if (gw < cfg->trunk.number_endpoints && endptr[0] == '@')
-   return >trunk.endpoints[gw];
+   if (gw < cfg->trunk.number_endpoints && endptr[0] == '@') {
+   endp = >trunk.endpoints[gw];
+   endp->wildcarded_req = false;
+   return endp;
+   }
}
 
/* Deprecated method without prefix */
@@ -272,8 +278,11 @@
 "Addressing virtual trunk without prefix (deprecated), please use 
%s: '%s'\n",
 MGCP_ENDPOINT_PREFIX_VIRTUAL_TRUNK, mgcp);
gw = strtoul(mgcp, , 16);
-   if (gw < cfg->trunk.number_endpoints && endptr[0] == '@')
-   return >trunk.endpoints[gw];
+   if (gw < cfg->trunk.number_endpoints && endptr[0] == '@') {
+   endp = >trunk.endpoints[gw];
+   endp->wildcarded_req = false;
+   return endp;
+   }
 
LOGP(DLMGCP, LOGL_ERROR, "Not able to find the endpoint: '%s'\n", mgcp);
*cause = -500;
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 05aefc1..337aa9b 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -199,7 +199,7 @@
int rc;
 
/* NOTE: Only in the virtual trunk we allow dynamic endpoint names */
-   if (endp->wildcarded_crcx
+   if (endp->wildcarded_req
&& endp->tcfg->trunk_type == MGCP_TRUNK_VIRTUAL) {
rc = msgb_printf(msg, "Z: %s%x@%s\r\n",
 MGCP_ENDPOINT_PREFIX_VIRTUAL_TRUNK,

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

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


[PATCH] osmo-mgw[master]: protocol: reject DLCX/CRCX/MDCX on unsupported parameters

2018-02-02 Thread dexter

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

protocol: reject DLCX/CRCX/MDCX on unsupported parameters

When an unsupported MGCP parameter (e.g. N) is used, then this
parameter is ignored and the command execution continues. However,
an MGCP command that contains an unsupported parameter should
be rejected.

- Make sure that MGCP commands DLCX, CRCX and MDCX are rejected,
  when they contain unsupported parameters.

Change-Id: I8cd5987fc6befcd53a7c4916f77b1a24c904ba48
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index b0d9943..7fed8c3 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -535,6 +535,7 @@
LOGP(DLMGCP, LOGL_NOTICE,
 "CRCX: endpoint:%x unhandled option: '%c'/%d\n",
 ENDPOINT_NUMBER(endp), *line, *line);
+   return create_err_response(NULL, 539, "CRCX", p->trans);
break;
}
}
@@ -768,6 +769,7 @@
LOGP(DLMGCP, LOGL_NOTICE,
 "MDCX: endpoint:0x%x Unhandled MGCP option: 
'%c'/%d\n",
 ENDPOINT_NUMBER(endp), line[0], line[0]);
+   return create_err_response(NULL, 539, "CRCX", p->trans);
break;
}
}
@@ -918,6 +920,7 @@
LOGP(DLMGCP, LOGL_NOTICE,
 "DLCX: endpoint:0x%x Unhandled MGCP option: 
'%c'/%d\n",
 ENDPOINT_NUMBER(endp), line[0], line[0]);
+   return create_err_response(NULL, 539, "CRCX", p->trans);
break;
}
}

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

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


[PATCH] osmo-mgw[master]: protocol: exit cleanly when local cx options check fails

2018-02-02 Thread dexter

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

protocol: exit cleanly when local cx options check fails

When set_local_cx_options() returns an error code the MGCP command
execution is aborted and and the error code is returned, but on
CRCX the already seized eindpoint is not released.

- Do not generate the error response on the spot, jump to the
  respective label and let the already existing error handling
  do its work.

This patch is a follow-up page to:
Change-Id I02aaa3042f2a0e32eb4ec6b8753deab7082947a0

Change-Id: Iaef4ea6c6a2f24ac8b276966bda72d0b30f25cd5
Related: OS#2654
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 7fed8c3..2977fdf 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -604,7 +604,8 @@
LOGP(DLMGCP, LOGL_ERROR,
 "CRCX: endpoint:%x inavlid local connection options!\n",
 ENDPOINT_NUMBER(endp));
-   return create_err_response(endp, rc, "CRCX", p->trans);
+   error_code = rc;
+   goto error2;
}
 
snprintf(conn_name, sizeof(conn_name), "%s", callid);
@@ -803,7 +804,8 @@
LOGP(DLMGCP, LOGL_ERROR,
 "MDCX: endpoint:%x inavlid local connection options!\n",
 ENDPOINT_NUMBER(endp));
-   return create_err_response(endp, rc, "MDCX", p->trans);
+   error_code = rc;
+   goto error3;
}
 
if (!have_sdp && endp->local_options.codec)

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

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


[PATCH] osmo-mgw[master]: client: add an optional FSM interface

2018-02-02 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/5881

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

client: add an optional FSM interface

the client API is not very intuitive and requires a lot of extra
care when it is used from an osmo-fsm.

- Add an FSM that permits comfortable handling of an MGCP
  connection.

Change-Id: I887ce0c15a831dffeb6251a975337b83942af566
---
M include/Makefile.am
A include/osmocom/mgcp_client/mgcp_client_fsm.h
M include/osmocom/mgcp_client/mgcp_client_internal.h
M src/libosmo-mgcp-client/Makefile.am
A src/libosmo-mgcp-client/mgcp_client_fsm.c
5 files changed, 670 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/81/5881/8

diff --git a/include/Makefile.am b/include/Makefile.am
index b52e5ea..e8fc211 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -7,6 +7,7 @@
osmocom/legacy_mgcp/mgcp_internal.h \
osmocom/legacy_mgcp/osmux.h \
osmocom/mgcp_client/mgcp_client.h \
+   osmocom/mgcp_client/mgcp_client_fsm.h \
osmocom/mgcp_client/mgcp_common.h \
osmocom/mgcp/mgcp.h \
osmocom/mgcp/mgcp_common.h \
diff --git a/include/osmocom/mgcp_client/mgcp_client_fsm.h 
b/include/osmocom/mgcp_client/mgcp_client_fsm.h
new file mode 100644
index 000..a9ee876
--- /dev/null
+++ b/include/osmocom/mgcp_client/mgcp_client_fsm.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include 
+#include 
+#include 
+
+/*! Connection information. This struct organizes the connection infromation
+ *  one connection side (either remote or local). It is used to pass parameters
+ *  (local) to the FSM and get responses (remote) from the FSM as pointer
+ *  attached to the FSM event */
+struct mgcp_conn_info {
+   /*!< RTP connection IP-Address (optional, string e.g. "127.0.0.1") */
+   char addr[INET_ADDRSTRLEN];
+
+   /*!< RTP connection IP-Port (optional)  */
+   uint16_t port;
+
+   /*!< RTP endpoint */
+   char endpoint[MGCP_ENDPOINT_MAXLEN];
+
+   /*!< CALL ID (unique per call) */
+   unsigned int call_id;
+};
+
+struct osmo_fsm_inst *mgcp_conn_create(struct mgcp_client *mgcp, struct 
osmo_fsm_inst *parent_fi, uint32_t parent_term_evt,
+  uint32_t parent_evt, struct 
mgcp_conn_info *conn_info);
+int mgcp_conn_modify(struct osmo_fsm_inst *fi, uint32_t parent_evt, struct 
mgcp_conn_info *conn_info);
+void mgcp_conn_delete(struct osmo_fsm_inst *fi);
diff --git a/include/osmocom/mgcp_client/mgcp_client_internal.h 
b/include/osmocom/mgcp_client/mgcp_client_internal.h
index 690a4af..a2b330e 100644
--- a/include/osmocom/mgcp_client/mgcp_client_internal.h
+++ b/include/osmocom/mgcp_client/mgcp_client_internal.h
@@ -28,8 +28,6 @@
 
 int mgcp_client_rx(struct mgcp_client *mgcp, struct msgb *msg);
 
-struct mgcp_response_pending * mgcp_client_pending_add(
-   struct mgcp_client *mgcp,
-   mgcp_trans_id_t trans_id,
-   mgcp_response_cb_t response_cb,
-   void *priv);
+struct mgcp_response_pending *mgcp_client_pending_add(struct mgcp_client *mgcp,
+ mgcp_trans_id_t trans_id,
+ mgcp_response_cb_t 
response_cb, void *priv);
diff --git a/src/libosmo-mgcp-client/Makefile.am 
b/src/libosmo-mgcp-client/Makefile.am
index 1e4e764..a3a920b 100644
--- a/src/libosmo-mgcp-client/Makefile.am
+++ b/src/libosmo-mgcp-client/Makefile.am
@@ -29,6 +29,7 @@
 libosmo_mgcp_client_la_SOURCES = \
mgcp_client.c \
mgcp_client_vty.c \
+   mgcp_client_fsm.c \
$(NULL)
 
 libosmo_mgcp_client_la_LDFLAGS = $(AM_LDFLAGS) -version-info 
$(MGCP_CLIENT_LIBVERSION)
diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c 
b/src/libosmo-mgcp-client/mgcp_client_fsm.c
new file mode 100644
index 000..c38a0ad
--- /dev/null
+++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c
@@ -0,0 +1,637 @@
+/* (C) 2017 by sysmocom - s.f.m.c. GmbH 
+ * All Rights Reserved
+ *
+ * Author: Philipp Maier
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see .
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Context 

[PATCH] osmo-mgw[master]: cosmetic: Add missing \n on log line

2018-02-02 Thread dexter

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

cosmetic: Add missing \n on log line

The final log lone in find_endpoint() lacks the \n causing a messed
up log output.

- Add missing \n

Change-Id: I97fca654b199dfb7aae2359322a56c6d0bae9599
---
M src/libosmo-mgcp/mgcp_msg.c
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index f533d55..89046c0 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -202,7 +202,7 @@
}
}
 
-   LOGP(DLMGCP, LOGL_ERROR, "Not able to find a free endpoint");
+   LOGP(DLMGCP, LOGL_ERROR, "Not able to find a free endpoint\n");
return NULL;
 }
 

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

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


[PATCH] osmo-mgw[master]: protocol: prohibit wildcarded requests for MDCX and DLCX

2018-02-02 Thread dexter
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6260

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

protocol: prohibit wildcarded requests for MDCX and DLCX

When a wildcarded request is made with a DLCX or MDCX command
the MGW will search for a free endpoint and continues the command
execution with that endpoint.

- Catch the wildcarded request early on DLCX and MDCX and return
  with an error code.

See also TTCN3 testcases:
MGCP_Test.TC_mdcx_wildcarded
MGCP_Test.TC_dlcx_wildcarded

Change-Id: Ia77d44a6a86083e62338e5845b553e5cf13ebd10
---
M src/libosmo-mgcp/mgcp_protocol.c
1 file changed, 16 insertions(+), 0 deletions(-)


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

diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 337aa9b..5fbea10 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -739,6 +739,14 @@
 
LOGP(DLMGCP, LOGL_NOTICE, "MDCX: modifying existing connection ...\n");
 
+   /* Prohibit wildcarded requests */
+   if (endp->wildcarded_req) {
+   LOGP(DLMGCP, LOGL_ERROR,
+"DLCX: endpoint:0x%x wildcarded endpoint names not 
supported.\n",
+ENDPOINT_NUMBER(endp));
+   return create_err_response(endp, 507, "DLCX", p->trans);
+   }
+
if (llist_count(>conns) <= 0) {
LOGP(DLMGCP, LOGL_ERROR,
 "MDCX: endpoint:0x%x endpoint is not holding a 
connection.\n",
@@ -912,6 +920,14 @@
 "DLCX: endpoint:0x%x deleting connection ...\n",
 ENDPOINT_NUMBER(endp));
 
+   /* Prohibit wildcarded requests */
+   if (endp->wildcarded_req) {
+   LOGP(DLMGCP, LOGL_ERROR,
+"DLCX: endpoint:0x%x wildcarded endpoint names not 
supported.\n",
+ENDPOINT_NUMBER(endp));
+   return create_err_response(endp, 507, "DLCX", p->trans);
+   }
+
if (llist_count(>conns) <= 0) {
LOGP(DLMGCP, LOGL_ERROR,
 "DLCX: endpoint:0x%x endpoint is not holding a 
connection.\n",

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

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


[PATCH] osmo-mgw[master]: client: use heap to store mgcp_response

2018-02-02 Thread dexter
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/6222

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

client: use heap to store mgcp_response

The struct that holds the parsing results of the MGCP response is
allocated on the stack. However, it would make sense to allocate
the struct dynamically on the heap. This also would provide a
talloc context that is in reach on most places of the code.

- Allocate struct mgcp_response dynamically in mgcp_client_rx()

- Use struct mgcp_response as talloc context for temporary
  allocated memory while parsing the response.

Change-Id: I5099abe68b580c75b47bc797bf93f01084f0c4db
---
M src/libosmo-mgcp-client/mgcp_client.c
1 file changed, 22 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/22/6222/4

diff --git a/src/libosmo-mgcp-client/mgcp_client.c 
b/src/libosmo-mgcp-client/mgcp_client.c
index efe1d1f..ea7ac36 100644
--- a/src/libosmo-mgcp-client/mgcp_client.c
+++ b/src/libosmo-mgcp-client/mgcp_client.c
@@ -257,7 +257,7 @@
 
/* Since this functions performs a destructive parsing, we create a
 * local copy of the body data */
-   data = talloc_zero_size(NULL, strlen(r->body)+1);
+   data = talloc_zero_size(r, strlen(r->body)+1);
OSMO_ASSERT(data);
data_ptr = data;
osmo_strlcpy(data, r->body, strlen(r->body));
@@ -336,7 +336,7 @@
 
/* Since this functions performs a destructive parsing, we create a
 * local copy of the body data */
-   data = talloc_zero_size(NULL, strlen(r->body)+1);
+   data = talloc_zero_size(r, strlen(r->body)+1);
OSMO_ASSERT(data);
data_ptr = data;
osmo_strlcpy(data, r->body, strlen(r->body));
@@ -410,32 +410,42 @@
  */
 int mgcp_client_rx(struct mgcp_client *mgcp, struct msgb *msg)
 {
-   struct mgcp_response r = { 0 };
+   struct mgcp_response *r;
struct mgcp_response_pending *pending;
int rc;
 
-   rc = mgcp_response_parse_head(, msg);
+   r = talloc_zero(mgcp, struct mgcp_response);
+   OSMO_ASSERT(r);
+
+   rc = mgcp_response_parse_head(r, msg);
if (rc) {
LOGP(DLMGCP, LOGL_ERROR, "Cannot parse MGCP response (head)\n");
-   return -1;
+   rc = 1;
+   goto error;
}
 
-   rc = parse_head_params();
+   rc = parse_head_params(r);
if (rc) {
LOGP(DLMGCP, LOGL_ERROR, "Cannot parse MGCP response (head 
parameters)\n");
-   return -1;
+   rc = 1;
+   goto error;
}
 
-   pending = mgcp_client_response_pending_get(mgcp, r.head.trans_id);
+   pending = mgcp_client_response_pending_get(mgcp, r->head.trans_id);
if (!pending) {
LOGP(DLMGCP, LOGL_ERROR,
 "Cannot find matching MGCP transaction for trans_id %d\n",
-r.head.trans_id);
-   return -ENOENT;
+r->head.trans_id);
+   rc = -ENOENT;
+   goto error;
}
 
-   mgcp_client_handle_response(mgcp, pending, );
-   return 0;
+   mgcp_client_handle_response(mgcp, pending, r);
+   rc = 0;
+
+error:
+   talloc_free(r);
+   return rc;
 }
 
 static int mgcp_do_read(struct osmo_fd *fd)

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5099abe68b580c75b47bc797bf93f01084f0c4db
Gerrit-PatchSet: 4
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bts[master]: Remove unused variables

2018-02-02 Thread dexter

Patch Set 1:

(1 comment)

> (1 comment)

https://gerrit.osmocom.org/#/c/6248/1/src/common/rsl.c
File src/common/rsl.c:

Line 1251
> This one was introduced recently by @dexter.
The Patch looks ok to me, but this line must stay. Its a fix for a nullpointer 
deref. See also function rsl_tx_mode_modif_ack() below, there this is set as 
well.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3fec7e4b337f3ea4d8cd79f4e7261babc34911cb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-HasComments: Yes


osmo-bts[master]: rsl: do not allow MODE MODIFY request with unsupp. codec/rate

2018-02-02 Thread dexter

Patch Set 1:

(4 comments)

> (1 comment)

https://gerrit.osmocom.org/#/c/6097/1/include/osmo-bts/gsm_data.h
File include/osmo-bts/gsm_data.h:

Line 97:const struct bts_cm *cm; /* Table with supp. ch 
rate/mode combinations */
> if this is alway an array that needs to be as large as MAX_PCHAN_T, then wh
This pointer is not for a dynamically allocated struct. Its set by 
bts_model_init() on startup to a hardcoded table. (e.g. see l1_if.c in in 
osmo-bts-octphy) The problem I wanted to solve here is that I wanted to have an 
easy to fill out, static table inside the hardware specific part. The pointer 
is set once on initialization to give access to the data. If we want to have 
this as an array, we would have to copy the table on startup. If you think that 
makes it better understandable I can do this of course. Any ideas?


https://gerrit.osmocom.org/#/c/6097/1/src/common/bts.c
File src/common/bts.c:

Line 679: int bts_supports_cm(struct gsm_bts_role_bts *bts,
> Why not to use bool here?
I wanted it bo be uniform with bts_supports_cipher() (a few lines above) there 
they also used int.


Line 693:   for (i = 0;; i++) {
> Oops, I was mistaken. As the size of bts->support.cm
Yes, I will do this when we finally decided to turn support.cm into an array. 
At the moment it is a pointer to an array.


Line 702:   if (supported[i].pchan == _GSM_PCHAN_MAX)
> This could be moved to the 'for' condition...
Done


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id9b222b7ab19ece90591718bc562b3a8c5e02023
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-HasComments: Yes


gapk[master]: configure.ac: drop the -fvisibility=hidden check

2018-02-02 Thread Vadim Yanitskiy

Patch Set 1: Code-Review-1

> What about libgsmhr/Makefile.am? I think it uses SYMBOL_VISIBILITY.
 > If you remove it from configure.ac you should remove it from
 > makefile as well.

Sure, this was out of my attention...

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If2263a82a6c71475cb6ea8f9158a0e758abfd995
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[ABANDON] gapk[master]: configure.ac: drop the -fvisibility=hidden check

2018-02-02 Thread Vadim Yanitskiy
Vadim Yanitskiy has abandoned this change.

Change subject: configure.ac: drop the -fvisibility=hidden check
..


Abandoned

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: If2263a82a6c71475cb6ea8f9158a0e758abfd995
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 


osmocom-bb[master]: firmware/l23_api.c: increase the L3_MSG_SIZE

2018-02-02 Thread Vadim Yanitskiy

Patch Set 1: Code-Review-1

> Could you comment why both l1ctl_info_dl and l1ctl_burst_ind sizes
 > have to be added? Ideally - right next to the #define to make sure
 > we update this properly next time as well.

This is a question to the commit author.
I just realized that this change is unrelated to
the gprsdecode at all, and we only need the burst_ind structure...

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I237c6898cb7bbccb891e23ebab08498768a01574
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


osmo-bts[master]: l1sap.c: l1sap_tch_rts_ind: Remove unused variables

2018-02-02 Thread Vadim Yanitskiy

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie7cd648a4b8a5ae59efc8953d6424a91a0f025ef
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-bts[master]: gsm_pchan2chan_nr: move warning to pragma message and track ...

2018-02-02 Thread Max

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I21298fcd0d1c1aafdd3dc1e8c8dae37b271b1d3d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmocom-bb[master]: firmware/l23_api.c: increase the L3_MSG_SIZE

2018-02-02 Thread Max

Patch Set 1: Code-Review-1

Could you comment why both l1ctl_info_dl and l1ctl_burst_ind sizes have to be 
added? Ideally - right next to the #define to make sure we update this properly 
next time as well.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I237c6898cb7bbccb891e23ebab08498768a01574
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


osmo-bts[master]: l1sap.c: l1sap_tch_rts_ind: Remove unused variables

2018-02-02 Thread Max

Patch Set 1: Code-Review+1

I think it's a left over from log message which was skipped in the commit which 
made it into master.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie7cd648a4b8a5ae59efc8953d6424a91a0f025ef
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmocom-bb[master]: layer23/cell_log: set default logfile to /dev/null

2018-02-02 Thread Max

Patch Set 1: Code-Review-1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2a9982f221871c78c5c9a73b7b7a1787ff07a86c
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


[PATCH] gapk[master]: src/Makefile.am: fix osmo-gapk LDADD dependency

2018-02-02 Thread Vadim Yanitskiy

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

src/Makefile.am: fix osmo-gapk LDADD dependency

This change fixes parallel building problem, when osmo-gapk was
being compiled before its libosmogapk dependency:

  make[2]: *** No rule to make target '../src/libosmogapk.la',
   needed by 'osmo-gapk'.  Stop.
  make[2]: *** Waiting for unfinished jobs

For some reason, automake ignores a dependency if the full
path is provided:

  $(top_builddir)/src/libosmogapk.la

while the relative path solves the problem:

  libosmogapk.la

Closes: OS#2907
Change-Id: I3fdd1731bd372bbb42fe57981e757386e8ede0f0
---
M src/Makefile.am
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/gapk refs/changes/53/6253/1

diff --git a/src/Makefile.am b/src/Makefile.am
index 8efd165..50ffda4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -93,5 +93,5 @@
$(NULL)
 
 osmo_gapk_LDADD = \
-   $(top_builddir)/src/libosmogapk.la \
+   libosmogapk.la \
$(NULL)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3fdd1731bd372bbb42fe57981e757386e8ede0f0
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 


[PATCH] gapk[master]: configure.ac: drop the -fvisibility=hidden check

2018-02-02 Thread Vadim Yanitskiy

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

configure.ac: drop the -fvisibility=hidden check

As we don't use the visibility attributes, we don't need this.

Change-Id: If2263a82a6c71475cb6ea8f9158a0e758abfd995
---
M configure.ac
1 file changed, 0 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/gapk refs/changes/54/6254/1

diff --git a/configure.ac b/configure.ac
index 180e380..cbea154 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,18 +36,6 @@
AC_DEFINE(HAVE_LIBGSMHR, 1, [Define to 1 if libgsmhr is available])
 fi
 
-# Check for -fvisibility support
-#  (The following test is taken from WebKit's webkit.m4)
-saved_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -fvisibility=hidden "
-AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])],
-   [ AC_MSG_RESULT([yes])
- SYMBOL_VISIBILITY="-fvisibility=hidden"],
-   AC_MSG_RESULT([no]))
-CFLAGS="$saved_CFLAGS"
-AC_SUBST(SYMBOL_VISIBILITY)
-
 dnl check os: some linker flags not available on osx
 case $host in
 *-darwin*)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If2263a82a6c71475cb6ea8f9158a0e758abfd995
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 


gapk[master]: src/Makefile.am: fix osmo-gapk LDADD dependency

2018-02-02 Thread Max

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3fdd1731bd372bbb42fe57981e757386e8ede0f0
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


gapk[master]: configure.ac: drop the -fvisibility=hidden check

2018-02-02 Thread Max

Patch Set 1: Code-Review-1

What about libgsmhr/Makefile.am? I think it uses SYMBOL_VISIBILITY. If you 
remove it from configure.ac you should remove it from makefile as well.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If2263a82a6c71475cb6ea8f9158a0e758abfd995
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


osmocom-bb[master]: layer23/cell_log: set default logfile to /dev/null

2018-02-02 Thread Max

Patch Set 1:

I'd prefer to keep some log file by default - /tmp/osmocom.log for example. Or, 
at the very least, this should be explicitly described in readme as well as in 
the help for corresponding command-line option.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2a9982f221871c78c5c9a73b7b7a1787ff07a86c
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No