osmo-msc[master]: remove unused VTY command "location updating reject cause"

2018-02-13 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-msc[master]: remove unused VTY command "location updating reject cause"

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

Change subject: remove unused VTY command "location updating reject cause"
..


remove unused VTY command "location updating reject cause"

OsmoMSC is using whatever reject cause is apropriate in the given
situation.  This user-configurable reject cause only had relevance
in OsmoNITB, and hence it is an unused parameter that can be removed
in OsmoMSC.

Related: OS#2528
Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
---
M doc/examples/osmo-msc/osmo-msc.cfg
M doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
M doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
M include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs_vty.c
M src/libmsc/msc_vty.c
6 files changed, 0 insertions(+), 23 deletions(-)

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



diff --git a/doc/examples/osmo-msc/osmo-msc.cfg 
b/doc/examples/osmo-msc/osmo-msc.cfg
index 1261160..4cccebe 100644
--- a/doc/examples/osmo-msc/osmo-msc.cfg
+++ b/doc/examples/osmo-msc/osmo-msc.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg 
b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
index a5131e4..ea92912 100644
--- a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg 
b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
index 72f3410..7026293 100644
--- a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index cde1ce2..0548b80 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -238,7 +238,6 @@
enum gsm_auth_policy auth_policy;
regex_t authorized_regexp;
char *authorized_reg_str;
-   enum gsm48_reject_value reject_cause;
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
bool authentication_required;
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
index a4862ee..e5972f1 100644
--- a/src/libcommon-cs/common_cs_vty.c
+++ b/src/libcommon-cs/common_cs_vty.c
@@ -137,22 +137,6 @@
return CMD_SUCCESS;
 }
 
-DEFUN(cfg_net_reject_cause,
-  cfg_net_reject_cause_cmd,
-  "location updating reject cause <2-111>",
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Cause Value as Per GSM TS 04.08\n")
-{
-   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
-   gsmnet->reject_cause = atoi(argv[0]);
-
-   return CMD_SUCCESS;
-}
-
 DEFUN(cfg_net_encryption,
   cfg_net_encryption_cmd,
   "encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]",
@@ -324,7 +308,6 @@
install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
install_element(GSMNET_NODE, &cfg_net_authorize_regexp_cmd);
-   install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
install_element(GSMNET_NODE, &cfg_net_authentication_cmd);
install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index ad4014d..49081c6 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -187,8 +187,6 @@
vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
vty_out(vty, " auth policy %s%s", 
gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
-   vty_out(vty, " location updating reject cause %u%s",
-   gsmnet->reject_cause, VTY_NEWLINE);
vty_out(vty, " encryption a5");
for (i = 0; i < 8; i++) {
if (gsmnet->a5_encryption_mask & (1 << i))

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-msc[master]: remove dead code (gsm_parse_reg)

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

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

https://gerrit.osmocom.org/6423

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

remove dead code (gsm_parse_reg)

Change-Id: I47b0260561a9c2bad65c50c8164873e4c23d61b7
---
M include/osmocom/msc/gsm_data_shared.h
M src/libcommon/gsm_data.c
2 files changed, 0 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/23/6423/2

diff --git a/include/osmocom/msc/gsm_data_shared.h 
b/include/osmocom/msc/gsm_data_shared.h
index af7d89d..32c336b 100644
--- a/include/osmocom/msc/gsm_data_shared.h
+++ b/include/osmocom/msc/gsm_data_shared.h
@@ -1,7 +1,6 @@
 #ifndef _GSM_DATA_SHAREDH
 #define _GSM_DATA_SHAREDH
 
-#include 
 #include 
 #include 
 
@@ -40,11 +39,5 @@
GSM_PAGING_OOM,
GSM_PAGING_BUSY,
 };
-
-/*
- * help with parsing regexps
- */
-int gsm_parse_reg(void *ctx, regex_t *reg, char **str,
-   int argc, const char **argv) __attribute__ 
((warn_unused_result));
 
 #endif
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index a0ca81a..f7795b2 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -54,31 +54,6 @@
return get_value_string(rrlp_mode_names, mode);
 }
 
-int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char 
**argv)
-{
-   int ret;
-
-   ret = 0;
-   if (*str) {
-   talloc_free(*str);
-   *str = NULL;
-   }
-   regfree(reg);
-
-   if (argc > 0) {
-   *str = talloc_strdup(ctx, argv[0]);
-   ret = regcomp(reg, argv[0], 0);
-
-   /* handle compilation failures */
-   if (ret != 0) {
-   talloc_free(*str);
-   *str = NULL;
-   }
-   }
-
-   return ret;
-}
-
 bool classmark_is_r99(struct gsm_classmark *cm)
 {
int rev_lev = 0;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I47b0260561a9c2bad65c50c8164873e4c23d61b7
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-msc[master]: remove unused "auth policy" VTY command

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

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

https://gerrit.osmocom.org/6417

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

remove unused "auth policy" VTY command

This is yet another unsused bit from the OsmoNITB legacy.

Related: OS#2528
Change-Id: I825e659da529257e5edec94d9d59f0e10c1b4c63
---
M doc/examples/osmo-msc/osmo-msc.cfg
M doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
M doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
M include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs_vty.c
M src/libcommon/gsm_data.c
M src/libmsc/msc_vty.c
M tests/vty_test_runner.py
8 files changed, 0 insertions(+), 60 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/17/6417/3

diff --git a/doc/examples/osmo-msc/osmo-msc.cfg 
b/doc/examples/osmo-msc/osmo-msc.cfg
index 4cccebe..91c9eee 100644
--- a/doc/examples/osmo-msc/osmo-msc.cfg
+++ b/doc/examples/osmo-msc/osmo-msc.cfg
@@ -9,7 +9,6 @@
  mobile network code 1
  short name OsmoMSC
  long name OsmoMSC
- auth policy closed
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg 
b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
index ea92912..0b9fd2a 100644
--- a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
@@ -9,7 +9,6 @@
  mobile network code 1
  short name OsmoMSC
  long name OsmoMSC
- auth policy closed
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg 
b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
index 7026293..44ac3f8 100644
--- a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
@@ -9,7 +9,6 @@
  mobile network code 1
  short name OsmoMSC
  long name OsmoMSC
- auth policy closed
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 9701288..67b657a 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -207,13 +207,6 @@
msc_ctr_description,
 };
 
-enum gsm_auth_policy {
-   GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */
-   GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized 
in DB */
-   GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke 
authorization */
-   GSM_AUTH_POLICY_REGEXP, /* accept IMSIs matching given regexp */
-};
-
 #define MSC_PAGING_RESPONSE_TIMER_DEFAULT 10
 
 struct gsm_tz {
@@ -235,7 +228,6 @@
uint16_t network_code;
char *name_long;
char *name_short;
-   enum gsm_auth_policy auth_policy;
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
bool authentication_required;
@@ -371,9 +363,6 @@
 
 extern void *tall_bsc_ctx;
 extern int ipacc_rtp_direct;
-
-enum gsm_auth_policy gsm_auth_policy_parse(const char *arg);
-const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
 
 enum rrlp_mode rrlp_mode_parse(const char *arg);
 const char *rrlp_mode_name(enum rrlp_mode mode);
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
index 2fbe09c..01c6b35 100644
--- a/src/libcommon-cs/common_cs_vty.c
+++ b/src/libcommon-cs/common_cs_vty.c
@@ -103,24 +103,6 @@
return CMD_SUCCESS;
 }
 
-DEFUN(cfg_net_auth_policy,
-  cfg_net_auth_policy_cmd,
-  "auth policy (closed|accept-all|regexp|token)",
-   "Authentication (not cryptographic)\n"
-   "Set the GSM network authentication policy\n"
-   "Require the MS to be activated in HLR\n"
-   "Accept all MS, whether in HLR or not\n"
-   "Use regular expression for IMSI authorization decision\n"
-   "Use SMS-token based authentication\n")
-{
-   enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
-   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
-   gsmnet->auth_policy = policy;
-
-   return CMD_SUCCESS;
-}
-
 DEFUN(cfg_net_encryption,
   cfg_net_encryption_cmd,
   "encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]",
@@ -290,7 +272,6 @@
install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
-   install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
install_element(GSMNET_NODE, &cfg_net_authentication_cmd);
install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index 66b6e29..a0ca81a 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -36,24 +36,6 @@
 
 void *tall_bsc_ctx;
 
-static const struct value_string auth_policy_names[] = {
-   { GSM_AUTH_POLICY_CLOSED,   "closed" },
-   { GSM_AUTH_POLICY_ACCEPT_ALL,   "accept-all" },
-   { GSM_AUTH_POLICY_TOKEN,"token" },
- 

[PATCH] osmo-msc[master]: remove unused "authorized-regexp" VTY command

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

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

https://gerrit.osmocom.org/6416

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

remove unused "authorized-regexp" VTY command

This is another left-over VTY command from the OsmoNITB days.

If such functionality is desired, it must be implemented in OsmoHLR,
but not here.

Related: OS#2528
Change-Id: Icf0897c47388e49ba7886b55acc728a6f7d213fe
---
M include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs.c
M src/libcommon-cs/common_cs_vty.c
M tests/vty_test_runner.py
4 files changed, 0 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/16/6416/3

diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 0548b80..9701288 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -236,8 +236,6 @@
char *name_long;
char *name_short;
enum gsm_auth_policy auth_policy;
-   regex_t authorized_regexp;
-   char *authorized_reg_str;
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
bool authentication_required;
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
index cebaf39..a2f5cb3 100644
--- a/src/libcommon-cs/common_cs.c
+++ b/src/libcommon-cs/common_cs.c
@@ -44,14 +44,8 @@
 {
struct gsm_network *net;
 
-   const char *default_regexp = ".*";
-
net = talloc_zero(ctx, struct gsm_network);
if (!net)
-   return NULL;
-
-   if (gsm_parse_reg(net, &net->authorized_regexp, 
&net->authorized_reg_str, 1,
- &default_regexp) != 0)
return NULL;
 
net->country_code = country_code;
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
index e5972f1..2fbe09c 100644
--- a/src/libcommon-cs/common_cs_vty.c
+++ b/src/libcommon-cs/common_cs_vty.c
@@ -121,22 +121,6 @@
return CMD_SUCCESS;
 }
 
-DEFUN(cfg_net_authorize_regexp, cfg_net_authorize_regexp_cmd,
-  "authorized-regexp REGEXP",
-  "Set regexp for IMSI which will be used for authorization decision\n"
-  "Regular expression, IMSIs matching it are allowed to use the network\n")
-{
-   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-   if (gsm_parse_reg(gsmnet, &gsmnet->authorized_regexp,
- &gsmnet->authorized_reg_str, argc, argv) != 0) {
-   vty_out(vty, "%%Failed to parse the authorized-regexp: '%s'%s",
-   argv[0], VTY_NEWLINE);
-   return CMD_WARNING;
-   }
-
-   return CMD_SUCCESS;
-}
-
 DEFUN(cfg_net_encryption,
   cfg_net_encryption_cmd,
   "encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]",
@@ -307,7 +291,6 @@
install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
-   install_element(GSMNET_NODE, &cfg_net_authorize_regexp_cmd);
install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
install_element(GSMNET_NODE, &cfg_net_authentication_cmd);
install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
diff --git a/tests/vty_test_runner.py b/tests/vty_test_runner.py
index 707fc5c..19d2c60 100644
--- a/tests/vty_test_runner.py
+++ b/tests/vty_test_runner.py
@@ -156,9 +156,6 @@
 self.vty.command("network")
 self.assertTrue(self.vty.verify("auth policy closed", ['']))
 self.assertTrue(self.vty.verify("auth policy regexp", ['']))
-self.assertTrue(self.vty.verify("authorized-regexp ^001", ['']))
-self.assertTrue(self.vty.verify("authorized-regexp 02$", ['']))
-self.assertTrue(self.vty.verify("authorized-regexp *123.*", ['']))
 self.vty.command("end")
 
 def testSi2Q(self):

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Icf0897c47388e49ba7886b55acc728a6f7d213fe
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-hlr[master]: osmo-hlr: Add talloc context introspection via VTY

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

Change subject: osmo-hlr: Add talloc context introspection via VTY
..


osmo-hlr: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
---
M src/hlr.c
M src/hlr_vty.c
M tests/test_nodes.vty
3 files changed, 6 insertions(+), 0 deletions(-)

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



diff --git a/src/hlr.c b/src/hlr.c
index 168e203..f3a6864 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -439,6 +439,7 @@
 
hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR");
msgb_talloc_ctx_init(hlr_ctx, 0);
+   vty_info.tall_ctx = hlr_ctx;
 
g_hlr = talloc_zero(hlr_ctx, struct hlr);
 
diff --git a/src/hlr_vty.c b/src/hlr_vty.c
index 202f7f7..c10829d 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "hlr_vty.h"
 #include "hlr_vty_subscr.h"
@@ -126,6 +127,7 @@
g_hlr = hlr;
 
logging_vty_add_cmds(cat);
+   osmo_talloc_vty_add_cmds();
 
install_element(CONFIG_NODE, &cfg_hlr_cmd);
install_node(&hlr_node, config_write_hlr);
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index 69472e6..5afa144 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -13,6 +13,9 @@
 ...
   show logging vty
   show alarms
+  show talloc-context (application|all) (full|brief|DEPTH)
+  show talloc-context (application|all) (full|brief|DEPTH) tree ADDRESS
+  show talloc-context (application|all) (full|brief|DEPTH) filter REGEXP
   subscriber (imsi|msisdn|id) IDENT show
 
 OsmoHLR> enable

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
Gerrit-PatchSet: 3
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-hlr[master]: osmo-hlr: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
Gerrit-PatchSet: 3
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: remove unused VTY command "location updating reject cause"

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

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

https://gerrit.osmocom.org/6415

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

remove unused VTY command "location updating reject cause"

OsmoMSC is using whatever reject cause is apropriate in the given
situation.  This user-configurable reject cause only had relevance
in OsmoNITB, and hence it is an unused parameter that can be removed
in OsmoMSC.

Related: OS#2528
Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
---
M doc/examples/osmo-msc/osmo-msc.cfg
M doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
M doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
M include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs_vty.c
M src/libmsc/msc_vty.c
6 files changed, 0 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/15/6415/3

diff --git a/doc/examples/osmo-msc/osmo-msc.cfg 
b/doc/examples/osmo-msc/osmo-msc.cfg
index 1261160..4cccebe 100644
--- a/doc/examples/osmo-msc/osmo-msc.cfg
+++ b/doc/examples/osmo-msc/osmo-msc.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg 
b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
index a5131e4..ea92912 100644
--- a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg 
b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
index 72f3410..7026293 100644
--- a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index cde1ce2..0548b80 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -238,7 +238,6 @@
enum gsm_auth_policy auth_policy;
regex_t authorized_regexp;
char *authorized_reg_str;
-   enum gsm48_reject_value reject_cause;
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
bool authentication_required;
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
index a4862ee..e5972f1 100644
--- a/src/libcommon-cs/common_cs_vty.c
+++ b/src/libcommon-cs/common_cs_vty.c
@@ -137,22 +137,6 @@
return CMD_SUCCESS;
 }
 
-DEFUN(cfg_net_reject_cause,
-  cfg_net_reject_cause_cmd,
-  "location updating reject cause <2-111>",
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Cause Value as Per GSM TS 04.08\n")
-{
-   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
-   gsmnet->reject_cause = atoi(argv[0]);
-
-   return CMD_SUCCESS;
-}
-
 DEFUN(cfg_net_encryption,
   cfg_net_encryption_cmd,
   "encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]",
@@ -324,7 +308,6 @@
install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
install_element(GSMNET_NODE, &cfg_net_authorize_regexp_cmd);
-   install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
install_element(GSMNET_NODE, &cfg_net_authentication_cmd);
install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index ad4014d..49081c6 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -187,8 +187,6 @@
vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
vty_out(vty, " auth policy %s%s", 
gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
-   vty_out(vty, " location updating reject cause %u%s",
-   gsmnet->reject_cause, VTY_NEWLINE);
vty_out(vty, " encryption a5");
for (i = 0; i < 8; i++) {
if (gsmnet->a5_encryption_mask & (1 << i))

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-hlr[master]: osmo-hlr: Add talloc context introspection via VTY

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

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

https://gerrit.osmocom.org/6421

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

osmo-hlr: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
---
M src/hlr.c
M src/hlr_vty.c
M tests/test_nodes.vty
3 files changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/21/6421/3

diff --git a/src/hlr.c b/src/hlr.c
index 168e203..f3a6864 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -439,6 +439,7 @@
 
hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR");
msgb_talloc_ctx_init(hlr_ctx, 0);
+   vty_info.tall_ctx = hlr_ctx;
 
g_hlr = talloc_zero(hlr_ctx, struct hlr);
 
diff --git a/src/hlr_vty.c b/src/hlr_vty.c
index 202f7f7..c10829d 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "hlr_vty.h"
 #include "hlr_vty_subscr.h"
@@ -126,6 +127,7 @@
g_hlr = hlr;
 
logging_vty_add_cmds(cat);
+   osmo_talloc_vty_add_cmds();
 
install_element(CONFIG_NODE, &cfg_hlr_cmd);
install_node(&hlr_node, config_write_hlr);
diff --git a/tests/test_nodes.vty b/tests/test_nodes.vty
index 69472e6..5afa144 100644
--- a/tests/test_nodes.vty
+++ b/tests/test_nodes.vty
@@ -13,6 +13,9 @@
 ...
   show logging vty
   show alarms
+  show talloc-context (application|all) (full|brief|DEPTH)
+  show talloc-context (application|all) (full|brief|DEPTH) tree ADDRESS
+  show talloc-context (application|all) (full|brief|DEPTH) filter REGEXP
   subscriber (imsi|msisdn|id) IDENT show
 
 OsmoHLR> enable

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
Gerrit-PatchSet: 3
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bsc[master]: osmo-bsc: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1245b6818eb54f5c0c8adddcd3a01ecc7363fb42
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] osmo-bsc[master]: osmo-bsc: Add talloc context introspection via VTY

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

Change subject: osmo-bsc: Add talloc context introspection via VTY
..


osmo-bsc: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I1245b6818eb54f5c0c8adddcd3a01ecc7363fb42
---
M src/libbsc/bsc_vty.c
M src/osmo-bsc/osmo_bsc_main.c
2 files changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 3da4745..a719358 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -4314,6 +4314,7 @@
install_element_ve(&show_paging_group_cmd);
 
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
 
install_element(GSMNET_NODE, &cfg_net_neci_cmd);
install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 1aff4c5..3deb369 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -197,6 +197,7 @@
 
tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
+   vty_info.tall_ctx = tall_bsc_ctx;
 
osmo_init_logging(&log_info);
osmo_stats_init(tall_bsc_ctx);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1245b6818eb54f5c0c8adddcd3a01ecc7363fb42
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] osmo-sgsn[master]: Add talloc context introspection via VTY

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

Change subject: Add talloc context introspection via VTY
..


Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I50eb1c5a28efbe4542e177ce3d0a236e75eecdd0
---
M src/gprs/gb_proxy_main.c
M src/gprs/gtphub_main.c
M src/gprs/sgsn_main.c
3 files changed, 9 insertions(+), 0 deletions(-)

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



diff --git a/src/gprs/gb_proxy_main.c b/src/gprs/gb_proxy_main.c
index 9f9c605..6f62400 100644
--- a/src/gprs/gb_proxy_main.c
+++ b/src/gprs/gb_proxy_main.c
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "../../bscconfig.h"
 
@@ -256,6 +257,7 @@
 
tall_bsc_ctx = talloc_named_const(NULL, 0, "nsip_proxy");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
+   vty_info.tall_ctx = tall_bsc_ctx;
 
signal(SIGINT, &signal_handler);
signal(SIGTERM, &signal_handler);
@@ -269,6 +271,7 @@
vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(&gprs_log_info);
gbproxy_vty_init();
 
diff --git a/src/gprs/gtphub_main.c b/src/gprs/gtphub_main.c
index 3f7de50..197c5e3 100644
--- a/src/gprs/gtphub_main.c
+++ b/src/gprs/gtphub_main.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -336,6 +337,7 @@
 
osmo_gtphub_ctx = talloc_named_const(NULL, 0, "osmo_gtphub");
msgb_talloc_ctx_init(osmo_gtphub_ctx, 0);
+   vty_info.tall_ctx = osmo_gtphub_ctx;
 
signal(SIGINT, &signal_handler);
signal(SIGTERM, &signal_handler);
@@ -349,6 +351,7 @@
vty_info.copyright = gtphub_copyright;
vty_init(&vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
 gtphub_vty_init(hub, cfg);
 
rate_ctr_init(osmo_gtphub_ctx);
diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index b2a028c..0276e34 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -376,6 +377,7 @@
srand(time(NULL));
tall_bsc_ctx = talloc_named_const(NULL, 0, "osmo_sgsn");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
+   vty_info.tall_ctx = tall_bsc_ctx;
 
signal(SIGINT, &signal_handler);
signal(SIGTERM, &signal_handler);
@@ -390,6 +392,7 @@
vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(&gprs_log_info);
sgsn_vty_init(&sgsn_inst.cfg);
ctrl_vty_init(tall_bsc_ctx);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I50eb1c5a28efbe4542e177ce3d0a236e75eecdd0
Gerrit-PatchSet: 2
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bsc[master]: osmo-bsc: Add talloc context introspection via VTY

2018-02-13 Thread Vadim Yanitskiy

Patch Set 2: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1245b6818eb54f5c0c8adddcd3a01ecc7363fb42
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] osmo-msc[master]: osmo-msc: Add talloc context introspection via VTY

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

Change subject: osmo-msc: Add talloc context introspection via VTY
..


osmo-msc: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I575500bd911f9792ab5ca76eebb1d2682ee34fa3
---
M src/osmo-msc/msc_main.c
1 file changed, 3 insertions(+), 0 deletions(-)

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



diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index b0b78be..da28083 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -366,6 +367,7 @@
 
tall_msc_ctx = talloc_named_const(NULL, 1, "osmo_msc");
talloc_ctx_init(tall_msc_ctx);
+   msc_vty_info.tall_ctx = tall_msc_ctx;
 
osmo_init_logging(&log_info);
osmo_stats_init(tall_msc_ctx);
@@ -394,6 +396,7 @@
 
ctrl_vty_init(tall_msc_ctx);
logging_vty_add_cmds(&log_info);
+   osmo_talloc_vty_add_cmds();
msc_vty_init(msc_network);
bsc_vty_init_extra();
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I575500bd911f9792ab5ca76eebb1d2682ee34fa3
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-msc[master]: osmo-msc: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[PATCH] osmo-bsc[master]: drop libcommon-cs completely

2018-02-13 Thread Neels Hofmeyr

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

drop libcommon-cs completely

Change-Id: I07d4a48af3154ee4d904686f230a51b8b8a94ff9
---
M configure.ac
M include/osmocom/bsc/Makefile.am
M include/osmocom/bsc/common_bsc.h
D include/osmocom/bsc/common_cs.h
M include/osmocom/bsc/gsm_data.h
M src/Makefile.am
M src/ipaccess/Makefile.am
M src/libbsc/Makefile.am
M src/libbsc/bsc_vty.c
M src/libbsc/net_init.c
D src/libcommon-cs/Makefile.am
D src/libcommon-cs/common_cs.c
D src/libcommon-cs/common_cs_vty.c
M src/libfilter/bsc_msg_filter.c
M src/osmo-bsc/Makefile.am
M src/osmo-bsc/osmo_bsc_filter.c
M src/osmo-bsc_nat/Makefile.am
M src/osmo-bsc_nat/bsc_nat.c
M src/utils/Makefile.am
M tests/abis/Makefile.am
M tests/bsc-nat/Makefile.am
M tests/bsc/Makefile.am
M tests/bssap/Makefile.am
M tests/channel/Makefile.am
M tests/gsm0408/Makefile.am
M tests/nanobts_omlattr/Makefile.am
M tests/subscr/Makefile.am
27 files changed, 3 insertions(+), 115 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/43/6443/1

diff --git a/configure.ac b/configure.ac
index 3356229..05f2d17 100644
--- a/configure.ac
+++ b/configure.ac
@@ -150,7 +150,6 @@
 src/Makefile
 src/libbsc/Makefile
 src/libfilter/Makefile
-src/libcommon-cs/Makefile
 src/osmo-bsc/Makefile
 src/osmo-bsc_nat/Makefile
 src/ipaccess/Makefile
diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index c503a50..f975947 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -16,7 +16,6 @@
chan_alloc.h \
common.h \
common_bsc.h \
-   common_cs.h \
ctrl.h \
debug.h \
e1_config.h \
diff --git a/include/osmocom/bsc/common_bsc.h b/include/osmocom/bsc/common_bsc.h
index 32e5097..d3c7ff5 100644
--- a/include/osmocom/bsc/common_bsc.h
+++ b/include/osmocom/bsc/common_bsc.h
@@ -1,7 +1,6 @@
 #pragma once
 
 #include 
-#include 
 
 struct gsm_network *bsc_network_init(void *ctx,
 uint16_t country_code,
diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h
deleted file mode 100644
index b6a8ed8..000
--- a/include/osmocom/bsc/common_cs.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#pragma once
-
-#include 
-#include 
-
-struct msgb;
-struct gsm_network;
-
-struct vty;
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 8af594f..d1a901e 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -17,7 +17,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
diff --git a/src/Makefile.am b/src/Makefile.am
index 814571f..82cf0be 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,7 +21,6 @@
 
 # Libraries
 SUBDIRS = \
-   libcommon-cs \
libbsc \
libfilter \
$(NULL)
diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am
index 0301d3a..a6195b9 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -46,7 +46,6 @@
 # FIXME: resolve the bogus dependencies patched around here:
 ipaccess_config_LDADD = \
$(top_builddir)/src/libbsc/libbsc.a \
-   $(top_builddir)/src/libcommon-cs/libcommon-cs.a \
$(OSMO_LIBS) \
$(NULL)
 
diff --git a/src/libbsc/Makefile.am b/src/libbsc/Makefile.am
index e68ada8..e8e69c7 100644
--- a/src/libbsc/Makefile.am
+++ b/src/libbsc/Makefile.am
@@ -19,8 +19,6 @@
libbsc.a \
$(NULL)
 
-libbsc_a_LIBADD = $(top_builddir)/src/libcommon-cs/libcommon-cs.a
-
 libbsc_a_SOURCES = \
abis_nm.c \
abis_nm_vty.c \
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index feb343a..6229aa2 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -56,7 +56,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/src/libbsc/net_init.c b/src/libbsc/net_init.c
index c5c7c5e..90f668f 100644
--- a/src/libbsc/net_init.c
+++ b/src/libbsc/net_init.c
@@ -17,7 +17,6 @@
  *
  */
 
-#include 
 #include 
 #include 
 #include 
diff --git a/src/libcommon-cs/Makefile.am b/src/libcommon-cs/Makefile.am
deleted file mode 100644
index e549509..000
--- a/src/libcommon-cs/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-AM_CPPFLAGS = \
-   $(all_includes) \
-   -I$(top_srcdir)/include \
-   -I$(top_builddir) \
-   $(NULL)
-
-AM_CFLAGS = \
-   -Wall \
-   $(LIBOSMOCORE_CFLAGS) \
-   $(LIBOSMOGSM_CFLAGS) \
-   $(LIBOSMOVTY_CFLAGS) \
-   $(LIBOSMOABIS_CFLAGS) \
-   $(LIBOSMOSIGTRAN_CFLAGS) \
-   $(COVERAGE_CFLAGS) \
-   $(NULL)
-
-noinst_LIBRARIES = libcommon-cs.a
-
-libcommon_cs_a_SOURCES = \
-   common_cs.c \
-   common_cs_vty.c
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
deleted file mode 100644
index 9307f63..000
--- a/src/libcommon-cs/common_cs.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Code used by both libbsc and libmsc (common_cs means "BSC or MSC").
- *
- * (C) 2016 by sysmocom s.m.f.c. 
- * (C) 200

[PATCH] osmo-bsc[master]: libcommon_cs: move gsm48 bits to libbsc

2018-02-13 Thread Neels Hofmeyr

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

libcommon_cs: move gsm48 bits to libbsc

These functions were originally shared between libmsc and libbsc in the old
openbsc.git; now osmo-bsc.git has its own copies, so move them into libbsc.

Change-Id: Ie411c2ce8008accee54782a442d6361e50777a54
---
M include/osmocom/bsc/common_cs.h
M include/osmocom/bsc/gsm_04_08_utils.h
M src/libbsc/gsm_04_08_utils.c
M src/libcommon-cs/common_cs.c
4 files changed, 63 insertions(+), 62 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/40/6440/1

diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h
index 432d4d5..dccc7b5 100644
--- a/include/osmocom/bsc/common_cs.h
+++ b/include/osmocom/bsc/common_cs.h
@@ -19,9 +19,3 @@
 int common_cs_vty_init(struct gsm_network *network,
  int (* config_write_net )(struct vty *));
 struct gsm_network *gsmnet_from_vty(struct vty *v);
-
-struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value);
-int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, 
uint8_t *mi_type);
-int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length,
-   char *mi_string, uint8_t *mi_type);
-struct msgb *gsm48_create_loc_upd_rej(uint8_t cause);
diff --git a/include/osmocom/bsc/gsm_04_08_utils.h 
b/include/osmocom/bsc/gsm_04_08_utils.h
index 625f173..34979ab 100644
--- a/include/osmocom/bsc/gsm_04_08_utils.h
+++ b/include/osmocom/bsc/gsm_04_08_utils.h
@@ -22,6 +22,12 @@
 int gsm48_tx_mm_serv_rej(struct gsm_subscriber_connection *conn,
 enum gsm48_reject_value value);
 
+struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value);
+int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, 
uint8_t *mi_type);
+int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length,
+   char *mi_string, uint8_t *mi_type);
+struct msgb *gsm48_create_loc_upd_rej(uint8_t cause);
+
 #define GSM48_ALLOC_SIZE2048
 #define GSM48_ALLOC_HEADROOM256
 
