[PATCH] osmo-ttcn3-hacks[master]: Add a test for OS#2714, "close RSL connections from unknown ...

2018-02-13 Thread Stefan Sperling

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

Add a test for OS#2714, "close RSL connections from unknown Unit ID"

Change-Id: I6a947d7411a016e4d7650031396cae3575756453
---
M bsc/BSC_Tests.ttcn
1 file changed, 42 insertions(+), 0 deletions(-)


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

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 086830a..3c2cf41 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -28,6 +28,7 @@
 import from BSSAP_CodecPort all;
 import from BSSMAP_Templates all;
 import from IPA_Emulation all;
+import from IPA_CodecPort all;
 import from IPA_Types all;
 import from RSL_Types all;
 import from RSL_Emulation all;
@@ -61,6 +62,7 @@
var BTS_State bts[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
+   port IPA_CODEC_PT IPA; /* Required for compilation of 
TC_rsl_unknown_unit_id() */
 
var MGCP_Emulation_CT vc_MGCP;
 
@@ -1236,6 +1238,45 @@
 
 /* TODO: Test OML link drop causes counter increment */
 
+/* BSC should close an RSL connection from a BTS with unknown unit ID 
(OS#2714). */
+testcase TC_rsl_unknown_unit_id() runs on test_CT {
+   timer T := 10.0;
+
+   bts[0].rsl.id := "IPA-0-RSL";
+   bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA");
+   bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars;
+   bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
+   bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at 
BTS */
+
+   /* Call a function of our 'parent component' BSSAP_Adapter_CT to start 
the
+* MSC-side BSSAP emulation */
+   f_bssap_init("VirtMSC", omit);
+
+   f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
+
+   f_init_mgcp("VirtMSC");
+
+   /* start RSL connection */
+   map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA);
+   connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]);
+   bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, 
mp_bsc_rsl_port, "", 1, bts[0].rsl.ccm_pars));
+
+   /* wait for IPA RSL link to connect and then disconnect */
+   T.start;
+   alt {
+   [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) {
+   T.stop;
+   setverdict(pass);
+   }
+   [] IPA_RSL[0].receive { repeat }
+   [] T.timeout {
+   setverdict(fail, "Timeout RSL waiting for connection to close");
+   self.stop;
+   }
+   }
+}
+
+
 /***
  * "New world" test cases using RSL_Emulation + BSSMAP_Emulation
  ***/
@@ -1594,6 +1635,7 @@
execute( TC_paging_imsi_load() );
 
execute( TC_rsl_drop_counter() );
+   execute( TC_rsl_unknown_unit_id() );
 
execute( TC_classmark() );
execute( TC_unsol_ass_fail() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6a947d7411a016e4d7650031396cae3575756453
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 


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

2018-02-13 Thread Max

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

SS7: return error on stream opening error

Previously we've just logged error but continued as is.
Let's treat it as a error to let upper layers decide on it.

Change-Id: I2ce55983b255b0b50fd5142d6ddf188dc8ee20b9
---
M src/osmo_ss7.c
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/07/6407/1

diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c
index 7f82f6e..bf5cf1d 100644
--- a/src/osmo_ss7.c
+++ b/src/osmo_ss7.c
@@ -1251,6 +1251,7 @@
if (rc < 0) {
LOGSS7(asp->inst, LOGL_ERROR, "Unable to open stream"
" client for ASP %s\n", asp->cfg.name);
+   return -ENOSTR;
}
/* TODO: make this configurable and not implicit */
role = XUA_ASPFSM_ROLE_ASP;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2ce55983b255b0b50fd5142d6ddf188dc8ee20b9
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Max 


osmo-gsm-tester[master]: log: Use sys._getframe() to avoid stat(2) calls

2018-02-13 Thread Pau Espin Pedrol

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


[PATCH] osmo-pcu[master]: emu: use libosmocore definitions

2018-02-13 Thread Max

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

emu: use libosmocore definitions

Change-Id: I4eade528faeb3841549ad7a6c78e8c1357909614
---
M tests/emu/openbsc_clone.h
1 file changed, 1 insertion(+), 29 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/05/6405/1

diff --git a/tests/emu/openbsc_clone.h b/tests/emu/openbsc_clone.h
index b3cc033..8661062 100644
--- a/tests/emu/openbsc_clone.h
+++ b/tests/emu/openbsc_clone.h
@@ -24,7 +24,7 @@
 #endif
 
 #include 
-
+#include 
 #include 
 
 enum gprs_llc_cmd {
@@ -58,34 +58,6 @@
 };
 
 int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp, const uint8_t 
*llc_hdr, int len);
-
-/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */
-#define GSM48_MT_GMM_ATTACH_ACK0x02
-
-/* Chapter 9.4.2 / Table 9.4.2 */
-struct gsm48_attach_ack {
-   uint8_t att_result:4,   /* 10.5.5.7 */
-force_stby:4;  /* 10.5.5.1 */
-   uint8_t ra_upd_timer;   /* 10.5.7.3 */
-   uint8_t radio_prio; /* 10.5.7.2 */
-   struct gsm48_ra_id ra_id; /* 10.5.5.15 */
-   uint8_t data[0];
-} __attribute__((packed));
-
-enum gsm48_gprs_ie_mm {
-   GSM48_IE_GMM_CIPH_CKSN  = 0x08, /* 10.5.1.2 */
-   GSM48_IE_GMM_TIMER_READY= 0x17, /* 10.5.7.3 */
-   GSM48_IE_GMM_ALLOC_PTMSI= 0x18, /* 10.5.1.4 */
-   GSM48_IE_GMM_PTMSI_SIG  = 0x19, /* 10.5.5.8 */
-   GSM48_IE_GMM_AUTH_RAND  = 0x21, /* 10.5.3.1 */
-   GSM48_IE_GMM_AUTH_SRES  = 0x22, /* 10.5.3.2 */
-   GSM48_IE_GMM_IMEISV = 0x23, /* 10.5.1.4 */
-   GSM48_IE_GMM_DRX_PARAM  = 0x27, /* 10.5.5.6 */
-   GSM48_IE_GMM_MS_NET_CAPA= 0x31, /* 10.5.5.12 */
-   GSM48_IE_GMM_PDP_CTX_STATUS = 0x32, /* 10.5.7.1 */
-   GSM48_IE_GMM_PS_LCS_CAPA= 0x33, /* 10.5.5.22 */
-   GSM48_IE_GMM_GMM_MBMS_CTX_ST= 0x35, /* 10.5.7.6 */
-};
 
 extern const struct tlv_definition gsm48_gmm_att_tlvdef;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4eade528faeb3841549ad7a6c78e8c1357909614
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 


osmo-pcu[master]: emu: use libosmocore definitions

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-pcu[master]: emu: use libosmocore definitions

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

Change subject: emu: use libosmocore definitions
..


emu: use libosmocore definitions

Change-Id: I4eade528faeb3841549ad7a6c78e8c1357909614
---
M tests/emu/openbsc_clone.h
1 file changed, 1 insertion(+), 29 deletions(-)

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



diff --git a/tests/emu/openbsc_clone.h b/tests/emu/openbsc_clone.h
index b3cc033..8661062 100644
--- a/tests/emu/openbsc_clone.h
+++ b/tests/emu/openbsc_clone.h
@@ -24,7 +24,7 @@
 #endif
 
 #include 
-
+#include 
 #include 
 
 enum gprs_llc_cmd {
@@ -58,34 +58,6 @@
 };
 
 int gprs_llc_hdr_parse(struct gprs_llc_hdr_parsed *ghp, const uint8_t 
*llc_hdr, int len);
-
-/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */
-#define GSM48_MT_GMM_ATTACH_ACK0x02
-
-/* Chapter 9.4.2 / Table 9.4.2 */
-struct gsm48_attach_ack {
-   uint8_t att_result:4,   /* 10.5.5.7 */
-force_stby:4;  /* 10.5.5.1 */
-   uint8_t ra_upd_timer;   /* 10.5.7.3 */
-   uint8_t radio_prio; /* 10.5.7.2 */
-   struct gsm48_ra_id ra_id; /* 10.5.5.15 */
-   uint8_t data[0];
-} __attribute__((packed));
-
-enum gsm48_gprs_ie_mm {
-   GSM48_IE_GMM_CIPH_CKSN  = 0x08, /* 10.5.1.2 */
-   GSM48_IE_GMM_TIMER_READY= 0x17, /* 10.5.7.3 */
-   GSM48_IE_GMM_ALLOC_PTMSI= 0x18, /* 10.5.1.4 */
-   GSM48_IE_GMM_PTMSI_SIG  = 0x19, /* 10.5.5.8 */
-   GSM48_IE_GMM_AUTH_RAND  = 0x21, /* 10.5.3.1 */
-   GSM48_IE_GMM_AUTH_SRES  = 0x22, /* 10.5.3.2 */
-   GSM48_IE_GMM_IMEISV = 0x23, /* 10.5.1.4 */
-   GSM48_IE_GMM_DRX_PARAM  = 0x27, /* 10.5.5.6 */
-   GSM48_IE_GMM_MS_NET_CAPA= 0x31, /* 10.5.5.12 */
-   GSM48_IE_GMM_PDP_CTX_STATUS = 0x32, /* 10.5.7.1 */
-   GSM48_IE_GMM_PS_LCS_CAPA= 0x33, /* 10.5.5.22 */
-   GSM48_IE_GMM_GMM_MBMS_CTX_ST= 0x35, /* 10.5.7.6 */
-};
 
 extern const struct tlv_definition gsm48_gmm_att_tlvdef;
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4eade528faeb3841549ad7a6c78e8c1357909614
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


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

2018-02-13 Thread Max

Patch Set 1:

N. B: this is RFC - I'm not sure if skipping the error was intentional in here 
so I'd appreciate feedback on it. If it is than we should at least add comment 
clarifying why this is necessary.

-- 
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: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


osmo-ttcn3-hacks[master]: MSC_Tests: Add CC sequence no. test with DTMF

2018-02-13 Thread daniel

Patch Set 1:

Yeah, removed that. I also added the test to control so it is executed 
automatically

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

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


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

2018-02-13 Thread Max

Patch Set 1: Code-Review-1

(1 comment)

You should either remove the remaining m4 file or add it as !pattern to 
gitignore.

https://gerrit.osmocom.org/#/c/6389/1/.gitignore
File .gitignore:

Line 24: m4/lt~obsolete.m4
> Agreed.
That'd be wrong:
git ls-files m4
m4/ax_check_compile_flag.m4


-- 
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: 1
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: Yes


[PATCH] osmo-ttcn3-hacks[master]: MSC_Tests: Add CC sequence no. test with DTMF

2018-02-13 Thread daniel
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6301

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

MSC_Tests: Add CC sequence no. test with DTMF

Change-Id: I9674343acc18187b9e016bd8e0be470d5424046f
---
M library/L3_Templates.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
3 files changed, 104 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/01/6301/2

diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index a7e14e2..8b1857d 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -777,6 +777,30 @@
}
 }
 