diff --git a/src/libbsc/gsm_04_08_utils.c b/src/libbsc/gsm_04_08_utils.c
index 85eb7b5..3004e5d 100644
--- a/src/libbsc/gsm_04_08_utils.c
+++ b/src/libbsc/gsm_04_08_utils.c
@@ -636,3 +636,60 @@
 
return gsm0808_submit_dtap(conn, msg, 0, 0);
 }
+
+struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value)
+{
+   struct msgb *msg;
+   struct gsm48_hdr *gh;
+
+   msg = gsm48_msgb_alloc_name("GSM 04.08 SERV REJ");
+   if (!msg)
+   return NULL;
+
+   gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
+   gh->proto_discr = GSM48_PDISC_MM;
+   gh->msg_type = GSM48_MT_MM_CM_SERV_REJ;
+   gh->data[0] = value;
+
+   return msg;
+}
+
+struct msgb *gsm48_create_loc_upd_rej(uint8_t cause)
+{
+   struct gsm48_hdr *gh;
+   struct msgb *msg;
+
+   msg = gsm48_msgb_alloc_name("GSM 04.08 LOC UPD REJ");
+   if (!msg)
+   return NULL;
+
+   gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
+   gh->proto_discr = GSM48_PDISC_MM;
+   gh->msg_type = GSM48_MT_MM_LOC_UPD_REJECT;
+   gh->data[0] = cause;
+   return msg;
+}
+
+int gsm48_extract_mi(uint8_t *classmark2_lv, int length, char *mi_string, 
uint8_t *mi_type)
+{
+   /* Check the size for the classmark */
+   if (length < 1 + *classmark2_lv)
+   return -1;
+
+   uint8_t *mi_lv = classmark2_lv + *classmark2_lv + 1;
+   if (length < 2 + *classmark2_lv + mi_lv[0])
+   return -2;
+
+   *mi_type = mi_lv[1] & GSM_MI_TYPE_MASK;
+   return gsm48_mi_to_string(mi_string, GSM48_MI_SIZE, mi_lv+1, *mi_lv);
+}
+
+int gsm48_paging_extract_mi(struct gsm48_pag_resp *resp, int length,
+   char *mi_string, uint8_t *mi_type)
+{
+   static const uint32_t classmark_offset =
+   offsetof(struct gsm48_pag_resp, classmark2);
+   uint8_t *classmark2_lv = (uint8_t *) &resp->classmark2;
+   return gsm48_extract_mi(classmark2_lv, length - classmark_offset,
+   mi_string, mi_type);
+}
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
index 0520e96..9307f63 100644
--- a/src/libcommon-cs/common_cs.c
+++ b/src/libcommon-cs/common_cs.c
@@ -30,59 +30,3 @@
 #include 
 #include 
 
-struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value)
-{
-   struct msgb *msg;
-   struct gsm48_hdr *gh;
-
-   msg = gsm48_msgb_alloc_name("GSM 04.08 SERV REJ");
-   if (!msg)
-   return NULL;
-
-   gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh) + 1);
-   gh->proto_discr = GSM48_PDISC_MM;
-   gh->msg_type = GSM48_MT_MM_CM_SERV_REJ;
-   gh->data[0] = value;
-
-   return msg;
-}
-
-struct msgb *gsm48_create_loc_upd_rej(uint8_t cause)
-{
-   struct gsm48_hdr *gh;
-   struct msgb *msg;
-
-   msg = gsm48_msgb_alloc_name("GSM 04.08 LOC UPD REJ");
-   if

[PATCH] osmo-bsc[master]: temp dev: make osmo-bsc_nat compile

2018-02-13 Thread Neels Hofmeyr

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

temp dev: make osmo-bsc_nat compile

Change-Id: I165499762956b95ebd77c7670dc0ba0d03df59c6
---
M configure.ac
M src/Makefile.am
M src/osmo-bsc_nat/Makefile.am
M src/osmo-bsc_nat/bsc_nat.c
4 files changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/27/6427/1

diff --git a/configure.ac b/configure.ac
index d756970..74b4fd3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,6 +153,7 @@
 src/libfilter/Makefile
 src/libcommon-cs/Makefile
 src/osmo-bsc/Makefile
+src/osmo-bsc_nat/Makefile
 src/ipaccess/Makefile
 src/utils/Makefile
 tests/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 637272d..d40ab51 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,4 +32,5 @@
utils \
ipaccess \
osmo-bsc \
+   osmo-bsc_nat \
$(NULL)
diff --git a/src/osmo-bsc_nat/Makefile.am b/src/osmo-bsc_nat/Makefile.am
index a941b58..6ca4ac0 100644
--- a/src/osmo-bsc_nat/Makefile.am
+++ b/src/osmo-bsc_nat/Makefile.am
@@ -10,6 +10,7 @@
$(LIBOSMOGSM_CFLAGS) \
$(LIBOSMOVTY_CFLAGS) \
$(LIBOSMOCTRL_CFLAGS) \
+   $(LIBOSMOABIS_CFLAGS) \
$(LIBOSMOSCCP_CFLAGS) \
$(LIBOSMOLEGACYMGCP_CFLAGS) \
$(COVERAGE_CFLAGS) \
@@ -47,7 +48,9 @@
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOVTY_LIBS) \
$(LIBOSMOCTRL_LIBS) \
+   $(LIBOSMOABIS_LIBS) \
$(LIBOSMOSIGTRAN_LIBS) \
+   $(LIBOSMOLEGACYMGCP_LIBS) \
$(LIBRARY_GSM) \
-lrt \
$(NULL)
diff --git a/src/osmo-bsc_nat/bsc_nat.c b/src/osmo-bsc_nat/bsc_nat.c
index 5569d2f..411ec83 100644
--- a/src/osmo-bsc_nat/bsc_nat.c
+++ b/src/osmo-bsc_nat/bsc_nat.c
@@ -1733,3 +1733,5 @@
 
return 0;
 }
+
+struct bsc_msc_data *osmo_msc_data_find(struct gsm_network *net, int nr) { 
return NULL; }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I165499762956b95ebd77c7670dc0ba0d03df59c6
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: libcommon: eliminate bsc_version.h

2018-02-13 Thread Neels Hofmeyr

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

libcommon: eliminate bsc_version.h

Move the copyright string into osmo_bsc_main.c. No other users of it exist.

Change-Id: I7f48924f484e4e4b98be4ca8bee253e6ea9c0576
---
M src/libcommon/Makefile.am
D src/libcommon/bsc_version.c
M src/osmo-bsc/osmo_bsc_main.c
3 files changed, 7 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/28/6428/1

diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 9f7e7b9..af578a2 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -20,7 +20,6 @@
$(NULL)
 
 libcommon_a_SOURCES = \
-   bsc_version.c \
common_vty.c \
debug.c \
gsm_data.c \
diff --git a/src/libcommon/bsc_version.c b/src/libcommon/bsc_version.c
deleted file mode 100644
index f0369bf..000
--- a/src/libcommon/bsc_version.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Hold the copyright and version string */
-/* (C) 2010-2016 by Harald Welte 
- * All Rights Reserved
- *
- * 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 "../../bscconfig.h"
-
-const char *openbsc_copyright =
-   "Copyright (C) 2008-2016 Harald Welte, Holger Freyther\r\n"
-   "Contributions by Daniel Willmann, Jan Lübbe, Stefan Schmidt\r\n"
-   "Dieter Spaar, Andreas Eversberg, Sylvain Munaut, Neels Hofmeyr\r\n\r\n"
-   "License AGPLv3+: GNU AGPL version 3 or later 
\r\n"
-   "This is free software: you are free to change and redistribute it.\r\n"
-   "There is NO WARRANTY, to the extent permitted by law.\r\n";
-
-
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 1aff4c5..626f257 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -62,7 +62,6 @@
 struct gsm_network *bsc_gsmnet = 0;
 static const char *config_file = "osmo-bsc.cfg";
 static const char *rf_ctrl = NULL;
-extern const char *openbsc_copyright;
 static int daemonize = 0;
 static struct llist_head access_lists;
 
@@ -151,6 +150,13 @@
 
 static struct vty_app_info vty_info = {
.name   = "OsmoBSC",
+   .copyright  =
+   "Copyright (C) 2008-2018 Harald Welte, Holger Freyther\r\n"
+   "Contributions by Daniel Willmann, Jan Lübbe, Stefan Schmidt\r\n"
+   "Dieter Spaar, Andreas Eversberg, Sylvain Munaut, Neels Hofmeyr\r\n\r\n"
+   "License AGPLv3+: GNU AGPL version 3 or later 
\r\n"
+   "This is free software: you are free to change and redistribute it.\r\n"
+   "There is NO WARRANTY, to the extent permitted by law.\r\n",
.version= PACKAGE_VERSION,
.go_parent_cb   = bsc_vty_go_parent,
.is_config_node = bsc_vty_is_config_node,
@@ -217,7 +223,6 @@
/* enable filters */
 
/* This needs to precede handle_options() */
-   vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
bsc_vty_init(bsc_gsmnet);
bsc_msg_lst_vty_init(tall_bsc_ctx, &access_lists, BSC_NODE);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f48924f484e4e4b98be4ca8bee253e6ea9c0576
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: libcommon-cs: move vty bits to libbsc/bsc_vty.c

2018-02-13 Thread Neels Hofmeyr

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

libcommon-cs: move vty bits to libbsc/bsc_vty.c

The gsm_network VTY was partly shared between libmsc and libbsc in the old
openbsc.git; now osmo-bsc.git has its own copy, so merge all of it into
bsc_vty.c.

This leaves common_cs_vty.c practically empty; leave removal of the file to
later, when we drop the entire libcommon-cs in
I07d4a48af3154ee4d904686f230a51b8b8a94ff9.

Note that gsmnet_from_vty() is also already declared in bsc/vty.h.

Change-Id: I6f3a596f31762b48afed39a85a343c400826300f
---
M include/osmocom/bsc/common_cs.h
M src/libbsc/bsc_vty.c
M src/libcommon-cs/common_cs_vty.c
3 files changed, 197 insertions(+), 209 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/41/6441/1

diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h
index dccc7b5..f751a43 100644
--- a/include/osmocom/bsc/common_cs.h
+++ b/include/osmocom/bsc/common_cs.h
@@ -15,7 +15,3 @@
uint8_t key_len;
uint8_t key[MAX_A5_KEY_LEN];
 };
-
-int common_cs_vty_init(struct gsm_network *network,
- int (* config_write_net )(struct vty *));
-struct gsm_network *gsmnet_from_vty(struct vty *v);
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 3da4745..feb343a 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -115,6 +115,12 @@
{ 0, NULL }
 };
 
+struct cmd_node net_node = {
+   GSMNET_NODE,
+   "%s(config-net)# ",
+   1,
+};
+
 struct cmd_node bts_node = {
BTS_NODE,
"%s(config-net-bts)# ",
@@ -132,6 +138,20 @@
"%s(config-net-bts-trx-ts)# ",
1,
 };
+
+static struct gsm_network *vty_global_gsm_network = NULL;
+
+struct gsm_network *gsmnet_from_vty(struct vty *v)
+{
+   /* It can't hurt to force callers to continue to pass the vty instance
+* to this function, in case we'd like to retrieve the global
+* gsm_network instance from the vty at some point in the future. But
+* until then, just return the global pointer, which should have been
+* initialized by common_cs_vty_init().
+*/
+   OSMO_ASSERT(vty_global_gsm_network);
+   return vty_global_gsm_network;
+}
 
 static int dummy_config_write(struct vty *v)
 {
@@ -4269,6 +4289,167 @@
return CMD_SUCCESS;
 }
 