+template (value) PDU_ML3_MS_NW ts_ML3_MO_CC_START_DTMF(integer tid, charstring 
number) := {
+   discriminator := '0011'B,
+   tiOrSkip := {
+   transactionId := {
+   tio := int2bit(tid, 3),
+   tiFlag := '0'B,
+   tIExtension := omit
+   }
+   },
+   msgs := {
+   cc := {
+   startDTMF := {
+   messageType := '110101'B,
+   nsd := '00'B,
+   keypadFacility := {
+   elementIdentifier := '2C'O,
+   keypadInformation := 
int2bit(char2int(number), 7),
+   spare_1 := '0'B
+   }
+   }
+   }
+   }
+}
+
 template PDU_ML3_NW_MS tr_ML3_MT_CC_DISC(integer tid) := {
discriminator := '0011'B,
tiOrSkip := {
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 4f50b70..b81f61f 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -518,6 +518,67 @@
setverdict(pass);
 }
 
+function f_mo_seq_dtmf_dup(inout CallParameters cpars)
+runs on BSC_ConnHdlr {
+
+   timer T := 1.0;
+   var MobileIdentityLV mi;
+   var MNCC_PDU mncc;
+   var MgcpCommand mgcp_cmd;
+   var template PDU_ML3_MS_NW dtmf_dtap;
+
+   /* If we have a TMSI, use TMSI instead of IMSI */
+   if (ispresent(g_pars.tmsi)) {
+   mi := valueof(ts_MI_TMSI_LV(g_pars.tmsi));
+   } else {
+   mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
+   }
+   f_establish_fully(mi);
+
+   /* Create MNCC and MGCP expect */
+   f_create_mncc_expect(hex2str(cpars.called_party));
+   f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
+
+   BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_SETUP(cpars.transaction_id, 
cpars.called_party)));
+   MNCC.receive(tr_MNCC_SETUP_ind(?, 
tr_MNCC_number(hex2str(cpars.called_party -> value mncc;
+   cpars.mncc_callref := mncc.u.signal.callref;
+
+   /* Send DTMF */
+   dtmf_dtap := ts_ML3_MO_CC_START_DTMF(cpars.transaction_id, "2");
+   dtmf_dtap.msgs.cc.startDTMF.nsd := int2bit(2, 2);
+   BSSAP.send(ts_PDU_DTAP_MO(dtmf_dtap));
+   T.start;
+   alt {
+   [] MNCC.receive(tr_MNCC_START_DTMF_ind(cpars.mncc_callref, "2")) {}
+   [] T.timeout {
+   setverdict(fail, "Timeout waiting for START_DTMF_ind");
+   self.stop;
+   }
+   }
+
+   BSSAP.send(ts_PDU_DTAP_MO(dtmf_dtap));
+   T.start;
+   alt {
+   [] MNCC.receive(tr_MNCC_START_DTMF_ind(cpars.mncc_callref, "2")) {
+   setverdict(fail, "Received duplicate START_DTMF_ind");
+   self.stop;
+   }
+   [] T.timeout { }
+   }
+
+   dtmf_dtap := ts_ML3_MO_CC_START_DTMF(cpars.transaction_id, "3");
+   dtmf_dtap.msgs.cc.startDTMF.nsd := int2bit(3, 2);
+   BSSAP.send(ts_PDU_DTAP_MO(dtmf_dtap))
+   alt {
+   [] MNCC.receive(tr_MNCC_START_DTMF_ind(cpars.mncc_callref, "3")) { }
+   [] T.timeout {
+   setverdict(fail, "Received duplicate START_DTMF_ind");
+   self.stop;
+   }
+   }
+
+   setverdict(pass);
+}
 /* expect a clear command */
 function f_expect_clear(float t := 5.0) runs on BSC_ConnHdlr {
timer T := t;
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 322be5f..e283279 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1574,6 +1574,24 @@
vc_conn.done;
 }
 
+/* Test MO Call SETUP with DTMF */
+private function f_tc_mo_setup_dtmf_dup(charstring id, BSC_ConnHdlrPars pars) 
runs on BSC_ConnHdlr {
+   f_init_handler(pars);
+   var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
+   cpars.bss_rtp_port := 1110;
+   cpars.mgcp_connection_id_bss := '2'H;
+   cpars.mgcp_connection_id_mss := '3'H;
+
+   f_perform_lu(true);
+   f_mo_seq_dtmf_dup(cpars);
+}
+testcase TC_mo_setup_and_dtmf_dup() runs on MTC_CT {
+   var BSC_ConnHdlr vc_conn;
+   f_init();
+
+   vc_conn := f_start_handler(refers(f_tc_mo_setup_dtmf_dup), 

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

2018-02-13 Thread Vadim Yanitskiy

Patch Set 1:

> (1 comment)
 > 
 > You should either remove the remaining m4 file or add it as
 > !pattern to gitignore.

Max is right here. This was I would follow the way of libosmocore:

m4/*.m4
!m4/ax_*.m4

-- 
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: 1
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


[MERGED] osmo-gsm-tester[master]: log: Use sys._getframe() to avoid stat(2) calls

2018-02-13 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged.

Change subject: log: Use sys._getframe() to avoid stat(2) calls
..


log: Use sys._getframe() to avoid stat(2) calls

The Osmo MS driver is launching many many processes and I would
like to use the logging framework for the code as well.
Unfortunately the inspect/traceback code will use a linecache which
will execute stat(2) on one or more python files.

Related: OS#2927
Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
---
M src/osmo_gsm_tester/log.py
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/log.py b/src/osmo_gsm_tester/log.py
index a9f16c2..7c4ae44 100644
--- a/src/osmo_gsm_tester/log.py
+++ b/src/osmo_gsm_tester/log.py
@@ -275,8 +275,10 @@
 target.large_separator(*msgs, sublevel=sublevel, 
space_above=space_above)
 
 def get_src_from_caller(levels_up=1):
-caller = getframeinfo(stack()[levels_up][0])
-return '%s:%d' % (os.path.basename(caller.filename), caller.lineno)
+# Poke into internal to avoid hitting the linecache which will make one or
+# more calls to stat(2).
+frame = sys._getframe(levels_up)
+return '%s:%d' % (os.path.basename(frame.f_code.co_filename), 
frame.f_lineno)
 
 def get_src_from_exc_info(exc_info=None, levels_up=1):
 if exc_info is None:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
Gerrit-PatchSet: 3
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 


osmo-gsm-tester[master]: log: Use sys._getframe() to avoid stat(2) calls

2018-02-13 Thread Holger Freyther

Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/6377/1/src/osmo_gsm_tester/log.py
File src/osmo_gsm_tester/log.py:

Line 278: # Poke into internal to avoid hitting the linecache which will 
make one or
> According to [1], _getframe() can have a depth parameter, which if I unders
Thanks for looking up the docs. I assumed it would not be documented at all.

I wouldn't want to catch AttributeError.
The code will never be executed (and hence likely broken or at least 
bitrotting). Then PyPy supports sys._getframe() as well 
(https://bitbucket.org/pypy/pypy/src/fc85b98a24e2a5a30d667659260089db372817f1/pypy/module/sys/__init__.py?at=default=file-view-default#__init__.py-55)

ValueError:
The unknown/unknown was just because I iterate myself. I think getting a 
ValueError is good. If somebody passes a bogus offset we can discover this 
quickly (instead of silencing it).


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 
Gerrit-HasComments: Yes


[PATCH] osmo-gsm-tester[master]: log: Use sys._getframe() to avoid stat(2) calls

2018-02-13 Thread Holger Freyther
Hello Pau Espin Pedrol, Jenkins Builder,

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

https://gerrit.osmocom.org/6377

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

log: Use sys._getframe() to avoid stat(2) calls

The Osmo MS driver is launching many many processes and I would
like to use the logging framework for the code as well.
Unfortunately the inspect/traceback code will use a linecache which
will execute stat(2) on one or more python files.

Related: OS#2927
Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
---
M src/osmo_gsm_tester/log.py
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/77/6377/2

diff --git a/src/osmo_gsm_tester/log.py b/src/osmo_gsm_tester/log.py
index a9f16c2..7c4ae44 100644
--- a/src/osmo_gsm_tester/log.py
+++ b/src/osmo_gsm_tester/log.py
@@ -275,8 +275,10 @@
 target.large_separator(*msgs, sublevel=sublevel, 
space_above=space_above)
 
 def get_src_from_caller(levels_up=1):
-caller = getframeinfo(stack()[levels_up][0])
-return '%s:%d' % (os.path.basename(caller.filename), caller.lineno)
+# Poke into internal to avoid hitting the linecache which will make one or
+# more calls to stat(2).
+frame = sys._getframe(levels_up)
+return '%s:%d' % (os.path.basename(frame.f_code.co_filename), 
frame.f_lineno)
 
 def get_src_from_exc_info(exc_info=None, levels_up=1):
 if exc_info is None:

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8f6bacadcf74d3aa25db1e1f41644f64aa19cf92
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: neels 


osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Vadim Yanitskiy

Patch Set 2:

(6 comments)

https://gerrit.osmocom.org/#/c/5753/2/src/common/msg_utils.c
File src/common/msg_utils.c:

Line 484:   if (lchan->tch_mode != GSM48_CMODE_SPEECH_AMR) {
Moreover, I would recommend to use a switch here:

switch (lchan->tch_mode) ...


Line 487:   else {
Here you can avoid the usage of else block, and thus reduce
the code nesting, because the function will return if DTX is
optional for particular combination of lchan and fn...


Line 502:   LOGP(DL1C, LOGL_DEBUG, "%s Have to send 
%s %s zero speech frame, Fn=%d, Fn mod 104=%d, dump=%s\n",
This code block is already shifted away from the line
beginning, so I would use a single tab for such alignment.


Line 518:   LOGP(DL1C, LOGL_DEBUG, "%s Have to send 
%s %s zero speech frame, Fn=%d, Fn mod 104=%d, dump=%s\n",
Same here, single tab for arguments would be better.


Line 534: 
Why do we have this line here?

It's not related to the change anyhow, so please remove.


Line 560:   LOGP(DL1C, LOGL_DEBUG, "%s Have to send %s SID buffer "
Please also unify the alignment here...


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I40e9bf9438c0b400e4d29eb39ffae37207e34db6
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Minh-Quang Nguyen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Minh-Quang Nguyen 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


[PATCH] osmo-gsm-tester[master]: modem: deactivate_context: Fix dbg message

2018-02-13 Thread Pau Espin Pedrol

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

modem: deactivate_context: Fix dbg message

Change-Id: I9aea339fb08c20e1b66a0d24c76d855bf665a4cd
---
M src/osmo_gsm_tester/modem.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/09/6409/1

diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 7750740..8de3f9f 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -614,7 +614,7 @@
 return ctx_path
 
 def deactivate_context(self, ctx_id):
-self.dbg('activate_context', path=ctx_id)
+self.dbg('deactivate_context', path=ctx_id)
 ctx = systembus_get(ctx_id)
 ctx.SetProperty('Active', Variant('b', False))
 event_loop.wait(self, lambda: ctx.GetProperties()['Active'] == False)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9aea339fb08c20e1b66a0d24c76d855bf665a4cd
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


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

2018-02-13 Thread Max

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

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(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/08/6408/1

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, , >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(>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, , >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(>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 "
+   LOGIPA(conn, LOGL_ERROR, "Unexpected return from "
 "ipa_ccm_rcvmsg_base: %d\n", rc);
goto err;
}
@@ 

osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Pau Espin Pedrol

Patch Set 1:

ping. Minh-Quang do you plan to submit a new version soon? seems like a few 
minutes job but it's been waiting for over a month.

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

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


osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Minh-Quang Nguyen

Patch Set 1:

> ping. Minh-Quang do you plan to submit a new version soon? seems
 > like a few minutes job but it's been waiting for over a month.

Hi Paul, 

I am sorry for the delay. I think that we can simply replace the static const 
by const declaration in msg_util.h.

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

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


osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Max

Patch Set 1:

Do we need the same fix for sysmoBTS as well?

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

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


osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Vadim Yanitskiy

Patch Set 3: Code-Review-1

And finally, regarding to the commit message: we usually follow
a shorter line length in description, so I would be happy if you
limit it as other contributers do. But this is cosmetics...

-1 due to some code warnings...

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I40e9bf9438c0b400e4d29eb39ffae37207e34db6
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Minh-Quang Nguyen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Minh-Quang Nguyen 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Minh-Quang Nguyen
Hello Vadim Yanitskiy, Jenkins Builder,

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

https://gerrit.osmocom.org/5753

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

LC15: Fix missing fill frame and GSM 05.08 mandatory frame

Problem:
 We have noticed that the LC15 BTS does not send L2 fill frame in case there is 
nothing to transmit.
 This leads to bad RXQUAL repored by MS during signaling in TCH channel.

 Related issue: https://osmocom.org/issues/1950

Fixes:
 BTS needs to send L2 fill frame in case there is nothing to transmit as 
indicated
 in GSM 05.08, section 8.3.

 "On any TCH this subset of TDMA frames is always used for transmission during 
DTX. For speech, when
 no signalling or speech is to be transmitted these TDMA frames are occupied by 
the SID (Silence
 Descriptor) speech frame, see TS GSM 06.12 and TSM GSM 06.31 for detailed 
specification of the SID
 frame and its transmission requirements. In other cases when no information is 
required to be transmitted,
 e.g. on data channels, the L2 fill frame (see GSM 04.06 section 5.4.2.3) shall 
be transmitted as a FACCH
 in the TDMA frame subset always to be transmitted.
 On the SDCCH and on the half rate speech traffic channel in signalling only 
mode DTX is not allowed. In
 these cases and during signalling on the TCH when DTX is not used, the same L2 
fill frame shall be
 transmitted in case there is nothing else to transmit."

Change-Id: I40e9bf9438c0b400e4d29eb39ffae37207e34db6
---
M src/common/msg_utils.c
M src/osmo-bts-litecell15/l1_if.c
2 files changed, 119 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/53/5753/2

diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index f936c98..370dd09 100644
--- a/src/common/msg_utils.c
+++ b/src/common/msg_utils.c
@@ -36,6 +36,17 @@
 
 #define STI_BIT_MASK 16
 
+static const uint8_t gsm_speech_zero[GSM_FR_BYTES] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00
+};
+
+static const uint8_t amr_sid_first_zero[9] = {
+   0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
 static int check_fom(struct abis_om_hdr *omh, size_t len)
 {
if (omh->length != len) {
@@ -379,7 +390,7 @@
static const uint8_t f[] = { 52, 53, 54, 55, 56, 57, 58, 59 },
h0[] = { 0, 2, 4, 6, 52, 54, 56, 58 },
h1[] = { 14, 16, 18, 20, 66, 68, 70, 72 };
-   if (lchan->tch_mode == GSM48_CMODE_SPEECH_V1) {
+   if ((lchan->tch_mode == GSM48_CMODE_SPEECH_V1) || (lchan->tch_mode == 
GSM48_CMODE_SPEECH_AMR)){
if (lchan->type == GSM_LCHAN_TCH_F)
return fn_chk(f, fn, ARRAY_SIZE(f));
else
@@ -465,6 +476,7 @@
  */
 uint8_t repeat_last_sid(struct gsm_lchan *lchan, uint8_t *dst, uint32_t fn)
 {
+   uint8_t pl_len;
/* FIXME: add EFR support */
if (lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)
return 0;
@@ -472,11 +484,54 @@
if (lchan->tch_mode != GSM48_CMODE_SPEECH_AMR) {
if (dtx_sched_optional(lchan, fn))
return 0;
-   } else
+   else {
+   if (lchan->ts->trx->bts->dtxd) {
+   /* Need to send zeroed TCH frame on mandatory 
Fn defined in GSM 05.08, section 8.3 */
+   switch (lchan->type) {
+   case GSM_LCHAN_TCH_F:
+   pl_len = GSM_FR_BYTES;
+   break;
+   case GSM_LCHAN_TCH_H:
+   pl_len = GSM_HR_BYTES;
+   break;
+   default:
+   return 0;
+   }
+   memcpy(dst, gsm_speech_zero, pl_len);
+
+   LOGP(DL1C, LOGL_DEBUG, "%s Have to send %s %s 
zero speech frame, Fn=%d, Fn mod 104=%d, dump=%s\n",
+   
gsm_lchan_name(lchan),
+   
get_value_string(gsm_chan_t_names, lchan->type),
+   
get_value_string(gsm48_chan_mode_names, lchan->tch_mode),
+   fn,
+   fn%104,
+   
osmo_hexdump(dst, pl_len));
+   return pl_len + 1;
+   }
+   }
+   } else {
+   

[PATCH] osmo-ttcn3-hacks[master]: Add tests for OS#2714, "close RSL connections from unknown U...

2018-02-13 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6406

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

Add tests for OS#2714, "close RSL connections from unknown Unit ID".

This adds two new tests: One for RSL, and a second one which performs
the same test on the OML port. Both tests open an IPA Connection and
send a unit ID which is unknown to the BSC. The tests expect the BSC
to close the conncetion immediately.

We need to add handling for a socket error in IPA_Emulation because
otherwise these tests do not pass reliably as some closed connections
are not properly detected.

Change-Id: I6a947d7411a016e4d7650031396cae3575756453
---
M bsc/BSC_Tests.ttcn
M library/IPA_Emulation.ttcn
2 files changed, 104 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/06/6406/2

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 086830a..a18b17f 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -28,6 +28,7 @@
 import from BSSAP_CodecPort all;
 import from BSSMAP_Templates all;
 import from IPA_Emulation all;
+import from IPA_CodecPort all;
 import from IPA_Types all;
 import from RSL_Types all;
 import from RSL_Emulation all;
@@ -61,6 +62,7 @@
var BTS_State bts[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
+   port IPA_CODEC_PT IPA; /* Required for compilation of 
TC_rsl_unknown_unit_id() */
 
var MGCP_Emulation_CT vc_MGCP;
 
@@ -75,6 +77,8 @@
 modulepar {
/* IP address at which the BSC can be reached */
charstring mp_bsc_ip := "127.0.0.1";
+   /* port number to which to establish the IPA OML connections */
+   integer mp_bsc_oml_port := 3002;
/* port number to which to establish the IPA RSL connections */
integer mp_bsc_rsl_port := 3003;
/* port number to which to establish the IPA CTRL connection */
@@ -1236,6 +1240,83 @@
 
 /* TODO: Test OML link drop causes counter increment */
 
+/* BSC should close an RSL connection from a BTS with unknown unit ID 
(OS#2714). */
+testcase TC_rsl_unknown_unit_id() runs on test_CT {
+   timer T := 10.0;
+
+   bts[0].rsl.id := "IPA-0-RSL";
+   bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA");
+   bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars;
+   bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
+   bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at 
BTS */
+
+   /* Call a function of our 'parent component' BSSAP_Adapter_CT to start 
the
+* MSC-side BSSAP emulation */
+   f_bssap_init("VirtMSC", omit);
+
+   f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
+
+   f_init_mgcp("VirtMSC");
+
+   /* start RSL connection */
+   map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA);
+   connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]);
+   bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, 
mp_bsc_rsl_port, "", 1, bts[0].rsl.ccm_pars));
+
+   /* wait for IPA RSL link to connect and then disconnect */
+   T.start;
+   alt {
+   [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) {
+   T.stop;
+   setverdict(pass);
+   }
+   [] IPA_RSL[0].receive { repeat }
+   [] T.timeout {
+   setverdict(fail, "Timeout RSL waiting for connection to close");
+   self.stop;
+   }
+   }
+}
+
+/* BSC should close an RSL connection from a BTS with unknown unit ID 
(OS#2714). */
+testcase TC_oml_unknown_unit_id() runs on test_CT {
+   timer T := 10.0;
+
+   bts[0].rsl.id := "IPA-0-RSL";
+   bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA");
+   bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars;
+   bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
+   bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at 
BTS */
+
+   /* Call a function of our 'parent component' BSSAP_Adapter_CT to start 
the
+* MSC-side BSSAP emulation */
+   f_bssap_init("VirtMSC", omit);
+
+   f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
+
+   f_init_mgcp("VirtMSC");
+
+   /* start OML connection (XXX re-uses RSL port/protocol definitions) */
+   map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA);
+   connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]);
+   bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, 
mp_bsc_oml_port, "", 1, bts[0].rsl.ccm_pars));
+
+   /* wait for IPA OML link to connect and then disconnect */
+   T.start;
+   alt {
+   [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) {
+   T.stop;
+   setverdict(pass);
+   }
+   [] IPA_RSL[0].receive { repeat }
+   [] T.timeout {
+   setverdict(fail, "Timeout OML waiting for connection to close");
+   self.stop;
+ 

[PATCH] libosmocore[master]: Add helper functions for ACC bit flags in rach control IE.

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

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

https://gerrit.osmocom.org/6286

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

Add helper functions for ACC bit flags in rach control IE.

Add inline functions to manipulate and query ACC flag bits
in the rach_control.t2 and rach_control.t3 octets.
These function definitions also serve as documentation of
the purpose of rach_control.t2/t3.

Change-Id: I8f0a65c2980f86eb5c43f3bebe727f4d4d973163
Related: OS#2591
---
M include/osmocom/gsm/protocol/gsm_04_08.h
1 file changed, 43 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/86/6286/2

diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h 
b/include/osmocom/gsm/protocol/gsm_04_08.h
index 0e02744..4a821cc 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -460,10 +460,51 @@
 cell_bar :1,
 tx_integer :4,
 max_trans :2;
-   uint8_t t2;
-   uint8_t t3;
+   uint8_t t2; /* ACC 8-15 barred flags */
+   uint8_t t3; /* ACC 0-7 barred flags */
 } __attribute__ ((packed));
 
+/*
+ * Mark an Access Control Class as barred.
+ *  \param[in] rach_control A Rach Control Information Element.
+ *  \param[in] acc Access Control Class number (0 - 15) which shall be barred.
+ */
+static inline void gsm48_barr_acc(struct gsm48_rach_control *rach_control, 
unsigned int acc)
+{
+   OSMO_ASSERT(acc >= 0 && acc <= 15);
+   if (acc >= 8)
+   rach_control->t2 |= (1 << (acc - 8));
+   else
+   rach_control->t3 |= (1 << (acc));
+}
+
+/*
+ * Mark an Access Control Class as allowed.
+ *  \param[in] rach_control A Rach Control Information Element.
+ *  \param[in] acc Access Control Class number (0 - 15) which shall be allowed.
+ */
+static inline void gsm48_allow_acc(struct gsm48_rach_control *rach_control, 
unsigned int acc)
+{
+   OSMO_ASSERT(acc >= 0 && acc <= 15);
+   if (acc >= 8)
+   rach_control->t2 &= ~(1 << (acc - 8));
+   else
+   rach_control->t3 &= ~(1 << (acc));
+}
+
+/*
+ * Indicate whether an Access Control Class is barred.
+ *  \param[in] rach_control A Rach Control Information Element.
+ *  \param[in] acc Access Control Class number (0 - 15).
+ *  \returns true if the Access Control class is barred, false otherwise
+ */
+static inline bool gsm48_acc_is_barred(struct gsm48_rach_control 
*rach_control, unsigned int acc)
+{
+   OSMO_ASSERT(acc >= 0 && acc <= 15);
+   if (acc >= 8)
+   return (rach_control->t2 & (1 << (acc - 8))) != 0;
+   return (rach_control->t3 & (1 << (acc))) != 0;
+}
 
 /* Chapter 10.5.2.30 */
 struct gsm48_req_ref {

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8f0a65c2980f86eb5c43f3bebe727f4d4d973163
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Stefan Sperling 


osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Minh-Quang Nguyen

Patch Set 1:

> ping. Minh-Quang do you plan to submit a new version soon? seems
 > like a few minutes job but it's been waiting for over a month.

Unfortunately, my local branch of this topic has been lost... is there anyway 
to pull this topic to my local BTS repository?

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

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


[PATCH] osmo-ttcn3-hacks[master]: Add tests for OS#2714, "close RSL connections from unknown U...

2018-02-13 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6406

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

Add tests for OS#2714, "close RSL connections from unknown Unit ID".

This adds two new tests: One for RSL, and a second one which performs
the same test on the OML port. Both tests open an IPA connection and
send a unit ID which is unknown to the BSC. The tests expect the BSC
to close the connection immediately.

We need to add handling for a socket error in IPA_Emulation because
otherwise these tests do not pass reliably as some closed connections
are not properly detected.

Change-Id: I6a947d7411a016e4d7650031396cae3575756453
---
M bsc/BSC_Tests.ttcn
M library/IPA_Emulation.ttcn
2 files changed, 104 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/06/6406/3

diff --git a/bsc/BSC_Tests.ttcn b/bsc/BSC_Tests.ttcn
index 086830a..a18b17f 100644
--- a/bsc/BSC_Tests.ttcn
+++ b/bsc/BSC_Tests.ttcn
@@ -28,6 +28,7 @@
 import from BSSAP_CodecPort all;
 import from BSSMAP_Templates all;
 import from IPA_Emulation all;
+import from IPA_CodecPort all;
 import from IPA_Types all;
 import from RSL_Types all;
 import from RSL_Emulation all;
@@ -61,6 +62,7 @@
var BTS_State bts[NUM_BTS];
/* array of per-BTS RSL test ports */
port IPA_RSL_PT IPA_RSL[NUM_BTS];
+   port IPA_CODEC_PT IPA; /* Required for compilation of 
TC_rsl_unknown_unit_id() */
 
var MGCP_Emulation_CT vc_MGCP;
 
@@ -75,6 +77,8 @@
 modulepar {
/* IP address at which the BSC can be reached */
charstring mp_bsc_ip := "127.0.0.1";
+   /* port number to which to establish the IPA OML connections */
+   integer mp_bsc_oml_port := 3002;
/* port number to which to establish the IPA RSL connections */
integer mp_bsc_rsl_port := 3003;
/* port number to which to establish the IPA CTRL connection */
@@ -1236,6 +1240,83 @@
 
 /* TODO: Test OML link drop causes counter increment */
 
+/* BSC should close an RSL connection from a BTS with unknown unit ID 
(OS#2714). */
+testcase TC_rsl_unknown_unit_id() runs on test_CT {
+   timer T := 10.0;
+
+   bts[0].rsl.id := "IPA-0-RSL";
+   bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA");
+   bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars;
+   bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
+   bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at 
BTS */
+
+   /* Call a function of our 'parent component' BSSAP_Adapter_CT to start 
the
+* MSC-side BSSAP emulation */
+   f_bssap_init("VirtMSC", omit);
+
+   f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
+
+   f_init_mgcp("VirtMSC");
+
+   /* start RSL connection */
+   map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA);
+   connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]);
+   bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, 
mp_bsc_rsl_port, "", 1, bts[0].rsl.ccm_pars));
+
+   /* wait for IPA RSL link to connect and then disconnect */
+   T.start;
+   alt {
+   [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) {
+   T.stop;
+   setverdict(pass);
+   }
+   [] IPA_RSL[0].receive { repeat }
+   [] T.timeout {
+   setverdict(fail, "Timeout RSL waiting for connection to close");
+   self.stop;
+   }
+   }
+}
+
+/* BSC should close an RSL connection from a BTS with unknown unit ID 
(OS#2714). */
+testcase TC_oml_unknown_unit_id() runs on test_CT {
+   timer T := 10.0;
+
+   bts[0].rsl.id := "IPA-0-RSL";
+   bts[0].rsl.vc_IPA := IPA_Emulation_CT.create(bts[0].rsl.id & "-IPA");
+   bts[0].rsl.ccm_pars := c_IPA_default_ccm_pars;
+   bts[0].rsl.ccm_pars.name := "Osmocom TTCN-3 BTS Simulator";
+   bts[0].rsl.ccm_pars.unit_id := "0/0/0"; /* value which is unknown at 
BTS */
+
+   /* Call a function of our 'parent component' BSSAP_Adapter_CT to start 
the
+* MSC-side BSSAP emulation */
+   f_bssap_init("VirtMSC", omit);
+
+   f_ipa_ctrl_start(mp_bsc_ip, mp_bsc_ctrl_port);
+
+   f_init_mgcp("VirtMSC");
+
+   /* start OML connection (XXX re-uses RSL port/protocol definitions) */
+   map(bts[0].rsl.vc_IPA:IPA_PORT, system:IPA);
+   connect(bts[0].rsl.vc_IPA:IPA_RSL_PORT, self:IPA_RSL[0]);
+   bts[0].rsl.vc_IPA.start(IPA_Emulation.main_client(mp_bsc_ip, 
mp_bsc_oml_port, "", 1, bts[0].rsl.ccm_pars));
+
+   /* wait for IPA OML link to connect and then disconnect */
+   T.start;
+   alt {
+   [] IPA_RSL[0].receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_DOWN}) {
+   T.stop;
+   setverdict(pass);
+   }
+   [] IPA_RSL[0].receive { repeat }
+   [] T.timeout {
+   setverdict(fail, "Timeout OML waiting for connection to close");
+   self.stop;
+ 

osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Vadim Yanitskiy

Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/5753/3//COMMIT_MSG
Commit Message:

Line 13:  Related issue: https://osmocom.org/issues/1950
Please move close to the change-id and change to:

Related: OS#1950


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I40e9bf9438c0b400e4d29eb39ffae37207e34db6
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Minh-Quang Nguyen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Minh-Quang Nguyen 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Minh-Quang Nguyen

Patch Set 1:

> > ping. Minh-Quang do you plan to submit a new version soon? seems
 > > like a few minutes job but it's been waiting for over a month.
 > 
 > Unfortunately, my local branch of this topic has been lost... is
 > there anyway to pull this topic to my local BTS repository?

Just ignore my question. I have just found out there is a Download button at 
Gerrit GUI to pull this topic to my machine.

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

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


libosmocore[master]: Add helper functions for ACC bit flags in rach control IE.

2018-02-13 Thread Stefan Sperling

Patch Set 2:

> Uploaded patch set 2.

This new patch set should address the above review comments. This new changeset 
also aligns better with how the ACC ramping implementation turned out, i.e. 
these new inline functions could be used as drop-in replacements for local 
functions written for the proposed ACC ramping code (see 
https://gerrit.osmocom.org/#/c/6324/),

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8f0a65c2980f86eb5c43f3bebe727f4d4d973163
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Stefan Sperling 
Gerrit-HasComments: No


[MERGED] osmo-bsc[master]: Make RSL connection attempts time out.

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

Change subject: Make RSL connection attempts time out.
..


Make RSL connection attempts time out.

If a BTS/TRX does not respond to the "IPA RSL Connect" command,
pretend that the BTS has sent a NACK for the connection.

To ensure that osmo_timer_del(>rsl_connection_timeout) is not called
before this timer is initialized with osmo_timer_setup(), the E1 layer now
drops incoming RSL messages from a BTS/TRX in LOCKED administrative state.

We cancel the timeout if we receive an RSL Connect ACK or NACK from the BTS,
and if the underlying E1 link does down.

While here, add a missing message buffer free() in bts_isdn_sign_link().
The callers do not free it.

Change-Id: Ia72b65a0f15f47dcb8a6f944f6c3695a4a64b923
Related: OS#2716
---
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/abis_nm.c
M src/libbsc/bts_ipaccess_nanobts.c
M src/libbsc/e1_config.c
4 files changed, 44 insertions(+), 8 deletions(-)

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



diff --git a/include/osmocom/bsc/gsm_data_shared.h 
b/include/osmocom/bsc/gsm_data_shared.h
index e3e1389..b753e54 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -351,6 +351,9 @@
uint8_t rsl_tei;
struct e1inp_sign_link *rsl_link;
 
+   /* Timeout for initiating the RSL connection. */
+   struct osmo_timer_list rsl_connect_timeout;
+
/* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */
struct e1inp_sign_link *oml_link;
 
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 33af213..403b94c 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -2660,6 +2660,7 @@
DEBUGPC(DNM, "STREAM=0x%02x ",
*TLVP_VAL(, NM_ATT_IPACC_STREAM_ID));
DEBUGPC(DNM, "\n");
+   osmo_timer_del(_link->trx->rsl_connect_timeout);
break;
case NM_MT_IPACC_RSL_CONNECT_NACK:
LOGP(DNM, LOGL_ERROR, "RSL CONNECT NACK ");
@@ -2668,6 +2669,7 @@
abis_nm_nack_cause_name(*TLVP_VAL(, 
NM_ATT_NACK_CAUSES)));
else
LOGPC(DNM, LOGL_ERROR, "\n");
+   osmo_timer_del(_link->trx->rsl_connect_timeout);
break;
case NM_MT_IPACC_SET_NVATTR_ACK:
DEBUGPC(DNM, "SET NVATTR ACK\n");
@@ -2776,6 +2778,19 @@
attr_len);
 }
 