+#define NETWORK_STR "Configure the GSM network\n"
+#define CODE_CMD_STR "Code commands\n"
+#define NAME_CMD_STR "Name Commands\n"
+#define NAME_STR "Name to use\n"
+
+DEFUN(cfg_net,
+  cfg_net_cmd,
+  "network", NETWORK_STR)
+{
+   vty->index = gsmnet_from_vty(vty);
+   vty->node = GSMNET_NODE;
+
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_ncc,
+  cfg_net_ncc_cmd,
+  "network country code <1-999>",
+  "Set the GSM network country code\n"
+  "Country commands\n"
+  CODE_CMD_STR
+  "Network Country Code to use\n")
+{
+   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+
+   gsmnet->country_code = atoi(argv[0]);
+
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_mnc,
+  cfg_net_mnc_cmd,
+  "mobile network code <0-999>",
+  "Set the GSM mobile network code\n"
+  "Network Commands\n"
+  CODE_CMD_STR
+  "Mobile Network Code to use\n")
+{
+   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+
+   gsmnet->network_code = atoi(argv[0]);
+
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_encryption,
+  cfg_net_encryption_cmd,
+  "encryption a5 (0|1|2|3)",
+   "Encryption options\n"
+   "A5 encryption\n" "A5/0: No encryption\n"
+   "A5/1: Encryption\n" "A5/2: Export-grade Encryption\n"
+   "A5/3: 'New' Secure Encryption\n")
+{
+   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+
+   gsmnet->a5_encryption = atoi(argv[0]);
+
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_dyn_ts_allow_tch_f,
+  cfg_net_dyn_ts_allow_tch_f_cmd,
+  "dyn_ts_allow_tch_f (0|1)",
+  "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n"
+  "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n"
+  "Allow TCH/F on TCH_F_TCH_H_PDCH\n")
+{
+   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
+   gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false;
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_timezone,
+  cfg_net_timezone_cmd,
+  "timezone <-19-19> (0|15|30|45)",
+  "Set the Timezone Offset of the network\n"
+  "Timezone offset (hours)\n"
+  "Timezone offset (00 minutes)\n"
+  "Timezone offset (15 minutes)\n"
+  "Timezone offset (30 minutes)\n"
+  "Timezone offset (45 minutes)\n"
+  )
+{
+   struct gsm_network *net = vty->index;
+   int tzhr = atoi(argv[0]);
+   int tzmn = atoi(argv[1]);
+
+   net->tz.hr = tzhr;
+   net->tz.mn = tzmn;
+   net->tz.dst = 0;
+   net->tz.override = 1;
+
+   return CMD_SUCCESS;
+}
+
+DEFUN(cfg_net_timezone_dst,
+  cfg_net_timezone_dst_cmd,
+  "timezone <-19-19> (0|15|30|45) <0-2>",
+  "Set the Time

[PATCH] osmo-bsc[master]: libcommon: eliminate talloc_ctx.c

2018-02-13 Thread Neels Hofmeyr

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

libcommon: eliminate talloc_ctx.c

Interestingly enough, talloc_ctx_init() actually had not a single caller.

While dropping it, see to it that the few contexts that are actually used in
osmo-bsc.git are indeed initialized in all the main scopes.

Also initialize two void* ctxts as NULL explicitly, to allocate under the NULL
context in case some main scope forgets to branch it off another root context.
(That's bsc, fle and paging, all others actually come in from other libraries.)

Change-Id: I344a3d07e146999e154824837ed95db2b9879356
---
M src/ipaccess/ipaccess-proxy.c
M src/libbsc/abis_nm.c
M src/libbsc/paging.c
M src/libcommon/Makefile.am
M src/libcommon/gsm_data.c
D src/libcommon/talloc_ctx.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc_nat/bsc_nat.c
M src/utils/bs11_config.c
9 files changed, 24 insertions(+), 56 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/32/6432/1

diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index 5cf6d6d..d44cdf2 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -121,7 +121,7 @@
 };
 
 /* some of the code against we link from OpenBSC needs this */
-void *tall_bsc_ctx;
+void *tall_bsc_ctx = NULL;
 
 static char *listen_ipaddr;
 static char *bsc_ipaddr;
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 403b94c..671c874 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -2374,7 +2374,7 @@
 
 /* BS11 SWL */
 
-void *tall_fle_ctx;
+void *tall_fle_ctx = NULL;
 
 struct abis_nm_bs11_sw {
struct gsm_bts *bts;
diff --git a/src/libbsc/paging.c b/src/libbsc/paging.c
index be272f5..825d31e 100644
--- a/src/libbsc/paging.c
+++ b/src/libbsc/paging.c
@@ -51,7 +51,7 @@
 #include 
 #include 
 
-void *tall_paging_ctx;
+void *tall_paging_ctx = NULL;
 
 #define PAGING_TIMER 0, 50
 
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index a6ef44e..3518a55 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -22,6 +22,5 @@
 libcommon_a_SOURCES = \
gsm_data.c \
gsm_data_shared.c \
-   talloc_ctx.c \
handover_cfg.c \
$(NULL)
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index 92ebbfe..3b63ad0 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -39,7 +39,7 @@
 #include 
 #include 
 
-void *tall_bsc_ctx;
+void *tall_bsc_ctx = NULL;
 
 static LLIST_HEAD(bts_models);
 
diff --git a/src/libcommon/talloc_ctx.c b/src/libcommon/talloc_ctx.c
deleted file mode 100644
index 9f64d75..000
--- a/src/libcommon/talloc_ctx.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/* OpenBSC allocation contexts initialization code */
-/* (C) 2011-2016 by sysmocom s.f.m.c. GmbH 
- * All Rights Reserved
- *
- * 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 
-
-extern void *tall_bsc_ctx;
-extern void *tall_fle_ctx;
-extern void *tall_locop_ctx;
-extern void *tall_authciphop_ctx;
-extern void *tall_gsms_ctx;
-extern void *tall_subscr_ctx;
-extern void *tall_sub_req_ctx;
-extern void *tall_call_ctx;
-extern void *tall_paging_ctx;
-extern void *tall_sigh_ctx;
-extern void *tall_tqe_ctx;
-extern void *tall_trans_ctx;
-extern void *tall_ctr_ctx;
-
-void talloc_ctx_init(void *ctx_root)
-{
-   msgb_talloc_ctx_init(ctx_root, 0);
-   tall_fle_ctx = talloc_named_const(ctx_root, 0, "bs11_file_list_entry");
-   tall_locop_ctx = talloc_named_const(ctx_root, 0, "loc_updating_oper");
-   tall_authciphop_ctx = talloc_named_const(ctx_root, 0, "auth_ciph_oper");
-   tall_gsms_ctx = talloc_named_const(ctx_root, 0, "sms");
-   tall_subscr_ctx = talloc_named_const(ctx_root, 0, "subscriber");
-   tall_call_ctx = talloc_named_const(ctx_root, 0, "gsm_call");
-   tall_paging_ctx = talloc_named_const(ctx_root, 0, "paging_request");
-   tall_sigh_ctx = talloc_named_const(ctx_root, 0, "signal_handler");
-   tall_tqe_ctx = talloc_named_const(ctx_root, 0, "subch_txq_entry");
-   tall_trans_ctx = talloc_named_const(ctx_root, 0, "transaction");
-   tall_ctr_ctx = talloc_named_const(ctx_root, 0, "counter");
-}
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 6539969..2b6dfb6 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -413,6 +413,1

[PATCH] osmo-bsc[master]: libcommon-cs: move a_reset.c into libbsc

2018-02-13 Thread Neels Hofmeyr

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

libcommon-cs: move a_reset.c into libbsc

a_reset.c was originally used by both libmsc and libbsc in the old openbsc.git
repository. Now osmo-msc.git has its own copy, and the idea of sharing
libcommon-cs is no longer applicable. Move it to libbsc where it belongs.

Change-Id: I30e4b5dab9c6d761d20a3a0e5b9ec2d65e64ebc5
---
M src/libbsc/Makefile.am
R src/libbsc/a_reset.c
M src/libcommon-cs/Makefile.am
3 files changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/37/6437/1

diff --git a/src/libbsc/Makefile.am b/src/libbsc/Makefile.am
index f03b498..e68ada8 100644
--- a/src/libbsc/Makefile.am
+++ b/src/libbsc/Makefile.am
@@ -27,6 +27,7 @@
abis_om2000.c \
abis_om2000_vty.c \
abis_rsl.c \
+   a_reset.c \
bsc_rll.c \
bsc_subscriber.c \
paging.c \
diff --git a/src/libcommon-cs/a_reset.c b/src/libbsc/a_reset.c
similarity index 100%
rename from src/libcommon-cs/a_reset.c
rename to src/libbsc/a_reset.c
diff --git a/src/libcommon-cs/Makefile.am b/src/libcommon-cs/Makefile.am
index 8cca1d7..e549509 100644
--- a/src/libcommon-cs/Makefile.am
+++ b/src/libcommon-cs/Makefile.am
@@ -17,6 +17,5 @@
 noinst_LIBRARIES = libcommon-cs.a
 
 libcommon_cs_a_SOURCES = \
-   a_reset.c \
common_cs.c \
common_cs_vty.c

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I30e4b5dab9c6d761d20a3a0e5b9ec2d65e64ebc5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: ipaccess-proxy: don't redefine tall_bsc_ctx

2018-02-13 Thread Neels Hofmeyr

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

ipaccess-proxy: don't redefine tall_bsc_ctx

Curiously, ipaccess-proxy.c is able to define its own tall_bsc_ctx even though
the same should already be linked from gsm_data.c. Declare it extern instead
and hence use the one from gsm_data.c.

A linking error actually occured as soon as I joined gsm_data_shared.c into
gsm_data.c, which is how my attention was drawn to this. I assume that linking
didn't necessarily pull in gsm_data.c before and a separate tall_bsc_ctx was
permitted. As soon as the next commit merges those files
(Ie247bc492efb331871d970c56700595ad3f7e201), it becomes impossible to define a
second tall_bsc_ctx in ipaccess-proxy.c.

Change-Id: I9c9c8540419876696e65a690717144d497d60fb2
---
M src/ipaccess/ipaccess-proxy.c
1 file changed, 1 insertion(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/33/6433/1

diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index d44cdf2..6a3af28 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -120,8 +120,7 @@
UDP_TO_BSC = 6,
 };
 
-/* some of the code against we link from OpenBSC needs this */
-void *tall_bsc_ctx = NULL;
+extern void *tall_bsc_ctx;
 
 static char *listen_ipaddr;
 static char *bsc_ipaddr;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c9c8540419876696e65a690717144d497d60fb2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: libcommon-cs: move gsm_network_init() into bsc_network_init()

2018-02-13 Thread Neels Hofmeyr

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

libcommon-cs: move gsm_network_init() into bsc_network_init()

Some part of the network init was common between libbsc and libmsc in the old
openbsc.git repository. Now osmo-bsc.git is independent with its own copy of
the gsm_network initialization. So move it over to libbsc.

Change-Id: I8968787a5f0b078619264f0cb42349a9bc7943af
---
M include/osmocom/bsc/common_cs.h
M src/libbsc/net_init.c
M src/libcommon-cs/common_cs.c
3 files changed, 15 insertions(+), 38 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/38/6438/1

diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h
index c2e8515..432d4d5 100644
--- a/include/osmocom/bsc/common_cs.h
+++ b/include/osmocom/bsc/common_cs.h
@@ -16,10 +16,6 @@
uint8_t key[MAX_A5_KEY_LEN];
 };
 
-struct gsm_network *gsm_network_init(void *ctx,
-uint16_t country_code,
-uint16_t network_code);
-
 int common_cs_vty_init(struct gsm_network *network,
  int (* config_write_net )(struct vty *));
 struct gsm_network *gsmnet_from_vty(struct vty *v);
diff --git a/src/libbsc/net_init.c b/src/libbsc/net_init.c
index 435c0ce..4fa59ed 100644
--- a/src/libbsc/net_init.c
+++ b/src/libbsc/net_init.c
@@ -45,7 +45,21 @@
 {
struct gsm_network *net;
 
-   net = gsm_network_init(ctx, country_code, network_code);
+   net = talloc_zero(ctx, struct gsm_network);
+   if (!net)
+   return NULL;
+
+   net->country_code = country_code;
+   net->network_code = network_code;
+
+   /* Use 30 min periodic update interval as sane default */
+   net->t3212 = 5;
+
+   INIT_LLIST_HEAD(&net->trans_list);
+   INIT_LLIST_HEAD(&net->subscr_conns);
+
+   net->bsc_subscribers = talloc_zero(net, struct llist_head);
+   INIT_LLIST_HEAD(net->bsc_subscribers);
 
net->bsc_data = talloc_zero(net, struct osmo_bsc_data);
if (!net->bsc_data) {
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
index 39df45e..0520e96 100644
--- a/src/libcommon-cs/common_cs.c
+++ b/src/libcommon-cs/common_cs.c
@@ -30,39 +30,6 @@
 #include 
 #include 
 
-/* Warning: if bsc_network_init() is not called, some of the members of
- * gsm_network are not initialized properly and must not be used! (In
- * particular the llist heads and stats counters.)
- * The long term aim should be to have entirely separate structs for libbsc and
- * libmsc with some common general items.
- */
-struct gsm_network *gsm_network_init(void *ctx,
-uint16_t country_code,
-uint16_t network_code)
-{
-   struct gsm_network *net;
-
-   net = talloc_zero(ctx, struct gsm_network);
-   if (!net)
-   return NULL;
-
-   net->country_code = country_code;
-   net->network_code = network_code;
-
-   /* Use 30 min periodic update interval as sane default */
-   net->t3212 = 5;
-
-   INIT_LLIST_HEAD(&net->trans_list);
-   INIT_LLIST_HEAD(&net->subscr_conns);
-
-   net->bsc_subscribers = talloc_zero(net, struct llist_head);
-   INIT_LLIST_HEAD(net->bsc_subscribers);
-
-   net->dyn_ts_allow_tch_f = true;
-
-   return net;
-}
-
 struct msgb *gsm48_create_mm_serv_rej(enum gsm48_reject_value value)
 {
struct msgb *msg;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8968787a5f0b078619264f0cb42349a9bc7943af
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: gsm_network: drop unused subscr_epxire_timer

2018-02-13 Thread Neels Hofmeyr

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

gsm_network: drop unused subscr_epxire_timer

Change-Id: I2e34ffb35e244472f8bfc993facc8d6e130f10d9
---
M include/osmocom/bsc/gsm_data.h
1 file changed, 0 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/45/6445/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index fc745a2..3da4fff 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1169,9 +1169,6 @@
int T3122;
int T3141;
 
-   /* timer to expire old location updates */
-   struct osmo_timer_list subscr_expire_timer;
-
enum gsm_chan_t ctype_by_chreq[_NUM_CHREQ_T];
 
/* Use a TCH for handling requests of type paging any */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2e34ffb35e244472f8bfc993facc8d6e130f10d9
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: drop unused common.h

2018-02-13 Thread Neels Hofmeyr

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

drop unused common.h

Change-Id: I7cf4076d7e36ae71d88e70a86d5c2d0640c1146f
---
M include/osmocom/bsc/Makefile.am
D include/osmocom/bsc/common.h
M include/osmocom/bsc/gsm_data.h
3 files changed, 0 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/44/6444/1

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index f975947..b996070 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -14,7 +14,6 @@
bss.h \
bts_ipaccess_nanobts_omlattr.h \
chan_alloc.h \
-   common.h \
common_bsc.h \
ctrl.h \
debug.h \
diff --git a/include/osmocom/bsc/common.h b/include/osmocom/bsc/common.h
deleted file mode 100644
index d91b3d3..000
--- a/include/osmocom/bsc/common.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-enum nsap_addr_enc {
-   NSAP_ADDR_ENC_X213,
-   NSAP_ADDR_ENC_V4RAW,
-};
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index d1a901e..fc745a2 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -15,7 +15,6 @@
 
 #include 
 
-#include 
 #include 
 
 #include 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7cf4076d7e36ae71d88e70a86d5c2d0640c1146f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: libcommon: move remaining files to libbsc

2018-02-13 Thread Neels Hofmeyr

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

libcommon: move remaining files to libbsc

Move gsm_data.c and handover_cfg.c to libbsc, where they belong.

This leaves libcommon utterly empty, and it will be dropped in a subsequent
patch (Ifa3486f04cdd5fda1e92630dfc1a5f670773bc14).

Change-Id: I6178061fa30c7e1a4c22c29d3c8f508b1033569f
---
M src/libbsc/Makefile.am
R src/libbsc/gsm_data.c
R src/libbsc/handover_cfg.c
M src/libcommon/Makefile.am
4 files changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/35/6435/1

diff --git a/src/libbsc/Makefile.am b/src/libbsc/Makefile.am
index d118f44..f03b498 100644
--- a/src/libbsc/Makefile.am
+++ b/src/libbsc/Makefile.am
@@ -37,6 +37,7 @@
bts_unknown.c \
bts_sysmobts.c \
chan_alloc.c \
+   gsm_data.c \
handover_decision.c \
handover_logic.c \
meas_rep.c \
@@ -58,5 +59,6 @@
bsc_dyn_ts.c \
bts_ipaccess_nanobts_omlattr.c \
handover_vty.c \
+   handover_cfg.c \
$(NULL)
 
diff --git a/src/libcommon/gsm_data.c b/src/libbsc/gsm_data.c
similarity index 100%
rename from src/libcommon/gsm_data.c
rename to src/libbsc/gsm_data.c
diff --git a/src/libcommon/handover_cfg.c b/src/libbsc/handover_cfg.c
similarity index 100%
rename from src/libcommon/handover_cfg.c
rename to src/libbsc/handover_cfg.c
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 02ec0b6..7d2542c 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -20,6 +20,5 @@
$(NULL)
 
 libcommon_a_SOURCES = \
-   gsm_data.c \
handover_cfg.c \
$(NULL)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6178061fa30c7e1a4c22c29d3c8f508b1033569f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: gsm_network: drop unused trans_list

2018-02-13 Thread Neels Hofmeyr

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

gsm_network: drop unused trans_list

Change-Id: I7910ce8098d5431e41409bf09429ae4221efb360
---
M include/osmocom/bsc/gsm_data.h
M src/libbsc/net_init.c
2 files changed, 0 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/39/6439/1

diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index a0f2114..1d12f3d 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1144,12 +1144,6 @@
 
struct rate_ctr_group *bsc_ctrs;
 
-   /*
-* TODO: Move the trans_list into the subscriber connection and
-* create a pending list for MT transactions. These exist before
-* we have a subscriber connection.
-*/
-   struct llist_head trans_list;
struct bsc_api *bsc_api;
 
unsigned int num_bts;
diff --git a/src/libbsc/net_init.c b/src/libbsc/net_init.c
index 4fa59ed..c5c7c5e 100644
--- a/src/libbsc/net_init.c
+++ b/src/libbsc/net_init.c
@@ -55,7 +55,6 @@
/* Use 30 min periodic update interval as sane default */
net->t3212 = 5;
 
-   INIT_LLIST_HEAD(&net->trans_list);
INIT_LLIST_HEAD(&net->subscr_conns);
 
net->bsc_subscribers = talloc_zero(net, struct llist_head);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7910ce8098d5431e41409bf09429ae4221efb360
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-bsc[master]: libcommon: eliminate common_vty.c

2018-02-13 Thread Neels Hofmeyr

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

libcommon: eliminate common_vty.c

Move bsc_vty_go_parent() to osmo_bsc_main.c, and greatly simplify. Since
I24cbb3f6de111f2d31110c3c484c066f1153aac9 ("VTY: implicit node exit by
de-indenting, not parent lookup") in libosmocore, the go_parent_cb no longer
needs to provide the proper transition to the parent. The VTY API now actually
remembers which is the current node's parent, as well as what its index pointer
was (i.e. no need to recover the index pointer by a switch on the node id
anymore). The only code worth keeping in the go_parent_cb is the talloc_free()
to free the OML_NODE and OM2K_NODE context when leaving it.

In bsc_nat.c, provide an essentially empty go_parent_cb: after abovementioned
commit, there still needs to be *some* go_parent_cb defined for the generic
node exit to work, even if it doesn't do anything (might be fixed later).

Change-Id: I22ebb76742e9c5ab9dd608ac089a5c558aceeb36
---
M include/osmocom/bsc/vty.h
M src/libcommon/Makefile.am
D src/libcommon/common_vty.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc_nat/bsc_nat.c
5 files changed, 54 insertions(+), 157 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/29/6429/1

diff --git a/include/osmocom/bsc/vty.h b/include/osmocom/bsc/vty.h
index f705601..daf9750 100644
--- a/include/osmocom/bsc/vty.h
+++ b/include/osmocom/bsc/vty.h
@@ -41,8 +41,6 @@
HLR_NODE,
 };
 
-extern int bsc_vty_is_config_node(struct vty *vty, int node);
-
 struct log_info;
 int bsc_vty_init(struct gsm_network *network);
 int bsc_vty_init_extra(void);
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index af578a2..1a73e6c 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -20,7 +20,6 @@
$(NULL)
 
 libcommon_a_SOURCES = \
-   common_vty.c \
debug.c \
gsm_data.c \
gsm_data_shared.c \
diff --git a/src/libcommon/common_vty.c b/src/libcommon/common_vty.c
deleted file mode 100644
index 82327d1..000
--- a/src/libcommon/common_vty.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* OpenBSC VTY common helpers */
-/* (C) 2009-2010 by Harald Welte 
- * (C) 2009-2010 by Holger Hans Peter Freyther
- * All Rights Reserved
- *
- * 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 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-
-int bsc_vty_go_parent(struct vty *vty)
-{
-   switch (vty->node) {
-   case GSMNET_NODE:
-   vty->node = CONFIG_NODE;
-   vty->index = NULL;
-   break;
-   case BTS_NODE:
-   vty->node = GSMNET_NODE;
-   {
-   /* set vty->index correctly ! */
-   struct gsm_bts *bts = vty->index;
-   vty->index = bts->network;
-   vty->index_sub = NULL;
-   }
-   break;
-   case TRX_NODE:
-   vty->node = BTS_NODE;
-   {
-   /* set vty->index correctly ! */
-   struct gsm_bts_trx *trx = vty->index;
-   vty->index = trx->bts;
-   vty->index_sub = &trx->bts->description;
-   }
-   break;
-   case TS_NODE:
-   vty->node = TRX_NODE;
-   {
-   /* set vty->index correctly ! */
-   struct gsm_bts_trx_ts *ts = vty->index;
-   vty->index = ts->trx;
-   vty->index_sub = &ts->trx->description;
-   }
-   break;
-   case OML_NODE:
-   case OM2K_NODE:
-   vty->node = ENABLE_NODE;
-   /* NOTE: this only works because it's not part of the config
-* tree, where outer commands are searched via vty_go_parent()
-* and only (!) executed when a matching one is found.
-*/
-   talloc_free(vty->index);
-   vty->index = NULL;
-   break;
-   case OM2K_CON_GROUP_NODE:
-   vty->node = BTS_NODE;
-   {
-   struct con_group *cg = vty->index;
-   struct gsm_bts *bts = cg->bts;
-   vty->index = bts;
-   

[PATCH] osmo-bsc[master]: libcommon: eliminate debug.c

2018-02-13 Thread Neels Hofmeyr

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

libcommon: eliminate debug.c

Provide concise log categories for each main scope.

Move the complete log categories 1:1 to osmo_bsc_main.c.

In bsc_nat.c, omit obviously unused log categories.

In tests, omit almost all log categories, except for those explicitly tested as
the expected output.

Note: should any logging occur for a log category that is omitted by accident,
such will end up being logged as DLGLOBAL, so it will show up and we can fix
it, and it will not get lost silently.

Change-Id: Ib524e49ec211662e0dfde8161495a72aa8ad76cf
---
M include/osmocom/bsc/debug.h
M src/ipaccess/ipaccess-config.c
M src/ipaccess/ipaccess-proxy.c
M src/libcommon/Makefile.am
D src/libcommon/debug.c
M src/osmo-bsc/osmo_bsc_main.c
M src/osmo-bsc_nat/bsc_nat.c
M src/utils/bs11_config.c
M tests/abis/abis_test.c
M tests/bsc-nat-trie/bsc_nat_trie_test.c
M tests/bsc-nat/bsc_nat_test.c
M tests/bsc/bsc_test.c
M tests/bssap/bssap_test.c
M tests/channel/channel_test.c
M tests/gsm0408/gsm0408_test.c
M tests/nanobts_omlattr/nanobts_omlattr_test.c
M tests/subscr/bsc_subscr_test.c
17 files changed, 373 insertions(+), 243 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/30/6430/1

diff --git a/include/osmocom/bsc/debug.h b/include/osmocom/bsc/debug.h
index 131ae8a..b9295a0 100644
--- a/include/osmocom/bsc/debug.h
+++ b/include/osmocom/bsc/debug.h
@@ -44,5 +44,3 @@
DSIGTRAN,
Debug_LastEntry,
 };
-
-extern const struct log_info log_info;
diff --git a/src/ipaccess/ipaccess-config.c b/src/ipaccess/ipaccess-config.c
index 957a5bb..7e8cafd 100644
--- a/src/ipaccess/ipaccess-config.c
+++ b/src/ipaccess/ipaccess-config.c
@@ -838,6 +838,20 @@
 
 extern void bts_model_nanobts_init();
 
+static const struct log_info_cat log_categories[] = {
+   [DNM] = {
+   .name = "DNM",
+   .description = "A-bis Network Management / O&M (NM/OML)",
+   .color = "\033[1;36m",
+   .enabled = 1, .loglevel = LOGL_INFO,
+   },
+};
+
+static const struct log_info log_info = {
+   .cat = log_categories,
+   .num_cat = ARRAY_SIZE(log_categories),
+};
+
 int main(int argc, char **argv)
 {
struct gsm_bts *bts;
diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index b45b543..40749ee 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -1200,6 +1200,20 @@
}
 }
 
+static const struct log_info_cat log_categories[] = {
+   [DMM] = {
+   .name = "DMM",
+   .description = "Layer3 Mobility Management (MM)",
+   .color = "\033[1;33m",
+   .enabled = 1, .loglevel = LOGL_NOTICE,
+   },
+};
+
+const struct log_info log_info = {
+   .cat = log_categories,
+   .num_cat = ARRAY_SIZE(log_categories),
+};
+
 int main(int argc, char **argv)
 {
int rc;
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 1a73e6c..1f7f5c4 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -20,7 +20,6 @@
$(NULL)
 
 libcommon_a_SOURCES = \
-   debug.c \
gsm_data.c \
gsm_data_shared.c \
socket.c \
diff --git a/src/libcommon/debug.c b/src/libcommon/debug.c
deleted file mode 100644
index b5a490b..000
--- a/src/libcommon/debug.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* OpenBSC Debugging/Logging support code */
-
-/* (C) 2008-2010 by Harald Welte 
- * (C) 2008 by Holger Hans Peter Freyther 
- * All Rights Reserved
- *
- * 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 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* default categories */
-static const struct log_info_cat default_categories[] = {
-   [DRLL] = {
-   .name = "DRLL",
-   .description = "A-bis Radio Link Layer (RLL)",
-   .color = "\033[1;31m",
-   .enabled = 1, .loglevel = LOGL_NOTICE,
-   },
-   [DCC] = {
-   .name = "DCC",
-   .description = "Layer3 Call Control (CC)",
-   .color = "\033[1;32m",
-   .enabled = 1, .loglevel = LOGL_NOTICE,
-   },
-   [DMM] = {
-   .name = "DMM",
-   .description = "Layer3 Mobility Man

[PATCH] osmo-bsc[master]: drop libcommon completely

2018-02-13 Thread Neels Hofmeyr

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

drop libcommon completely

Change-Id: Ifa3486f04cdd5fda1e92630dfc1a5f670773bc14
---
M configure.ac
M src/Makefile.am
M src/ipaccess/Makefile.am
D src/libcommon/Makefile.am
M src/osmo-bsc/Makefile.am
M src/osmo-bsc_nat/Makefile.am
M src/utils/Makefile.am
M tests/abis/Makefile.am
M tests/bsc-nat-trie/Makefile.am
M tests/bsc-nat/Makefile.am
M tests/bsc/Makefile.am
M tests/bssap/Makefile.am
M tests/channel/Makefile.am
M tests/gsm0408/Makefile.am
M tests/nanobts_omlattr/Makefile.am
M tests/subscr/Makefile.am
16 files changed, 1 insertion(+), 42 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/36/6436/1

diff --git a/configure.ac b/configure.ac
index 74b4fd3..3356229 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,7 +149,6 @@
 include/osmocom/bsc/Makefile
 src/Makefile
 src/libbsc/Makefile
-src/libcommon/Makefile
 src/libfilter/Makefile
 src/libcommon-cs/Makefile
 src/osmo-bsc/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index d40ab51..814571f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,7 +21,6 @@
 
 # Libraries
 SUBDIRS = \
-   libcommon \
libcommon-cs \
libbsc \
libfilter \
diff --git a/src/ipaccess/Makefile.am b/src/ipaccess/Makefile.am
index b3b2b8c..0301d3a 100644
--- a/src/ipaccess/Makefile.am
+++ b/src/ipaccess/Makefile.am
@@ -30,7 +30,6 @@
 
 abisip_find_LDADD = \
$(top_builddir)/src/libbsc/libbsc.a \
-   $(top_builddir)/src/libcommon/libcommon.a \
$(OSMO_LIBS) \
$(NULL)
 
@@ -48,7 +47,6 @@
 ipaccess_config_LDADD = \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
-   $(top_builddir)/src/libcommon/libcommon.a \
$(OSMO_LIBS) \
$(NULL)
 
@@ -58,6 +56,5 @@
 
 ipaccess_proxy_LDADD = \
$(top_builddir)/src/libbsc/libbsc.a \
-   $(top_builddir)/src/libcommon/libcommon.a \
$(OSMO_LIBS) \
$(NULL)
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
deleted file mode 100644
index 7d2542c..000
--- a/src/libcommon/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-AM_CPPFLAGS = \
-   $(all_includes) \
-   -I$(top_srcdir)/include \
-   -I$(top_builddir) \
-   $(NULL)
-
-AM_CFLAGS = \
-   -Wall \
-   $(LIBOSMOCORE_CFLAGS) \
-   $(LIBOSMOGSM_CFLAGS) \
-   $(LIBOSMOVTY_CFLAGS) \
-   $(LIBOSMOABIS_CFLAGS) \
-   $(LIBOSMOSIGTRAN_CFLAGS) \
-   $(LIBOSMOLEGACYMGCP_CFLAGS) \
-   $(COVERAGE_CFLAGS) \
-   $(NULL)
-
-noinst_LIBRARIES = \
-   libcommon.a \
-   $(NULL)
-
-libcommon_a_SOURCES = \
-   handover_cfg.c \
-   $(NULL)
diff --git a/src/osmo-bsc/Makefile.am b/src/osmo-bsc/Makefile.am
index 7978852..50f9c78 100644
--- a/src/osmo-bsc/Makefile.am
+++ b/src/osmo-bsc/Makefile.am
@@ -43,7 +43,6 @@
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
-   $(top_builddir)/src/libcommon/libcommon.a \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOVTY_LIBS) \
diff --git a/src/osmo-bsc_nat/Makefile.am b/src/osmo-bsc_nat/Makefile.am
index 6ca4ac0..558deb6 100644
--- a/src/osmo-bsc_nat/Makefile.am
+++ b/src/osmo-bsc_nat/Makefile.am
@@ -42,7 +42,6 @@
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
-   $(top_builddir)/src/libcommon/libcommon.a \
$(LIBOSMOSCCP_LIBS) \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am
index 78d4965..354f2b2 100644
--- a/src/utils/Makefile.am
+++ b/src/utils/Makefile.am
@@ -49,7 +49,6 @@
 bs11_config_LDADD = \
$(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
-   $(top_builddir)/src/libcommon/libcommon.a \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(LIBOSMOABIS_LIBS) \
@@ -115,7 +114,7 @@
$(NULL)
 
 meas_json_LDADD = \
-   $(top_builddir)/src/libcommon/libcommon.a \
+   $(top_builddir)/src/libbsc/libbsc.a \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOGSM_LIBS) \
$(NULL)
diff --git a/tests/abis/Makefile.am b/tests/abis/Makefile.am
index 137321c..1e982af 100644
--- a/tests/abis/Makefile.am
+++ b/tests/abis/Makefile.am
@@ -26,7 +26,6 @@
 
 abis_test_LDADD = \
$(top_builddir)/src/libbsc/libbsc.a \
-   $(top_builddir)/src/libcommon/libcommon.a \
$(top_builddir)/src/libcommon-cs/libcommon-cs.a \
$(LIBOSMOCORE_LIBS) \
$(LIBOSMOABIS_LIBS) \
diff --git a/tests/bsc-nat-trie/Makefile.am b/tests/bsc-nat-trie/Makefile.am
index d20bd0a..4afa1a4 100644
--- a/tests/bsc-nat-trie/Makefile.am
+++ b/tests/bsc-nat-trie/Makefile.am
@@ -11,7 +11,6 @@
 bsc_nat_trie_test_SOURCES = bsc_nat_trie_test.c \
   

[PATCH] osmo-bsc[master]: libcommon: eliminate socket.c

2018-02-13 Thread Neels Hofmeyr

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

libcommon: eliminate socket.c

Replace calls to make_sock() with osmo_sock_init_ofd().
Shame on me for not testing every single one in practice, I hope for peer
review to confirm that this should be correct... Read closely please!

The IPPROTO_GRE define seems to be unused (at least in osmo-bsc.git), drop it
completely.

Change-Id: Ia6e4e0e1eed3328fa25b3b90be376d532ad0e56b
---
M include/osmocom/bsc/Makefile.am
D include/osmocom/bsc/socket.h
M src/ipaccess/ipaccess-proxy.c
M src/libcommon/Makefile.am
D src/libcommon/socket.c
M src/osmo-bsc_nat/bsc_nat.c
M src/osmo-bsc_nat/bsc_ussd.c
7 files changed, 37 insertions(+), 158 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/31/6431/1

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 699aeb3..1a43be4 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -48,7 +48,6 @@
rest_octets.h \
rs232.h \
signal.h \
-   socket.h \
system_information.h \
ussd.h \
vty.h \
diff --git a/include/osmocom/bsc/socket.h b/include/osmocom/bsc/socket.h
deleted file mode 100644
index 0fd85f1..000
--- a/include/osmocom/bsc/socket.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BSC_SOCKET_H
-#define _BSC_SOCKET_H
-
-#include 
-
-#ifndef IPPROTO_GRE
-#define IPPROTO_GRE 47
-#endif
-
-int make_sock(struct osmo_fd *bfd, int proto,
- uint32_t ip, uint16_t port, int priv_nr,
- int (*cb)(struct osmo_fd *fd, unsigned int what), void *data);
-
-#endif /* _BSC_SOCKET_H */
diff --git a/src/ipaccess/ipaccess-proxy.c b/src/ipaccess/ipaccess-proxy.c
index 40749ee..5cf6d6d 100644
--- a/src/ipaccess/ipaccess-proxy.c
+++ b/src/ipaccess/ipaccess-proxy.c
@@ -47,7 +47,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 /* one instance of an ip.access protocol proxy */
@@ -369,8 +369,11 @@
 
/* Create UDP socket for BTS packet injection */
udp_port = 1 + (site_id % 1000)*100 + (bts_id % 100);
-   ret = make_sock(&ipbc->udp_bts_fd, IPPROTO_UDP, INADDR_ANY, udp_port,
-   UDP_TO_BTS, udp_fd_cb, ipbc);
+   ipbc->udp_bts_fd.priv_nr = UDP_TO_BTS;
+   ipbc->udp_bts_fd.cb = udp_fd_cb;
+   ipbc->udp_bts_fd.data = ipbc;
+   ret = osmo_sock_init_ofd(&ipbc->udp_bts_fd, AF_INET, SOCK_DGRAM, 
IPPROTO_UDP,
+NULL, udp_port, OSMO_SOCK_F_BIND);
if (ret < 0)
goto err_udp_bts;
DEBUGP(DLINP, "(%u/%u/%u) Created UDP socket for injection "
@@ -378,8 +381,11 @@
 
/* Create UDP socket for BSC packet injection */
udp_port = 2 + (site_id % 1000)*100 + (bts_id % 100);
-   ret = make_sock(&ipbc->udp_bsc_fd, IPPROTO_UDP, INADDR_ANY, udp_port,
-   UDP_TO_BSC, udp_fd_cb, ipbc);
+   ipbc->udp_bsc_fd.priv_nr = UDP_TO_BSC;
+   ipbc->udp_bsc_fd.cb = udp_fd_cb;
+   ipbc->udp_bsc_fd.data = ipbc;
+   ret = osmo_sock_init_ofd(&ipbc->udp_bsc_fd, AF_INET, SOCK_DGRAM, 
IPPROTO_UDP,
+NULL, udp_port, OSMO_SOCK_F_BIND);
if (ret < 0)
goto err_udp_bsc;
DEBUGP(DLINP, "(%u/%u/%u) Created UDP socket for injection "
@@ -390,13 +396,12 @@
if (gprs_ns_ipaddr) {
struct sockaddr_in sock;
socklen_t len = sizeof(sock);
-   struct in_addr addr;
-   uint32_t ip;
 
-   inet_aton(listen_ipaddr, &addr);
-   ip = ntohl(addr.s_addr); /* make_sock() needs host byte order */
-   ret = make_sock(&ipbc->gprs_ns_fd, IPPROTO_UDP, ip, 0, 0,
-   gprs_ns_cb, ipbc);
+   ipbc->gprs_ns_fd.priv_nr = 0;
+   ipbc->gprs_ns_fd.cb = gprs_ns_cb;
+   ipbc->gprs_ns_fd.data = ipbc;
+   ret = osmo_sock_init_ofd(&ipbc->gprs_ns_fd, AF_INET, 
SOCK_DGRAM, IPPROTO_UDP,
+listen_ipaddr, 0, OSMO_SOCK_F_BIND);
if (ret < 0) {
LOGP(DLINP, LOGL_ERROR, "Creating the GPRS socket 
failed.\n");
goto err_udp_bsc;
@@ -1062,15 +1067,18 @@
osmo_timer_setup(&ipp->reconn_timer, reconn_tmr_cb, ipp);
 
/* Listen for OML connections */
-   ret = make_sock(&ipp->oml_listen_fd, IPPROTO_TCP, INADDR_ANY,
-   IPA_TCP_PORT_OML, OML_FROM_BTS, listen_fd_cb, NULL);
+   ipp->oml_listen_fd.priv_nr = OML_FROM_BTS;
+   ipp->oml_listen_fd.cb = listen_fd_cb;
+   ret = osmo_sock_init_ofd(&ipp->oml_listen_fd, AF_INET, SOCK_STREAM, 
IPPROTO_TCP,
+NULL, IPA_TCP_PORT_OML, OSMO_SOCK_F_BIND);
if (ret < 0)
return ret;
 
/* Listen for RSL connections */
-   ret = make_sock(&ipp->rsl_listen_fd, IPPROTO_TCP, INADDR_ANY,
-   IPA_TCP_PORT_RSL, RSL_FROM_BTS

[PATCH] osmo-bsc[master]: libcommon: join gsm_data_shared.* into gsm_data.*

2018-02-13 Thread Neels Hofmeyr

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

libcommon: join gsm_data_shared.* into gsm_data.*

The separation of gsm_data_shared.* from gsm_data.* historically allowed
compiling parts of it into osmo-bts, which we have dropped since (osmo-bts has
its own copy now). Even though gsm_data.* now becomes rather large by it,
remove the legacy separation to get rid of the "shared" naming, which is no
longer meaningful. A future patch might separate into meaningful smaller bits,
if we get the time.

Change-Id: Ie247bc492efb331871d970c56700595ad3f7e201
---
M include/osmocom/bsc/Makefile.am
M include/osmocom/bsc/e1_config.h
M include/osmocom/bsc/gsm_data.h
D include/osmocom/bsc/gsm_data_shared.h
M src/libcommon/Makefile.am
M src/libcommon/gsm_data.c
D src/libcommon/gsm_data_shared.c
M src/utils/meas_json.c
M tests/bssap/bssap_test.c
M tests/gsm0408/gsm0408_test.c
10 files changed, 1,736 insertions(+), 1,794 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/34/6434/1

diff --git a/include/osmocom/bsc/Makefile.am b/include/osmocom/bsc/Makefile.am
index 1a43be4..c503a50 100644
--- a/include/osmocom/bsc/Makefile.am
+++ b/include/osmocom/bsc/Makefile.am
@@ -23,7 +23,6 @@
gsm_04_08_utils.h \
gsm_04_80.h \
gsm_data.h \
-   gsm_data_shared.h \
handover.h \
handover_cfg.h \
handover_decision.h \
diff --git a/include/osmocom/bsc/e1_config.h b/include/osmocom/bsc/e1_config.h
index 909e3cc..d8d23c3 100644
--- a/include/osmocom/bsc/e1_config.h
+++ b/include/osmocom/bsc/e1_config.h
@@ -1,7 +1,9 @@
 #ifndef _E1_CONFIG_H
 #define _E1_CONFIG_H
 
-#include 
+struct gsm_bts_trx_ts;
+struct gsm_bts_trx;
+struct gsm_bts;
 
 int e1_reconfig_ts(struct gsm_bts_trx_ts *ts);
 int e1_reconfig_trx(struct gsm_bts_trx *trx);
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 9a35ca9..a0f2114 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -5,6 +5,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -17,6 +18,14 @@
 #include 
 #include 
 #include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 struct mgcp_client_conf;
 struct mgcp_client;
@@ -115,7 +124,891 @@
 };
 
 
-#include "gsm_data_shared.h"
+/* 16 is the max. number of SI2quater messages according to 3GPP TS 44.018 
Table 10.5.2.33b.1:
+   4-bit index is used (2# = 10#15) */
+#define SI2Q_MAX_NUM 16
+/* length in bits (for single SI2quater message) */
+#define SI2Q_MAX_LEN 160
+#define SI2Q_MIN_LEN 18
+
+struct osmo_bsc_data;
+
+struct osmo_bsc_sccp_con;
+
+/* Channel Request reason */
+enum gsm_chreq_reason_t {
+   GSM_CHREQ_REASON_EMERG,
+   GSM_CHREQ_REASON_PAG,
+   GSM_CHREQ_REASON_CALL,
+   GSM_CHREQ_REASON_LOCATION_UPD,
+   GSM_CHREQ_REASON_OTHER,
+   GSM_CHREQ_REASON_PDCH,
+};
+
+/* lchans 0..3 are SDCCH in combined channel configuration,
+   use 4 as magic number for BCCH hack - see osmo-bts-../oml.c:opstart_compl() 
*/
+#define CCCH_LCHAN 4
+
+#define TRX_NR_TS  8
+#define TS_MAX_LCHAN   8
+
+#define HARDCODED_ARFCN 123
+#define HARDCODED_BSIC 0x3f/* NCC = 7 / BCC = 7 */
+
+/* for multi-drop config */
+#define HARDCODED_BTS0_TS  1
+#define HARDCODED_BTS1_TS  6
+#define HARDCODED_BTS2_TS  11
+
+#define MAX_VERSION_LENGTH 64
+
+#define MAX_BTS_FEATURES 128
+
+enum gsm_hooks {
+   GSM_HOOK_NM_SWLOAD,
+   GSM_HOOK_RR_PAGING,
+   GSM_HOOK_RR_SECURITY,
+};
+
+enum gsm_paging_event {
+   GSM_PAGING_SUCCEEDED,
+   GSM_PAGING_EXPIRED,
+   GSM_PAGING_OOM,
+   GSM_PAGING_BUSY,
+};
+
+enum bts_gprs_mode {
+   BTS_GPRS_NONE = 0,
+   BTS_GPRS_GPRS = 1,
+   BTS_GPRS_EGPRS = 2,
+};
+
+struct gsm_lchan;
+struct osmo_rtp_socket;
+struct rtp_socket;
+struct bsc_api;
+
+/* Network Management State */
+struct gsm_nm_state {
+   uint8_t operational;
+   uint8_t administrative;
+   uint8_t availability;
+};
+
+struct gsm_abis_mo {
+   uint8_t obj_class;
+   uint8_t procedure_pending;
+   struct abis_om_obj_inst obj_inst;
+   const char *name;
+   struct gsm_nm_state nm_state;
+   struct tlv_parsed *nm_attr;
+   struct gsm_bts *bts;
+};
+
+/* Ericsson OM2000 Managed Object */
+struct abis_om2k_mo {
+   uint8_t class;
+   uint8_t bts;
+   uint8_t assoc_so;
+   uint8_t inst;
+} __attribute__ ((packed));
+
+struct om2k_mo {
+   struct abis_om2k_mo addr;
+   struct osmo_fsm_inst *fsm;
+};
+
+#define A38_XOR_MIN_KEY_LEN12
+#define A38_XOR_MAX_KEY_LEN16
+#define A38_COMP128_KEY_LEN16
+#define RSL_ENC_ALG_A5(x)  (x+1)
+#define MAX_EARFCN_LIST 32
+
+/* is the data link established? who established it? */
+#define LCHAN_SAPI_UNUSED  0
+#define LCHAN_SAPI_MS  1
+#define LCHAN_SAPI_NET 2
+#define LCHAN_SAPI_REL 3
+
+/* state of a logical channel */
+enum gsm_lchan_state {
+   LCHAN_S_NONE,   /* channel is n

[PATCH] osmo-bsc[master]: common_cs.h: mv gsm_encr to gsm_data.h

2018-02-13 Thread Neels Hofmeyr

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

common_cs.h: mv gsm_encr to gsm_data.h

This leaves common_cs.h practically empty. Leave its removal to the next patch,
which removes libcommon-cs entirely
(I07d4a48af3154ee4d904686f230a51b8b8a94ff9).

Change-Id: Ic3233f03580aa8c0ab178dfd33e68ecab5b9f042
---
M include/osmocom/bsc/common_cs.h
M include/osmocom/bsc/gsm_data.h
2 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/42/6442/1

diff --git a/include/osmocom/bsc/common_cs.h b/include/osmocom/bsc/common_cs.h
index f751a43..b6a8ed8 100644
--- a/include/osmocom/bsc/common_cs.h
+++ b/include/osmocom/bsc/common_cs.h
@@ -7,11 +7,3 @@
 struct gsm_network;
 
 struct vty;
-
-#define MAX_A5_KEY_LEN (128/8)
-
-struct gsm_encr {
-   uint8_t alg_id;
-   uint8_t key_len;
-   uint8_t key[MAX_A5_KEY_LEN];
-};
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 1d12f3d..8af594f 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -300,6 +300,14 @@
LCHAN_SAPI_S_ERROR,
 };
 
+#define MAX_A5_KEY_LEN (128/8)
+
+struct gsm_encr {
+   uint8_t alg_id;
+   uint8_t key_len;
+   uint8_t key[MAX_A5_KEY_LEN];
+};
+
 struct gsm_lchan {
/* The TS that we're part of */
struct gsm_bts_trx_ts *ts;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3233f03580aa8c0ab178dfd33e68ecab5b9f042
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[MERGED] osmo-ggsn[master]: Add talloc context introspection via VTY

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

Change subject: Add talloc context introspection via VTY
..


Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I460efff3a3dfa2c7d955871aca78b37552a29aff
---
M ggsn/ggsn.c
1 file changed, 3 insertions(+), 0 deletions(-)

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



diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index caf6151..df071d2 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -56,6 +56,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "../lib/tun.h"
@@ -1062,6 +1063,7 @@
 
tall_ggsn_ctx = talloc_named_const(NULL, 0, "OsmoGGSN");
msgb_talloc_ctx_init(tall_ggsn_ctx, 0);
+   g_vty_info.tall_ctx = tall_ggsn_ctx;
 
/* Handle keyboard interrupt SIGINT */
signal(SIGINT, &signal_handler);
@@ -1076,6 +1078,7 @@
 
vty_init(&g_vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(&log_info);
ggsn_vty_init();
ctrl_vty_init(tall_ggsn_ctx);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I460efff3a3dfa2c7d955871aca78b37552a29aff
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmocore[master]: talloc_ctx_vty: Fix help strings (missing \n at end of line)

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

Change subject: talloc_ctx_vty: Fix help strings (missing \n at end of line)
..


talloc_ctx_vty: Fix help strings (missing \n at end of line)

This was causing build failures in applications using this library
feature:

Documentation error (missing docs):



Documentation error (missing docs):



Documentation error (missing docs):



Documentation error (missing docs):



Change-Id: I785c852e3313d20eade79746a7cd485d2d5908ea
---
M src/vty/talloc_ctx_vty.c
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved; Verified



diff --git a/src/vty/talloc_ctx_vty.c b/src/vty/talloc_ctx_vty.c
index 601b696..e7fe675 100644
--- a/src/vty/talloc_ctx_vty.c
+++ b/src/vty/talloc_ctx_vty.c
@@ -175,7 +175,7 @@
"All contexts, if NULL-context tracking is enabled\n" \
"Display a full talloc memory hierarchy\n" \
"Display a brief talloc memory hierarchy\n" \
-   "Specify required maximal depth value"
+   "Specify required maximal depth value\n"
 
 DEFUN(show_talloc_ctx, show_talloc_ctx_cmd,
BASE_CMD_STR, BASE_CMD_DESCR)
@@ -202,7 +202,7 @@
 DEFUN(show_talloc_ctx_filter, show_talloc_ctx_filter_cmd,
BASE_CMD_STR " filter REGEXP", BASE_CMD_DESCR
"Filter chunks using regular expression\n"
-   "Regular expression")
+   "Regular expression\n")
 {
struct walk_cb_params *params;
int rc;
@@ -236,7 +236,7 @@
 DEFUN(show_talloc_ctx_tree, show_talloc_ctx_tree_cmd,
BASE_CMD_STR " tree ADDRESS", BASE_CMD_DESCR
"Display only a specific memory chunk\n"
-   "Chunk address (e.g. 0xdeadbeef)")
+   "Chunk address (e.g. 0xdeadbeef)\n")
 {
struct walk_cb_params *params;
int rc;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I785c852e3313d20eade79746a7cd485d2d5908ea
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


libosmocore[master]: talloc_ctx_vty: Fix help strings (missing \n at end of line)

2018-02-13 Thread Harald Welte

Patch Set 1: Verified+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I785c852e3313d20eade79746a7cd485d2d5908ea
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: build: Ensure all .pc files are installed

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

Change subject: build: Ensure all .pc files are installed
..


build: Ensure all .pc files are installed

Change-Id: I824e63087021adfda81bd0f867a3fdb5e9efcf7a
---
M Makefile.am
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/Makefile.am b/Makefile.am
index 5f23673..60ec1f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libosmocore.pc libosmocodec.pc libosmovty.pc libosmogsm.pc \
-libosmogb.pc libosmoctrl.pc libosmocoding.pc
+libosmogb.pc libosmoctrl.pc libosmocoding.pc libosmosim.pc
 
 @RELMAKE@
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I824e63087021adfda81bd0f867a3fdb5e9efcf7a
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: roox 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 


libosmocore[master]: build: Ensure all .pc files are installed

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I824e63087021adfda81bd0f867a3fdb5e9efcf7a
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: roox 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] libosmo-sccp[master]: build: AC_PROG_LIBTOOL is the same as LT_INIT

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

Change subject: build: AC_PROG_LIBTOOL is the same as LT_INIT
..


build: AC_PROG_LIBTOOL is the same as LT_INIT

Change-Id: I30f8d289d9dca892e40cd7ed787029fbcafa2dff
---
M configure.ac
1 file changed, 0 insertions(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/configure.ac b/configure.ac
index 5b91522..7b18db7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,6 @@
 AC_PROG_CC
 AC_PROG_INSTALL
 LT_INIT
-AC_PROG_LIBTOOL
 
 dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
 AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I30f8d289d9dca892e40cd7ed787029fbcafa2dff
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: roox 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


osmo-ggsn[master]: build: Remove AC_PROG_CXX, C++ is never used

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifda126ab2e5fdd98317e723aa6b10d964b4519c2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: roox 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


libosmo-sccp[master]: build: AC_PROG_LIBTOOL is the same as LT_INIT

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I30f8d289d9dca892e40cd7ed787029fbcafa2dff
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: roox 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[MERGED] osmo-ggsn[master]: build: Remove AC_PROG_CXX, C++ is never used

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

Change subject: build: Remove AC_PROG_CXX, C++ is never used
..


build: Remove AC_PROG_CXX, C++ is never used

Change-Id: Ifda126ab2e5fdd98317e723aa6b10d964b4519c2
---
M configure.ac
1 file changed, 0 insertions(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/configure.ac b/configure.ac
index 4fd0132..1193e46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,6 @@
 AC_PROG_INSTALL
 AC_PROG_AWK
 AC_PROG_CPP
-AC_PROG_CXX
 LT_INIT
 
 dnl check for pkg-config (explained in detail in libosmocore/configure.ac)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifda126ab2e5fdd98317e723aa6b10d964b4519c2
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: roox 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] gapk[master]: Add --enable-sanitize configure option

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

Change subject: Add --enable-sanitize configure option
..


Add --enable-sanitize configure option

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

Approvals:
  tnt: Looks good to me, but someone else must approve
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved; Verified



diff --git a/configure.ac b/configure.ac
index 180e380..018c479 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,15 @@
 # Checks for programs.
 AC_PROG_CC
 
+AC_ARG_ENABLE(sanitize,
+   [AS_HELP_STRING([--enable-sanitize], [Compile with address 
sanitizer enabled], )],
+   [sanitize=$enableval], [sanitize="no"])
+if test x"$sanitize" = x"yes"
+then
+   CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined"
+   CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
+fi
+
 # Checks for libraries.
  # libosmocore (codec module)
 PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.3.2)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibb26e5fc73843f3951dbc534653ee7d88e4c80e7
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: tnt 


gapk[master]: tests: enable / disable codec tests conditionally

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


gapk[master]: Ignore build products

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


gapk[master]: Add --enable-sanitize configure option

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2 Verified+1

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

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


[MERGED] gapk[master]: tests: enable / disable codec tests conditionally

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

Change subject: tests: enable / disable codec tests conditionally
..


tests: enable / disable codec tests conditionally

As the libosmogapk actually relies on external libraries for
audio coding, we should enable / disable particular codec
tests depending on the build configuration.

Closes: OS#2926
Change-Id: Ie4711294c43ff88b17431615883abf96d1ae02a6
---
M configure.ac
M tests/Makefile.am
A tests/atlocal.in
M tests/testsuite.at
4 files changed, 35 insertions(+), 4 deletions(-)

Approvals:
  Vadim Yanitskiy: Verified
  Harald Welte: Looks good to me, approved
  roox: Looks good to me, but someone else must approve



diff --git a/configure.ac b/configure.ac
index 180e380..8eef951 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@
include/Makefile
include/gsmhr/Makefile
libosmogapk.pc
+   tests/atlocal
tests/Makefile
 ])
 
@@ -29,9 +30,9 @@
[--disable-gsmhr],
[Disable support for GSM HR codec using reference code]
)],
-   [enable_gsmhr=0], [enable_gsmhr=1])
-AM_CONDITIONAL(ENABLE_GSMHR, test "x$enable_gsmhr" = "x1")
-if test "x$enable_gsmhr" = "x1"; then
+   [enable_gsmhr=$enableval], [enable_gsmhr="yes"])
+AM_CONDITIONAL(ENABLE_GSMHR, test "x$enable_gsmhr" = "xyes")
+if test "x$enable_gsmhr" = "xyes"; then
AM_PATH_PYTHON([2.4])
AC_DEFINE(HAVE_LIBGSMHR, 1, [Define to 1 if libgsmhr is available])
 fi
@@ -84,6 +85,11 @@
 fi
 AC_SUBST(LIBGSM_LIBS)
 
+# Conditional codec tests
+AC_SUBST(ENABLE_AMR_EFR_TESTS, [$found_opencore_amrnb])
+AC_SUBST(ENABLE_HR_TESTS, [$enable_gsmhr])
+AC_SUBST(ENABLE_FR_TESTS, [$found_libgsm])
+
 # Checks for header files.
 AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h])
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cda5c2d..f838fa4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -72,7 +72,7 @@
ref-files/* \
$(NULL)
 
-DISTCLEANFILES = atconfig
+DISTCLEANFILES = atconfig atlocal
 TESTSUITE = $(srcdir)/testsuite
 
 check-local: atconfig $(TESTSUITE)
diff --git a/tests/atlocal.in b/tests/atlocal.in
new file mode 100644
index 000..437897e
--- /dev/null
+++ b/tests/atlocal.in
@@ -0,0 +1,3 @@
+enable_amr_efr_tests='@ENABLE_AMR_EFR_TESTS@'
+enable_hr_tests='@ENABLE_HR_TESTS@'
+enable_fr_tests='@ENABLE_FR_TESTS@'
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 7367bc5..9855f5b 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -25,6 +25,7 @@
 
 AT_SETUP([conv/enc/amr_efr])
 AT_KEYWORDS([amr_efr])
+AT_CHECK([test "x$enable_amr_efr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.amr-efr > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -35,6 +36,7 @@
 
 AT_SETUP([conv/enc/gsm])
 AT_KEYWORDS([gsm])
+AT_CHECK([test "x$enable_fr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.gsm > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -45,6 +47,7 @@
 
 AT_SETUP([conv/enc/racal_hr])
 AT_KEYWORDS([racal_hr])
+AT_CHECK([test "x$enable_hr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.racal-hr > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -55,6 +58,7 @@
 
 AT_SETUP([conv/enc/racal_fr])
 AT_KEYWORDS([racal_fr])
+AT_CHECK([test "x$enable_fr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.racal-fr > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -65,6 +69,7 @@
 
 AT_SETUP([conv/enc/racal_efr])
 AT_KEYWORDS([racal_efr])
+AT_CHECK([test "x$enable_amr_efr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.racal-efr > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -75,6 +80,7 @@
 
 AT_SETUP([conv/enc/ti_hr])
 AT_KEYWORDS([ti_hr])
+AT_CHECK([test "x$enable_hr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.ti-hr > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -85,6 +91,7 @@
 
 AT_SETUP([conv/enc/ti_fr])
 AT_KEYWORDS([ti_fr])
+AT_CHECK([test "x$enable_fr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.ti-fr > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -95,6 +102,7 @@
 
 AT_SETUP([conv/enc/ti_efr])
 AT_KEYWORDS([ti_efr])
+AT_CHECK([test "x$enable_amr_efr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.ti-efr > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -105,6 +113,7 @@
 
 AT_SETUP([conv/enc/rtp_efr])
 AT_KEYWORDS([rtp_efr])
+AT_CHECK([test "x$enable_amr_efr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1_5.s16.rtp-efr > expout
 AT_CHECK([
$abs_top_builddir/src/osmo-gapk \
@@ -115,6 +124,7 @@
 
 AT_SETUP([conv/enc/rtp_hr_etsi])
 AT_KEYWORDS([rtp_hr_etsi])
+AT_CHECK([test "x$enable_hr_tests" = xyes || exit 77])
 cat $abs_srcdir/ref-files/hhgttg_part1

gapk[master]: Add basic CI integration

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

> External packages should be
 > added as build slave dependencies to ansible.

Then please document/communicate this and make sure that all existing slaves 
(as well as future ones vi ansible) have those dpeendencies installed before 
creating a related jenkins job description

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib4b36df8f010cd7e035fe5a8b846632541b655f5
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


[MERGED] osmo-ggsn[master]: sgsnemu: listen param is a host, not an interface

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

Change subject: sgsnemu: listen param is a host, not an interface
..


sgsnemu: listen param is a host, not an interface

This param is parsed by gethostbyname() and it's confusing to document
it as an interface, because users will then attempt to pass "lo" to it,
which fails.

Change-Id: Id8ef0e12ddcaf8bfd199a44de0ba4280f05d4431
---
M sgsnemu/cmdline.c
M sgsnemu/cmdline.ggo
M sgsnemu/cmdline.h
3 files changed, 6 insertions(+), 6 deletions(-)

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



diff --git a/sgsnemu/cmdline.c b/sgsnemu/cmdline.c
index 412e484..b062533 100644
--- a/sgsnemu/cmdline.c
+++ b/sgsnemu/cmdline.c
@@ -41,7 +41,7 @@
"  --pidfile=STRING  Filename of process id file\n  
(default=`./sgsnemu.pid')",
"  --statedir=STRING Directory of nonvolatile data  
(default=`./')",
"  --dns=STRING  DNS Server to use",
-   "  -l, --listen=STRING   Local interface",
+   "  -l, --listen=STRING   Local host",
"  -r, --remote=STRING   Remote host",
"  --contexts=INTNumber of contexts  (default=`1')",
"  --timelimit=INT   Exit after timelimit seconds  
(default=`0')",
@@ -1003,7 +1003,7 @@
goto failure;
 
break;
-   case 'l':   /* Local interface.  */
+   case 'l':   /* Local host.  */
 
if (update_arg((void *)&(args_info->listen_arg),
   &(args_info->listen_orig),
diff --git a/sgsnemu/cmdline.ggo b/sgsnemu/cmdline.ggo
index dec19cd..0f415f5 100644
--- a/sgsnemu/cmdline.ggo
+++ b/sgsnemu/cmdline.ggo
@@ -26,7 +26,7 @@
 option  "statedir" - "Directory of nonvolatile data"  string default="./" 
no
 
 option  "dns"  - "DNS Server to use"  string no
-option  "listen"   l "Local interface"string no
+option  "listen"   l "Local host" string no
 option  "remote"   r "Remote host"string no
 
 option  "contexts" - "Number of contexts" intdefault="1" no
diff --git a/sgsnemu/cmdline.h b/sgsnemu/cmdline.h
index 31a2085..24f772b 100644
--- a/sgsnemu/cmdline.h
+++ b/sgsnemu/cmdline.h
@@ -69,11 +69,11 @@
const char *dns_help;
/**< @brief DNS Server to use help description.  */
char *listen_arg;
-   /**< @brief Local interface.  */
+   /**< @brief Local host.  */
char *listen_orig;
-   /**< @brief Local interface original value given at 
command line.  */
+   /**< @brief Local host original value given at command 
line.  */
const char *listen_help;
-  /**< @brief Local interface help description.  */
+  /**< @brief Local host help description.  */
char *remote_arg;
/**< @brief Remote host.  */
char *remote_orig;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id8ef0e12ddcaf8bfd199a44de0ba4280f05d4431
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ggsn[master]: sgsnemu: listen param is a host, not an interface

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id8ef0e12ddcaf8bfd199a44de0ba4280f05d4431
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-ggsn[master]: sgsnemu: Fix bad ptr during context deallocation

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9e563522173a82b265e93b1ef9dc93ced40fefa2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-ggsn[master]: sgsnemu: Fix bad ptr during context deallocation

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

Change subject: sgsnemu: Fix bad ptr during context deallocation
..


sgsnemu: Fix bad ptr during context deallocation

Older commit switched pdp_t to have an array of 2 peers instead of
only one in order to accomodate for ipv4v6 contexts, which can have 2
addresses assigned. The usage of peer field was not updated in sgsnemu
accordingly, which means the wrong memory portion was being accessed.

Fixes: 2d6a69e69a4b4cb2b8cc63c4810dae44e5a4d8f6 ("Add support for IPv4v6 End 
User Addresses")

Change-Id: I9e563522173a82b265e93b1ef9dc93ced40fefa2
---
M sgsnemu/sgsnemu.c
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index cf4aa44..804b542 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -1312,8 +1312,8 @@
if (tun && options.ipdown)
tun_runscript(tun, options.ipdown);
 
-   ipdel((struct iphash_t *)pdp->peer);
-   memset(pdp->peer, 0, sizeof(struct iphash_t));  /* To be sure */
+   ipdel((struct iphash_t *)pdp->peer[0]);
+   memset(pdp->peer[0], 0, sizeof(struct iphash_t));   /* To be sure */
 
if (1 == options.contexts)
state = 5;  /* Disconnected */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9e563522173a82b265e93b1ef9dc93ced40fefa2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ggsn[master]: sgsnemu: fix: no outgoing GTP-U in "createif" mode

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

Change subject: sgsnemu: fix: no outgoing GTP-U in "createif" mode
..


sgsnemu: fix: no outgoing GTP-U in "createif" mode

in "createif" mode uplink traffic not forwarding
from tun interface into Gn, inside GTP-U.
create_pdp_conf get iphash (ipm) with pdp ==  0x0
Fix - in create_pdp_conf - instead of casting using already
definned iphash in ipset function.

Change-Id: Icd58450548b3a47cb933d70a2e3166c067552b2c
---
M sgsnemu/sgsnemu.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 630733b..cf4aa44 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -1462,7 +1462,7 @@
free(forwarding);
}
 
-   ipset((struct iphash_t *)pdp->peer, &addr);
+   ipset(iph, &addr);
 
state = 2;  /* Connected */
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icd58450548b3a47cb933d70a2e3166c067552b2c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Viktor Tsymbalyuk 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Viktor Tsymbalyuk 


osmo-ggsn[master]: sgsnemu: fix: no outgoing GTP-U in "createif" mode

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icd58450548b3a47cb933d70a2e3166c067552b2c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Viktor Tsymbalyuk 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Viktor Tsymbalyuk 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: gsmtap.h: define TETRA DMO mode channels

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

Change subject: gsmtap.h: define TETRA DMO mode channels
..


gsmtap.h: define TETRA DMO mode channels

Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
---
M include/osmocom/core/gsmtap.h
1 file changed, 5 insertions(+), 0 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved; Verified



diff --git a/include/osmocom/core/gsmtap.h b/include/osmocom/core/gsmtap.h
index 7a14ba9..b4239f8 100644
--- a/include/osmocom/core/gsmtap.h
+++ b/include/osmocom/core/gsmtap.h
@@ -112,6 +112,11 @@
 #define GSMTAP_TETRA_BNCH  0x06
 #define GSMTAP_TETRA_STCH  0x07
 #define GSMTAP_TETRA_TCH_F 0x08
+#define GSMTAP_TETRA_DMO_SCH_S 0x09
+#define GSMTAP_TETRA_DMO_SCH_H 0x0a
+#define GSMTAP_TETRA_DMO_SCH_F 0x0b
+#define GSMTAP_TETRA_DMO_STCH  0x0c
+#define GSMTAP_TETRA_DMO_TCH   0x0d
 
 /* == DO NOT MAKE UNAPPROVED MODIFICATIONS HERE = */
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: allesklar2 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: allesklar2 


libosmocore[master]: gsmtap.h: define TETRA DMO mode channels

2018-02-13 Thread Harald Welte

Patch Set 3: Code-Review+2 Verified+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I98976c0ff16a69b2508a79259ed1aeaec51e7549
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: allesklar2 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: allesklar2 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: WIP: Prepare MSC_Tests for ability to emulate two BSCs

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibe3ae6ed4181c6ba7501f5443b4f22e3c8abeb3e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-ttcn3-hacks[master]: bsc: Add VTY module to BSC_Tests

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

Change subject: bsc: Add VTY module to BSC_Tests
..


bsc: Add VTY module to BSC_Tests

Change-Id: Ia78f1231f56fc5f3b003bccc850ea109ed4ed2d8
---
M bsc/BSC_Tests.cfg
M bsc/BSC_Tests.ttcn
M bsc/gen_links.sh
M bsc/regen_makefile.sh
4 files changed, 26 insertions(+), 2 deletions(-)

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



diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index c31c9eb..44bbf61 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -12,6 +12,14 @@
 
 [TESTPORT_PARAMETERS]
 #*.*.udpReuseAddress := "yes";
+*.BSCVTY.CTRL_MODE := "client"
+*.BSCVTY.CTRL_HOSTNAME := "127.0.0.1"
+*.BSCVTY.CTRL_PORTNUM := "4242"
+*.BSCVTY.CTRL_LOGIN_SKIPPED := "yes"
+*.BSCVTY.CTRL_DETECT_SERVER_DISCONNECTED := "yes"
+*.BSCVTY.CTRL_READMODE := "buffered"
+*.BSCVTY.CTRL_CLIENT_CLEANUP_LINEFEED := "yes"
+*.BSCVTY.PROMPT1 := "OsmoBSC> "
 
 [MODULE_PARAMETERS]
 #mp_bsc_rsl_port := 3003;
@@ -30,6 +38,7 @@
 #};
 
 #mp_ipa_mgcp_uses_osmo_ext := true;
+Osmocom_VTY_Functions.mp_prompt_prefix := "OsmoBSC";
 
 [MAIN_CONTROLLER]
 
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index cb2b41e..9ab3b2c 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -37,6 +37,9 @@
 import from Osmocom_CTRL_Types all;
 import from Osmocom_CTRL_Adapter all;
 
+import from Osmocom_VTY_Functions all;
+import from TELNETasp_PortType all;
+
 import from MobileL3_CommonIE_Types all;
 import from MobileL3_Types all;
 import from L3_Templates all;
@@ -63,6 +66,7 @@
port IPA_RSL_PT IPA_RSL[NUM_BTS];
 
var MGCP_Emulation_CT vc_MGCP;
+   port TELNETasp_PT BSCVTY;
 
var BSSAP_Adapter g_bssap;
/* for old legacy-tests only */
@@ -235,6 +239,12 @@
vc_MGCP.start(MGCP_Emulation.main(ops, mgcp_pars, id));
 }
 
+private function f_init_vty(charstring id) runs on test_CT {
+   map(self:BSCVTY, system:BSCVTY);
+   f_vty_set_prompts(BSCVTY);
+   f_vty_transceive(BSCVTY, "enable");
+}
+
 /* global initialization function
  * \param nr_bts Number of BTSs we should start/bring up
  * \param handler_mode Start an RSL_Emulation_CT component (true) or not 
(false) */
@@ -258,6 +268,7 @@
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
 
f_init_mgcp("VirtMSC");
+   f_init_vty("VirtMSC");
 
for (i := 0; i < nr_bts; i := i+1) {
/* wait until osmo-bts-omldummy has respawned */
diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index e807ca5..c80ae64 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -75,6 +75,10 @@
 FILES="RTP_EncDec.cc RTP_Types.ttcn"
 gen_links $DIR $FILES
 
+DIR=$BASEDIR/titan.TestPorts.TELNETasp/src
+FILES="TELNETasp_PT.cc  TELNETasp_PT.hh  TELNETasp_PortType.ttcn"
+gen_links $DIR $FILES
+
 DIR=../library
-FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn 
Native_Functions.ttcn Native_FunctionDefs.cc IPA_Types.ttcn IPA_CodecPort.ttcn 
IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn 
L3_Templates.ttcn BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn 
RLCMAC_CSN1_Types.ttcn GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn 
MGCP_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn 
MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc 
BSSAP_CodecPort.ttcn BSSAP_Adapter.ttcn Osmocom_CTRL_Types.ttcn 
Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn RTP_CodecPort.ttcn 
RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn 
IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn GSUP_Types.ttcn"
+FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn 
Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc 
IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn 
IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn L3_Templates.ttcn 
BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn RLCMAC_CSN1_Types.ttcn 
GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn MGCP_Emulation.ttcn 
MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn 
MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc 
BSSAP_CodecPort.ttcn BSSAP_Adapter.ttcn Osmocom_CTRL_Types.ttcn 
Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn RTP_CodecPort.ttcn 
RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn 
IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn GSUP_Types.ttcn"
 gen_links $DIR $FILES
diff --git a/bsc/regen_makefile.sh b/bsc/regen_makefile.sh
index 08eaae4..0b8e1fa 100755
--- a/bsc/regen_makefile.sh
+++ b/bsc/regen_makefile.sh
@@ -2,6 +2,6 @@
 
 MAIN=BSC_Tests.ttcn
 
-FILES="*.ttcn IPA_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc 
TCCConversion.cc TCCInterface.cc SCTPasp_PT.cc RTP_EncDec.cc SDP_EncDec.cc 
RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc IuUP_EncDec.cc 
Native_FunctionDefs.cc *.c"
+FILES="*.ttcn IPA_CodecPort_CtrlFunctD

[MERGED] osmo-ttcn3-hacks[master]: WIP: Intra-BSC handover testing

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

Change subject: WIP: Intra-BSC handover testing
..


WIP: Intra-BSC handover testing

Change-Id: Ic47e639a7c8640c736c84a44780fc8e111a64b52
---
M bsc/BSC_Tests.ttcn
M bsc/MSC_ConnectionHandler.ttcn
M library/L3_Templates.ttcn
3 files changed, 203 insertions(+), 3 deletions(-)

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



diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 9ab3b2c..cccec49 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -1277,6 +1277,8 @@
connect(vc_conn:MGCP_PROC, vc_MGCP:MGCP_PROC);
connect(vc_conn:RSL, bts[0].rsl.vc_RSL:CLIENT_PT);
connect(vc_conn:RSL_PROC, bts[0].rsl.vc_RSL:RSL_PROC);
+   connect(vc_conn:RSL1, bts[1].rsl.vc_RSL:CLIENT_PT);
+   connect(vc_conn:RSL1_PROC, bts[1].rsl.vc_RSL:RSL_PROC);
connect(vc_conn:BSSAP, g_bssap.vc_BSSMAP:CLIENT);
connect(vc_conn:MGCP, vc_MGCP:MGCP_CLIENT);
vc_conn.start(derefers(fn)(id));
@@ -1553,6 +1555,71 @@
vc_conn.done;
 }
 
+/* execute a "bts <0-255> trx <0-255> timeslot <0-7> sub-slot <0-7>" command 
on given Dchan */
+private function f_vty_ss_action(charstring suffix, integer bts_nr, integer 
trx_nr, RslChannelNr chan_nr)
+runs on MSC_ConnHdlr {
+   /* FIXME: resolve those from component-global state */
+   var integer ts_nr := chan_nr.tn;
+   var integer ss_nr;
+   if (ischosen(chan_nr.u.ch0)) {
+   ss_nr := 0;
+   } else if (ischosen(chan_nr.u.lm)) {
+   ss_nr := chan_nr.u.lm.sub_chan;
+   } else if (ischosen(chan_nr.u.sdcch4)) {
+   ss_nr := chan_nr.u.sdcch4.sub_chan;
+   } else if (ischosen(chan_nr.u.sdcch8)) {
+   ss_nr := chan_nr.u.sdcch8.sub_chan;
+   } else {
+   setverdict(fail, "Invalid ChanNr ", chan_nr);
+   self.stop;
+   }
+
+   var charstring cmd := "bts "&int2str(bts_nr)&" trx "&int2str(trx_nr)&
+   " timeslot "&int2str(ts_nr)&" sub-slot 
"&int2str(ss_nr)&" ";
+   f_vty_transceive(BSCVTY, cmd & suffix);
+}
+
+private function f_vty_handover(integer bts_nr, integer trx_nr, RslChannelNr 
chan_nr,
+   integer new_bts_nr)
+runs on MSC_ConnHdlr {
+   f_vty_ss_action("handover " & int2str(new_bts_nr), bts_nr, trx_nr, 
chan_nr);
+}
+
+/* intra-BSC hand-over between BTS0 and BTS1 */
+private function f_tc_ho_int(charstring id) runs on MSC_ConnHdlr {
+   var TestHdlrParams pars := valueof(t_def_TestHdlrPars);
+   var template PDU_BSSAP exp_compl := tr_BSSMAP_AssignmentComplete(omit, 
?);
+   var BSSMAP_IE_AoIP_TransportLayerAddress tla := 
valueof(ts_BSSMAP_IE_AoIP_TLA4('01020304'O, 2342));
+   var PDU_BSSAP ass_cmd := valueof(ts_BSSMAP_AssignmentReq(omit, tla));
+   const OCT8 kc := '0001020304050607'O;
+
+   ass_cmd.pdu.bssmap.assignmentRequest.channelType := 
valueof(ts_BSSMAP_IE_ChannelType);
+   ass_cmd.pdu.bssmap.assignmentRequest.codecList := 
valueof(ts_BSSMAP_IE_CodecList({ts_CodecFR}));
+
+   f_establish_fully(pars, ass_cmd, exp_compl);
+
+   var HandoverState hs := {
+   rr_ho_cmpl_seen := false,
+   handover_done := false,
+   old_chan_nr := -
+   };
+   /* issue hand-over command on VTY */
+   f_vty_handover(0, 0, g_chan_nr, 1);
+   /* temporarily suspend DChan processing on BTS1 to avoid race with 
RSLEM_register */
+   f_rslem_suspend(RSL1_PROC);
+   alt {
+   [] as_handover(hs);
+   /* FIXME: somehow determine that the hand-over has completed, by MGCP 
MDCX? */
+   }
+}
+
+testcase TC_ho_int() runs on test_CT {
+   var MSC_ConnHdlr vc_conn;
+   f_init(2, true);
+   f_sleep(1.0);
+   vc_conn := f_start_handler(refers(f_tc_ho_int), testcasename());
+   vc_conn.done;
+}
 
 
 control {
@@ -1623,6 +1690,7 @@
execute( TC_unsol_ho_fail() );
execute( TC_err_82_short_msg() );
execute( TC_err_84_unknown_msg() );
+   execute( TC_ho_int() );
 }
 
 }
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 5f1095a..b68b4f8 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -62,7 +62,8 @@
 type record MediaState {
MgcpEndpointmgcp_ep,
MgcpConnState   mgcp_conn[2],
-   BtsMediaState   bts
+   BtsMediaState   bts,
+   BtsMediaState   bts1 /* only during hand-over */
 };
 
 function f_MediaState_init(inout MediaState g_media, integer nr, HostName bts, 
HostName mgw) {
@@ -73,6 +74,17 @@
rtp_pt := 0,
bts := {
host := bts,
+   port_nr := 9000 + nr*2
+   },
+   peer := -
+   }
+
+   g_media.bts1 := {
+   ipa_crcx_seen := false,
+   conn_id := nr,
+

[MERGED] osmo-ttcn3-hacks[master]: MSC_ConnectionHdlr: Add telnet to VTY to each ConnHdlr

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

Change subject: MSC_ConnectionHdlr: Add telnet to VTY to each ConnHdlr
..


MSC_ConnectionHdlr: Add telnet to VTY to each ConnHdlr

This allows each ConnHandler to issue telnet commands to the VTY

As a side-effect, it puts some more stress on the VTY interface,
as each [parallel] DchanHdlr now has its own telnet connection.

Change-Id: Ibd726af53219d829286da80b44ea4d9fb2ffdf3d
---
M bsc/MSC_ConnectionHandler.ttcn
1 file changed, 8 insertions(+), 1 deletion(-)

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



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 8193a8d..5f1095a 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -24,6 +24,9 @@
 import from MobileL3_RRM_Types all;
 import from L3_Templates all;
 
+import from TELNETasp_PortType all;
+import from Osmocom_VTY_Functions all;
+
 
 /***
  * Media related handling
@@ -233,6 +236,7 @@
 
/* procedure port back to our parent (BSSMAP_Emulation_CT) for control 
*/
port BSSMAPEM_PROC_PT BSSMAPEM;
+   port TELNETasp_PT BSCVTY;
 
var MediaState g_media;
 }
@@ -240,6 +244,9 @@
 /* initialize all parameters */
 function f_MscConnHdlr_init(integer i, HostName bts, HostName mgw) runs on 
MSC_ConnHdlr {
f_MediaState_init(g_media, i, bts, mgw);
+   map(self:BSCVTY, system:BSCVTY);
+   f_vty_set_prompts(BSCVTY);
+   f_vty_transceive(BSCVTY, "enable");
 }
 
 /* Callback function from general BSSMAP_Emulation whenever a connectionless
@@ -576,7 +583,7 @@
st.is_assignment := true;
}
 
-   f_MediaState_init(g_media, 1, "127.0.0.2", "127.0.0.3");
+   f_MscConnHdlr_init(1, "127.0.0.2", "127.0.0.3");
 
f_create_chan_and_exp(pars);
/* we should now have a COMPL_L3 at the MSC */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibd726af53219d829286da80b44ea4d9fb2ffdf3d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: WIP: Prepare MSC_Tests for ability to emulate two BSCs

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

Change subject: WIP: Prepare MSC_Tests for ability to emulate two BSCs
..


WIP: Prepare MSC_Tests for ability to emulate two BSCs

Change-Id: Ibe3ae6ed4181c6ba7501f5443b4f22e3c8abeb3e
---
M bsc/BSC_Tests.cfg
M bsc/BSC_Tests.ttcn
M library/BSSAP_Adapter.ttcn
M library/BSSMAP_Emulation.ttcn
M library/RTP_Emulation.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.cfg
M msc/MSC_Tests.ttcn
8 files changed, 231 insertions(+), 159 deletions(-)

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



diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index 497489f..c31c9eb 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -19,11 +19,15 @@
 #mp_bsc_ip   := "127.0.0.1";
 #mp_test_ip   := "127.0.0.1";
 
-#mp_sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" };
-#mp_own_pc := 185;
-#mp_own_ssn := 254;
-#mp_peer_pc := 187;
-#mp_peer_ssn := 254;
+#BSC_Tests.mp_bssap_cfg := {
+#  sccp_service_type := "mtp3_itu",
+#  sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" },
+#  own_pc := 185,
+#  own_ssn := 254,
+#  peer_pc := 187,
+#  peer_ssn := 254,
+#  sio := '83'O
+#};
 
 #mp_ipa_mgcp_uses_osmo_ext := true;
 
diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 086830a..cb2b41e 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -56,13 +56,17 @@
IPA_Client rsl
 }
 
-type component test_CT extends BSSAP_Adapter_CT, CTRL_Adapter_CT {
+type component test_CT extends CTRL_Adapter_CT {
/* Array of per-BTS state */
var BTS_State bts[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
 
var MGCP_Emulation_CT vc_MGCP;
+
+   var BSSAP_Adapter g_bssap;
+   /* for old legacy-tests only */
+   port BSSAP_CODEC_PT BSSAP;
 
/* are we initialized yet */
var boolean g_initialized := false;
@@ -81,6 +85,36 @@
integer mp_bsc_ctrl_port := 4249;
/* IP address at which the test binds */
charstring mp_test_ip := "127.0.0.1";
+
+   BSSAP_Configuration mp_bssap_cfg := {
+   sccp_service_type := "mtp3_itu",
+   sctp_addr := { 23905, "127.0.0.1", 2905, "127.0.0.1" },
+   own_pc := 185,
+   own_ssn := 254,
+   peer_pc := 187,
+   peer_ssn := 254,
+   sio := '83'O
+   };
+}
+
+private function f_legacy_bssap_reset() runs on test_CT {
+   var BSSAP_N_UNITDATA_ind ud_ind;
+   timer T := 5.0;
+   BSSAP.send(ts_BSSAP_UNITDATA_req(g_bssap.sccp_addr_peer, 
g_bssap.sccp_addr_own, ts_BSSMAP_Reset(0)));
+   T.start;
+   alt {
+   [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(g_bssap.sccp_addr_own, 
g_bssap.sccp_addr_peer, tr_BSSMAP_ResetAck)) {
+   log("Received RESET-ACK in response to RESET, we're ready to 
go!");
+   }
+   [] BSSAP.receive(tr_BSSAP_UNITDATA_ind(?, ?, tr_BSSMAP_Reset)) -> value 
ud_ind {
+   log("Respoding to inbound RESET with RESET-ACK");
+   BSSAP.send(ts_BSSAP_UNITDATA_req(ud_ind.callingAddress, 
ud_ind.calledAddress,
+  ts_BSSMAP_ResetAck));
+   repeat;
+   }
+   [] BSSAP.receive { repeat; }
+   [] T.timeout { setverdict(fail, "Waiting for RESET-ACK after sending 
RESET"); }
+   }
 }
 
 type record IPA_Client {
@@ -215,9 +249,11 @@
/* Call a function of our 'parent component' BSSAP_Adapter_CT to start 
the
 * MSC-side BSSAP emulation */
if (handler_mode) {
-   f_bssap_init("VirtMSC", MSC_BssmapOps);
+   f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", MSC_BssmapOps);
} else {
-   f_bssap_init("VirtMSC", omit);
+   f_bssap_init(g_bssap, mp_bssap_cfg, "VirtMSC", omit);
+   connect(self:BSSAP, g_bssap.vc_SCCP:SCCP_SP_PORT);
+   f_legacy_bssap_reset();
}
f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
 
@@ -268,7 +304,6 @@
var BSSAP_N_UNITDATA_ind ud_ind;
 
f_init(1);
-   f_bssap_reset();
 

IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23)));
f_exp_ipa_rx(0, tr_RSL_MsgTypeD(RSL_MT_CHAN_ACTIV));
@@ -281,7 +316,6 @@
var integer chreq_total;
 
f_init(1);
-   f_bssap_reset();
 
chreq_total := f_ctrl_get_ratectr_abs(IPA_CTRL, "bts", 0, 
"chreq:total");

IPA_RSL[0].send(ts_ASP_RSL_UD(IPAC_PROTO_RSL_TRX0,ts_RSL_CHAN_RQD('23'O, 23)));
@@ -296,7 +330,6 @@
var RSL_Message rx_rsl;
 
f_init(1);
-   f_bssap_reset();
 
/* Send CHAN RQD and wait for allocation; acknowledge it */
var RslChannelNr chan_nr := f_chreq_act_ack();
@@ -315,7 +348,6 @@
var ASP_RSL_Unitdata rx_rsl_ud;
 
f_init(1);
-   f_bssap_reset();
 
/* Send 

osmo-ttcn3-hacks[master]: WIP: Intra-BSC handover testing

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic47e639a7c8640c736c84a44780fc8e111a64b52
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-ttcn3-hacks[master]: RSL_Emulation: Add procedure calls to suspend/resume dchan h...

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

Change subject: RSL_Emulation: Add procedure calls to suspend/resume dchan 
handling
..


RSL_Emulation: Add procedure calls to suspend/resume dchan handling

We introduce a procedure by which any DchanHandler can globally
disable all receiving/processing of DChan related messages.  This is
required in upcoming handover code, as we need to block handling
of messages such as RSL IPAC CRCX on the new Dchan before we have
processed the RR HANDOVER CMD and raised an associated expect here in
the RSL emulation code.

Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
---
M library/RSL_Emulation.ttcn
1 file changed, 34 insertions(+), 3 deletions(-)

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



diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index f45b425..dab1785 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -54,9 +54,10 @@
 
 signature RSLEM_register(uint8_t trx_nr, RslChannelNr chan_nr, RSL_DchanHdlr 
hdlr);
 signature RSLEM_unregister(uint8_t trx_nr, RslChannelNr chan_nr, RSL_DchanHdlr 
hdlr);
+signature RSLEM_suspend(boolean suspend);
 
 type port RSLEM_PROC_PT procedure {
-   inout RSLEM_register, RSLEM_unregister;
+   inout RSLEM_register, RSLEM_unregister, RSLEM_suspend;
 } with { extension "internal" };
 
 /***
@@ -276,6 +277,8 @@
var uint8_t trx_nr;
var integer cid;
var integer i;
+   /* special synchronization handling during hand-over */
+   var boolean dchan_suspended := false;
 
f_conn_table_init();
 
@@ -348,7 +351,7 @@
IPA_PT.send(ts_ASP_RSL_UD(rx_rsl.streamId, 
ts_RSL_CHAN_ACT_ACK(chan_nr, 23)));
}
 
-   [] IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeDR(?))) -> value rx_rsl {
+   [not dchan_suspended] 
IPA_PT.receive(tr_RSL(tr_RSL_MsgTypeDR(?))) -> value rx_rsl {
/* dispatch to channel based on ChanId */
cid := 
f_cid_by_chan_nr(f_trx_by_streamId(rx_rsl.streamId),
rx_rsl.rsl.ies[0].body.chan_nr);
@@ -359,7 +362,7 @@
}
}
 
-   [] IPA_PT.receive {
+   [not dchan_suspended] IPA_PT.receive {
setverdict(fail, "Received unknown primitive from IPA");
self.stop;
}
@@ -389,6 +392,17 @@
RSL_PROC.reply(RSLEM_unregister:{trx_nr, chan_nr, 
vc_conn});
}
 
+   [] RSL_PROC.getcall(RSLEM_suspend:{true}) {
+   log("Suspending DChan");
+   dchan_suspended := true;
+   RSL_PROC.reply(RSLEM_suspend:{true});
+   }
+
+   [] RSL_PROC.getcall(RSLEM_suspend:{false}) {
+   log("Resuming DChan");
+   dchan_suspended := false;
+   RSL_PROC.reply(RSLEM_suspend:{false});
+   }
 
}
}
@@ -420,5 +434,22 @@
}
 }
 
+/* resume handling of RSL DChan messages from IPA until f_rslem_resume() is 
called */
+function f_rslem_suspend(RSLEM_PROC_PT PT)
+runs on RSL_DchanHdlr {
+   PT.call(RSLEM_suspend:{true}) {
+   [] PT.getreply(RSLEM_suspend:{true}) {};
+   }
+}
+
+/* resume handling of RSL DChan messages after f_rslem_suspend() is called */
+function f_rslem_resume(RSLEM_PROC_PT PT)
+runs on RSL_DchanHdlr {
+   PT.call(RSLEM_suspend:{false}) {
+   [] PT.getreply(RSLEM_suspend:{false}) {};
+   }
+}
+
+
 
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-ttcn3-hacks[master]: RSL_Emulation: Add second RSL/RSL_PROC port for hand-over cases

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

Change subject: RSL_Emulation: Add second RSL/RSL_PROC port for hand-over cases
..


RSL_Emulation: Add second RSL/RSL_PROC port for hand-over cases

Also, extend RSLEM_{register,unregister}() with an optional third
argiment, so the RSL_DchanHdlr can register 'expect' also for
that secondary BTS/port during hand-over

Change-Id: Ic22778f17dc4b93ef54837cf400ddd7d1732ae7e
---
M library/RSL_Emulation.ttcn
1 file changed, 11 insertions(+), 6 deletions(-)

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



diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index d20718f..f45b425 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -33,6 +33,9 @@
port RSL_DCHAN_PT RSL;
port RSLEM_PROC_PT RSL_PROC;
var RslChannelNr g_chan_nr;
+   /* second BTS / DChan during hand-over */
+   port RSL_DCHAN_PT RSL1;
+   port RSLEM_PROC_PT RSL1_PROC;
 };
 
 type record RSLDC_ChanRqd {
@@ -402,16 +405,18 @@
 }
 
 /* client/conn_hdlr side function to use procedure port to register 
stream_id/chan_nr */
-function f_rslem_register(uint8_t trx_nr, RslChannelNr chan_nr) runs on 
RSL_DchanHdlr {
-   RSL_PROC.call(RSLEM_register:{trx_nr, chan_nr, self}) {
-   [] RSL_PROC.getreply(RSLEM_register:{?,?,?}) {};
+function f_rslem_register(uint8_t trx_nr, RslChannelNr chan_nr, RSLEM_PROC_PT 
PT := RSL_PROC)
+runs on RSL_DchanHdlr {
+   PT.call(RSLEM_register:{trx_nr, chan_nr, self}) {
+   [] PT.getreply(RSLEM_register:{?,?,?}) {};
}
 }
 
 /* client/conn_hdlr side function to use procedure port to unregister 
stream_id/chan_nr */
-function f_rslem_unregister(uint8_t trx_nr, RslChannelNr chan_nr) runs on 
RSL_DchanHdlr {
-   RSL_PROC.call(RSLEM_unregister:{trx_nr, chan_nr, self}) {
-   [] RSL_PROC.getreply(RSLEM_unregister:{?,?,?}) {};
+function f_rslem_unregister(uint8_t trx_nr, RslChannelNr chan_nr, 
RSLEM_PROC_PT PT := RSL_PROC)
+runs on RSL_DchanHdlr {
+   PT.call(RSLEM_unregister:{trx_nr, chan_nr, self}) {
+   [] PT.getreply(RSLEM_unregister:{?,?,?}) {};
}
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic22778f17dc4b93ef54837cf400ddd7d1732ae7e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-ttcn3-hacks[master]: RSL_Emulation: Add procedure calls to suspend/resume dchan h...

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ibef65f87d0d481accbc0e019874dd43b3f9a5dbc
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-msc[master]: VLR: fix potential NULL dereference

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/6388/1/src/libmsc/gsm_04_08.c
File src/libmsc/gsm_04_08.c:

Line 3718:  conn->vsub = vlr_subscr_get(vsub);
a NULL return is only possible if 'vsub' is NULL.  I don't think this is valid 
here.  Read the comment above the function.  So if at all, I would put an 
OSMO_ASSERT(vsub) here. Neels?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I13632908d0b67323202effa9dd6f29732a12cc91
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels 
Gerrit-HasComments: Yes


libosmo-sccp[master]: SS7: return error on stream opening error

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review-2

we are asking osmo_stream_cli_open2() to do re-connects, so a one-time negative 
result is just an intermediate notification, and not a final outcome.  
libosmo-netif will continue to retry to connect.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2ce55983b255b0b50fd5142d6ddf188dc8ee20b9
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


libosmocore[master]: talloc_ctx_vty: Fix help strings (missing \n at end of line)

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I785c852e3313d20eade79746a7cd485d2d5908ea
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] libosmocore[master]: talloc_ctx_vty: Fix help strings (missing \n at end of line)

2018-02-13 Thread Harald Welte

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

talloc_ctx_vty: Fix help strings (missing \n at end of line)

This was causing build failures in applications using this library
feature:

Documentation error (missing docs):



Documentation error (missing docs):



Documentation error (missing docs):



Documentation error (missing docs):



Change-Id: I785c852e3313d20eade79746a7cd485d2d5908ea
---
M src/vty/talloc_ctx_vty.c
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/26/6426/1

diff --git a/src/vty/talloc_ctx_vty.c b/src/vty/talloc_ctx_vty.c
index 601b696..e7fe675 100644
--- a/src/vty/talloc_ctx_vty.c
+++ b/src/vty/talloc_ctx_vty.c
@@ -175,7 +175,7 @@
"All contexts, if NULL-context tracking is enabled\n" \
"Display a full talloc memory hierarchy\n" \
"Display a brief talloc memory hierarchy\n" \
-   "Specify required maximal depth value"
+   "Specify required maximal depth value\n"
 
 DEFUN(show_talloc_ctx, show_talloc_ctx_cmd,
BASE_CMD_STR, BASE_CMD_DESCR)
@@ -202,7 +202,7 @@
 DEFUN(show_talloc_ctx_filter, show_talloc_ctx_filter_cmd,
BASE_CMD_STR " filter REGEXP", BASE_CMD_DESCR
"Filter chunks using regular expression\n"
-   "Regular expression")
+   "Regular expression\n")
 {
struct walk_cb_params *params;
int rc;
@@ -236,7 +236,7 @@
 DEFUN(show_talloc_ctx_tree, show_talloc_ctx_tree_cmd,
BASE_CMD_STR " tree ADDRESS", BASE_CMD_DESCR
"Display only a specific memory chunk\n"
-   "Chunk address (e.g. 0xdeadbeef)")
+   "Chunk address (e.g. 0xdeadbeef)\n")
 {
struct walk_cb_params *params;
int rc;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I785c852e3313d20eade79746a7cd485d2d5908ea
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


osmo-sgsn[master]: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I50eb1c5a28efbe4542e177ce3d0a236e75eecdd0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-ggsn[master]: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I460efff3a3dfa2c7d955871aca78b37552a29aff
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-ggsn[master]: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

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

Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I460efff3a3dfa2c7d955871aca78b37552a29aff
---
M ggsn/ggsn.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/25/6425/1

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index caf6151..df071d2 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -56,6 +56,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "../lib/tun.h"
@@ -1062,6 +1063,7 @@
 
tall_ggsn_ctx = talloc_named_const(NULL, 0, "OsmoGGSN");
msgb_talloc_ctx_init(tall_ggsn_ctx, 0);
+   g_vty_info.tall_ctx = tall_ggsn_ctx;
 
/* Handle keyboard interrupt SIGINT */
signal(SIGINT, &signal_handler);
@@ -1076,6 +1078,7 @@
 
vty_init(&g_vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(&log_info);
ggsn_vty_init();
ctrl_vty_init(tall_ggsn_ctx);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I460efff3a3dfa2c7d955871aca78b37552a29aff
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-sgsn[master]: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

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

Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I50eb1c5a28efbe4542e177ce3d0a236e75eecdd0
---
M src/gprs/gb_proxy_main.c
M src/gprs/gtphub_main.c
M src/gprs/sgsn_main.c
3 files changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/24/6424/1

diff --git a/src/gprs/gb_proxy_main.c b/src/gprs/gb_proxy_main.c
index 9f9c605..6f62400 100644
--- a/src/gprs/gb_proxy_main.c
+++ b/src/gprs/gb_proxy_main.c
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "../../bscconfig.h"
 
@@ -256,6 +257,7 @@
 
tall_bsc_ctx = talloc_named_const(NULL, 0, "nsip_proxy");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
+   vty_info.tall_ctx = tall_bsc_ctx;
 
signal(SIGINT, &signal_handler);
signal(SIGTERM, &signal_handler);
@@ -269,6 +271,7 @@
vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(&gprs_log_info);
gbproxy_vty_init();
 
diff --git a/src/gprs/gtphub_main.c b/src/gprs/gtphub_main.c
index 3f7de50..197c5e3 100644
--- a/src/gprs/gtphub_main.c
+++ b/src/gprs/gtphub_main.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -336,6 +337,7 @@
 
osmo_gtphub_ctx = talloc_named_const(NULL, 0, "osmo_gtphub");
msgb_talloc_ctx_init(osmo_gtphub_ctx, 0);
+   vty_info.tall_ctx = osmo_gtphub_ctx;
 
signal(SIGINT, &signal_handler);
signal(SIGTERM, &signal_handler);
@@ -349,6 +351,7 @@
vty_info.copyright = gtphub_copyright;
vty_init(&vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
 gtphub_vty_init(hub, cfg);
 
rate_ctr_init(osmo_gtphub_ctx);
diff --git a/src/gprs/sgsn_main.c b/src/gprs/sgsn_main.c
index b2a028c..0276e34 100644
--- a/src/gprs/sgsn_main.c
+++ b/src/gprs/sgsn_main.c
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -376,6 +377,7 @@
srand(time(NULL));
tall_bsc_ctx = talloc_named_const(NULL, 0, "osmo_sgsn");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
+   vty_info.tall_ctx = tall_bsc_ctx;
 
signal(SIGINT, &signal_handler);
signal(SIGTERM, &signal_handler);
@@ -390,6 +392,7 @@
vty_info.copyright = openbsc_copyright;
vty_init(&vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(&gprs_log_info);
sgsn_vty_init(&sgsn_inst.cfg);
ctrl_vty_init(tall_bsc_ctx);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50eb1c5a28efbe4542e177ce3d0a236e75eecdd0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[MERGED] libosmo-abis[master]: IPA: log remote address

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

Change subject: IPA: log remote address
..


IPA: log remote address

Wrap IPA logging to always print peer's address to simplify
troubleshooting.

Change-Id: I19ebaea45812aad6b3d3480cac0f1f833daf428d
---
M src/input/ipa.c
1 file changed, 20 insertions(+), 18 deletions(-)

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



diff --git a/src/input/ipa.c b/src/input/ipa.c
index fbed038..fc1ca50 100644
--- a/src/input/ipa.c
+++ b/src/input/ipa.c
@@ -23,6 +23,8 @@
 
 #include 
 
+#define LOGIPA(link, level, fmt, args...) LOGP(DLINP, level, "%s:%u " fmt, 
link->addr, link->port, ## args)
+
 void ipa_msg_push_header(struct msgb *msg, uint8_t proto)
 {
struct ipaccess_head *hh;
@@ -51,20 +53,20 @@
struct msgb *msg;
int ret;
 
-   LOGP(DLINP, LOGL_DEBUG, "message received\n");
+   LOGIPA(link, LOGL_DEBUG, "message received\n");
 
ret = ipa_msg_recv_buffered(ofd->fd, &msg, &link->pending_msg);
if (ret < 0) {
if (ret == -EAGAIN)
return;
if (ret == -EPIPE || ret == -ECONNRESET)
-   LOGP(DLINP, LOGL_ERROR, "lost connection with 
server\n");
+   LOGIPA(link, LOGL_ERROR, "lost connection with 
server\n");
ipa_client_conn_close(link);
if (link->updown_cb)
link->updown_cb(link, 0);
return;
} else if (ret == 0) {
-   LOGP(DLINP, LOGL_ERROR, "connection closed with server\n");
+   LOGIPA(link, LOGL_ERROR, "connection closed with server\n");
ipa_client_conn_close(link);
if (link->updown_cb)
link->updown_cb(link, 0);
@@ -87,7 +89,7 @@
struct llist_head *lh;
int ret;
 
-   LOGP(DLINP, LOGL_DEBUG, "sending data\n");
+   LOGIPA(link, LOGL_DEBUG, "sending data\n");
 
if (llist_empty(&link->tx_queue)) {
ofd->when &= ~BSC_FD_WRITE;
@@ -104,7 +106,7 @@
if (link->updown_cb)
link->updown_cb(link, 0);
}
-   LOGP(DLINP, LOGL_ERROR, "error to send\n");
+   LOGIPA(link, LOGL_ERROR, "error to send\n");
}
msgb_free(msg);
return 0;
@@ -126,18 +128,18 @@
return 0;
}
ofd->when &= ~BSC_FD_WRITE;
-   LOGP(DLINP, LOGL_NOTICE, "connection done.\n");
+   LOGIPA(link, LOGL_NOTICE, "connection done\n");
link->state = IPA_CLIENT_LINK_STATE_CONNECTED;
if (link->updown_cb)
link->updown_cb(link, 1);
break;
case IPA_CLIENT_LINK_STATE_CONNECTED:
if (what & BSC_FD_READ) {
-   LOGP(DLINP, LOGL_DEBUG, "connected read\n");
+   LOGIPA(link, LOGL_DEBUG, "connected read\n");
ipa_client_read(link);
}
if (what & BSC_FD_WRITE) {
-   LOGP(DLINP, LOGL_DEBUG, "connected write\n");
+   LOGIPA(link, LOGL_DEBUG, "connected write\n");
ipa_client_write(link);
}
break;
@@ -335,18 +337,18 @@
struct msgb *msg;
int ret;
 
-   LOGP(DLINP, LOGL_DEBUG, "message received\n");
+   LOGIPA(conn, LOGL_DEBUG, "message received\n");
 
ret = ipa_msg_recv_buffered(ofd->fd, &msg, &conn->pending_msg);
if (ret < 0) {
if (ret == -EAGAIN)
return;
if (ret == -EPIPE || ret == -ECONNRESET)
-   LOGP(DLINP, LOGL_ERROR, "lost connection with 
server\n");
+   LOGIPA(conn, LOGL_ERROR, "lost connection with 
server\n");
ipa_server_conn_destroy(conn);
return;
} else if (ret == 0) {
-   LOGP(DLINP, LOGL_ERROR, "connection closed with server\n");
+   LOGIPA(conn, LOGL_ERROR, "connection closed with server\n");
ipa_server_conn_destroy(conn);
return;
}
@@ -361,7 +363,7 @@
struct msgb *msg;
int ret;
 
-   LOGP(DLINP, LOGL_DEBUG, "sending data\n");
+   LOGIPA(conn, LOGL_DEBUG, "sending data\n");
msg = msgb_dequeue(&conn->tx_queue);
 
if (!msg) {
@@ -371,7 +373,7 @@
 
ret = send(conn->ofd.fd, msg->data, msg->len, 0);
if (ret < 0) {
-   LOGP(DLINP, LOGL_ERROR, "error to send\n");
+   LOGIPA(conn, LOGL_ERROR, "error to send\n");
}
msgb_free(msg);
 }
@@ -450,7 +452,7 @@
break;
default:
/* Error */
-   LOGP(DLINP, LOGL_ERROR, "Unexpected return from "
+ 

libosmo-abis[master]: IPA: log remote address

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I19ebaea45812aad6b3d3480cac0f1f833daf428d
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: remove dead code (gsm_parse_reg)

2018-02-13 Thread Harald Welte

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

remove dead code (gsm_parse_reg)

Change-Id: I47b0260561a9c2bad65c50c8164873e4c23d61b7
---
M include/osmocom/msc/gsm_data_shared.h
M src/libcommon/gsm_data.c
2 files changed, 0 insertions(+), 32 deletions(-)


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

diff --git a/include/osmocom/msc/gsm_data_shared.h 
b/include/osmocom/msc/gsm_data_shared.h
index af7d89d..32c336b 100644
--- a/include/osmocom/msc/gsm_data_shared.h
+++ b/include/osmocom/msc/gsm_data_shared.h
@@ -1,7 +1,6 @@
 #ifndef _GSM_DATA_SHAREDH
 #define _GSM_DATA_SHAREDH
 
-#include 
 #include 
 #include 
 
@@ -40,11 +39,5 @@
GSM_PAGING_OOM,
GSM_PAGING_BUSY,
 };
-
-/*
- * help with parsing regexps
- */
-int gsm_parse_reg(void *ctx, regex_t *reg, char **str,
-   int argc, const char **argv) __attribute__ 
((warn_unused_result));
 
 #endif
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index a0ca81a..f7795b2 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -54,31 +54,6 @@
return get_value_string(rrlp_mode_names, mode);
 }
 
-int gsm_parse_reg(void *ctx, regex_t *reg, char **str, int argc, const char 
**argv)
-{
-   int ret;
-
-   ret = 0;
-   if (*str) {
-   talloc_free(*str);
-   *str = NULL;
-   }
-   regfree(reg);
-
-   if (argc > 0) {
-   *str = talloc_strdup(ctx, argv[0]);
-   ret = regcomp(reg, argv[0], 0);
-
-   /* handle compilation failures */
-   if (ret != 0) {
-   talloc_free(*str);
-   *str = NULL;
-   }
-   }
-
-   return ret;
-}
-
 bool classmark_is_r99(struct gsm_classmark *cm)
 {
int rev_lev = 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I47b0260561a9c2bad65c50c8164873e4c23d61b7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-msc[master]: remove unused VTY command "location updating reject cause"

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

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

https://gerrit.osmocom.org/6415

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

remove unused VTY command "location updating reject cause"

OsmoMSC is using whatever reject cause is apropriate in the given
situation.  This user-configurable reject cause only had relevance
in OsmoNITB, and hence it is an unused parameter that can be removed
in OsmoMSC.

Related: OS#2528
Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
---
M doc/examples/osmo-msc/osmo-msc.cfg
M doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
M doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
M include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs_vty.c
M src/libmsc/msc_vty.c
6 files changed, 0 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/15/6415/2

diff --git a/doc/examples/osmo-msc/osmo-msc.cfg 
b/doc/examples/osmo-msc/osmo-msc.cfg
index 1261160..4cccebe 100644
--- a/doc/examples/osmo-msc/osmo-msc.cfg
+++ b/doc/examples/osmo-msc/osmo-msc.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg 
b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
index a5131e4..ea92912 100644
--- a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg 
b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
index 72f3410..7026293 100644
--- a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
@@ -10,7 +10,6 @@
  short name OsmoMSC
  long name OsmoMSC
  auth policy closed
- location updating reject cause 13
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index cde1ce2..0548b80 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -238,7 +238,6 @@
enum gsm_auth_policy auth_policy;
regex_t authorized_regexp;
char *authorized_reg_str;
-   enum gsm48_reject_value reject_cause;
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
bool authentication_required;
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
index a4862ee..e5972f1 100644
--- a/src/libcommon-cs/common_cs_vty.c
+++ b/src/libcommon-cs/common_cs_vty.c
@@ -137,22 +137,6 @@
return CMD_SUCCESS;
 }
 
-DEFUN(cfg_net_reject_cause,
-  cfg_net_reject_cause_cmd,
-  "location updating reject cause <2-111>",
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Set the reject cause of location updating reject\n"
-  "Cause Value as Per GSM TS 04.08\n")
-{
-   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
-   gsmnet->reject_cause = atoi(argv[0]);
-
-   return CMD_SUCCESS;
-}
-
 DEFUN(cfg_net_encryption,
   cfg_net_encryption_cmd,
   "encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]",
@@ -324,7 +308,6 @@
install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
install_element(GSMNET_NODE, &cfg_net_authorize_regexp_cmd);
-   install_element(GSMNET_NODE, &cfg_net_reject_cause_cmd);
install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
install_element(GSMNET_NODE, &cfg_net_authentication_cmd);
install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index ad4014d..49081c6 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -187,8 +187,6 @@
vty_out(vty, " short name %s%s", gsmnet->name_short, VTY_NEWLINE);
vty_out(vty, " long name %s%s", gsmnet->name_long, VTY_NEWLINE);
vty_out(vty, " auth policy %s%s", 
gsm_auth_policy_name(gsmnet->auth_policy), VTY_NEWLINE);
-   vty_out(vty, " location updating reject cause %u%s",
-   gsmnet->reject_cause, VTY_NEWLINE);
vty_out(vty, " encryption a5");
for (i = 0; i < 8; i++) {
if (gsmnet->a5_encryption_mask & (1 << i))

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-msc[master]: remove unused "authorized-regexp" VTY command

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

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

https://gerrit.osmocom.org/6416

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

remove unused "authorized-regexp" VTY command

This is another left-over VTY command from the OsmoNITB days.

If such functionality is desired, it must be implemented in OsmoHLR,
but not here.

Related: OS#2528
Change-Id: Icf0897c47388e49ba7886b55acc728a6f7d213fe
---
M include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs.c
M src/libcommon-cs/common_cs_vty.c
M tests/vty_test_runner.py
4 files changed, 0 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/16/6416/2

diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 0548b80..9701288 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -236,8 +236,6 @@
char *name_long;
char *name_short;
enum gsm_auth_policy auth_policy;
-   regex_t authorized_regexp;
-   char *authorized_reg_str;
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
bool authentication_required;
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
index cebaf39..a2f5cb3 100644
--- a/src/libcommon-cs/common_cs.c
+++ b/src/libcommon-cs/common_cs.c
@@ -44,14 +44,8 @@
 {
struct gsm_network *net;
 
-   const char *default_regexp = ".*";
-
net = talloc_zero(ctx, struct gsm_network);
if (!net)
-   return NULL;
-
-   if (gsm_parse_reg(net, &net->authorized_regexp, 
&net->authorized_reg_str, 1,
- &default_regexp) != 0)
return NULL;
 
net->country_code = country_code;
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
index e5972f1..2fbe09c 100644
--- a/src/libcommon-cs/common_cs_vty.c
+++ b/src/libcommon-cs/common_cs_vty.c
@@ -121,22 +121,6 @@
return CMD_SUCCESS;
 }
 
-DEFUN(cfg_net_authorize_regexp, cfg_net_authorize_regexp_cmd,
-  "authorized-regexp REGEXP",
-  "Set regexp for IMSI which will be used for authorization decision\n"
-  "Regular expression, IMSIs matching it are allowed to use the network\n")
-{
-   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-   if (gsm_parse_reg(gsmnet, &gsmnet->authorized_regexp,
- &gsmnet->authorized_reg_str, argc, argv) != 0) {
-   vty_out(vty, "%%Failed to parse the authorized-regexp: '%s'%s",
-   argv[0], VTY_NEWLINE);
-   return CMD_WARNING;
-   }
-
-   return CMD_SUCCESS;
-}
-
 DEFUN(cfg_net_encryption,
   cfg_net_encryption_cmd,
   "encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]",
@@ -307,7 +291,6 @@
install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
-   install_element(GSMNET_NODE, &cfg_net_authorize_regexp_cmd);
install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
install_element(GSMNET_NODE, &cfg_net_authentication_cmd);
install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
diff --git a/tests/vty_test_runner.py b/tests/vty_test_runner.py
index 707fc5c..19d2c60 100644
--- a/tests/vty_test_runner.py
+++ b/tests/vty_test_runner.py
@@ -156,9 +156,6 @@
 self.vty.command("network")
 self.assertTrue(self.vty.verify("auth policy closed", ['']))
 self.assertTrue(self.vty.verify("auth policy regexp", ['']))
-self.assertTrue(self.vty.verify("authorized-regexp ^001", ['']))
-self.assertTrue(self.vty.verify("authorized-regexp 02$", ['']))
-self.assertTrue(self.vty.verify("authorized-regexp *123.*", ['']))
 self.vty.command("end")
 
 def testSi2Q(self):

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Icf0897c47388e49ba7886b55acc728a6f7d213fe
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-msc[master]: osmo-msc: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

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

osmo-msc: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I575500bd911f9792ab5ca76eebb1d2682ee34fa3
---
M src/osmo-msc/msc_main.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/22/6422/1

diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index b0b78be..da28083 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -51,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -366,6 +367,7 @@
 
tall_msc_ctx = talloc_named_const(NULL, 1, "osmo_msc");
talloc_ctx_init(tall_msc_ctx);
+   msc_vty_info.tall_ctx = tall_msc_ctx;
 
osmo_init_logging(&log_info);
osmo_stats_init(tall_msc_ctx);
@@ -394,6 +396,7 @@
 
ctrl_vty_init(tall_msc_ctx);
logging_vty_add_cmds(&log_info);
+   osmo_talloc_vty_add_cmds();
msc_vty_init(msc_network);
bsc_vty_init_extra();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I575500bd911f9792ab5ca76eebb1d2682ee34fa3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-msc[master]: remove unused "auth policy" VTY command

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

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

https://gerrit.osmocom.org/6417

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

remove unused "auth policy" VTY command

This is yet another unsused bit from the OsmoNITB legacy.

Related: OS#2528
Change-Id: I825e659da529257e5edec94d9d59f0e10c1b4c63
---
M doc/examples/osmo-msc/osmo-msc.cfg
M doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
M doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
M include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs_vty.c
M src/libcommon/gsm_data.c
M src/libmsc/msc_vty.c
M tests/vty_test_runner.py
8 files changed, 0 insertions(+), 60 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/17/6417/2

diff --git a/doc/examples/osmo-msc/osmo-msc.cfg 
b/doc/examples/osmo-msc/osmo-msc.cfg
index 4cccebe..91c9eee 100644
--- a/doc/examples/osmo-msc/osmo-msc.cfg
+++ b/doc/examples/osmo-msc/osmo-msc.cfg
@@ -9,7 +9,6 @@
  mobile network code 1
  short name OsmoMSC
  long name OsmoMSC
- auth policy closed
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg 
b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
index ea92912..0b9fd2a 100644
--- a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
@@ -9,7 +9,6 @@
  mobile network code 1
  short name OsmoMSC
  long name OsmoMSC
- auth policy closed
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg 
b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
index 7026293..44ac3f8 100644
--- a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
@@ -9,7 +9,6 @@
  mobile network code 1
  short name OsmoMSC
  long name OsmoMSC
- auth policy closed
  encryption a5 0
  rrlp mode none
  mm info 1
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 9701288..67b657a 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -207,13 +207,6 @@
msc_ctr_description,
 };
 
-enum gsm_auth_policy {
-   GSM_AUTH_POLICY_CLOSED, /* only subscribers authorized in DB */
-   GSM_AUTH_POLICY_ACCEPT_ALL, /* accept everyone, even if not authorized 
in DB */
-   GSM_AUTH_POLICY_TOKEN, /* accept first, send token per sms, then revoke 
authorization */
-   GSM_AUTH_POLICY_REGEXP, /* accept IMSIs matching given regexp */
-};
-
 #define MSC_PAGING_RESPONSE_TIMER_DEFAULT 10
 
 struct gsm_tz {
@@ -235,7 +228,6 @@
uint16_t network_code;
char *name_long;
char *name_short;
-   enum gsm_auth_policy auth_policy;
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
bool authentication_required;
@@ -371,9 +363,6 @@
 
 extern void *tall_bsc_ctx;
 extern int ipacc_rtp_direct;
-
-enum gsm_auth_policy gsm_auth_policy_parse(const char *arg);
-const char *gsm_auth_policy_name(enum gsm_auth_policy policy);
 
 enum rrlp_mode rrlp_mode_parse(const char *arg);
 const char *rrlp_mode_name(enum rrlp_mode mode);
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
index 2fbe09c..01c6b35 100644
--- a/src/libcommon-cs/common_cs_vty.c
+++ b/src/libcommon-cs/common_cs_vty.c
@@ -103,24 +103,6 @@
return CMD_SUCCESS;
 }
 
-DEFUN(cfg_net_auth_policy,
-  cfg_net_auth_policy_cmd,
-  "auth policy (closed|accept-all|regexp|token)",
-   "Authentication (not cryptographic)\n"
-   "Set the GSM network authentication policy\n"
-   "Require the MS to be activated in HLR\n"
-   "Accept all MS, whether in HLR or not\n"
-   "Use regular expression for IMSI authorization decision\n"
-   "Use SMS-token based authentication\n")
-{
-   enum gsm_auth_policy policy = gsm_auth_policy_parse(argv[0]);
-   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-
-   gsmnet->auth_policy = policy;
-
-   return CMD_SUCCESS;
-}
-
 DEFUN(cfg_net_encryption,
   cfg_net_encryption_cmd,
   "encryption a5 <0-3> [<0-3>] [<0-3>] [<0-3>]",
@@ -290,7 +272,6 @@
install_element(GSMNET_NODE, &cfg_net_mnc_cmd);
install_element(GSMNET_NODE, &cfg_net_name_short_cmd);
install_element(GSMNET_NODE, &cfg_net_name_long_cmd);
-   install_element(GSMNET_NODE, &cfg_net_auth_policy_cmd);
install_element(GSMNET_NODE, &cfg_net_encryption_cmd);
install_element(GSMNET_NODE, &cfg_net_authentication_cmd);
install_element(GSMNET_NODE, &cfg_net_rrlp_mode_cmd);
diff --git a/src/libcommon/gsm_data.c b/src/libcommon/gsm_data.c
index 66b6e29..a0ca81a 100644
--- a/src/libcommon/gsm_data.c
+++ b/src/libcommon/gsm_data.c
@@ -36,24 +36,6 @@
 
 void *tall_bsc_ctx;
 
-static const struct value_string auth_policy_names[] = {
-   { GSM_AUTH_POLICY_CLOSED,   "closed" },
-   { GSM_AUTH_POLICY_ACCEPT_ALL,   "accept-all" },
-   { GSM_AUTH_POLICY_TOKEN,"token" },
- 

[MERGED] osmo-msc[master]: remove unused dyn_ts_allow_tch_f VTY option

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

Change subject: remove unused dyn_ts_allow_tch_f VTY option
..


remove unused dyn_ts_allow_tch_f VTY option

This belongs into the BSC and has no relevance in the MSC, as the MSC
has no clue about dynamic timeslots.

Related: OS#2528
Change-Id: Iaa41d22db81120572d4cd2c0c4c75d258947a42f
---
M include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs.c
M src/libcommon-cs/common_cs_vty.c
M src/osmo-msc/msc_main.c
4 files changed, 0 insertions(+), 32 deletions(-)

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



diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 444618c..cde1ce2 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -273,9 +273,6 @@
/* control interface */
struct ctrl_handle *ctrl;
 
-   /* Allow or disallow TCH/F on dynamic TCH/F_TCH/H_PDCH; OS#1778 */
-   bool dyn_ts_allow_tch_f;
-
/* all active subscriber connections. */
struct llist_head subscr_conns;
 
diff --git a/src/libcommon-cs/common_cs.c b/src/libcommon-cs/common_cs.c
index 170b62a..cebaf39 100644
--- a/src/libcommon-cs/common_cs.c
+++ b/src/libcommon-cs/common_cs.c
@@ -78,8 +78,6 @@
 
net->mncc_recv = mncc_recv;
 
-   net->dyn_ts_allow_tch_f = true;
-
INIT_LLIST_HEAD(&net->a.bscs);
 
return net;
diff --git a/src/libcommon-cs/common_cs_vty.c b/src/libcommon-cs/common_cs_vty.c
index 8c9f127..a4862ee 100644
--- a/src/libcommon-cs/common_cs_vty.c
+++ b/src/libcommon-cs/common_cs_vty.c
@@ -216,18 +216,6 @@
return CMD_SUCCESS;
 }
 
-DEFUN(cfg_net_dyn_ts_allow_tch_f,
-  cfg_net_dyn_ts_allow_tch_f_cmd,
-  "dyn_ts_allow_tch_f (0|1)",
-  "Allow or disallow allocating TCH/F on TCH_F_TCH_H_PDCH timeslots\n"
-  "Disallow TCH/F on TCH_F_TCH_H_PDCH (default)\n"
-  "Allow TCH/F on TCH_F_TCH_H_PDCH\n")
-{
-   struct gsm_network *gsmnet = gsmnet_from_vty(vty);
-   gsmnet->dyn_ts_allow_tch_f = atoi(argv[0]) ? true : false;
-   return CMD_SUCCESS;
-}
-
 DEFUN(cfg_net_timezone,
   cfg_net_timezone_cmd,
   "timezone <-19-19> (0|15|30|45)",
@@ -346,7 +334,6 @@
install_element(GSMNET_NODE, &cfg_net_no_timezone_cmd);
install_element(GSMNET_NODE, &cfg_net_per_loc_upd_cmd);
install_element(GSMNET_NODE, &cfg_net_no_per_loc_upd_cmd);
-   install_element(GSMNET_NODE, &cfg_net_dyn_ts_allow_tch_f_cmd);
 
return CMD_SUCCESS;
 }
diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index 2413c43..b0b78be 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -402,20 +402,6 @@
return -1;
 #endif
 
-   /*
-* For osmo-nitb, skip TCH/F for now, because otherwise dyn TS
-* always imply the possibility to have a mix of TCH/F and
-* TCH/H channels; if two phones request a TCH/F and a TCH/H,
-* respectively, they cannot call each other. If we deny TCH/F,
-* they will both fall back to TCH/H, and dynamic channels are
-* usable. See OS#1778.
-*
-* A third-party MSC may well be able to handle a TCH/H TCH/F
-* mismatch. Moreover, this option may be overwritten in the
-* config file or in VTY.
-*/
-   msc_network->dyn_ts_allow_tch_f = false;
-
rc = vty_read_config_file(msc_cmdline_config.config_file, NULL);
if (rc < 0) {
LOGP(DMSC, LOGL_FATAL, "Failed to parse the config file: 
'%s'\n",

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iaa41d22db81120572d4cd2c0c4c75d258947a42f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-msc[master]: remove bsc_api.h and all users - they're all dead code

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

Change subject: remove bsc_api.h and all users - they're all dead code
..


remove bsc_api.h and all users - they're all dead code

Related: OS#2528
Change-Id: I332aa8697c98a0d7b3db65f98711275da3d381d7
---
M include/osmocom/msc/Makefile.am
D include/osmocom/msc/bsc_api.h
M include/osmocom/msc/gsm_data.h
M include/osmocom/msc/gsm_data_shared.h
M include/osmocom/msc/osmo_msc.h
M src/libmsc/gsm_04_08.c
M src/libmsc/gsm_04_14.c
M src/libmsc/osmo_msc.c
M tests/msc_vlr/msc_vlr_tests.c
9 files changed, 1 insertion(+), 77 deletions(-)

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



diff --git a/include/osmocom/msc/Makefile.am b/include/osmocom/msc/Makefile.am
index d31883a..f0e24c4 100644
--- a/include/osmocom/msc/Makefile.am
+++ b/include/osmocom/msc/Makefile.am
@@ -1,7 +1,6 @@
 noinst_HEADERS = \
a_iface.h \
a_iface_bssap.h \
-   bsc_api.h \
common.h \
common_cs.h \
db.h \
diff --git a/include/osmocom/msc/bsc_api.h b/include/osmocom/msc/bsc_api.h
deleted file mode 100644
index 4936f53..000
--- a/include/osmocom/msc/bsc_api.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* GSM 08.08 like API for OpenBSC */
-
-#ifndef OPENBSC_BSC_API_H
-#define OPENBSC_BSC_API_H
-
-#include "gsm_data.h"
-
-#define BSC_API_CONN_POL_ACCEPT0
-#define BSC_API_CONN_POL_REJECT1
-
-struct bsc_api {
-   /*! \brief BTS->MSC: tell MSC a SAPI was not established */
-   void (*sapi_n_reject)(struct gsm_subscriber_connection *conn, int dlci);
-   /*! \brief MS->MSC: Tell MSC that ciphering has been enabled */
-   void (*cipher_mode_compl)(struct gsm_subscriber_connection *conn,
- struct msgb *msg, uint8_t chosen_encr);
-   /*! \brief MS->MSC: New MM context with L3 payload */
-   int (*compl_l3)(struct gsm_subscriber_connection *conn,
-   struct msgb *msg, uint16_t chosen_channel); 
-   /*! \brief MS->BSC/MSC: Um L3 message */
-   void (*dtap)(struct gsm_subscriber_connection *conn, uint8_t link_id,
-   struct msgb *msg);
-   /*! \brief BSC->MSC: Assignment of lchan successful */
-   void (*assign_compl)(struct gsm_subscriber_connection *conn,
- uint8_t rr_cause, uint8_t chosen_channel,
- uint8_t encr_alg_id, uint8_t speech_mode);
-   /*! \brief BSC->MSC: Assignment of lchan failed */
-   void (*assign_fail)(struct gsm_subscriber_connection *conn,
-uint8_t cause, uint8_t *rr_cause);
-   /*! \brief BSC->MSC: RR conn has been cleared */
-   int (*clear_request)(struct gsm_subscriber_connection *conn,
- uint32_t cause);
-   /*! \brief BSC->MSC: Classmark Update */
-   void (*classmark_chg)(struct gsm_subscriber_connection *conn,
- const uint8_t *cm2, uint8_t cm2_len,
- const uint8_t *cm3, uint8_t cm3_len);
-
-   /**
-* Configure the multirate setting on this channel. If it is
-* not implemented AMR5.9 will be used.
-*/
-   void (*mr_config)(struct gsm_subscriber_connection *conn,
-   struct gsm_lchan *lchan, int full_rate);
-
-   /** Callback for additional actions during conn cleanup */
-   void (*conn_cleanup)(struct gsm_subscriber_connection *conn);
-};
-
-#endif
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 3e4b5a8..561cf3d 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -344,7 +344,6 @@
 * we have a subscriber connection.
 */
struct llist_head trans_list;
-   struct bsc_api *bsc_api;
 
unsigned int paging_response_timer;
 
diff --git a/include/osmocom/msc/gsm_data_shared.h 
b/include/osmocom/msc/gsm_data_shared.h
index 68b36ab..857946d 100644
--- a/include/osmocom/msc/gsm_data_shared.h
+++ b/include/osmocom/msc/gsm_data_shared.h
@@ -44,7 +44,6 @@
 struct gsm_mncc;
 struct osmo_rtp_socket;
 struct rtp_socket;
-struct bsc_api;
 
 /*
  * help with parsing regexps
diff --git a/include/osmocom/msc/osmo_msc.h b/include/osmocom/msc/osmo_msc.h
index 2fa8c46..2b019e1 100644
--- a/include/osmocom/msc/osmo_msc.h
+++ b/include/osmocom/msc/osmo_msc.h
@@ -8,8 +8,6 @@
 
 #include 
 
-#include "bsc_api.h"
-
 #define MSC_HLR_REMOTE_IP_DEFAULT "127.0.0.1"
 #define MSC_HLR_REMOTE_PORT_DEFAULT OSMO_GSUP_PORT
 
@@ -55,8 +53,6 @@
MSC_CONN_ACCEPT = 0,
MSC_CONN_REJECT = 1,
 };
-
-struct bsc_api *msc_bsc_api();
 
 int msc_create_conn_fsm(struct gsm_subscriber_connection *conn, const char 
*id);
 
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index a5b967e..b928171 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -46,7 +46,6 @@
 #include 
 #inclu

[MERGED] osmo-msc[master]: dead code removal

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

Change subject: dead code removal
..


dead code removal

Related: OS#2528
Change-Id: I89157c446d66e11adbe3cad587eb34ec40271c12
---
M include/osmocom/msc/gsm_04_08.h
M include/osmocom/msc/gsm_data.h
M include/osmocom/msc/gsm_data_shared.h
M src/libmsc/vty_interface_layer3.c
4 files changed, 2 insertions(+), 105 deletions(-)

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



diff --git a/include/osmocom/msc/gsm_04_08.h b/include/osmocom/msc/gsm_04_08.h
index 58cb7ae..f059d75 100644
--- a/include/osmocom/msc/gsm_04_08.h
+++ b/include/osmocom/msc/gsm_04_08.h
@@ -31,9 +31,7 @@
 int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg);
 
 int gsm0408_rcvmsg(struct msgb *msg, uint8_t link_id);
-enum gsm_chan_t get_ctype_by_chreq(struct gsm_network *bts, uint8_t ra);
 /* don't use "enum gsm_chreq_reason_t" to avoid circular dependency */
-int get_reason_by_chreq(uint8_t ra, int neci);
 void gsm_net_update_ctype(struct gsm_network *net);
 
 int gsm48_tx_mm_info(struct gsm_subscriber_connection *conn);
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 561cf3d..444618c 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -25,31 +25,12 @@
 /** annotations for msgb ownership */
 #define __uses
 
-#define OBSC_NM_W_ACK_CB(__msgb) (__msgb)->cb[3]
-
 struct mncc_sock_state;
-struct gsm_subscriber_group;
 struct vlr_instance;
 struct vlr_subscr;
 struct ranap_ue_conn_ctx;
 
-#define OBSC_LINKID_CB(__msgb) (__msgb)->cb[3]
-
 #define tmsi_from_string(str) strtoul(str, NULL, 10)
-
-/* 3-bit long values */
-#define EARFCN_PRIO_INVALID 8
-#define EARFCN_MEAS_BW_INVALID 8
-/* 5-bit long values */
-#define EARFCN_QRXLV_INVALID 32
-#define EARFCN_THRESH_LOW_INVALID 32
-
-enum gsm_security_event {
-   GSM_SECURITY_NOAVAIL,
-   GSM_SECURITY_AUTH_FAILED,
-   GSM_SECURITY_SUCCEEDED,
-   GSM_SECURITY_ALREADY,
-};
 
 struct msgb;
 typedef int gsm_cbfn(unsigned int hooknum,
@@ -57,56 +38,12 @@
 struct msgb *msg,
 void *data, void *param);
 
-/* Real authentication information containing Ki */
-enum gsm_auth_algo {
-   AUTH_ALGO_NONE,
-   AUTH_ALGO_XOR,
-   AUTH_ALGO_COMP128v1,
-};
-
-struct gsm_auth_info {
-   enum gsm_auth_algo auth_algo;
-   unsigned int a3a8_ki_len;
-   uint8_t a3a8_ki[16];
-};
-
 struct gsm_auth_tuple {
int use_count;
int key_seq;
struct osmo_auth_vector vec;
 };
 #define GSM_KEY_SEQ_INVAL  7   /* GSM 04.08 - 10.5.1.2 */
-
-/*
- * AUTHENTICATION/CIPHERING state
- */
-struct gsm_security_operation {
-   struct gsm_auth_tuple atuple;
-   gsm_cbfn *cb;
-   void *cb_data;
-};
-
-/*
- * A dummy to keep a connection up for at least
- * a couple of seconds to work around MSC issues.
- */
-struct gsm_anchor_operation {
-   struct osmo_timer_list timeout;
-};
-
-/* Maximum number of neighbor cells whose average we track */
-#define MAX_NEIGH_MEAS 10
-/* Maximum size of the averaging window for neighbor cells */
-#define MAX_WIN_NEIGH_AVG  10
-
-/* processed neighbor measurements for one cell */
-struct neigh_meas_proc {
-   uint16_t arfcn;
-   uint8_t bsic;
-   uint8_t rxlev[MAX_WIN_NEIGH_AVG];
-   unsigned int rxlev_cnt;
-   uint8_t last_seen_nr;
-};
 
 enum ran_type {
RAN_UNKNOWN,
@@ -154,12 +91,6 @@
uint8_t expire_timer_stopped;
/* SMS helpers for libmsc */
uint8_t next_rp_ref;
-
-   /*
-* Operations that have a state and might be pending
-*/
-   struct gsm_security_operation *sec_operation;
-   struct gsm_anchor_operation *anch_operation;
 
struct osmo_fsm_inst *conn_fsm;
 
@@ -311,26 +242,11 @@
/* bit-mask of permitted encryption algorithms. LSB=A5/0, MSB=A5/7 */
uint8_t a5_encryption_mask;
bool authentication_required;
-   int neci;
int send_mm_info;
struct {
int active;
-   /* Window RXLEV averaging */
-   unsigned int win_rxlev_avg; /* number of SACCH frames */
-   /* Window RXQUAL averaging */
-   unsigned int win_rxqual_avg;/* number of SACCH frames */
-   /* Window RXLEV neighbouring cells averaging */
-   unsigned int win_rxlev_avg_neigh; /* number of SACCH frames */
-
-   /* how often should we check for power budget HO */
-   unsigned int pwr_interval;  /* SACCH frames */
-   /* how much better does a neighbor cell have to be ? */
-   unsigned int pwr_hysteresis;/* dBm */
-   /* maximum distacne before we try a handover */
-   unsigned int max_distance;  /* TA values */
} handover;
 
-   struct rate_ctr_group *bs

[MERGED] osmo-msc[master]: gsm_data: remove unused gsm_subscriber_connection members

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

Change subject: gsm_data: remove unused gsm_subscriber_connection members
..


gsm_data: remove unused gsm_subscriber_connection members

The mncc_rtp_create_pending and mncc_rtp_connect_pending members
were unused, let's remove them.

Related: OS#2528
Change-Id: I417e23ec53323ddd8e1e5d18952566fe8fd6ac24
---
M include/osmocom/msc/gsm_data.h
1 file changed, 0 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 06328dc..3e4b5a8 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -168,8 +168,6 @@
 
/* MNCC rtp bridge markers */
int mncc_rtp_bridge;
-   int mncc_rtp_create_pending;
-   int mncc_rtp_connect_pending;
 
/* back pointers */
struct gsm_network *network;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I417e23ec53323ddd8e1e5d18952566fe8fd6ac24
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-bts[master]: osmo-bts: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ieed87b8109e0095a3d99c30f0b042aa3ee4b6384
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-hlr[master]: osmo-hlr: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

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

osmo-hlr: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
---
M src/hlr.c
M src/hlr_vty.c
2 files changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/21/6421/1

diff --git a/src/hlr.c b/src/hlr.c
index 168e203..f3a6864 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -439,6 +439,7 @@
 
hlr_ctx = talloc_named_const(NULL, 1, "OsmoHLR");
msgb_talloc_ctx_init(hlr_ctx, 0);
+   vty_info.tall_ctx = hlr_ctx;
 
g_hlr = talloc_zero(hlr_ctx, struct hlr);
 
diff --git a/src/hlr_vty.c b/src/hlr_vty.c
index 202f7f7..c10829d 100644
--- a/src/hlr_vty.c
+++ b/src/hlr_vty.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "hlr_vty.h"
 #include "hlr_vty_subscr.h"
@@ -126,6 +127,7 @@
g_hlr = hlr;
 
logging_vty_add_cmds(cat);
+   osmo_talloc_vty_add_cmds();
 
install_element(CONFIG_NODE, &cfg_hlr_cmd);
install_node(&hlr_node, config_write_hlr);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc2c333b83f85fa69a364e3e342f12f50dbc2f70
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[MERGED] osmo-bts[master]: osmo-bts: Add talloc context introspection via VTY

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

Change subject: osmo-bts: Add talloc context introspection via VTY
..


osmo-bts: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: Ieed87b8109e0095a3d99c30f0b042aa3ee4b6384
---
M src/common/main.c
M src/common/vty.c
2 files changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/src/common/main.c b/src/common/main.c
index 2804ca6..b7d5653 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -235,6 +235,7 @@
 
tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context");
msgb_talloc_ctx_init(tall_bts_ctx, 100*1024);
+   bts_vty_info.tall_ctx = tall_bts_ctx;
 
bts_log_init(NULL);
vty_init(&bts_vty_info);
diff --git a/src/common/vty.c b/src/common/vty.c
index 06330b4..5abc90e 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1502,6 +1502,7 @@
install_element_ve(&show_lchan_summary_cmd);
 
logging_vty_add_cmds(cat);
+   osmo_talloc_vty_add_cmds();
 
install_node(&bts_node, config_write_bts);
install_element(CONFIG_NODE, &cfg_bts_cmd);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ieed87b8109e0095a3d99c30f0b042aa3ee4b6384
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-bsc[master]: vty: Permit codec-list containing both full-rate and half-ra...

2018-02-13 Thread Harald Welte

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

vty: Permit codec-list containing both full-rate and half-rate codecs

Once upon a time, in the old osmo-bsc-sccplite, there was a restriction
of not being able to handle configurations with both TCH/F and TCH/H
type codecs.  This time is long gone, so let's remove this constraint.

Change-Id: Iba0822f57c41cedeeb7f069be540f3a851752a23
Closes: OS#2763
---
M src/osmo-bsc/osmo_bsc_vty.c
1 file changed, 2 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/19/6419/1

diff --git a/src/osmo-bsc/osmo_bsc_vty.c b/src/osmo-bsc/osmo_bsc_vty.c
index fb8b275..e173b4a 100644
--- a/src/osmo-bsc/osmo_bsc_vty.c
+++ b/src/osmo-bsc/osmo_bsc_vty.c
@@ -289,10 +289,7 @@
   "List of audio codecs, e.g. fr3 fr1 hr3\n")
 {
struct bsc_msc_data *data = bsc_msc_data(vty);
-   int saw_fr, saw_hr;
int i;
-
-   saw_fr = saw_hr = 0;
 
/* free the old list... if it exists */
if (data->audio_support) {
@@ -319,19 +316,10 @@
struct gsm_audio_support);
data->audio_support[i]->ver = atoi(argv[i] + 2);
 
-   if (strncmp("hr", argv[i], 2) == 0) {
+   if (strncmp("hr", argv[i], 2) == 0)
data->audio_support[i]->hr = 1;
-   saw_hr = 1;
-   } else if (strncmp("fr", argv[i], 2) == 0) {
+   else if (strncmp("fr", argv[i], 2) == 0)
data->audio_support[i]->hr = 0;
-   saw_fr = 1;
-   }
-
-   if (saw_hr && saw_fr) {
-   vty_out(vty, "Can not have full-rate and half-rate 
codec.%s",
-   VTY_NEWLINE);
-   return CMD_ERR_INCOMPLETE;
-   }
}
 
return CMD_SUCCESS;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba0822f57c41cedeeb7f069be540f3a851752a23
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-bsc[master]: osmo-bsc: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

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

osmo-bsc: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: I1245b6818eb54f5c0c8adddcd3a01ecc7363fb42
---
M src/libbsc/bsc_vty.c
M src/osmo-bsc/osmo_bsc_main.c
2 files changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/20/6420/1

diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c
index 3da4745..a719358 100644
--- a/src/libbsc/bsc_vty.c
+++ b/src/libbsc/bsc_vty.c
@@ -4314,6 +4314,7 @@
install_element_ve(&show_paging_group_cmd);
 
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
 
install_element(GSMNET_NODE, &cfg_net_neci_cmd);
install_element(GSMNET_NODE, &cfg_net_T3101_cmd);
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 1aff4c5..3deb369 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -197,6 +197,7 @@
 
tall_bsc_ctx = talloc_named_const(NULL, 1, "openbsc");
msgb_talloc_ctx_init(tall_bsc_ctx, 0);
+   vty_info.tall_ctx = tall_bsc_ctx;
 
osmo_init_logging(&log_info);
osmo_stats_init(tall_bsc_ctx);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1245b6818eb54f5c0c8adddcd3a01ecc7363fb42
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-bts[master]: osmo-bts: Add talloc context introspection via VTY

2018-02-13 Thread Harald Welte

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

osmo-bts: Add talloc context introspection via VTY

This requires libosmocore with Change-Id
I43fc42880b22294d83c565ae600ac65e4f38b30d or later.

Change-Id: Ieed87b8109e0095a3d99c30f0b042aa3ee4b6384
---
M src/common/main.c
M src/common/vty.c
2 files changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/18/6418/1

diff --git a/src/common/main.c b/src/common/main.c
index 2804ca6..b7d5653 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -235,6 +235,7 @@
 
tall_bts_ctx = talloc_named_const(NULL, 1, "OsmoBTS context");
msgb_talloc_ctx_init(tall_bts_ctx, 100*1024);
+   bts_vty_info.tall_ctx = tall_bts_ctx;
 
bts_log_init(NULL);
vty_init(&bts_vty_info);
diff --git a/src/common/vty.c b/src/common/vty.c
index 06330b4..5abc90e 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1502,6 +1502,7 @@
install_element_ve(&show_lchan_summary_cmd);
 
logging_vty_add_cmds(cat);
+   osmo_talloc_vty_add_cmds();
 
install_node(&bts_node, config_write_bts);
install_element(CONFIG_NODE, &cfg_bts_cmd);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieed87b8109e0095a3d99c30f0b042aa3ee4b6384
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[MERGED] osmo-sgsn[master]: .gitignore: Add m4 files

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

Change subject: .gitignore: Add m4 files
..


.gitignore: Add m4 files

Existing m4/ax_check_compile_flag.m4 is skipped from the list of ignored
files.

Change-Id: I7ad810e720ee8a02a28c601aa966ddde04023819
---
M .gitignore
1 file changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/.gitignore b/.gitignore
index 5f6aee2..7879088 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,8 @@
 #configure
 aclocal.m4
 autom4te.cache/
+m4/*.m4
+!m4/ax_*.m4
 config.log
 config.status
 config.guess

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7ad810e720ee8a02a28c601aa966ddde04023819
Gerrit-PatchSet: 2
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 


osmo-msc[master]: remove unused "auth policy" VTY command

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I825e659da529257e5edec94d9d59f0e10c1b4c63
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-msc[master]: remove unused VTY command "location updating reject cause"

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-msc[master]: remove unused "authorized-regexp" VTY command

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icf0897c47388e49ba7886b55acc728a6f7d213fe
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-sgsn[master]: sgsn_libgtp.c: Fix typos and whitespace

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

Change subject: sgsn_libgtp.c: Fix typos and whitespace
..


sgsn_libgtp.c: Fix typos and whitespace

Change-Id: Ic223cf378a83051603f58dacf087cc59d9f03890
---
M src/gprs/sgsn_libgtp.c
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gprs/sgsn_libgtp.c b/src/gprs/sgsn_libgtp.c
index ae293f1..4061e7a 100644
--- a/src/gprs/sgsn_libgtp.c
+++ b/src/gprs/sgsn_libgtp.c
@@ -587,7 +587,7 @@
 static int cb_recovery(struct sockaddr_in *peer, uint8_t recovery)
 {
struct sgsn_ggsn_ctx *ggsn;
-   
+
ggsn = sgsn_ggsn_ctx_by_addr(&peer->sin_addr);
if (!ggsn) {
LOGP(DGPRS, LOGL_NOTICE, "Received Recovery IE for unknown 
GGSN\n");
@@ -635,7 +635,7 @@
 /* Called whenever a PDP context is deleted for any reason */
 static int cb_delete_context(struct pdp_t *pdp)
 {
-   LOGPDPX(DGPRS, LOGL_INFO, pdp, "Context was deleted\n")   ;
+   LOGPDPX(DGPRS, LOGL_INFO, pdp, "Context was deleted\n");
 
return 0;
 }
@@ -652,13 +652,13 @@
 /* Called when we receive a Supported Ext Headers Notification */
 static int cb_extheader_ind(struct sockaddr_in *peer)
 {
-   LOGP(DGPRS, LOGL_INFO, "GTP Supported Ext Headers Noficiation "
+   LOGP(DGPRS, LOGL_INFO, "GTP Supported Ext Headers Notification "
"from %s:%u\n", inet_ntoa(peer->sin_addr),
ntohs(peer->sin_port));
return 0;
 }
 
-/* Called whenever we recive a DATA packet */
+/* Called whenever we receive a DATA packet */
 static int cb_data_ind(struct pdp_t *lib, void *packet, unsigned int len)
 {
struct bssgp_paging_info pinfo;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic223cf378a83051603f58dacf087cc59d9f03890
Gerrit-PatchSet: 2
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


osmo-sgsn[master]: .gitignore: Add m4 files

2018-02-13 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7ad810e720ee8a02a28c601aa966ddde04023819
Gerrit-PatchSet: 2
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-msc[master]: remove bsc_api.h and all users - they're all dead code

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I332aa8697c98a0d7b3db65f98711275da3d381d7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-msc[master]: remove unused dyn_ts_allow_tch_f VTY option

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iaa41d22db81120572d4cd2c0c4c75d258947a42f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-msc[master]: dead code removal

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I89157c446d66e11adbe3cad587eb34ec40271c12
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


  1   2   >