+static void rsl_connect_timeout(void *data)
+{
+   struct gsm_bts_trx *trx = data;
+   struct ipacc_ack_signal_data signal;
+
+   LOGP(DRSL, LOGL_NOTICE, "(bts=%d,trx=%d) RSL connection request timed 
out\n", trx->bts->nr, trx->nr);
+
+   /* Fake an RSL CONECT NACK message from the BTS. */
+   signal.trx = trx;
+   signal.msg_type = NM_MT_IPACC_RSL_CONNECT_NACK;
+   osmo_signal_dispatch(SS_NM, S_NM_IPACC_NACK, );
+}
+
 int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
 uint32_t ip, uint16_t port, uint8_t stream)
 {
@@ -2785,6 +2800,9 @@
NM_ATT_IPACC_DST_IP, 0, 0, 0, 0 };
 
int attr_len = sizeof(attr);
+   int error;
+
+   osmo_timer_setup(>rsl_connect_timeout, rsl_connect_timeout, trx);
 
ia.s_addr = htonl(ip);
attr[1] = stream;
@@ -2799,9 +2817,13 @@
DEBUGP(DNM, "ip.access RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n",
inet_ntoa(ia), port, stream);
 
-   return abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
-   NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
-   trx->nr, 0xff, attr, attr_len);
+   error = abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
+NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
+trx->nr, 0xff, attr, attr_len);
+   if (error == 0)
+   osmo_timer_schedule(>rsl_connect_timeout, 60, 0);
+
+   return error;
 }
 
 /* restart / reboot an ip.access nanoBTS */
diff --git a/src/libbsc/bts_ipaccess_nanobts.c 
b/src/libbsc/bts_ipaccess_nanobts.c
index 03bb708..cf85961 100644
--- a/src/libbsc/bts_ipaccess_nanobts.c
+++ b/src/libbsc/bts_ipaccess_nanobts.c
@@ -470,15 +470,19 @@
 {
/* No matter what link went down, we close both signal links. */
struct e1inp_ts *ts = >ts[E1INP_SIGN_OML-1];
+   struct gsm_bts *bts = NULL;
struct e1inp_sign_link *link;
 
llist_for_each_entry(link, >sign.sign_links, list) {
-   struct gsm_bts *bts = link->trx->bts;
-
-   ipaccess_drop_oml(bts);
-   /* Yes, we only use the first element of the list. */
-   break;
+   /* Get bts pointer from the first element of the list. */
+   if (bts == 

[MERGED] libosmocore[master]: Add helper functions for ACC bit flags in rach control IE.

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

Change subject: Add helper functions for ACC bit flags in rach control IE.
..


Add helper functions for ACC bit flags in rach control IE.

Add inline functions to manipulate and query ACC flag bits
in the rach_control.t2 and rach_control.t3 octets.
These function definitions also serve as documentation of
the purpose of rach_control.t2/t3.

Change-Id: I8f0a65c2980f86eb5c43f3bebe727f4d4d973163
Related: OS#2591
---
M include/osmocom/gsm/protocol/gsm_04_08.h
1 file changed, 43 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h 
b/include/osmocom/gsm/protocol/gsm_04_08.h
index 0e02744..4a821cc 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -460,10 +460,51 @@
 cell_bar :1,
 tx_integer :4,
 max_trans :2;
-   uint8_t t2;
-   uint8_t t3;
+   uint8_t t2; /* ACC 8-15 barred flags */
+   uint8_t t3; /* ACC 0-7 barred flags */
 } __attribute__ ((packed));
 
+/*
+ * Mark an Access Control Class as barred.
+ *  \param[in] rach_control A Rach Control Information Element.
+ *  \param[in] acc Access Control Class number (0 - 15) which shall be barred.
+ */
+static inline void gsm48_barr_acc(struct gsm48_rach_control *rach_control, 
unsigned int acc)
+{
+   OSMO_ASSERT(acc >= 0 && acc <= 15);
+   if (acc >= 8)
+   rach_control->t2 |= (1 << (acc - 8));
+   else
+   rach_control->t3 |= (1 << (acc));
+}
+
+/*
+ * Mark an Access Control Class as allowed.
+ *  \param[in] rach_control A Rach Control Information Element.
+ *  \param[in] acc Access Control Class number (0 - 15) which shall be allowed.
+ */
+static inline void gsm48_allow_acc(struct gsm48_rach_control *rach_control, 
unsigned int acc)
+{
+   OSMO_ASSERT(acc >= 0 && acc <= 15);
+   if (acc >= 8)
+   rach_control->t2 &= ~(1 << (acc - 8));
+   else
+   rach_control->t3 &= ~(1 << (acc));
+}
+
+/*
+ * Indicate whether an Access Control Class is barred.
+ *  \param[in] rach_control A Rach Control Information Element.
+ *  \param[in] acc Access Control Class number (0 - 15).
+ *  \returns true if the Access Control class is barred, false otherwise
+ */
+static inline bool gsm48_acc_is_barred(struct gsm48_rach_control 
*rach_control, unsigned int acc)
+{
+   OSMO_ASSERT(acc >= 0 && acc <= 15);
+   if (acc >= 8)
+   return (rach_control->t2 & (1 << (acc - 8))) != 0;
+   return (rach_control->t3 & (1 << (acc))) != 0;
+}
 
 /* Chapter 10.5.2.30 */
 struct gsm48_req_ref {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8f0a65c2980f86eb5c43f3bebe727f4d4d973163
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Stefan Sperling 


osmo-bsc[master]: Make RSL connection attempts time out.

2018-02-13 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia72b65a0f15f47dcb8a6f944f6c3695a4a64b923
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-bsc[master]: Make RSL connection attempts time out.

2018-02-13 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6386

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

Make RSL connection attempts time out.

If a BTS/TRX does not respond to the "IPA RSL Connect" command,
pretend that the BTS has sent a NACK for the connection.

To ensure that osmo_timer_del(>rsl_connection_timeout) is not called
before this timer is initialized with osmo_timer_setup(), the E1 layer now
drops incoming RSL messages from a BTS/TRX in LOCKED administrative state.

We cancel the timeout if we receive an RSL Connect ACK or NACK from the BTS,
and if the underlying E1 link does down.

While here, add a missing message buffer free() in bts_isdn_sign_link().
The callers do not free it.

Change-Id: Ia72b65a0f15f47dcb8a6f944f6c3695a4a64b923
Related: OS#2716
---
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/abis_nm.c
M src/libbsc/bts_ipaccess_nanobts.c
M src/libbsc/e1_config.c
4 files changed, 44 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/86/6386/2

diff --git a/include/osmocom/bsc/gsm_data_shared.h 
b/include/osmocom/bsc/gsm_data_shared.h
index e3e1389..b753e54 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -351,6 +351,9 @@
uint8_t rsl_tei;
struct e1inp_sign_link *rsl_link;
 
+   /* Timeout for initiating the RSL connection. */
+   struct osmo_timer_list rsl_connect_timeout;
+
/* Some BTS (specifically Ericsson RBS) have a per-TRX OML Link */
struct e1inp_sign_link *oml_link;
 
diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c
index 33af213..403b94c 100644
--- a/src/libbsc/abis_nm.c
+++ b/src/libbsc/abis_nm.c
@@ -2660,6 +2660,7 @@
DEBUGPC(DNM, "STREAM=0x%02x ",
*TLVP_VAL(, NM_ATT_IPACC_STREAM_ID));
DEBUGPC(DNM, "\n");
+   osmo_timer_del(_link->trx->rsl_connect_timeout);
break;
case NM_MT_IPACC_RSL_CONNECT_NACK:
LOGP(DNM, LOGL_ERROR, "RSL CONNECT NACK ");
@@ -2668,6 +2669,7 @@
abis_nm_nack_cause_name(*TLVP_VAL(, 
NM_ATT_NACK_CAUSES)));
else
LOGPC(DNM, LOGL_ERROR, "\n");
+   osmo_timer_del(_link->trx->rsl_connect_timeout);
break;
case NM_MT_IPACC_SET_NVATTR_ACK:
DEBUGPC(DNM, "SET NVATTR ACK\n");
@@ -2776,6 +2778,19 @@
attr_len);
 }
 
+static void rsl_connect_timeout(void *data)
+{
+   struct gsm_bts_trx *trx = data;
+   struct ipacc_ack_signal_data signal;
+
+   LOGP(DRSL, LOGL_NOTICE, "(bts=%d,trx=%d) RSL connection request timed 
out\n", trx->bts->nr, trx->nr);
+
+   /* Fake an RSL CONECT NACK message from the BTS. */
+   signal.trx = trx;
+   signal.msg_type = NM_MT_IPACC_RSL_CONNECT_NACK;
+   osmo_signal_dispatch(SS_NM, S_NM_IPACC_NACK, );
+}
+
 int abis_nm_ipaccess_rsl_connect(struct gsm_bts_trx *trx,
 uint32_t ip, uint16_t port, uint8_t stream)
 {
@@ -2785,6 +2800,9 @@
NM_ATT_IPACC_DST_IP, 0, 0, 0, 0 };
 
int attr_len = sizeof(attr);
+   int error;
+
+   osmo_timer_setup(>rsl_connect_timeout, rsl_connect_timeout, trx);
 
ia.s_addr = htonl(ip);
attr[1] = stream;
@@ -2799,9 +2817,13 @@
DEBUGP(DNM, "ip.access RSL CONNECT IP=%s PORT=%u STREAM=0x%02x\n",
inet_ntoa(ia), port, stream);
 
-   return abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
-   NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
-   trx->nr, 0xff, attr, attr_len);
+   error = abis_nm_ipaccess_msg(trx->bts, NM_MT_IPACC_RSL_CONNECT,
+NM_OC_BASEB_TRANSC, trx->bts->bts_nr,
+trx->nr, 0xff, attr, attr_len);
+   if (error == 0)
+   osmo_timer_schedule(>rsl_connect_timeout, 60, 0);
+
+   return error;
 }
 
 /* restart / reboot an ip.access nanoBTS */
diff --git a/src/libbsc/bts_ipaccess_nanobts.c 
b/src/libbsc/bts_ipaccess_nanobts.c
index 03bb708..cf85961 100644
--- a/src/libbsc/bts_ipaccess_nanobts.c
+++ b/src/libbsc/bts_ipaccess_nanobts.c
@@ -470,15 +470,19 @@
 {
/* No matter what link went down, we close both signal links. */
struct e1inp_ts *ts = >ts[E1INP_SIGN_OML-1];
+   struct gsm_bts *bts = NULL;
struct e1inp_sign_link *link;
 
llist_for_each_entry(link, >sign.sign_links, list) {
-   struct gsm_bts *bts = link->trx->bts;
-
-   ipaccess_drop_oml(bts);
-   /* Yes, we only use the first element of the list. */
-   break;
+   /* Get bts pointer from the first element of the list. */
+   if (bts == NULL)
+   bts = 

osmo-ttcn3-hacks[master]: Add tests for OS#2714, "close RSL connections from unknown U...

2018-02-13 Thread Harald Welte

Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/6406/3/bsc/BSC_Tests.ttcn
File bsc/BSC_Tests.ttcn:

Line 1244: testcase TC_rsl_unknown_unit_id() runs on test_CT {
I think it makes sense t owrap those two into one function and call that 
function from both test cases?  It seems at first sight only the port number is 
different, right?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6a947d7411a016e4d7650031396cae3575756453
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


osmo-bsc[master]: Generate the S_L_INP_TEI_UP signal earlier.

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+1

i think this should be tested with a real BTS setup before merging

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3b76ae6b00043e706dddc78209311e00ace85bb7
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-bts[master]: LC15: Fix missing fill frame and GSM 05.08 mandatory frame

2018-02-13 Thread Minh-Quang Nguyen

Patch Set 1:

> (1 comment)

Thanks for your comments. I will refactor the codes to make them cleaner at 
some point.

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

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


osmo-gsm-tester[master]: modem: deactivate_context: Fix dbg message

2018-02-13 Thread Pau Espin Pedrol

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

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I9aea339fb08c20e1b66a0d24c76d855bf665a4cd
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


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

2018-02-13 Thread Pau Espin Pedrol
Hello Max, Jenkins Builder,

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

https://gerrit.osmocom.org/6389

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

.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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/89/6389/2

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: newpatchset
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 


[PATCH] osmo-gsm-tester[master]: modem: deactivate_context: Fix dbg message

2018-02-13 Thread Pau Espin Pedrol

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

modem: deactivate_context: Fix dbg message

Change-Id: Ib3cb72ebcbfbf53693a2d76ca1592ef7d394dd87
---
M src/osmo_gsm_tester/modem.py
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/10/6410/1

diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 7750740..8de3f9f 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -614,7 +614,7 @@
 return ctx_path
 
 def deactivate_context(self, ctx_id):
-self.dbg('activate_context', path=ctx_id)
+self.dbg('deactivate_context', path=ctx_id)
 ctx = systembus_get(ctx_id)
 ctx.SetProperty('Active', Variant('b', False))
 event_loop.wait(self, lambda: ctx.GetProperties()['Active'] == False)

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3cb72ebcbfbf53693a2d76ca1592ef7d394dd87
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


[MERGED] osmo-gsm-tester[master]: modem: deactivate_context: Fix dbg message

2018-02-13 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged.

Change subject: modem: deactivate_context: Fix dbg message
..


modem: deactivate_context: Fix dbg message

Change-Id: Ib3cb72ebcbfbf53693a2d76ca1592ef7d394dd87
---
M src/osmo_gsm_tester/modem.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/modem.py b/src/osmo_gsm_tester/modem.py
index 7750740..8de3f9f 100644
--- a/src/osmo_gsm_tester/modem.py
+++ b/src/osmo_gsm_tester/modem.py
@@ -614,7 +614,7 @@
 return ctx_path
 
 def deactivate_context(self, ctx_id):
-self.dbg('activate_context', path=ctx_id)
+self.dbg('deactivate_context', path=ctx_id)
 ctx = systembus_get(ctx_id)
 ctx.SetProperty('Active', Variant('b', False))
 event_loop.wait(self, lambda: ctx.GetProperties()['Active'] == False)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib3cb72ebcbfbf53693a2d76ca1592ef7d394dd87
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


[ABANDON] osmo-gsm-tester[master]: modem: deactivate_context: Fix dbg message

2018-02-13 Thread Pau Espin Pedrol
Pau Espin Pedrol has abandoned this change.

Change subject: modem: deactivate_context: Fix dbg message
..


Abandoned

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: I9aea339fb08c20e1b66a0d24c76d855bf665a4cd
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


osmo-gsm-tester[master]: modem: deactivate_context: Fix dbg message

2018-02-13 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib3cb72ebcbfbf53693a2d76ca1592ef7d394dd87
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[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(_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(_lchan_summary_cmd);
 
logging_vty_add_cmds(cat);
+   osmo_talloc_vty_add_cmds();
 
install_node(_node, config_write_bts);
install_element(CONFIG_NODE, _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 


[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(_paging_group_cmd);
 
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
 
install_element(GSMNET_NODE, _net_neci_cmd);
install_element(GSMNET_NODE, _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(_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-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 


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


[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]: 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 

[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


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]: 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


[MERGED] osmo-msc[master]: MNCC: Copy bearer_cap from MNCC to gsm_trans

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

Change subject: MNCC: Copy bearer_cap from MNCC to gsm_trans
..


MNCC: Copy bearer_cap from MNCC to gsm_trans

When we receive bearer capabilities from MNCC and encode thme into
a CC message, we have to also update our "cache" inside 'struct
gsm_trans'.  Only that way, the BSSMAP ASSIGNMENT code is aware of
the actual current/present bearer capabilities such as permitted speech
codecs.

This will in practise only work if the related CC/MNCC message with
berer_cap IE will happen before the MSC performs the BSSMAP ASSIGNMENT
procedure.  Our logic still needs to change in a way that the CC/MNCC
code in gsm_04_08.c detects if trans->bearer_cap != new bearer_cap, and
in that case triggers a new follow-up BSSMAP ASSIGNMENT.

Change-Id: I6838dc0c8c4c2c6bba385da548c92f3fc91060c1
Closes: OS#2854
---
M src/libmsc/gsm_04_08.c
1 file changed, 6 insertions(+), 1 deletion(-)

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



diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 6c95488..a5b967e 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1883,8 +1883,10 @@
new_cc_state(trans, GSM_CSTATE_MO_CALL_PROC);
 
/* bearer capability */
-   if (proceeding->fields & MNCC_F_BEARER_CAP)
+   if (proceeding->fields & MNCC_F_BEARER_CAP) {
gsm48_encode_bearer_cap(msg, 0, >bearer_cap);
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
+   }
/* facility */
if (proceeding->fields & MNCC_F_FACILITY)
gsm48_encode_facility(msg, 0, >facility);
@@ -2575,6 +2577,7 @@
 
/* bearer capability */
gsm48_encode_bearer_cap(msg, 1, >bearer_cap);
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
 
new_cc_state(trans, GSM_CSTATE_MO_TERM_MODIFY);
 
@@ -2621,6 +2624,7 @@
 
/* bearer capability */
gsm48_encode_bearer_cap(msg, 1, >bearer_cap);
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
 
new_cc_state(trans, GSM_CSTATE_ACTIVE);
 
@@ -2673,6 +2677,7 @@
 
/* bearer capability */
gsm48_encode_bearer_cap(msg, 1, >bearer_cap);
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
/* cause */
gsm48_encode_cause(msg, 1, >cause);
 

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

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


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


[MERGED] osmo-msc[master]: MT Calls: Copy bearer capabilities from NNCC primitive to trans

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

Change subject: MT Calls: Copy bearer capabilities from NNCC primitive to trans
..


MT Calls: Copy bearer capabilities from NNCC primitive to trans

When we receive a MNCC_SETUP_REQ primitive from the external MNCC
handler, we must not only encode it into the TS 04.08 CC SETUP, but
also keep it around in the "trans" structure representing this voice
call, as it is needed e.g. at BSSMAP ASSIGNMENT time.

Change-Id: Ib6919d148ff6687112e8166dbde947be19e70a76
Related: OS#2322
Closes: OS#2929
---
M src/libmsc/gsm_04_08.c
1 file changed, 5 insertions(+), 1 deletion(-)

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/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index 7b6e94a..6c95488 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1767,8 +1767,12 @@
gsm48_start_cc_timer(trans, 0x303, GSM48_T303);
 
/* bearer capability */
-   if (setup->fields & MNCC_F_BEARER_CAP)
+   if (setup->fields & MNCC_F_BEARER_CAP) {
+   /* Create a copy of the bearer capability in the transaction 
struct, so we
+* can use this information later */
+   memcpy(>bearer_cap, >bearer_cap, 
sizeof(trans->bearer_cap));
gsm48_encode_bearer_cap(msg, 0, >bearer_cap);
+   }
/* facility */
if (setup->fields & MNCC_F_FACILITY)
gsm48_encode_facility(msg, 0, >facility);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6919d148ff6687112e8166dbde947be19e70a76
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: neels 


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]: gsm_data: remove unused gsm_subscriber_connection members

2018-02-13 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
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
Gerrit-HasComments: No


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


[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 
 

[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 

[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, _hlr_cmd);
install_node(_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(_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(_lchan_summary_cmd);
 
logging_vty_add_cmds(cat);
+   osmo_talloc_vty_add_cmds();
 
install_node(_node, config_write_bts);
install_element(CONFIG_NODE, _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


[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(>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, _net_no_timezone_cmd);
install_element(GSMNET_NODE, _net_per_loc_upd_cmd);
install_element(GSMNET_NODE, _net_no_per_loc_upd_cmd);
-   install_element(GSMNET_NODE, _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]: 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


[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, , >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(>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, , >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(>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 "
+   LOGIPA(conn, 

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-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, _handler);
@@ -1076,6 +1078,7 @@
 
vty_init(_vty_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(_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 


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-msc[master]: gsm_data: remove unused gsm_subscriber_connection members

2018-02-13 Thread Harald Welte

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

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(-)


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

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: newchange
Gerrit-Change-Id: I417e23ec53323ddd8e1e5d18952566fe8fd6ac24
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

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

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 include/osmocom/msc/gsm_data.h
M src/libcommon-cs/common_cs_vty.c
M src/libmsc/msc_vty.c
3 files changed, 0 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/15/6415/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, _net_name_long_cmd);
install_element(GSMNET_NODE, _net_auth_policy_cmd);
install_element(GSMNET_NODE, _net_authorize_regexp_cmd);
-   install_element(GSMNET_NODE, _net_reject_cause_cmd);
install_element(GSMNET_NODE, _net_encryption_cmd);
install_element(GSMNET_NODE, _net_authentication_cmd);
install_element(GSMNET_NODE, _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: newchange
Gerrit-Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


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

2018-02-13 Thread Harald Welte

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

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
3 files changed, 0 insertions(+), 25 deletions(-)


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

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, >authorized_regexp, 
>authorized_reg_str, 1,
- _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, >authorized_regexp,
- >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, _net_name_short_cmd);
install_element(GSMNET_NODE, _net_name_long_cmd);
install_element(GSMNET_NODE, _net_auth_policy_cmd);
-   install_element(GSMNET_NODE, _net_authorize_regexp_cmd);
install_element(GSMNET_NODE, _net_encryption_cmd);
install_element(GSMNET_NODE, _net_authentication_cmd);
install_element(GSMNET_NODE, _net_rrlp_mode_cmd);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icf0897c47388e49ba7886b55acc728a6f7d213fe
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

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

remove unused "auth policy" VTY command

This is yet another unsused bit from the OsmoNITB legacy.

Related: OS#2528
Change-Id: I825e659da529257e5edec94d9d59f0e10c1b4c63
---
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
4 files changed, 0 insertions(+), 49 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/17/6417/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, _net_mnc_cmd);
install_element(GSMNET_NODE, _net_name_short_cmd);
install_element(GSMNET_NODE, _net_name_long_cmd);
-   install_element(GSMNET_NODE, _net_auth_policy_cmd);
install_element(GSMNET_NODE, _net_encryption_cmd);
install_element(GSMNET_NODE, _net_authentication_cmd);
install_element(GSMNET_NODE, _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" },
-   { GSM_AUTH_POLICY_REGEXP,   "regexp" },
-   { 0,NULL }
-};
-
-enum gsm_auth_policy gsm_auth_policy_parse(const char *arg)
-{
-   return get_string_value(auth_policy_names, arg);
-}
-
-const char *gsm_auth_policy_name(enum gsm_auth_policy policy)
-{
-   return get_value_string(auth_policy_names, policy);
-}
-
 static const struct value_string rrlp_mode_names[] = {
{ RRLP_MODE_NONE,   "none" },
{ RRLP_MODE_MS_BASED,   "ms-based" },
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 49081c6..77ced8e 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -186,7 +186,6 @@
vty_out(vty, " mobile network code %u%s", gsmnet->network_code, 
VTY_NEWLINE);
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, " encryption a5");
for (i = 0; i < 8; i++) {
if (gsmnet->a5_encryption_mask & (1 << i))

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

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

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

2018-02-13 Thread Harald Welte

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

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(-)


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

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(>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, _net_no_timezone_cmd);
install_element(GSMNET_NODE, _net_per_loc_upd_cmd);
install_element(GSMNET_NODE, _net_no_per_loc_upd_cmd);
-   install_element(GSMNET_NODE, _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: newchange
Gerrit-Change-Id: Iaa41d22db81120572d4cd2c0c4c75d258947a42f
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


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

2018-02-13 Thread Harald Welte

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

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(-)


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

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 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
diff --git a/src/libmsc/gsm_04_14.c b/src/libmsc/gsm_04_14.c
index 6d75bba..2be534c 100644
--- 

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

2018-02-13 Thread Harald Welte

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

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(-)


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

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 *bsc_ctrs;
struct rate_ctr_group *msc_ctrs;
struct osmo_counter *active_calls;
 
@@ -347,21 +263,10 @@
 

[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, _net_name_long_cmd);
install_element(GSMNET_NODE, _net_auth_policy_cmd);
install_element(GSMNET_NODE, _net_authorize_regexp_cmd);
-   install_element(GSMNET_NODE, _net_reject_cause_cmd);
install_element(GSMNET_NODE, _net_encryption_cmd);
install_element(GSMNET_NODE, _net_authentication_cmd);
install_element(GSMNET_NODE, _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, >authorized_regexp, 
>authorized_reg_str, 1,
- _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, >authorized_regexp,
- >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, _net_name_short_cmd);
install_element(GSMNET_NODE, _net_name_long_cmd);
install_element(GSMNET_NODE, _net_auth_policy_cmd);
-   install_element(GSMNET_NODE, _net_authorize_regexp_cmd);
install_element(GSMNET_NODE, _net_encryption_cmd);
install_element(GSMNET_NODE, _net_authentication_cmd);
install_element(GSMNET_NODE, _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(_info);
osmo_stats_init(tall_msc_ctx);
@@ -394,6 +396,7 @@
 
ctrl_vty_init(tall_msc_ctx);
logging_vty_add_cmds(_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, _net_mnc_cmd);
install_element(GSMNET_NODE, _net_name_short_cmd);
install_element(GSMNET_NODE, _net_name_long_cmd);
-   install_element(GSMNET_NODE, _net_auth_policy_cmd);
install_element(GSMNET_NODE, _net_encryption_cmd);
install_element(GSMNET_NODE, _net_authentication_cmd);
install_element(GSMNET_NODE, _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" },
-   { GSM_AUTH_POLICY_REGEXP, 

[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-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, _handler);
signal(SIGTERM, _handler);
@@ -269,6 +271,7 @@
vty_info.copyright = openbsc_copyright;
vty_init(_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(_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, _handler);
signal(SIGTERM, _handler);
@@ -349,6 +351,7 @@
vty_info.copyright = gtphub_copyright;
vty_init(_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, _handler);
signal(SIGTERM, _handler);
@@ -390,6 +392,7 @@
vty_info.copyright = openbsc_copyright;
vty_init(_info);
logging_vty_add_cmds(NULL);
+   osmo_talloc_vty_add_cmds();
osmo_stats_vty_add_cmds(_log_info);
sgsn_vty_init(_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 


[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 


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


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


[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 "(bts_nr)&" trx "(trx_nr)&
+   " timeslot "(ts_nr)&" sub-slot 
"(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,
+   rtp_pt := 0,
+   

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


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


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] 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, );
+   ipset(iph, );
 
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 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


  1   2   >