osmo-msc[master]: trans_free: drop bad assertion

2018-04-09 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[PATCH] osmo-hlr[master]: notify GSUP clients when HLR subscriber information changes

2018-04-09 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/7685

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

notify GSUP clients when HLR subscriber information changes

Add a function which triggers subscriber update notifications to
all connected GSUP clients, and invoke it when the MSISDN of a
subscriber is changed via VTY.

This makes the TTCN3 HLR test TC_vty_msisdn_isd pass.

Note that the new function currently relies on implementation
details of the Location Update Operation (luop) code.
Because of this we currently log a slightly misleading message
when the updated Insert Subscriber Data message is sent:
  "luop.c:161 LU OP state change: LU RECEIVED -> ISD SENT"
This message is misleading because, in fact, no location update
message was received from a GSUP client at that moment.

So while this change fixes the externally visible behaviour, we may
want to follow this up with some refactoring to avoid relying on
luop internals. It seems acceptable to do that in a separate step
since such a change will be more involved and harder to review.

We may want to trigger such notifications in other situations as well.
This is left for future work, too. There are no TTCN3 test cases for
other situations yet, as far as I can see.

Related: OS#2785
Change-Id: Iffe1d7afb9fc7dbae542f70bbf5391ddc08a14b4
---
M src/hlr.c
M src/hlr.h
M src/hlr_vty_subscr.c
3 files changed, 40 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/85/7685/2

diff --git a/src/hlr.c b/src/hlr.c
index 838b1bc..4fbc268 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -46,6 +46,38 @@
 
 static struct hlr *g_hlr;
 
+/* Trigger 'Insert Subscriber Data' messages to all connected GSUP clients.
+ *
+ * FIXME: In order to support large-scale networks this function should skip
+ * VLRs/SGSNs which do not currently serve the subscriber.
+ *
+ * \param[in] subscr  A subscriber we have new data to send for.
+ */
+void
+osmo_hlr_subscriber_update_notify(struct hlr_subscriber *subscr)
+{
+struct osmo_gsup_conn *co;
+
+   if (g_hlr->gs == NULL)
+   return;
+
+   llist_for_each_entry(co, _hlr->gs->clients, list) {
+   struct lu_operation *luop = lu_op_alloc_conn(co);
+   if (!luop) {
+   LOGP(DMAIN, LOGL_ERROR,
+  "IMSI='%s': Cannot notify GSUP client, cannot 
allocate lu_operation,"
+  " for %s:%u\n", subscr->imsi,
+  co && co->conn && co->conn->server? 
co->conn->server->addr : "unset",
+  co && co->conn && co->conn->server? 
co->conn->server->port : 0);
+   continue;
+   }
+   luop->subscr = *subscr;
+   luop->state = LU_S_LU_RECEIVED; /* Pretend we received a 
location update. */
+   lu_op_tx_insert_subscr_data(luop);
+   lu_op_free(luop);
+   }
+}
+
 /***
  * Send Auth Info handling
  ***/
diff --git a/src/hlr.h b/src/hlr.h
index f63bc2b..368a052 100644
--- a/src/hlr.h
+++ b/src/hlr.h
@@ -38,3 +38,7 @@
/* Local bind addr */
char *gsup_bind_addr;
 };
+
+struct hlr_subscriber;
+
+void osmo_hlr_subscriber_update_notify(struct hlr_subscriber *subscr);
diff --git a/src/hlr_vty_subscr.c b/src/hlr_vty_subscr.c
index 7191a1c..4092a8f 100644
--- a/src/hlr_vty_subscr.c
+++ b/src/hlr_vty_subscr.c
@@ -257,6 +257,10 @@
 
vty_out(vty, "%% Updated subscriber IMSI='%s' to MSISDN='%s'%s",
subscr.imsi, msisdn, VTY_NEWLINE);
+
+   if (db_subscr_get_by_msisdn(g_hlr->dbc, msisdn, ) == 0)
+   osmo_hlr_subscriber_update_notify();
+
return CMD_SUCCESS;
 }
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iffe1d7afb9fc7dbae542f70bbf5391ddc08a14b4
Gerrit-PatchSet: 2
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 


osmo-hlr[master]: notify GSUP clients when HLR subscriber information changes

2018-04-09 Thread Stefan Sperling

Patch Set 1:

> (1 comment)

Subscriber entries in the DB contain a vlr_number and sgsn_number. It seems 
those are only set, I cannot find code which reads them back.

I'll add a comment as you suggest.

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

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


osmo-msc[master]: VTY: add USSD processing back-end configuration

2018-04-09 Thread Neels Hofmeyr

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/7677/1/src/osmo-msc/msc_main.c
File src/osmo-msc/msc_main.c:

Line 634:   /* Initialize USSD */
> Probably, it's my bad habit to comment each code block...
it's in many computer science syllabi as well: "comment every code block! even 
if it exactly copies the words of the code itself!" -- also happens with API 
docs a lot:  "get_frblxztrf(): Get the Frblxztrf." -- useless clutter :)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0b3c5ccea4054113e8e23109b1ab68d9f0e18497
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Neels Hofmeyr

Patch Set 2: Verified+1

add V+1 manually, the jenkins result wasn't counted

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: CC: intentionally release T308 on BSSMAP Clear Request from BSC

2018-04-09 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/7704

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

CC: intentionally release T308 on BSSMAP Clear Request from BSC

So far we hit a running T308 during CC release when caused by a BSSMAP Clear
Request, and we loudly log that as error.

However, now I understand that T308 is a direct cause of the dispatch of a REL
IND towards MNCC, which is used to indicate teardown to MNCC. So during
_gsm48_cc_trans_free(), we first clear all timers, then invoke
mncc_release_ind() which starts another timer (useful for graceful CC Release,
but in this code path the intention is immediate release). Simply immediately
cancel the timer again and release the conn.

A separate question is whether a BSSMAP Clear Request should be less aggressive
in releasing the connections; i.e. instead of calling trans_free() all around,
to rather ask each transaction to "please stop soon", somehow.

Related: OS#3062
Change-Id: I231fdb574a086a206321148474cbdc7ca9cf39f0
---
M src/libmsc/gsm_04_08.c
M src/libmsc/transaction.c
M tests/msc_vlr/msc_vlr_test_call.err
3 files changed, 4 insertions(+), 10 deletions(-)


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

diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index e5ddb44..f29c0b6 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1422,6 +1422,9 @@
mncc_release_ind(trans->net, trans, trans->callref,
 GSM48_CAUSE_LOC_PRN_S_LU,
 GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
+   /* This is a final freeing of the transaction. The MNCC release 
may have triggered the
+* T308 release timer, but we don't have the luxury of graceful 
CC Release here. */
+   gsm48_stop_cc_timer(trans);
}
if (trans->cc.state != GSM_CSTATE_NULL)
new_cc_state(trans, GSM_CSTATE_NULL);
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index 66b929a..147099e 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -122,15 +122,6 @@
switch (trans->protocol) {
case GSM48_PDISC_CC:
_gsm48_cc_trans_free(trans);
-   if (osmo_timer_pending(>cc.timer)) {
-   LOGP(DCC, LOGL_ERROR,
-"%s Timer 0x%x is still running while discarding 
transaction"
-" -- this is a bug: we were still expecting a 
response but"
-" are freeing the transaction anyway\n",
-vlr_subscr_name(trans->conn->vsub), 
trans->cc.Tcurrent);
-   osmo_timer_del(>cc.timer);
-   trans->cc.Tcurrent = 0;
-   }
conn_usage_token = MSC_CONN_USE_TRANS_CC;
break;
case GSM48_PDISC_SMS:
diff --git a/tests/msc_vlr/msc_vlr_test_call.err 
b/tests/msc_vlr/msc_vlr_test_call.err
index 6142464..1b8002b 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -1085,8 +1085,8 @@
 DMNCC transmit message MNCC_REL_CNF
 DCC Sending 'MNCC_REL_CNF' to MNCC.
   MSC --> MNCC: callref 0x423: MNCC_REL_CNF
+DCC stopping pending timer T308
 DCC (ti 00 sub MSISDN:42342) new state RELEASE_REQ -> NULL
-DCC MSISDN:42342 Timer 0x308 is still running while discarding transaction -- 
this is a bug: we were still expecting a response but are freeing the 
transaction anyway
 DREF VLR subscr MSISDN:42342 usage decreases to: 2
 DREF MSISDN:42342: MSC conn use - trans_cc == 1 (0x4)
 - Iu Release --RAN_UTRAN_IU--> MS

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I231fdb574a086a206321148474cbdc7ca9cf39f0
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-msc[master]: refactor subscr_conn and subscr_conn_fsm de-/alloc

2018-04-09 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/7705

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

refactor subscr_conn and subscr_conn_fsm de-/alloc

Refactor:

1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm.
2. Add separate AUTH_CIPH state to the FSM.
3. Use conn->use_count to trigger conn release.
4. Add separate RELEASING state to the FSM.
5. Add rate counters for each of the three Complete Layer 3 types.

Details:

1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm.

Historically, a gsm_subscriber_connection was allocated in libbsc land, and
only upon Complete Layer 3 did libmsc add the fsm instance. After splitting
openbsc.git into a separate osmo-msc, this is no longer necessary, hence:

Closely tie gsm_subscriber_connection allocation to the subscr_conn_fsm
instance: talloc the conn as a child of the FSM instance, and discard the conn
as soon as the FSM terminates.

2. Add separate AUTH_CIPH state to the FSM.

Decoding the Complete Layer 3 message is distinctly separate from waiting for
the VLR FSMs to conclude. Use the NEW state as "we don't know if this is a
valid message yet", and the AUTH_CIPH state as "evaluating, don't release".

A profound effect of this: should we for any odd reason fail to leave the FSM's
NEW state, the conn will be released right at the end of msc_compl_l3(),
without needing to trigger release in each code path.

3. Use conn->use_count to trigger conn release.

Before, the FSM itself would hold a use count on the conn, and hence we would
need to ask it whether it is ready to release the conn yet by dispatching
events, to achieve a use_count decrement.

Instead, unite the FSM instance and conn, and do not hold a use count by the
FSM. Hence, trigger an FSM "UNUSED" event only when the use_count reaches zero.
As long as use counts are done correctly, the FSM will terminate correctly.

These exceptions:

- The new AUTH_CIPH state explicitly ignores UNUSED events, since we expect the
  use count to reach zero while evaluating Authentication and Ciphering. (I
  experimented with holding a use count by AUTH_CIPH onenter() and releasing by
  onleave(), but the use count and thus the conn are released before the next
  state can initiate transactions that would increment the use count again.
  Same thing for the VLR FSMs holding a use count, they should be done before
  we advance to the next state. The easiest is to simply expect zero use count
  during the AUTH_CIPH state.)

- A CM Service Request means that even though the MSC would be through with all
  it wants to do, we shall still wait for a request to follow from the MS.
  Hence the FSM holds a use count on itself while a CM Service is pending.

- While waiting for a Release/Clear Complete, the FSM holds a use count on
  itself.

4. Add separate RELEASING state to the FSM.

If we decide to release for other reasons than a use count reaching zero, we
still need to be able to wait for the msc_dtap() use count on the conn to
release.

(An upcoming patch will further use the RELEASING state to properly wait for
Clear Complete / Release Complete messages.)

5. Add rate counters for each of the three Complete Layer 3 types.

Besides LU, also count CM Service Request and Paging Response
acceptance/rejections. Without these counters, only very few of the auth+ciph
outcomes actually show in the counters.

Related: OS#3122
Change-Id: I55feb379e176a96a831e105b86202b17a0ffe889
---
M include/osmocom/msc/gsm_data.h
M include/osmocom/msc/osmo_msc.h
M src/libmsc/gsm_04_08.c
M src/libmsc/msc_ifaces.c
M src/libmsc/osmo_msc.c
M src/libmsc/subscr_conn.c
M src/libmsc/transaction.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.err
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
M tests/msc_vlr/msc_vlr_test_no_authen.err
M tests/msc_vlr/msc_vlr_test_reject_concurrency.err
M tests/msc_vlr/msc_vlr_test_rest.c
M tests/msc_vlr/msc_vlr_test_rest.err
M tests/msc_vlr/msc_vlr_test_umts_authen.err
M tests/msc_vlr/msc_vlr_tests.c
20 files changed, 3,580 insertions(+), 2,937 deletions(-)


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


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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I55feb379e176a96a831e105b86202b17a0ffe889
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Neels Hofmeyr

msc_vlr_test_call: reproduce OS#3062

A related ttcn3 test is added in Ic80646e1fba37bb6163ca3a7eead7980b4ad7a51

Related: OS#3062
Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
---
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
4 files changed, 436 insertions(+), 0 deletions(-)


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

diff --git a/tests/msc_vlr/msc_vlr_test_call.c 
b/tests/msc_vlr/msc_vlr_test_call.c
index 6359865..9d4126e 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -31,6 +31,12 @@
mncc_tx_to_cc(net, msg_type, mncc);
 }
 
+static void on_call_release_mncc_sends_to_cc(uint32_t msg_type, struct 
gsm_mncc *mncc)
+{
+   mncc->msg_type = msg_type;
+   on_call_release_mncc_sends_to_cc_data = mncc;
+}
+
 #define IMSI "90170010650"
 
 static void standard_lu()
@@ -334,6 +340,80 @@
comment_end();
 }
 
+static void test_call_mt2()
+{
+   struct gsm_mncc mncc = {
+   .imsi = IMSI,
+   .callref = 0x423,
+   };
+
+   comment_start();
+
+   fake_time_start();
+
+   standard_lu();
+
+   BTW("after a while, MNCC asks us to setup a call, causing Paging");
+   
+   paging_expect_imsi(IMSI);
+   paging_sent = false;
+   mncc_sends_to_cc(MNCC_SETUP_REQ, );
+
+   VERBOSE_ASSERT(paging_sent, == true, "%d");
+   VERBOSE_ASSERT(paging_stopped, == false, "%d");
+
+   btw("MS replies with Paging Response, and VLR sends Auth Request");
+   auth_request_sent = false;
+   auth_request_expect_rand = "c187a53a5e6b9d573cac7c74451fd46d";
+   auth_request_expect_autn = "1843a645b98d5b2d666af46c45d9";
+   ms_sends_msg("062707"
+"03575886" /* classmark 2 */
+"08991007106005" /* IMSI */);
+   VERBOSE_ASSERT(auth_request_sent, == true, "%d");
+
+   btw("MS sends Authen Response, VLR accepts and sends 
SecurityModeControl");
+   expect_security_mode_ctrl(NULL, "1159ec926a50e98c034a6b7d7c9f418d");
+   ms_sends_msg("0554" "7db47cf7" "2104" "f81e4dc7"); /* 2nd vector's res, 
s.a. */
+   VERBOSE_ASSERT(security_mode_ctrl_sent, == true, "%d");
+
+   btw("MS sends SecurityModeControl acceptance, VLR accepts, sends CC 
Setup");
+   dtap_expect_tx("0305" /* CC: Setup */);
+   ms_sends_security_mode_complete();
+   VERBOSE_ASSERT(paging_stopped, == true, "%d");
+
+   cc_to_mncc_expect_tx(IMSI, MNCC_CALL_CONF_IND);
+   ms_sends_msg("8348" /* CC: Call Confirmed */
+"0406600402000581" /* Bearer Capability */
+"15020100" /* Call Control Capabilities */
+"40080402600400021f00" /* Supported Codec List */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(1, 23);
+
+   cc_to_mncc_expect_tx("", MNCC_ALERT_IND);
+   ms_sends_msg("8381" /* CC: Alerting */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(15, 23);
+
+   btw("The call failed, the BSC sends a BSSMAP Clear Request");
+   on_call_release_mncc_sends_to_cc(MNCC_REL_REQ, );
+   cc_to_mncc_expect_tx("", MNCC_REL_CNF);
+   dtap_expect_tx("032d"); /* CC: Release */
+   expect_iu_release();
+   msc_clear_request(g_conn, 0);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+   OSMO_ASSERT(iu_release_sent);
+
+   EXPECT_CONN_COUNT(0);
+
+   /* Make sure a pending release timer doesn't fire later to access freed 
data */
+   fake_time_passes(15, 23);
+
+   clear_vlr();
+   comment_end();
+}
+
 static void test_call_mo_to_unknown()
 {
struct gsm_mncc mncc = {
@@ -497,6 +577,7 @@
 msc_vlr_test_func_t msc_vlr_tests[] = {
test_call_mo,
test_call_mt,
+   test_call_mt2,
test_call_mo_to_unknown,
test_call_mo_to_unknown_timeout,
NULL
diff --git a/tests/msc_vlr/msc_vlr_test_call.err 
b/tests/msc_vlr/msc_vlr_test_call.err
index 281f418..6142464 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -757,6 +757,352 @@
 full talloc report on 'msgb' (total  0 bytes in   1 blocks)
 talloc_total_blocks(tall_bsc_ctx) == 12
 
+= test_call_mt2
+- Total time passed: 0.00 s
+- Location Update request causes a GSUP Send Auth Info request to HLR
+  MSC <--RAN_UTRAN_IU-- MS: GSM48_MT_MM_LOC_UPD_REQUEST
+  new conn
+DREF unknown: MSC conn use + compl_l3 == 1 (0x1)
+DRLL Dispatching 04.08 message GSM48_MT_MM_LOC_UPD_REQUEST (0x5:0x8)
+DREF unknown: MSC conn use + fsm == 2 (0x5)
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Allocated
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Received Event 
SUBSCR_CONN_E_START
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: state_chg to 
SUBSCR_CONN_S_NEW
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_NEW}: Updated ID from LU

[PATCH] osmo-ttcn3-hacks[master]: msc: add TC_mo_cc_bssmap_clear to catch OS#3062

2018-04-09 Thread Neels Hofmeyr

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

msc: add TC_mo_cc_bssmap_clear to catch OS#3062

The test currently crashes osmo-msc, which is fixed by
I5c30e0f9545fb76615776ff6cc16b56aeb5b043a (osmo-msc).

Related: OS#3062
Change-Id: Ic80646e1fba37bb6163ca3a7eead7980b4ad7a51
---
M msc/MSC_Tests.ttcn
1 file changed, 40 insertions(+), 0 deletions(-)


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

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index b5108c7..f2f1f72 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1884,6 +1884,45 @@
vc_conn.done;
 }
 
+/* BSSMAP Clear Request in the middle of a call, see OS#3062 */
+private function f_tc_mo_cc_bssmap_clear(charstring id, BSC_ConnHdlrPars pars) 
runs on BSC_ConnHdlr {
+   f_init_handler(pars);
+   var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
+   var MNCC_PDU mncc;
+   var MgcpCommand mgcp_cmd;
+
+   f_perform_lu();
+
+   f_establish_fully();
+   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;
+   MNCC.send(ts_MNCC_CALL_PROC_req(cpars.mncc_callref, 
cpars.mncc_bearer_cap));
+   
BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_CALL_PROC(cpars.transaction_id)));
+
+   MNCC.send(ts_MNCC_ALERT_req(cpars.mncc_callref));
+   
BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_ALERTING(cpars.transaction_id)));
+   MGCP.receive(tr_CRCX);
+
+   f_sleep(1.0);
+   BSSAP.send(ts_BSSMAP_ClearRequest(0));
+
+   MNCC.receive(tr_MNCC_REL_ind(?, ?)) -> value mncc;
+   MNCC.send(ts_MNCC_REL_cnf(cpars.mncc_callref, 
valueof(ts_MNCC_cause(47;
+
+   BSSAP.receive(tr_BSSMAP_ClearCommand);
+   BSSAP.send(ts_BSSMAP_ClearComplete);
+}
+testcase TC_mo_cc_bssmap_clear() runs on MTC_CT {
+   var BSC_ConnHdlr vc_conn;
+   f_init();
+
+   vc_conn := f_start_handler(refers(f_tc_mo_cc_bssmap_clear), 43);
+   vc_conn.done;
+}
 
 
 /* TODO:
@@ -1952,6 +1991,7 @@
 
/* Run this last: at the time of writing this test crashes the MSC */
execute( TC_lu_imsi_auth_tmsi_encr_3_1_log_msc_debug() );
+   execute( TC_mo_cc_bssmap_clear() );
 }
 
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic80646e1fba37bb6163ca3a7eead7980b4ad7a51
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] osmo-ttcn3-hacks[master]: MNCC: don't delete call table entries

2018-04-09 Thread Neels Hofmeyr

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

MNCC: don't delete call table entries

If we receive an MNCC_REL_ind, we still may want to reply with an MNCC_REL_cnf.
If the REL_ind, however, already drops the call table entry, all I get is:
"MNCC Call table not found by MNCC Call ID "

The call table should be cleared on each f_mncc_init(), so I guess it's fine to
just not delete entries during ongoing communication.

Change-Id: I73ec066744475d3cc464e34854175f8cf14cf125
---
M library/MNCC_Emulation.ttcn
1 file changed, 0 insertions(+), 4 deletions(-)


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

diff --git a/library/MNCC_Emulation.ttcn b/library/MNCC_Emulation.ttcn
index 59e3e77..2b83e70 100644
--- a/library/MNCC_Emulation.ttcn
+++ b/library/MNCC_Emulation.ttcn
@@ -299,8 +299,6 @@
/* forward to respective client */
vc_conn := f_comp_by_call_id(call_id);
MNCC_CLIENT.send(sd.data) to vc_conn;
-   /* remove from call table */
-   f_call_table_del(call_id);
}
 
/* MNCC -> Client: call related messages */
@@ -325,8 +323,6 @@
var integer call_id := f_call_id_by_comp(vc_conn);
/* forward to MNCC socket */
MNCC.send(t_SD_MNCC(g_mncc_ud_id, mncc));
-   /* remove from call table */
-   f_call_table_del(call_id);
}
 
/* Client -> MNCC Socket: Normal message */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I73ec066744475d3cc464e34854175f8cf14cf125
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Neels Hofmeyr

Patch Set 1:

note related ttcn3 test: https://gerrit.osmocom.org/7712

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: fix BSC Clear Request

2018-04-09 Thread Neels Hofmeyr

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

fix BSC Clear Request

On receiving a Clear Request, don't send a Clear Command "out of band", let the
FSM do the release handling by invoking msc_subscr_conn_mo_close().

Fixes: ttcn3 MSC_Tests.TC_lu_clear_request
Change-Id: I168b889ac7989641cc679b781dcffb87ff13a710
---
M src/libmsc/a_iface_bssap.c
1 file changed, 2 insertions(+), 8 deletions(-)


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

diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index 87ccf05..6d5848a 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -216,8 +216,6 @@
 static int bssmap_rx_clear_rqst(struct gsm_subscriber_connection *conn,
struct msgb *msg, struct tlv_parsed *tp)
 {
-   int rc;
-   struct msgb *msg_resp;
uint8_t cause;
 
LOGPCONN(conn, LOGL_INFO, "Rx BSSMAP CLEAR REQUEST\n");
@@ -228,13 +226,9 @@
}
cause = TLVP_VAL(tp, GSM0808_IE_CAUSE)[0];
 
-   /* Respond with clear command */
-   msg_resp = gsm0808_create_clear_command(GSM0808_CAUSE_CALL_CONTROL);
-   rc = osmo_sccp_tx_data_msg(conn->a.scu, conn->a.conn_id, msg_resp);
+   msc_subscr_conn_mo_close(conn, cause);
 
-   msc_clear_request(conn, cause);
-
-   return rc;
+   return 0;
 }
 
 /* Endpoint to handle BSSMAP clear complete */

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

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


[PATCH] osmo-msc[master]: refactor subscr_conn and subscr_conn_fsm de-/alloc

2018-04-09 Thread Neels Hofmeyr

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

refactor subscr_conn and subscr_conn_fsm de-/alloc

Refactor:

1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm.
2. Add separate AUTH_CIPH state to the FSM.
3. Use conn->use_count to trigger conn release.
4. Add separate RELEASING state to the FSM.
5. Add rate counters for each of the three Complete Layer 3 types.

Details:

1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm.

Historically, a gsm_subscriber_connection was allocated in libbsc land, and
only upon Complete Layer 3 did libmsc add the fsm instance. After splitting
openbsc.git into a separate osmo-msc, this is no longer necessary, hence:

Closely tie gsm_subscriber_connection allocation to the subscr_conn_fsm
instance: talloc the conn as a child of the FSM instance, and discard the conn
as soon as the FSM terminates.

2. Add separate AUTH_CIPH state to the FSM.

Decoding the Complete Layer 3 message is distinctly separate from waiting for
the VLR FSMs to conclude. Use the NEW state as "we don't know if this is a
valid message yet", and the AUTH_CIPH state as "evaluating, don't release".

A profound effect of this: should we for any odd reason fail to leave the FSM's
NEW state, the conn will be released right at the end of msc_compl_l3(),
without needing to trigger release in each code path.

3. Use conn->use_count to trigger conn release.

Before, the FSM itself would hold a use count on the conn, and hence we would
need to ask it whether it is ready to release the conn yet by dispatching
events, to achieve a use_count decrement.

Instead, unite the FSM instance and conn, and do not hold a use count by the
FSM. Hence, trigger an FSM "UNUSED" event only when the use_count reaches zero.
As long as use counts are done correctly, the FSM will terminate correctly.

These exceptions:

- The new AUTH_CIPH state explicitly ignores UNUSED events, since we expect the
  use count to reach zero while evaluating Authentication and Ciphering. (I
  experimented with holding a use count by AUTH_CIPH onenter() and releasing by
  onleave(), but the use count and thus the conn are released before the next
  state can initiate transactions that would increment the use count again.
  Same thing for the VLR FSMs holding a use count, they should be done before
  we advance to the next state. The easiest is to simply expect zero use count
  during the AUTH_CIPH state.)

- A CM Service Request means that even though the MSC would be through with all
  it wants to do, we shall still wait for a request to follow from the MS.
  Hence the FSM holds a use count on itself while a CM Service is pending.

- While waiting for a Release/Clear Complete, the FSM holds a use count on
  itself.

4. Add separate RELEASING state to the FSM.

If we decide to release for other reasons than a use count reaching zero, we
still need to be able to wait for the msc_dtap() use count on the conn to
release.

(An upcoming patch will further use the RELEASING state to properly wait for
Clear Complete / Release Complete messages.)

5. Add rate counters for each of the three Complete Layer 3 types.

Besides LU, also count CM Service Request and Paging Response
acceptance/rejections. Without these counters, only very few of the auth+ciph
outcomes actually show in the counters.

Related: OS#3122
Change-Id: I55feb379e176a96a831e105b86202b17a0ffe889
---
M include/osmocom/msc/gsm_data.h
M include/osmocom/msc/osmo_msc.h
M src/libmsc/gsm_04_08.c
M src/libmsc/msc_ifaces.c
M src/libmsc/osmo_msc.c
M src/libmsc/subscr_conn.c
M src/libmsc/transaction.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.err
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
M tests/msc_vlr/msc_vlr_test_no_authen.err
M tests/msc_vlr/msc_vlr_test_reject_concurrency.err
M tests/msc_vlr/msc_vlr_test_rest.c
M tests/msc_vlr/msc_vlr_test_rest.err
M tests/msc_vlr/msc_vlr_test_umts_authen.err
M tests/msc_vlr/msc_vlr_tests.c
20 files changed, 3,576 insertions(+), 2,937 deletions(-)


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


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

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


[PATCH] osmo-msc[master]: msc_vlr_test_call: reproduce OS#3062

2018-04-09 Thread Neels Hofmeyr

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

msc_vlr_test_call: reproduce OS#3062

Change-Id: Ice7197b48d4e163a3c4d97b559fdcd7e88c4107e
---
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_tests.c
M tests/msc_vlr/msc_vlr_tests.h
4 files changed, 436 insertions(+), 0 deletions(-)


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

diff --git a/tests/msc_vlr/msc_vlr_test_call.c 
b/tests/msc_vlr/msc_vlr_test_call.c
index 6359865..9d4126e 100644
--- a/tests/msc_vlr/msc_vlr_test_call.c
+++ b/tests/msc_vlr/msc_vlr_test_call.c
@@ -31,6 +31,12 @@
mncc_tx_to_cc(net, msg_type, mncc);
 }
 
+static void on_call_release_mncc_sends_to_cc(uint32_t msg_type, struct 
gsm_mncc *mncc)
+{
+   mncc->msg_type = msg_type;
+   on_call_release_mncc_sends_to_cc_data = mncc;
+}
+
 #define IMSI "90170010650"
 
 static void standard_lu()
@@ -334,6 +340,80 @@
comment_end();
 }
 
+static void test_call_mt2()
+{
+   struct gsm_mncc mncc = {
+   .imsi = IMSI,
+   .callref = 0x423,
+   };
+
+   comment_start();
+
+   fake_time_start();
+
+   standard_lu();
+
+   BTW("after a while, MNCC asks us to setup a call, causing Paging");
+   
+   paging_expect_imsi(IMSI);
+   paging_sent = false;
+   mncc_sends_to_cc(MNCC_SETUP_REQ, );
+
+   VERBOSE_ASSERT(paging_sent, == true, "%d");
+   VERBOSE_ASSERT(paging_stopped, == false, "%d");
+
+   btw("MS replies with Paging Response, and VLR sends Auth Request");
+   auth_request_sent = false;
+   auth_request_expect_rand = "c187a53a5e6b9d573cac7c74451fd46d";
+   auth_request_expect_autn = "1843a645b98d5b2d666af46c45d9";
+   ms_sends_msg("062707"
+"03575886" /* classmark 2 */
+"08991007106005" /* IMSI */);
+   VERBOSE_ASSERT(auth_request_sent, == true, "%d");
+
+   btw("MS sends Authen Response, VLR accepts and sends 
SecurityModeControl");
+   expect_security_mode_ctrl(NULL, "1159ec926a50e98c034a6b7d7c9f418d");
+   ms_sends_msg("0554" "7db47cf7" "2104" "f81e4dc7"); /* 2nd vector's res, 
s.a. */
+   VERBOSE_ASSERT(security_mode_ctrl_sent, == true, "%d");
+
+   btw("MS sends SecurityModeControl acceptance, VLR accepts, sends CC 
Setup");
+   dtap_expect_tx("0305" /* CC: Setup */);
+   ms_sends_security_mode_complete();
+   VERBOSE_ASSERT(paging_stopped, == true, "%d");
+
+   cc_to_mncc_expect_tx(IMSI, MNCC_CALL_CONF_IND);
+   ms_sends_msg("8348" /* CC: Call Confirmed */
+"0406600402000581" /* Bearer Capability */
+"15020100" /* Call Control Capabilities */
+"40080402600400021f00" /* Supported Codec List */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(1, 23);
+
+   cc_to_mncc_expect_tx("", MNCC_ALERT_IND);
+   ms_sends_msg("8381" /* CC: Alerting */);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+
+   fake_time_passes(15, 23);
+
+   btw("The call failed, the BSC sends a BSSMAP Clear Request");
+   on_call_release_mncc_sends_to_cc(MNCC_REL_REQ, );
+   cc_to_mncc_expect_tx("", MNCC_REL_CNF);
+   dtap_expect_tx("032d"); /* CC: Release */
+   expect_iu_release();
+   msc_clear_request(g_conn, 0);
+   OSMO_ASSERT(cc_to_mncc_tx_confirmed);
+   OSMO_ASSERT(iu_release_sent);
+
+   EXPECT_CONN_COUNT(0);
+
+   /* Make sure a pending release timer doesn't fire later to access freed 
data */
+   fake_time_passes(15, 23);
+
+   clear_vlr();
+   comment_end();
+}
+
 static void test_call_mo_to_unknown()
 {
struct gsm_mncc mncc = {
@@ -497,6 +577,7 @@
 msc_vlr_test_func_t msc_vlr_tests[] = {
test_call_mo,
test_call_mt,
+   test_call_mt2,
test_call_mo_to_unknown,
test_call_mo_to_unknown_timeout,
NULL
diff --git a/tests/msc_vlr/msc_vlr_test_call.err 
b/tests/msc_vlr/msc_vlr_test_call.err
index 281f418..6142464 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -757,6 +757,352 @@
 full talloc report on 'msgb' (total  0 bytes in   1 blocks)
 talloc_total_blocks(tall_bsc_ctx) == 12
 
+= test_call_mt2
+- Total time passed: 0.00 s
+- Location Update request causes a GSUP Send Auth Info request to HLR
+  MSC <--RAN_UTRAN_IU-- MS: GSM48_MT_MM_LOC_UPD_REQUEST
+  new conn
+DREF unknown: MSC conn use + compl_l3 == 1 (0x1)
+DRLL Dispatching 04.08 message GSM48_MT_MM_LOC_UPD_REQUEST (0x5:0x8)
+DREF unknown: MSC conn use + fsm == 2 (0x5)
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Allocated
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: Received Event 
SUBSCR_CONN_E_START
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_INIT}: state_chg to 
SUBSCR_CONN_S_NEW
+DMM Subscr_Conn(90170010650){SUBSCR_CONN_S_NEW}: Updated ID from LU
+DMM LOCATION UPDATING REQUEST: 

[PATCH] osmo-msc[master]: trans_free: drop bad assertion

2018-04-09 Thread Neels Hofmeyr

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

trans_free: drop bad assertion

I assumed that trans_free() would always be called before freeing the FSM. But
the actual conn free dance that tries to make sure a release is triggered from
all directions actually may run into a situation where conn->fi is NULL.

The situation is described in OS#3125.

For now simply drop the assert.

The subscr conn and FSM dealloc will soon be glued firmly together; but I want
to add a test against OS#3062 before that, and that would also hit above 
assertion.

Related: OS#3125 OS#3062
Change-Id: I5c30e0f9545fb76615776ff6cc16b56aeb5b043a
---
M src/libmsc/transaction.c
1 file changed, 0 insertions(+), 3 deletions(-)


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

diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index 5b033dc..66b929a 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -158,9 +158,6 @@
trans->conn = NULL;
talloc_free(trans);
 
-   /* trans_free() should always happen while the fi is still around. */
-   OSMO_ASSERT(conn->fi);
-
/* Possibly this was the last transaction used by this conn. */
subscr_conn_release_when_unused(conn);
 }

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

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


[PATCH] osmo-msc[master]: CC: intentionally release T308 on BSSMAP Clear Request from BSC

2018-04-09 Thread Neels Hofmeyr

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

CC: intentionally release T308 on BSSMAP Clear Request from BSC

So far we hit a running T308 during CC release when caused by a BSSMAP Clear
Request, and we loudly log that as error.

However, now I understand that T308 is a direct cause of the dispatch of a REL
IND towards MNCC, which is used to indicate teardown to MNCC. So during
_gsm48_cc_trans_free(), we first clear all timers, then invoke
mncc_release_ind() which starts another timer (useful for graceful CC Release,
but in this code path the intention is immediate release). Simply immediately
cancel the timer again and release the conn.

A separate question is whether a BSSMAP Clear Request should be less aggressive
in releasing the connections; i.e. instead of calling trans_free() all around,
to rather ask each transaction to "please stop soon", somehow.

Related: OS#3062
Change-Id: I231fdb574a086a206321148474cbdc7ca9cf39f0
---
M src/libmsc/gsm_04_08.c
M src/libmsc/transaction.c
M tests/msc_vlr/msc_vlr_test_call.err
3 files changed, 4 insertions(+), 10 deletions(-)


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

diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index e5ddb44..f29c0b6 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -1422,6 +1422,9 @@
mncc_release_ind(trans->net, trans, trans->callref,
 GSM48_CAUSE_LOC_PRN_S_LU,
 GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
+   /* This is a final freeing of the transaction. The MNCC release 
may have triggered the
+* T308 release timer, but we don't have the luxury of graceful 
CC Release here. */
+   gsm48_stop_cc_timer(trans);
}
if (trans->cc.state != GSM_CSTATE_NULL)
new_cc_state(trans, GSM_CSTATE_NULL);
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index 66b929a..147099e 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -122,15 +122,6 @@
switch (trans->protocol) {
case GSM48_PDISC_CC:
_gsm48_cc_trans_free(trans);
-   if (osmo_timer_pending(>cc.timer)) {
-   LOGP(DCC, LOGL_ERROR,
-"%s Timer 0x%x is still running while discarding 
transaction"
-" -- this is a bug: we were still expecting a 
response but"
-" are freeing the transaction anyway\n",
-vlr_subscr_name(trans->conn->vsub), 
trans->cc.Tcurrent);
-   osmo_timer_del(>cc.timer);
-   trans->cc.Tcurrent = 0;
-   }
conn_usage_token = MSC_CONN_USE_TRANS_CC;
break;
case GSM48_PDISC_SMS:
diff --git a/tests/msc_vlr/msc_vlr_test_call.err 
b/tests/msc_vlr/msc_vlr_test_call.err
index 6142464..1b8002b 100644
--- a/tests/msc_vlr/msc_vlr_test_call.err
+++ b/tests/msc_vlr/msc_vlr_test_call.err
@@ -1085,8 +1085,8 @@
 DMNCC transmit message MNCC_REL_CNF
 DCC Sending 'MNCC_REL_CNF' to MNCC.
   MSC --> MNCC: callref 0x423: MNCC_REL_CNF
+DCC stopping pending timer T308
 DCC (ti 00 sub MSISDN:42342) new state RELEASE_REQ -> NULL
-DCC MSISDN:42342 Timer 0x308 is still running while discarding transaction -- 
this is a bug: we were still expecting a response but are freeing the 
transaction anyway
 DREF VLR subscr MSISDN:42342 usage decreases to: 2
 DREF MSISDN:42342: MSC conn use - trans_cc == 1 (0x4)
 - Iu Release --RAN_UTRAN_IU--> MS

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

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


[PATCH] osmo-msc[master]: msc conn ref counts: log human readable list of conn owners

2018-04-09 Thread Neels Hofmeyr

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

msc conn ref counts: log human readable list of conn owners

Change-Id: I2a09efafbdbdde0399238f7d79feea8612605201
---
M src/libmsc/osmo_msc.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.err
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
M tests/msc_vlr/msc_vlr_test_no_authen.err
M tests/msc_vlr/msc_vlr_test_reject_concurrency.err
M tests/msc_vlr/msc_vlr_test_rest.err
M tests/msc_vlr/msc_vlr_test_umts_authen.err
12 files changed, 1,107 insertions(+), 1,076 deletions(-)


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


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

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


[PATCH] osmo-msc[master]: cosmetic: embed compl_l3_type in FSM id

2018-04-09 Thread Neels Hofmeyr

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

cosmetic: embed compl_l3_type in FSM id

In the subscr_conn_fsm instance's ID, include the Complete Layer 3 type, so
that we can see on the first glance whether a state transition belongs to MO or
MT.

The huge patch is due to the cosmetic change affecting nearly every single log
line in the msc_vlr_tests, by nature of changing the FSM's ID.

Related: OS#3122
Change-Id: I2a7e27e0f16df1872dcda64cb928c3b8528ea3f7
---
M src/libmsc/subscr_conn.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.err
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
M tests/msc_vlr/msc_vlr_test_no_authen.err
M tests/msc_vlr/msc_vlr_test_reject_concurrency.err
M tests/msc_vlr/msc_vlr_test_rest.err
M tests/msc_vlr/msc_vlr_test_umts_authen.err
12 files changed, 7,132 insertions(+), 7,132 deletions(-)


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


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

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


[PATCH] osmo-bts[master]: WIP: l1_utils: increase size of octphy_cid_vals[] to 51

2018-04-09 Thread dexter

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

WIP: l1_utils: increase size of octphy_cid_vals[] to 51

*** WORK IN PROGRESS: DO NOT MERGE UNTIL CHECKED BACK WITH OCTASIC ***

The size of the array octphy_cid_vals[] is currently set to 37,
which also matches the amount of elements defined in l1_utils.c.

For some reason the array size needs to be increased up to 51.

- increase array size of octply_cid_vals[] from 37 to 51.

Change-Id: Ib3872cae36a76d93cb478a55e6fc3b03a9c6caaf
Related: SYS#4139
Patch-by: Octasic inc.
---
M src/osmo-bts-octphy/l1_utils.c
M src/osmo-bts-octphy/l1_utils.h
2 files changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/src/osmo-bts-octphy/l1_utils.c b/src/osmo-bts-octphy/l1_utils.c
index 8a8e155..df69259 100644
--- a/src/osmo-bts-octphy/l1_utils.c
+++ b/src/osmo-bts-octphy/l1_utils.c
@@ -80,7 +80,7 @@
{ 0, NULL }
 };
 
-const struct value_string octphy_cid_vals[37] = {
+const struct value_string octphy_cid_vals[51] = {
{ cOCTVC1_GSM_MSG_TRX_OPEN_CID, "TRX-OPEN" },
{ cOCTVC1_GSM_MSG_TRX_CLOSE_CID,"TRX-CLOSE" },
{ cOCTVC1_GSM_MSG_TRX_STATUS_CID,   "TRX-STATUS" },
diff --git a/src/osmo-bts-octphy/l1_utils.h b/src/osmo-bts-octphy/l1_utils.h
index d1a8717..9b2025f 100644
--- a/src/osmo-bts-octphy/l1_utils.h
+++ b/src/osmo-bts-octphy/l1_utils.h
@@ -5,5 +5,5 @@
 const struct value_string octphy_l1sapi_names[23];
 const struct value_string octphy_dir_names[5];
 const struct value_string octphy_clkmgr_state_vals[8];
-const struct value_string octphy_cid_vals[37];
+const struct value_string octphy_cid_vals[51];
 const struct value_string octphy_eid_vals[7];

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3872cae36a76d93cb478a55e6fc3b03a9c6caaf
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: dexter 


[MERGED] osmo-ttcn3-hacks[master]: msc: Initial SMS testing (MO + MT SMS, successful case, no S...

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: msc: Initial SMS testing (MO + MT SMS, successful case, no SMPP)
..


msc: Initial SMS testing (MO + MT SMS, successful case, no SMPP)

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

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



diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 3203b0e..3304662 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -2,7 +2,7 @@
 
 /* L3 Templates, building on top of MobileL3*_Types from Ericsson.
  *
- * (C) 2017 by Harald Welte 
+ * (C) 2017-2018 by Harald Welte 
  * All rights reserved.
  *
  * Released under the terms of GNU General Public License, Version 2 or
@@ -17,7 +17,7 @@
 import from MobileL3_RRM_Types all;
 import from MobileL3_CC_Types all;
 import from MobileL3_GMM_SM_Types all;
-//import from MobileL3_SMS_Types all;
+import from MobileL3_SMS_Types all;
 
 /* TS 24.007 Table 11.3 TI Flag */
 const BIT1 c_TIF_ORIG := '0'B;
@@ -2168,4 +2168,284 @@
with { extension "prototype(convert) encode(RAW)" };
 
 
+
+/* SMS TPDU Layer */
+
+template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template 
(value) TP_DA dst_addr,
+ template (value) OCT1 pid, template 
(value) OCT1 dcs,
+ integer length_ind, octetstring 
user_data) := {
+   sMS_SUBMIT := {
+   tP_MTI := '01'B,/* SUBMIT */
+   tP_RD := '1'B,  /* reject duplicates */
+   tP_VPF := '00'B,/* not present */
+   tP_SRR := '0'B, /* no status report requested */
+   tP_UDHI := '0'B,/* no user data header in UD */
+   tP_RP := '0'B,  /* no reply path */
+   tP_MR := msg_ref,
+   tP_DA := dst_addr,
+   tP_PID := pid,
+   tP_DCS := dcs,
+   tP_VP := omit,
+   tP_UDL_UD := {
+   tP_LengthIndicator := length_ind,
+   tP_UD := user_data
+   }
+   }
+}
+
+template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
+   template octetstring user_data := ?,
+   template OCT1 pid := ?, template OCT1 dcs 
:= ?,
+   template BIT1 mms := ?
+   ) := {
+   sMS_DELIVER := {
+   tP_MTI := '00'B,/* DELIVER */
+   tP_MMS := mms,  /* more messages to send */
+   tP_LP := ?, /* ?!? */
+   tP_Spare := '0'B,
+   tP_SRI := '0'B, /* status report indication */
+   tP_UDHI := '0'B,/* no user data header in UD */
+   tP_RP := '0'B,  /* no reply path */
+   tP_OA := src_addr,
+   tP_PID := pid,
+   tP_DCS := dcs,
+   tP_SCTS := ?,
+   tP_UDL_UD := {
+   tP_LengthIndicator := ?,
+   tP_UD := user_data
+   }
+   }
+}
+
+/* RP Layer */
+
+private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits 
rp_orig)
+return RP_OriginatorAddressLV {
+   var RP_OriginatorAddressLV ret;
+   if (istemplatekind(rp_orig, "omit")) {
+   ret := { 0, omit };
+   } else {
+   ret := { 0, valueof(rp_orig) };
+   }
+   return ret;
+}
+
+private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits 
rp_dst)
+return RP_DestinationAddressLV {
+   var RP_DestinationAddressLV ret;
+   if (istemplatekind(rp_dst, "omit")) {
+   ret := { 0, omit };
+   } else {
+   ret := { 0, valueof(rp_dst) };
+   }
+   return ret;
+}
+
+template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
+   template (omit) 
RP_NumberingPlan_and_NumberDigits rp_orig,
+   template (omit) 
RP_NumberingPlan_and_NumberDigits rp_dst,
+   template (value) 
TPDU_RP_DATA_MS_SGSN tpdu) := {
+   rP_DATA_MS_SGSN := {
+   rP_MTI := '000'B,
+   rP_Spare := '0'B,
+   rP_MessageReference := msg_ref,
+   rP_OriginatorAddress := ts_RpOrig(rp_orig),
+   rP_DestinationAddress := ts_RpDst(rp_dst),
+   rP_User_Data := {
+   rP_LengthIndicator := 0, /* overwritten */
+   rP_TPDU := tpdu
+   }
+   }
+}
+
+template 

osmo-ttcn3-hacks[master]: msc: Initial SMS testing (MO + MT SMS, successful case, no S...

2018-04-09 Thread Harald Welte

Patch Set 3: Code-Review+2

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

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


osmo-msc[master]: libmsc/ussd: implement basic USSD session management

2018-04-09 Thread Neels Hofmeyr

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/7699/1/tests/msc_vlr/msc_vlr_test_authen_reuse.err
File tests/msc_vlr/msc_vlr_test_authen_reuse.err:

Line 263: DCC (ti 08 sub MSISDN:42342 callref 0) New transaction
> read above three log lines. the first two have incomplete or no context, an
(hm, seems that 'ti 08' is also in old code)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I21c6777cb88f1f4f80f75dcd39734e952bd4e8b0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: Yes


osmo-msc[master]: libmsc/ussd: implement basic USSD session management

2018-04-09 Thread Neels Hofmeyr

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/7699/1/src/libmsc/ussd.c
File src/libmsc/ussd.c:

Line 129:   OSMO_ASSERT(session);
> if we pass a NULL in here, osmo-msc would crash on the assert, taking down 
btw, I made the same mistake recently and you hit that in OS#3125 -- remember 
the crash on OSMO_ASSERT(conn->conn_fsm) ;)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I21c6777cb88f1f4f80f75dcd39734e952bd4e8b0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: Yes


osmo-msc[master]: libmsc/ussd: implement basic USSD session management

2018-04-09 Thread Neels Hofmeyr

Patch Set 1: Code-Review-1

(15 comments)

https://gerrit.osmocom.org/#/c/7699/1/include/osmocom/msc/ussd.h
File include/osmocom/msc/ussd.h:

Line 33:struct gsm_trans *trans;
a gsm_trans always belongs to a conn. Do you really need a separate conn 
pointer? Can there be a valid ussd_session without a trans?


Line 35:/* A link to the global sessions list */
more like an entry within the global sessions list


Line 41: uint32_t ussd_session_id_gen(void);
(this could remain static in ussd.c)


Line 48:struct gsm_trans *trans);
again, you shouldn't need both conn and trans


https://gerrit.osmocom.org/#/c/7699/1/src/libmsc/ussd.c
File src/libmsc/ussd.c:

Line 61:DEBUGP(DMM, "Allocate a new USSD session\n");
When reading this in the log, I'd immediately want to know: for which 
subscriber??

Even besides mere logging, it makes sense to always firmly associate a ussd 
session with a given subscriber, or even with a conn. You will always have at 
least a vlr_subscr first and then allocate a USSD session for that subscr, 
right? Even better would be to even have a gsm_subscriber_connection before 
allocating ussd. Then talloc that ussd session as child of that conn, not child 
of the network. How are the semantics of USSD sessions?


Line 88:DEBUGP(DMM, "Found a USSD session (sid=%u)\n", 
session->sid);
log context (vlr_subscr_name())


Line 103:   OSMO_ASSERT(trans);
I think you could just rely on the calling code to not pass NULL.


Line 117:   session->trans->transaction_id, session->sid);
we commonly log the context first, then the message; and when logging hex, 
prepend a 0x to make it clear, like:

  (subscr %s, trans_id=0x%x, sid=%u) Found USSD session


Line 126:   DEBUGP(DMM, "Deallocate an USSD session\n");
log context


Line 129:   OSMO_ASSERT(session);
if we pass a NULL in here, osmo-msc would crash on the assert, taking down all 
active connections. Decide:

* it is valid to pass NULL into ussd_session_free(). Then if (!session) return; 
i.e. don't crash, just ignore.

OR

* it is invalid to pass NULL in here. Then simply never do that and also don't 
assert nor check it here.


Line 183:   ussd_session_free(session);
wait, a ussd_session is discarded basically right upon receiving the USSD 
request, in all cases? Does it never live past the first rx of SS Request? If 
we, for example, were to pass the request on to the HLR, we'd have to 
asynchronously wait for the HLR's response to reply, and only then discard.

I'm getting the impression ussd_session should not be a separate struct, but 
rather be a third part of the cc,sms union in struct gsm_trans. Then make use 
of the common transaction alloc and teardown API.

For example, if the BSC decides to suddenly send a BSSMAP Clear Request, the 
subscr_conn.c wants to free all transactions. Will it know that a ussd_session 
is associated with a trans? If the ussd session *is* a gsm_trans, then it 
certainly will.

Also, IMHO, if a session was allocated outside of the handler, the deallocation 
should also happen outside.


Line 218:   DEBUGP(DMM, "Received SS/USSD data (trans_id=%x)\n", tid);
log context, and the same multiple times below


Line 221:   OSMO_ASSERT(conn->vsub);
you can assume that conn->vsub is always populated when you're as far as 
handling DTAP


https://gerrit.osmocom.org/#/c/7699/1/tests/msc_vlr/msc_vlr_test_authen_reuse.err
File tests/msc_vlr/msc_vlr_test_authen_reuse.err:

Line 263: DCC (ti 08 sub MSISDN:42342 callref 0) New transaction
read above three log lines. the first two have incomplete or no context, and 
are basically obsolete once the third is logged. One time you log 'trans_id=8', 
then you log 'ti 08'. What is 08, octal representation?


Line 268: DMM USSD: Own number requested
This above (probably very old) log line might have gotten you the idea that we 
don't need context ;)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I21c6777cb88f1f4f80f75dcd39734e952bd4e8b0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: Yes


[PATCH] libosmocore[master]: GSUP: implement simple session management support

2018-04-09 Thread Vadim Yanitskiy

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

GSUP: implement simple session management support

Unlike TCAP/MAP, GSUP is just a transport layer without the
dialogue/context. This makes impossible to have a session
based communication (e.g. USSD) over GSUP.

This change introduces two new IEs:

  - OSMO_GSUP_SESSION_ID_IE,
  - OSMO_GSUP_SESSION_STATE_IE,

which can be used to indicate that the message is related to
a session with given ID, and to manage a session state, i.e.
initiate, continue, and finish.

Also, this change introduces a group of new messages intended
for requesting a new (unused) session ID before its initiation.

Change-Id: I1cee271fed0284a134ffed103c0d4bebbcfde2a8
Related: OS#1597
---
M TODO-RELEASE
M include/osmocom/gsm/gsup.h
M src/gsm/gsup.c
M tests/gsup/gsup_test.c
M tests/gsup/gsup_test.err
M tests/gsup/gsup_test.ok
6 files changed, 96 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/7700/1

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 16496d6..65b0fa8 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -13,3 +13,5 @@
 fsmfsmc / fsm.hadded callback for graceful 
exit => ABI changed
 gsmgsm0480.c / gsm0480.h   the 'ss_request' struct 
extended with ussd_data,
ussd_data_len, and 
ussd_data_dcs => ABI changed
+gsup   gsup.h  the 'osmo_gsup_message' struct 
extended with
+   session information => ABI 
changed
diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index 1a8a3b2..08f89e1 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -81,6 +81,18 @@
OSMO_GSUP_AUTS_IE   = 0x26,
OSMO_GSUP_RES_IE= 0x27,
OSMO_GSUP_CN_DOMAIN_IE  = 0x28,
+
+   /**
+* Session management
+*
+* SESSION_ID is used to distinguish between concurrent
+* sessions, and shall be unique for each active one.
+*
+* SESSION_STATE indicates the current state of a session,
+* see the 'osmo_gsup_session_state' enum for details.
+*/
+   OSMO_GSUP_SESSION_ID_IE = 0x30,
+   OSMO_GSUP_SESSION_STATE_IE  = 0x31,
 };
 
 /*! GSUP message type */
@@ -110,6 +122,19 @@
OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST  = 0b00011100,
OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR= 0b00011101,
OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT   = 0b0000,
+
+   /**
+* Unlike TCAP/MAP, GSUP is just a transport layer without the
+* dialogue/context. The following messages are intended for
+* session-based communications, e.g. USSD over GSUP.
+*
+* This message can be used by one of two communicating
+* entries in order to request a new (unused) session ID
+* before initiating a new session.
+*/
+   OSMO_GSUP_MSGT_SESSION_ID_REQUEST   = 0b0010,
+   OSMO_GSUP_MSGT_SESSION_ID_ERROR = 0b0011,
+   OSMO_GSUP_MSGT_SESSION_ID_RESULT= 0b00100010,
 };
 
 #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b0011) == 0b00)
@@ -129,6 +154,17 @@
 enum osmo_gsup_cn_domain {
OSMO_GSUP_CN_DOMAIN_PS  = 1,
OSMO_GSUP_CN_DOMAIN_CS  = 2,
+};
+
+enum osmo_gsup_session_state {
+   /* Undefined session state */
+   OSMO_GSUP_SESSION_STATE_NONE= 0x00,
+   /* Request to initiate a new session */
+   OSMO_GSUP_SESSION_STATE_BEGIN   = 0x01,
+   /* Communication within the existing session */
+   OSMO_GSUP_SESSION_STATE_CONTINUE= 0x02,
+   /* Indication of the session end */
+   OSMO_GSUP_SESSION_STATE_END = 0x03,
 };
 
 /*! parsed/decoded PDP context information */
@@ -175,6 +211,10 @@
enum osmo_gsup_cn_domaincn_domain;
const uint8_t   *pdp_charg_enc;
size_t  pdp_charg_enc_len;
+
+   /*! Session management fields */
+   enum osmo_gsup_session_statesession_state;
+   uint32_tsession_id;
 };
 
 int osmo_gsup_decode(const uint8_t *data, size_t data_len,
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index b6ac56d..78818c5 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -62,6 +62,11 @@
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_REQUEST),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_ERROR),
OSMO_VALUE_STRING(OSMO_GSUP_MSGT_LOCATION_CANCEL_RESULT),
+
+   OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SESSION_ID_REQUEST),
+   OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SESSION_ID_ERROR),
+   OSMO_VALUE_STRING(OSMO_GSUP_MSGT_SESSION_ID_RESULT),
+
{ 0, NULL }
 };
 
@@ -385,6 +390,14 @@
gsup_msg->pdp_charg_enc_len = value_len;
   

[PATCH] libosmocore[master]: GSUP: add USSD messages support according to 3GPP TS 09.02

2018-04-09 Thread Vadim Yanitskiy
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/7600

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

GSUP: add USSD messages support according to 3GPP TS 09.02

In order to be able to transfer USSD messages via GSUP,
this change introduces the new message types:

  - OSMO_GSUP_MSGT_PROC_USS_REQ,
  - OSMO_GSUP_MSGT_USS_REQ,
  - OSMO_GSUP_MSGT_USS_NOTIFY,

which correspond to MAP message types defined by 3GPP
TS 09.02 "Mobile Application Part (MAP) specification".

The 'osmo_gsup_message' structure was extended with a child
structure that represents a single decoded and/or to be
encoded SS/USSD message.

Change-Id: Ie17a78043a35fffbdd59e80fd2b2da39cce5e532
Related: OS#1597
---
M TODO-RELEASE
M include/osmocom/gsm/gsup.h
M src/gsm/gsup.c
M tests/gsup/gsup_test.c
M tests/gsup/gsup_test.err
M tests/gsup/gsup_test.ok
6 files changed, 289 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/7600/4

diff --git a/TODO-RELEASE b/TODO-RELEASE
index 65b0fa8..a7cc302 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -15,3 +15,4 @@
ussd_data_len, and 
ussd_data_dcs => ABI changed
 gsup   gsup.h  the 'osmo_gsup_message' struct 
extended with
session information => ABI 
changed
+   SS/USSD information => ABI 
changed
diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index 08f89e1..a152fde 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -93,6 +93,18 @@
 */
OSMO_GSUP_SESSION_ID_IE = 0x30,
OSMO_GSUP_SESSION_STATE_IE  = 0x31,
+
+   /**
+* 3GPP TS 09.02 "Mobile Application Part (MAP) specification",
+* Section 7.6.4 "Supplementary services parameters"
+* Section 7.6.3 "Subscriber management parameters"
+* Section 7.6.1 "Common parameters"
+*/
+   OSMO_GSUP_SS_INFO_IE= 0x35,
+   OSMO_GSUP_SS_INVOKE_ID_IE   = 0x36,
+   OSMO_GSUP_SS_ALERTING_PATTERN_IE= 0x37,
+   OSMO_GSUP_USSD_STRING_DCS_IE= 0x38,
+   OSMO_GSUP_USSD_STRING_IE= 0x39,
 };
 
 /*! GSUP message type */
@@ -135,6 +147,42 @@
OSMO_GSUP_MSGT_SESSION_ID_REQUEST   = 0b0010,
OSMO_GSUP_MSGT_SESSION_ID_ERROR = 0b0011,
OSMO_GSUP_MSGT_SESSION_ID_RESULT= 0b00100010,
+
+   /**
+* 3GPP TS 09.02 "Mobile Application Part (MAP) specification",
+* Section 11 "Supplementary services related services",
+* Call independent supplementary services
+*/
+
+   /**
+* Section 11.9 "MAP_PROCESS_UNSTRUCTURED_SS_REQUEST service"
+* Is used to relay information in order to allow unstructured
+* supplementary service operation.
+*/
+   OSMO_GSUP_MSGT_PROC_USS_REQ_REQUEST = 0b00100100,
+   OSMO_GSUP_MSGT_PROC_USS_REQ_ERROR   = 0b00100101,
+   OSMO_GSUP_MSGT_PROC_USS_REQ_RESULT  = 0b00100110,
+
+   /**
+* Section 11.10 "MAP_UNSTRUCTURED_SS_REQUEST service"
+* Is used when the invoking entity requires information
+* from the mobile user, in connection with unstructured
+* supplementary service handling.
+*/
+   OSMO_GSUP_MSGT_USS_REQ_REQUEST  = 0b00101000,
+   OSMO_GSUP_MSGT_USS_REQ_ERROR= 0b00101001,
+   OSMO_GSUP_MSGT_USS_REQ_RESULT   = 0b00101010,
+
+
+   /**
+* Section 11.11 "MAP_UNSTRUCTURED_SS_NOTIFY service"
+* Is used when the invoking entity requires a notification
+* to be sent to the mobile user, in connection with
+* unstructured supplementary services handling.
+*/
+   OSMO_GSUP_MSGT_USS_NOTIFY_REQUEST   = 0b00101100,
+   OSMO_GSUP_MSGT_USS_NOTIFY_ERROR = 0b00101101,
+   OSMO_GSUP_MSGT_USS_NOTIFY_RESULT= 0b00101110,
 };
 
 #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b0011) == 0b00)
@@ -190,6 +238,22 @@
size_t  pdp_charg_enc_len;
 };
 
+/*! parsed/decoded SS/USSD information */
+struct osmo_gsup_ss_info {
+   /*! Should this IE be taken into account? */
+   boolhave_info;
+   /*! Invoke ID, helps to relate the response to request */
+   uint32_tinvoke_id;
+   /*! USSD request or response string DCS (Data Coding Scheme) */
+   uint8_t ussd_string_dcs;
+   /*! USSD request or response string length */
+   size_t  ussd_string_len;
+   /*! USSD request or response string */
+   const uint8_t   *ussd_string;
+   /*! SS notification alerting pattern */
+   const uint8_t  

Jenkins build is back to normal : master-osmo-gmr » a1=default,a2=default,a3=default,osmocom-master-debian9 #350

2018-04-09 Thread jenkins
See 




osmo-msc[master]: libmsc/ussd: don't overwrite rc if decoding failed

2018-04-09 Thread Harald Welte

Patch Set 4: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I344e4b3a9aad617686a7ddbdeae5780fd8b07e58
Gerrit-PatchSet: 4
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: libmsc/ussd: implement basic USSD session management

2018-04-09 Thread Vadim Yanitskiy

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

libmsc/ussd: implement basic USSD session management

During some long period, including the OpenBSC time, the USSD
processing code was (and still is) pretty trivial, so there
was no transaction management, nor connection reference
counting.

Meanwhile, according to GSM TS 04.10, section 2.2.6 "Multiple
supplementary service invocations", call independent SS/USSD
transactions can exist in parallel with other CM-Layer and MM
transactions. Several call independent SS/USSD transactions
can be used simultaneously.

Thus, a single USSD session is identified by:

  - MM / CM connection (pointer address),
  - Transaction ID (see TS GSM 04.08).

This change introduces a new structure, named 'ussd_session',
that corresponds to a single SS/USSD-session, and allows a
subscriber to have a few concurrent sessions in parallel.

Also, this facilitates the further implementation of network
originated SS/USSD-sessions, and the development of external
USSD interface.

Change-Id: I21c6777cb88f1f4f80f75dcd39734e952bd4e8b0
---
M include/osmocom/msc/ussd.h
M src/libmsc/transaction.c
M src/libmsc/ussd.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.err
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_no_authen.err
M tests/msc_vlr/msc_vlr_test_reject_concurrency.err
M tests/msc_vlr/msc_vlr_test_umts_authen.err
9 files changed, 486 insertions(+), 134 deletions(-)


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

diff --git a/include/osmocom/msc/ussd.h b/include/osmocom/msc/ussd.h
index 6c821b1..b4144ab 100644
--- a/include/osmocom/msc/ussd.h
+++ b/include/osmocom/msc/ussd.h
@@ -12,6 +12,40 @@
 /* Forward declarations to avoid mutual include */
 struct gsm_subscriber_connection;
 struct gsm_network;
+struct gsm_trans;
+
+struct ussd_session {
+   /**
+* GSM TS 04.10, section 2.2.6 "Multiple supplementary service
+* invocations" says: Call independent SS transactions can exist
+* in parallel with other CM-Layer and MM transactions. Several
+* call independent SS transactions can be used simultaneously.
+*
+* So, a single USSD session is identified by:
+*
+*   - MM / CM connection (pointer address),
+*   - Transaction ID (see TS GSM 04.08).
+*
+* Multiple operations may be sent on the same transaction
+* (see session), and are identified by Invoke ID.
+*/
+   struct gsm_subscriber_connection *conn;
+   struct gsm_trans *trans;
+
+   /* A link to the global sessions list */
+   struct llist_head list;
+   /* An unique session ID */
+   uint32_t sid;
+};
+
+uint32_t ussd_session_id_gen(void);
+struct ussd_session *ussd_session_alloc(struct gsm_network *net);
+void ussd_session_free(struct ussd_session *session);
+
+struct ussd_session *ussd_session_get_by_sid(uint32_t sid);
+struct ussd_session *ussd_session_get(
+   struct gsm_subscriber_connection *conn,
+   struct gsm_trans *trans);
 
 int ussd_init(struct gsm_network *net);
 void ussd_shutdown(struct gsm_network *net);
diff --git a/src/libmsc/transaction.c b/src/libmsc/transaction.c
index 5b033dc..f3da003 100644
--- a/src/libmsc/transaction.c
+++ b/src/libmsc/transaction.c
@@ -137,6 +137,9 @@
_gsm411_sms_trans_free(trans);
conn_usage_token = MSC_CONN_USE_TRANS_SMS;
break;
+   case GSM48_PDISC_NC_SS:
+   conn_usage_token = MSC_CONN_USE_TRANS_USSD;
+   break;
}
 
if (trans->paging_request) {
diff --git a/src/libmsc/ussd.c b/src/libmsc/ussd.c
index 22d1ba8..7f72a65 100644
--- a/src/libmsc/ussd.c
+++ b/src/libmsc/ussd.c
@@ -3,6 +3,7 @@
 /* (C) 2008-2009 by Harald Welte 
  * (C) 2008, 2009 by Holger Hans Peter Freyther 
  * (C) 2009 by Mike Haben 
+ * (C) 2018 by Vadim Yanitskiy 
  *
  * All Rights Reserved
  *
@@ -29,6 +30,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -36,9 +40,102 @@
 #include 
 #include 
 #include 
+#include 
 
-static int (*ussd_handler)(struct gsm_subscriber_connection *conn,
+static int (*ussd_handler)(struct ussd_session *session,
const struct ss_request *req) = NULL;
+
+/* Global sessions list */
+static LLIST_HEAD(ussd_active_sessions);
+
+uint32_t ussd_session_id_gen(void)
+{
+   static uint32_t sid_src = 0;
+   return sid_src++;
+}
+
+struct ussd_session *ussd_session_alloc(struct gsm_network *net)
+{
+   struct ussd_session *session;
+
+   DEBUGP(DMM, "Allocate a new USSD session\n");
+
+   /* Allocate a new session */
+   session = talloc_zero(net, struct ussd_session);
+   if (!session)
+   return NULL;
+
+   /* Generate unique session ID */
+   session->sid = ussd_session_id_gen();
+   

[MERGED] osmo-msc[master]: libmsc/ussd.c: cosmetic: correct log level and message

2018-04-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: libmsc/ussd.c: cosmetic: correct log level and message
..


libmsc/ussd.c: cosmetic: correct log level and message

Change-Id: If6c270fae54ce79c2708c99d7762ce6ff71f43d9
---
M src/libmsc/ussd.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/src/libmsc/ussd.c b/src/libmsc/ussd.c
index 748cfbb..ab59571 100644
--- a/src/libmsc/ussd.c
+++ b/src/libmsc/ussd.c
@@ -72,7 +72,8 @@
gh = msgb_l3(msg);
rc = gsm0480_decode_ss_request(gh, msgb_l3len(msg), );
if (!rc) {
-   DEBUGP(DMM, "Unhandled SS\n");
+   LOGP(DMM, LOGL_ERROR, "SS/USSD message parsing error, "
+   "rejecting request...\n");
rc = gsm0480_send_ussd_reject(conn, );
return rc;
}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If6c270fae54ce79c2708c99d7762ce6ff71f43d9
Gerrit-PatchSet: 4
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] osmo-msc[master]: ussd.h: cosmetic: remove useless comment

2018-04-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: ussd.h: cosmetic: remove useless comment
..


ussd.h: cosmetic: remove useless comment

We usually put comments for functions in *.c files, while header
files are usually plain listings of the API without comments.

Change-Id: I6b0d1d9e1a1b1ffb71cb9905e74f6fad2333bb65
---
M include/osmocom/msc/ussd.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/ussd.h b/include/osmocom/msc/ussd.h
index 2665468..84a3d6a 100644
--- a/include/osmocom/msc/ussd.h
+++ b/include/osmocom/msc/ussd.h
@@ -1,8 +1,6 @@
 #ifndef _USSD_H
 #define _USSD_H
 
-/* Handler function for mobile-originated USSD messages */
-
 #include 
 
 int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6b0d1d9e1a1b1ffb71cb9905e74f6fad2333bb65
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] osmo-msc[master]: ussd.h: cosmetic: use '#pragma once' include guard

2018-04-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: ussd.h: cosmetic: use '#pragma once' include guard
..


ussd.h: cosmetic: use '#pragma once' include guard

Change-Id: I0e78aa946b8e6bc7c31534751b2ee5c867bfd490
---
M include/osmocom/msc/ussd.h
1 file changed, 1 insertion(+), 4 deletions(-)

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



diff --git a/include/osmocom/msc/ussd.h b/include/osmocom/msc/ussd.h
index 84a3d6a..bc4227b 100644
--- a/include/osmocom/msc/ussd.h
+++ b/include/osmocom/msc/ussd.h
@@ -1,8 +1,5 @@
-#ifndef _USSD_H
-#define _USSD_H
+#pragma once
 
 #include 
 
 int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg);
-
-#endif

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

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


[MERGED] osmo-msc[master]: libmsc/gsm_04_80.c: drop unused 'in_msg' argument

2018-04-09 Thread Vadim Yanitskiy
Vadim Yanitskiy has submitted this change and it was merged.

Change subject: libmsc/gsm_04_80.c: drop unused 'in_msg' argument
..


libmsc/gsm_04_80.c: drop unused 'in_msg' argument

It isn't used, so no need to pass it.

Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
---
M include/osmocom/msc/gsm_04_80.h
M src/libmsc/gsm_04_80.c
M src/libmsc/ussd.c
3 files changed, 9 insertions(+), 11 deletions(-)

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



diff --git a/include/osmocom/msc/gsm_04_80.h b/include/osmocom/msc/gsm_04_80.h
index 7da45a0..dedf243 100644
--- a/include/osmocom/msc/gsm_04_80.h
+++ b/include/osmocom/msc/gsm_04_80.h
@@ -7,10 +7,9 @@
 struct gsm_subscriber_connection;
 
 int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
-  const struct msgb *in_msg, const char* 
response_text,
+  const char* response_text,
   const struct ss_request *req);
 int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
-const struct msgb *msg,
 const struct ss_request *request);
 
 int msc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level,
diff --git a/src/libmsc/gsm_04_80.c b/src/libmsc/gsm_04_80.c
index 37e058c..12b41a1 100644
--- a/src/libmsc/gsm_04_80.c
+++ b/src/libmsc/gsm_04_80.c
@@ -62,8 +62,7 @@
 
 /* Send response to a mobile-originated ProcessUnstructuredSS-Request */
 int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
-  const struct msgb *in_msg, const char 
*response_text,
-  const struct ss_request *req)
+  const char *response_text, const struct 
ss_request *req)
 {
struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 USSD RSP");
struct gsm48_hdr *gh;
@@ -110,7 +109,6 @@
 }
 
 int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
-const struct msgb *in_msg,
 const struct ss_request *req)
 {
struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 USSD REJ");
diff --git a/src/libmsc/ussd.c b/src/libmsc/ussd.c
index eeab52a..748cfbb 100644
--- a/src/libmsc/ussd.c
+++ b/src/libmsc/ussd.c
@@ -40,7 +40,8 @@
 const char USSD_TEXT_OWN_NUMBER[] = "*#100#";
 
 /* A network-specific handler function */
-static int send_own_number(struct gsm_subscriber_connection *conn, const 
struct msgb *msg, const struct ss_request *req)
+static int send_own_number(struct gsm_subscriber_connection *conn,
+  const struct ss_request *req)
 {
char *own_number = conn->vsub->msisdn;
char response_string[GSM_EXTENSION_LENGTH + 20];
@@ -50,7 +51,7 @@
 
/* Need trailing CR as EOT character */
snprintf(response_string, sizeof(response_string), "Your extension is 
%s\r", own_number);
-   return gsm0480_send_ussd_response(conn, msg, response_string, req);
+   return gsm0480_send_ussd_response(conn, response_string, req);
 }
 
 /* Entrypoint - handler function common to all mobile-originated USSDs */
@@ -72,7 +73,7 @@
rc = gsm0480_decode_ss_request(gh, msgb_l3len(msg), );
if (!rc) {
DEBUGP(DMM, "Unhandled SS\n");
-   rc = gsm0480_send_ussd_reject(conn, msg, );
+   rc = gsm0480_send_ussd_reject(conn, );
return rc;
}
 
@@ -80,7 +81,7 @@
if (req.ussd_text[0] == '\0' || req.ussd_text[0] == 0xFF) {
if (req.ss_code > 0) {
/* Assume interrogateSS or modification of it and 
reject */
-   rc = gsm0480_send_ussd_reject(conn, msg, );
+   rc = gsm0480_send_ussd_reject(conn, );
return rc;
}
/* Still assuming a Release-Complete and returning */
@@ -90,10 +91,10 @@
msc_subscr_conn_communicating(conn);
if (!strcmp(USSD_TEXT_OWN_NUMBER, (const char *)req.ussd_text)) {
DEBUGP(DMM, "USSD: Own number requested\n");
-   rc = send_own_number(conn, msg, );
+   rc = send_own_number(conn, );
} else {
DEBUGP(DMM, "Unhandled USSD %s\n", req.ussd_text);
-   rc = gsm0480_send_ussd_reject(conn, msg, );
+   rc = gsm0480_send_ussd_reject(conn, );
}
 
return rc;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
Gerrit-PatchSet: 4
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels 

osmo-msc[master]: VTY: add USSD processing back-end configuration

2018-04-09 Thread Vadim Yanitskiy

Patch Set 1:

(3 comments)

https://gerrit.osmocom.org/#/c/7677/1/src/libmsc/msc_vty.c
File src/libmsc/msc_vty.c:

Line 1384: static struct cmd_node ussd_node = {
> How much USSD config will follow? Does it really warrant a new sub-node?
My initial idea was to also add GSUP related configuration
here. I was going to init a separate GSUP client and use
it to connect to the external USSD handler (GSUP server).

Now I understood that this is stupid idea, and I can
reuse the existing link between both MSC and HLR...

Not MSC should connect to a USSD gateway, but the
gateway itself should connect to HLR.

So, probably, we can avoid having a separate node.


Line 1414:  else {
> the vty does pretty tight input checking, you will *never* get any other st
Ok, thanks for a tip! I'll drop this branch.


https://gerrit.osmocom.org/#/c/7677/1/src/osmo-msc/msc_main.c
File src/osmo-msc/msc_main.c:

Line 634:   /* Initialize USSD */
> ("init_ussd" pretty much says it all, right?)
Probably, it's my bad habit to comment each code block...


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0b3c5ccea4054113e8e23109b1ab68d9f0e18497
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


osmo-msc[master]: libmsc/ussd.c: cosmetic: correct log level and message

2018-04-09 Thread Harald Welte

Patch Set 3: Code-Review+2

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

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


osmo-msc[master]: libmsc/gsm_04_80.c: drop unused 'in_msg' argument

2018-04-09 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: libmsc/gsm_04_80.c: drop unused 'in_msg' argument

2018-04-09 Thread Vadim Yanitskiy
Hello Neels Hofmeyr, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/7674

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

libmsc/gsm_04_80.c: drop unused 'in_msg' argument

It isn't used, so no need to pass it.

Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
---
M include/osmocom/msc/gsm_04_80.h
M src/libmsc/gsm_04_80.c
M src/libmsc/ussd.c
3 files changed, 9 insertions(+), 11 deletions(-)


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

diff --git a/include/osmocom/msc/gsm_04_80.h b/include/osmocom/msc/gsm_04_80.h
index 7da45a0..dedf243 100644
--- a/include/osmocom/msc/gsm_04_80.h
+++ b/include/osmocom/msc/gsm_04_80.h
@@ -7,10 +7,9 @@
 struct gsm_subscriber_connection;
 
 int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
-  const struct msgb *in_msg, const char* 
response_text,
+  const char* response_text,
   const struct ss_request *req);
 int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
-const struct msgb *msg,
 const struct ss_request *request);
 
 int msc_send_ussd_notify(struct gsm_subscriber_connection *conn, int level,
diff --git a/src/libmsc/gsm_04_80.c b/src/libmsc/gsm_04_80.c
index 37e058c..12b41a1 100644
--- a/src/libmsc/gsm_04_80.c
+++ b/src/libmsc/gsm_04_80.c
@@ -62,8 +62,7 @@
 
 /* Send response to a mobile-originated ProcessUnstructuredSS-Request */
 int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
-  const struct msgb *in_msg, const char 
*response_text,
-  const struct ss_request *req)
+  const char *response_text, const struct 
ss_request *req)
 {
struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 USSD RSP");
struct gsm48_hdr *gh;
@@ -110,7 +109,6 @@
 }
 
 int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
-const struct msgb *in_msg,
 const struct ss_request *req)
 {
struct msgb *msg = gsm48_msgb_alloc_name("GSM 04.08 USSD REJ");
diff --git a/src/libmsc/ussd.c b/src/libmsc/ussd.c
index eeab52a..748cfbb 100644
--- a/src/libmsc/ussd.c
+++ b/src/libmsc/ussd.c
@@ -40,7 +40,8 @@
 const char USSD_TEXT_OWN_NUMBER[] = "*#100#";
 
 /* A network-specific handler function */
-static int send_own_number(struct gsm_subscriber_connection *conn, const 
struct msgb *msg, const struct ss_request *req)
+static int send_own_number(struct gsm_subscriber_connection *conn,
+  const struct ss_request *req)
 {
char *own_number = conn->vsub->msisdn;
char response_string[GSM_EXTENSION_LENGTH + 20];
@@ -50,7 +51,7 @@
 
/* Need trailing CR as EOT character */
snprintf(response_string, sizeof(response_string), "Your extension is 
%s\r", own_number);
-   return gsm0480_send_ussd_response(conn, msg, response_string, req);
+   return gsm0480_send_ussd_response(conn, response_string, req);
 }
 
 /* Entrypoint - handler function common to all mobile-originated USSDs */
@@ -72,7 +73,7 @@
rc = gsm0480_decode_ss_request(gh, msgb_l3len(msg), );
if (!rc) {
DEBUGP(DMM, "Unhandled SS\n");
-   rc = gsm0480_send_ussd_reject(conn, msg, );
+   rc = gsm0480_send_ussd_reject(conn, );
return rc;
}
 
@@ -80,7 +81,7 @@
if (req.ussd_text[0] == '\0' || req.ussd_text[0] == 0xFF) {
if (req.ss_code > 0) {
/* Assume interrogateSS or modification of it and 
reject */
-   rc = gsm0480_send_ussd_reject(conn, msg, );
+   rc = gsm0480_send_ussd_reject(conn, );
return rc;
}
/* Still assuming a Release-Complete and returning */
@@ -90,10 +91,10 @@
msc_subscr_conn_communicating(conn);
if (!strcmp(USSD_TEXT_OWN_NUMBER, (const char *)req.ussd_text)) {
DEBUGP(DMM, "USSD: Own number requested\n");
-   rc = send_own_number(conn, msg, );
+   rc = send_own_number(conn, );
} else {
DEBUGP(DMM, "Unhandled USSD %s\n", req.ussd_text);
-   rc = gsm0480_send_ussd_reject(conn, msg, );
+   rc = gsm0480_send_ussd_reject(conn, );
}
 
return rc;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 

[PATCH] osmo-msc[master]: libmsc/ussd: don't overwrite rc if decoding failed

2018-04-09 Thread Vadim Yanitskiy
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/7676

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

libmsc/ussd: don't overwrite rc if decoding failed

Change-Id: I344e4b3a9aad617686a7ddbdeae5780fd8b07e58
---
M src/libmsc/ussd.c
1 file changed, 3 insertions(+), 2 deletions(-)


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

diff --git a/src/libmsc/ussd.c b/src/libmsc/ussd.c
index ab59571..fe1610f 100644
--- a/src/libmsc/ussd.c
+++ b/src/libmsc/ussd.c
@@ -74,8 +74,9 @@
if (!rc) {
LOGP(DMM, LOGL_ERROR, "SS/USSD message parsing error, "
"rejecting request...\n");
-   rc = gsm0480_send_ussd_reject(conn, );
-   return rc;
+   gsm0480_send_ussd_reject(conn, );
+   /* The GSM 04.80 API uses inverted codes (0 means error) */
+   return -EPROTO;
}
 
/* Interrogation or releaseComplete? */

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

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


[PATCH] osmo-msc[master]: libmsc/ussd.c: cosmetic: correct log level and message

2018-04-09 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/7675

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

libmsc/ussd.c: cosmetic: correct log level and message

Change-Id: If6c270fae54ce79c2708c99d7762ce6ff71f43d9
---
M src/libmsc/ussd.c
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/src/libmsc/ussd.c b/src/libmsc/ussd.c
index 748cfbb..ab59571 100644
--- a/src/libmsc/ussd.c
+++ b/src/libmsc/ussd.c
@@ -72,7 +72,8 @@
gh = msgb_l3(msg);
rc = gsm0480_decode_ss_request(gh, msgb_l3len(msg), );
if (!rc) {
-   DEBUGP(DMM, "Unhandled SS\n");
+   LOGP(DMM, LOGL_ERROR, "SS/USSD message parsing error, "
+   "rejecting request...\n");
rc = gsm0480_send_ussd_reject(conn, );
return rc;
}

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

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


osmo-msc[master]: VTY: add USSD processing back-end configuration

2018-04-09 Thread Neels Hofmeyr

Patch Set 1:

(7 comments)

I guess if you agree with harald's comment, then most of this will go away 
anyway, but here goes:

https://gerrit.osmocom.org/#/c/7677/1/include/osmocom/msc/ussd.h
File include/osmocom/msc/ussd.h:

Line 12: /* Forward declarations to avoid mutual include */
(I'd drop the comment, we do this all the time, so everyone knows why anyway)


https://gerrit.osmocom.org/#/c/7677/1/src/libmsc/msc_vty.c
File src/libmsc/msc_vty.c:

Line 1384: static struct cmd_node ussd_node = {
How much USSD config will follow? Does it really warrant a new sub-node?


Line 1414:  else {
the vty does pretty tight input checking, you will *never* get any other string 
than exactly "none" or "local" here. No need for the else.


Line 1429:  vty_out(vty, "none%s", VTY_NEWLINE);
(in case you remove the sub-node, you could write nothing if "none" is the 
default.)


https://gerrit.osmocom.org/#/c/7677/1/src/libmsc/ussd.c
File src/libmsc/ussd.c:

Line 41:const struct ss_request *req) = NULL;
If external handlers will show up in the future, they need to be able to 
provide their handler function, so this function type should be a typedef in a 
.h file. However, the choice of enum values to configure which ussd handler is 
active looks like there will be no external handler in a modular 
"function-pointery" way. It feels a bit overkill to have both enum and function 
pointer: either have a publicly configurable function pointer, or an enum value 
and switch() on that value when handling ussd.


Line 142: {
If there's going to be a shutdown and a choice of multiple handlers, there 
probably need to be shutdown functions per handler? So instead of just one 
handler function, you'd need a struct of function pointers, a bit like struct 
vlr_ops.


https://gerrit.osmocom.org/#/c/7677/1/src/osmo-msc/msc_main.c
File src/osmo-msc/msc_main.c:

Line 634:   /* Initialize USSD */
("init_ussd" pretty much says it all, right?)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0b3c5ccea4054113e8e23109b1ab68d9f0e18497
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: Yes


[MERGED] osmo-msc[master]: Permit any Sender MSISDN when sending SMS from VTY

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Permit any Sender MSISDN when sending SMS from VTY
..


Permit any Sender MSISDN when sending SMS from VTY

In the old days, OsmoNITB couldn't process any SMS that wasn't between
two subscribers on the same NITB.

We've long re-worked the internals in order to process SMS with
arbitrary sender MSISDN (e.g. from SMPP). However, the VTY command
"subscriber ... sms" was never updated, it seems.

Change-Id: I62b17e0a67989484415f0df2c8cb4ff1f94dbf2b
Closes: OS#3151
---
M include/osmocom/msc/gsm_04_11.h
M src/libmsc/gsm_04_11.c
M src/libmsc/msc_vty.c
M tests/msc_vlr/msc_vlr_tests.c
4 files changed, 32 insertions(+), 26 deletions(-)

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/include/osmocom/msc/gsm_04_11.h b/include/osmocom/msc/gsm_04_11.h
index 3305e3e..e3ff4ba 100644
--- a/include/osmocom/msc/gsm_04_11.h
+++ b/include/osmocom/msc/gsm_04_11.h
@@ -34,7 +34,7 @@
 struct gsm_sms *sms_alloc(void);
 void sms_free(struct gsm_sms *sms);
 struct gsm_sms *sms_from_text(struct vlr_subscr *receiver,
- struct vlr_subscr *sender,
+ const char *sender_msisdn,
  int dcs, const char *text);
 
 void _gsm411_sms_trans_free(struct gsm_trans *trans);
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index aa60490..077c8d8 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -82,7 +82,7 @@
 }
 
 struct gsm_sms *sms_from_text(struct vlr_subscr *receiver,
- struct vlr_subscr *sender,
+ const char *sender_msisdn,
   int dcs, const char *text)
 {
struct gsm_sms *sms = sms_alloc();
@@ -93,7 +93,7 @@
sms->receiver = vlr_subscr_get(receiver);
OSMO_STRLCPY_ARRAY(sms->text, text);
 
-   OSMO_STRLCPY_ARRAY(sms->src.addr, sender->msisdn);
+   OSMO_STRLCPY_ARRAY(sms->src.addr, sender_msisdn);
sms->reply_path_req = 0;
sms->status_rep_req = 0;
sms->ud_hdr_ind = 0;
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 33613e9..84d4d14 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -705,13 +705,13 @@
 }
 
 static int _send_sms_str(struct vlr_subscr *receiver,
-struct vlr_subscr *sender,
+const char *sender_msisdn,
 char *str, uint8_t tp_pid)
 {
struct gsm_network *net = receiver->vlr->user_ctx;
struct gsm_sms *sms;
 
-   sms = sms_from_text(receiver, sender, 0, str);
+   sms = sms_from_text(receiver, sender_msisdn, 0, str);
sms->protocol_id = tp_pid;
 
/* store in database for the queue */
@@ -813,7 +813,7 @@
SUBSCR_HELP "SMS Operations\n" SUBSCR_HELP "Send SMS\n" "Actual SMS 
Text\n")
 {
struct vlr_subscr *vsub = get_vsub_by_argv(gsmnet, argv[0], argv[1]);
-   struct vlr_subscr *sender = get_vsub_by_argv(gsmnet, argv[2], argv[3]);
+   const char *sender_msisdn;
char *str;
int rc;
 
@@ -824,21 +824,24 @@
goto err;
}
 
-   if (!sender) {
-   vty_out(vty, "%% No sender found for %s %s%s",
-   argv[2], argv[3], VTY_NEWLINE);
-   rc = CMD_WARNING;
-   goto err;
+   if (!strcmp(argv[2], "msisdn"))
+   sender_msisdn = argv[3];
+   else {
+   struct vlr_subscr *sender = get_vsub_by_argv(gsmnet, argv[2], 
argv[3]);
+   if (!sender) {
+   vty_out(vty, "%% No sender found for %s %s%s", argv[2], 
argv[3], VTY_NEWLINE);
+   rc = CMD_WARNING;
+   goto err;
+   }
+   sender_msisdn = sender->msisdn;
+   vlr_subscr_put(sender);
}
 
str = argv_concat(argv, argc, 4);
-   rc = _send_sms_str(vsub, sender, str, 0);
+   rc = _send_sms_str(vsub, sender_msisdn, str, 0);
talloc_free(str);
 
 err:
-   if (sender)
-   vlr_subscr_put(sender);
-
if (vsub)
vlr_subscr_put(vsub);
 
@@ -852,7 +855,7 @@
SUBSCR_HELP "Silent SMS Operations\n" SUBSCR_HELP "Send SMS\n" "Actual 
SMS Text\n")
 {
struct vlr_subscr *vsub = get_vsub_by_argv(gsmnet, argv[0], argv[1]);
-   struct vlr_subscr *sender = get_vsub_by_argv(gsmnet, argv[2], argv[3]);
+   const char *sender_msisdn;
char *str;
int rc;
 
@@ -863,21 +866,24 @@
goto err;
}
 
-   if (!sender) {
-   vty_out(vty, "%% No sender found for %s %s%s",
-   argv[2], argv[3], VTY_NEWLINE);
-   rc = CMD_WARNING;
-   goto err;
+   if (!strcmp(argv[2], 

osmo-msc[master]: Permit any Sender MSISDN when sending SMS from VTY

2018-04-09 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-msc[master]: DTAP: Ensure proper DLCI is used in MSC-originated DTAP

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: DTAP: Ensure proper DLCI is used in MSC-originated DTAP
..


DTAP: Ensure proper DLCI is used in MSC-originated DTAP

The DLCI field of the DTAP header indicates the SAPI as well as the
data link (main DCCH or SACCH).  We must make sure to use the correct
DLCI when sending DTAP to the BSC.

We achieve this by
* storing the DLCI in the msgb->cb while parsing the DTAP header
* storing the received DLCI (from msgb->cb) in the transaction for
  mobile-originated transactions
* using the trans->dlci to sent msgb->cb when transmitting L3
* filling the DTAP DLCI value from msgb->cb when transmitting DTAP

For MSC-originated transactions, we choose a DLCI value corresponding
to the service (SAPI=0 for CC, SAPI=3 for SMS) and store that in
trans->dlci.

Closes: OS#3150
Change-Id: If511b20f52575054cab1346d99a8cb68d827fdbf
---
M include/osmocom/msc/gsm_data.h
M include/osmocom/msc/transaction.h
M src/libmsc/a_iface.c
M src/libmsc/a_iface_bssap.c
M src/libmsc/gsm_04_08.c
M src/libmsc/gsm_04_11.c
6 files changed, 16 insertions(+), 4 deletions(-)

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



diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index f3e1b94..6f0aca4 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -20,7 +20,8 @@
 
 #include "gsm_data_shared.h"
 
-
+/* TS 48.008 DLCI containing DCCH/ACCH + SAPI */
+#define OMSC_LINKID_CB(__msgb)   (__msgb)->cb[3]
 
 /** annotations for msgb ownership */
 #define __uses
diff --git a/include/osmocom/msc/transaction.h 
b/include/osmocom/msc/transaction.h
index 272fb3b..63b1cc5 100644
--- a/include/osmocom/msc/transaction.h
+++ b/include/osmocom/msc/transaction.h
@@ -31,6 +31,9 @@
/* The current transaction ID */
uint8_t transaction_id;
 
+   /* The DLCI (DCCH/ACCH + SAPI) of this transaction */
+   uint8_t dlci;
+
/* To whom we belong, unique identifier of remote MM entity */
struct vlr_subscr *vsub;
 
diff --git a/src/libmsc/a_iface.c b/src/libmsc/a_iface.c
index 2b1baf0..6f2000e 100644
--- a/src/libmsc/a_iface.c
+++ b/src/libmsc/a_iface.c
@@ -145,14 +145,13 @@
struct gsm_subscriber_connection *conn;
struct msgb *msg_resp;
 
-   /* FIXME: Set this to some meaninful value! */
-   uint8_t link_id = 0x00;
+   uint8_t link_id = OMSC_LINKID_CB(msg);
OSMO_ASSERT(msg);
conn = (struct gsm_subscriber_connection *)msg->dst;
OSMO_ASSERT(conn);
OSMO_ASSERT(conn->a.scu);
 
-   LOGPCONN(conn, LOGL_DEBUG, "Passing DTAP message from MSC to BSC\n");
+   LOGPCONN(conn, LOGL_DEBUG, "Passing DTAP message (DLCI=0x%02x) from MSC 
to BSC\n", link_id);
 
msg->l3h = msg->data;
msg_resp = gsm0808_create_dtap(msg, link_id);
diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c
index 1665e23..d0d6bc0 100644
--- a/src/libmsc/a_iface_bssap.c
+++ b/src/libmsc/a_iface_bssap.c
@@ -610,6 +610,7 @@
 {
struct gsm_network *network = a_conn_info->network;
struct gsm_subscriber_connection *conn;
+   struct dtap_header *dtap = (struct dtap_header *) msg->l2h;
 
conn = subscr_conn_lookup_a(network, a_conn_info->conn_id);
if (!conn) {
@@ -620,6 +621,7 @@
 
/* msc_dtap expects the dtap payload in l3h */
msg->l3h = msg->l2h + 3;
+   OMSC_LINKID_CB(msg) = dtap->link_id;
 
/* Forward dtap payload into the msc */
msc_dtap(conn, conn->a.conn_id, msg);
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c
index a90ff17..e5ddb44 100644
--- a/src/libmsc/gsm_04_08.c
+++ b/src/libmsc/gsm_04_08.c
@@ -164,6 +164,7 @@
 * work that the caller no longer has to do */
if (trans) {
gh->proto_discr = trans->protocol | (trans->transaction_id << 
4);
+   OMSC_LINKID_CB(msg) = trans->dlci;
}
 
return msc_tx_dtap(conn, msg);
@@ -3110,6 +3111,7 @@
 
/* Assign conn */
trans->conn = msc_subscr_conn_get(conn, MSC_CONN_USE_TRANS_CC);
+   trans->dlci = 0x00; /* SAPI=0, not SACCH */
vlr_subscr_put(vsub);
} else {
/* update the subscriber we deal with */
@@ -3262,6 +3264,7 @@
}
/* Assign transaction */
trans->conn = msc_subscr_conn_get(conn, MSC_CONN_USE_TRANS_CC);
+   trans->dlci = OMSC_LINKID_CB(msg); /* DLCI as received from BSC 
*/
cm_service_request_concludes(conn, msg);
}
 
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index f82aa6d..aa60490 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -137,6 +137,7 @@
/* Outgoing needs the highest bit set */
gh->proto_discr = trans->protocol | (trans->transaction_id<<4);
gh->msg_type = 

osmo-msc[master]: DTAP: Ensure proper DLCI is used in MSC-originated DTAP

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: L3_Templates: Introudce constants for tiFlag

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic06eb2016eb9979b8556366e4a909f3c0336aa92
Gerrit-PatchSet: 2
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]: msc: generate mobile identity inside f_establish_fully()

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: msc: generate mobile identity inside f_establish_fully()
..


msc: generate mobile identity inside f_establish_fully()

This reduces the code duplication in every caller of the function.

Change-Id: Iaa071b131a8ff372d70677c8622d227f88e9ea53
---
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 20 insertions(+), 32 deletions(-)

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



diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 62eddf3..73368a2 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -190,9 +190,18 @@
 };
 
 /* helper function to fully establish a dedicated channel */
-function f_establish_fully(MobileIdentityLV mi, EstablishType etype := 
EST_TYPE_MO_CALL)
+function f_establish_fully(EstablishType etype := EST_TYPE_MO_CALL)
 runs on BSC_ConnHdlr {
var PDU_ML3_MS_NW l3_info;
+   var MobileIdentityLV mi;
+
+   /* 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));
+   }
+
select (etype) {
case (EST_TYPE_MO_CALL) {
l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
@@ -408,7 +417,6 @@
 function f_mt_call_establish(inout CallParameters cpars)
 runs on BSC_ConnHdlr {
 
-   var MobileIdentityLV mi;
var MNCC_PDU mncc;
var MgcpCommand mgcp_cmd;
 
@@ -421,13 +429,7 @@
/* BSC <- MSC: Expect paging. FIXME: By TMSI or not? */
BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi));
 
-   /* 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, EST_TYPE_PAG_RESP);
+   f_establish_fully(EST_TYPE_PAG_RESP);
 
/* MS <- MSC: Expect CC SETUP */
BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_SETUP(cpars.transaction_id, 
*, cpars.called_party)));
@@ -498,21 +500,14 @@
 function f_mo_call_establish(inout CallParameters cpars)
 runs on BSC_ConnHdlr {
 
-   var MobileIdentityLV mi;
var MNCC_PDU mncc;
var MgcpCommand mgcp_cmd;
var boolean respond_to_dlcx;
 
-   /* 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));
-   }
if (cpars.emergency) {
-   f_establish_fully(mi, EST_TYPE_EMERG_CALL);
+   f_establish_fully(EST_TYPE_EMERG_CALL);
} else {
-   f_establish_fully(mi, EST_TYPE_MO_CALL);
+   f_establish_fully(EST_TYPE_MO_CALL);
}
 
/* Create MNCC and MGCP expect */
@@ -664,18 +659,11 @@
 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);
+   f_establish_fully();
 
/* Create MNCC and MGCP expect */
f_create_mncc_expect(hex2str(cpars.called_party));
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 6ec08bb..503f98b 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1137,7 +1137,7 @@
 
f_perform_lu();
 
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+   f_establish_fully();
f_expect_clear();
 }
 testcase TC_establish_and_nothing() runs on MTC_CT {
@@ -1156,7 +1156,7 @@
 
f_perform_lu();
 
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+   f_establish_fully();
f_create_mncc_expect(hex2str(cpars.called_party));
f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1181,7 +1181,7 @@
 
f_perform_lu();
 
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+   f_establish_fully();
f_create_mncc_expect(hex2str(cpars.called_party));
f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1220,7 +1220,7 @@
 
f_perform_lu();
 
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+   f_establish_fully();
f_create_mncc_expect(hex2str(cpars.called_party));
f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1312,7 +1312,7 @@
/* MSC->BSC: expect PAGING from MSC */

[MERGED] osmo-ttcn3-hacks[master]: L3_Templates: Introudce constants for tiFlag

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: L3_Templates: Introudce constants for tiFlag
..


L3_Templates: Introudce constants for tiFlag

... this makes the code more readable/understandable.

Change-Id: Ic06eb2016eb9979b8556366e4a909f3c0336aa92
---
M library/L3_Templates.ttcn
M msc/gen_links.sh
M msc/regen_makefile.sh
3 files changed, 29 insertions(+), 21 deletions(-)

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



diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index a2b872c..3203b0e 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -19,6 +19,9 @@
 import from MobileL3_GMM_SM_Types all;
 //import from MobileL3_SMS_Types all;
 
+/* TS 24.007 Table 11.3 TI Flag */
+const BIT1 c_TIF_ORIG := '0'B;
+const BIT1 c_TIF_REPL := '1'B;
 
 type enumerated CmServiceType {
CM_TYPE_MO_CALL ('0001'B),
@@ -704,7 +707,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
}
@@ -776,7 +779,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -818,7 +821,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -890,7 +893,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -912,7 +915,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -934,7 +937,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -958,7 +961,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -982,7 +985,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -1001,7 +1004,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -1202,7 +1205,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B, /* response from destination */
+   tiFlag := c_TIF_REPL, /* response from destination */
tIExtension := omit
}
},
@@ -1231,7 +1234,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B, /* from originator */
+   tiFlag := c_TIF_ORIG, /* from originator */
tIExtension := omit
}
},
@@ -1887,7 +1890,7 @@
tiOrSkip := {
transactionId := {
tio := tid,
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -1920,7 +1923,7 @@
tiOrSkip := {
transactionId := {
tio := tid,
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -1945,7 +1948,7 @@
tiOrSkip := {
transactionId := {
tio := tid,
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,

osmo-ttcn3-hacks[master]: msc: generate mobile identity inside f_establish_fully()

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[ABANDON] osmo-ttcn3-hacks[master]: WIP: SMPP codec for TITAN

2018-04-09 Thread Harald Welte
Harald Welte has abandoned this change.

Change subject: WIP: SMPP codec for TITAN
..


Abandoned

Ericsson has released a complete SMPP codec. no need to reinvent the wheel.

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

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


[PATCH] osmo-ttcn3-hacks[master]: msc: Initial SMS testing (MO + MT SMS, successful case, no S...

2018-04-09 Thread Harald Welte

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

msc: Initial SMS testing (MO + MT SMS, successful case, no SMPP)

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


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

diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 3203b0e..3304662 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -2,7 +2,7 @@
 
 /* L3 Templates, building on top of MobileL3*_Types from Ericsson.
  *
- * (C) 2017 by Harald Welte 
+ * (C) 2017-2018 by Harald Welte 
  * All rights reserved.
  *
  * Released under the terms of GNU General Public License, Version 2 or
@@ -17,7 +17,7 @@
 import from MobileL3_RRM_Types all;
 import from MobileL3_CC_Types all;
 import from MobileL3_GMM_SM_Types all;
-//import from MobileL3_SMS_Types all;
+import from MobileL3_SMS_Types all;
 
 /* TS 24.007 Table 11.3 TI Flag */
 const BIT1 c_TIF_ORIG := '0'B;
@@ -2168,4 +2168,284 @@
with { extension "prototype(convert) encode(RAW)" };
 
 
+
+/* SMS TPDU Layer */
+
+template (value) TPDU_RP_DATA_MS_SGSN ts_SMS_SUBMIT(OCT1 msg_ref, template 
(value) TP_DA dst_addr,
+ template (value) OCT1 pid, template 
(value) OCT1 dcs,
+ integer length_ind, octetstring 
user_data) := {
+   sMS_SUBMIT := {
+   tP_MTI := '01'B,/* SUBMIT */
+   tP_RD := '1'B,  /* reject duplicates */
+   tP_VPF := '00'B,/* not present */
+   tP_SRR := '0'B, /* no status report requested */
+   tP_UDHI := '0'B,/* no user data header in UD */
+   tP_RP := '0'B,  /* no reply path */
+   tP_MR := msg_ref,
+   tP_DA := dst_addr,
+   tP_PID := pid,
+   tP_DCS := dcs,
+   tP_VP := omit,
+   tP_UDL_UD := {
+   tP_LengthIndicator := length_ind,
+   tP_UD := user_data
+   }
+   }
+}
+
+template TPDU_RP_DATA_SGSN_MS tr_SMS_DELIVER(template TP_OA src_addr := ?,
+   template octetstring user_data := ?,
+   template OCT1 pid := ?, template OCT1 dcs 
:= ?,
+   template BIT1 mms := ?
+   ) := {
+   sMS_DELIVER := {
+   tP_MTI := '00'B,/* DELIVER */
+   tP_MMS := mms,  /* more messages to send */
+   tP_LP := ?, /* ?!? */
+   tP_Spare := '0'B,
+   tP_SRI := '0'B, /* status report indication */
+   tP_UDHI := '0'B,/* no user data header in UD */
+   tP_RP := '0'B,  /* no reply path */
+   tP_OA := src_addr,
+   tP_PID := pid,
+   tP_DCS := dcs,
+   tP_SCTS := ?,
+   tP_UDL_UD := {
+   tP_LengthIndicator := ?,
+   tP_UD := user_data
+   }
+   }
+}
+
+/* RP Layer */
+
+private function ts_RpOrig(template (omit) RP_NumberingPlan_and_NumberDigits 
rp_orig)
+return RP_OriginatorAddressLV {
+   var RP_OriginatorAddressLV ret;
+   if (istemplatekind(rp_orig, "omit")) {
+   ret := { 0, omit };
+   } else {
+   ret := { 0, valueof(rp_orig) };
+   }
+   return ret;
+}
+
+private function ts_RpDst(template (omit) RP_NumberingPlan_and_NumberDigits 
rp_dst)
+return RP_DestinationAddressLV {
+   var RP_DestinationAddressLV ret;
+   if (istemplatekind(rp_dst, "omit")) {
+   ret := { 0, omit };
+   } else {
+   ret := { 0, valueof(rp_dst) };
+   }
+   return ret;
+}
+
+template (value) RPDU_MS_SGSN ts_RP_DATA_MO(OCT1 msg_ref,
+   template (omit) 
RP_NumberingPlan_and_NumberDigits rp_orig,
+   template (omit) 
RP_NumberingPlan_and_NumberDigits rp_dst,
+   template (value) 
TPDU_RP_DATA_MS_SGSN tpdu) := {
+   rP_DATA_MS_SGSN := {
+   rP_MTI := '000'B,
+   rP_Spare := '0'B,
+   rP_MessageReference := msg_ref,
+   rP_OriginatorAddress := ts_RpOrig(rp_orig),
+   rP_DestinationAddress := ts_RpDst(rp_dst),
+   rP_User_Data := {
+   rP_LengthIndicator := 0, /* overwritten */
+   rP_TPDU := tpdu
+   }
+   }
+}
+
+template RPDU_SGSN_MS tr_RP_DATA_MT(template OCT1 msg_ref,
+   template RP_NumberingPlan_and_NumberDigits 
rp_orig,
+ 

[PATCH] osmo-ttcn3-hacks[master]: msc: generate mobile identity inside f_establish_fully()

2018-04-09 Thread Harald Welte

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

msc: generate mobile identity inside f_establish_fully()

This reduces the code duplication in every caller of the function.

Change-Id: Iaa071b131a8ff372d70677c8622d227f88e9ea53
---
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
2 files changed, 20 insertions(+), 32 deletions(-)


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

diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 62eddf3..73368a2 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -190,9 +190,18 @@
 };
 
 /* helper function to fully establish a dedicated channel */
-function f_establish_fully(MobileIdentityLV mi, EstablishType etype := 
EST_TYPE_MO_CALL)
+function f_establish_fully(EstablishType etype := EST_TYPE_MO_CALL)
 runs on BSC_ConnHdlr {
var PDU_ML3_MS_NW l3_info;
+   var MobileIdentityLV mi;
+
+   /* 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));
+   }
+
select (etype) {
case (EST_TYPE_MO_CALL) {
l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_MO_CALL, mi));
@@ -408,7 +417,6 @@
 function f_mt_call_establish(inout CallParameters cpars)
 runs on BSC_ConnHdlr {
 
-   var MobileIdentityLV mi;
var MNCC_PDU mncc;
var MgcpCommand mgcp_cmd;
 
@@ -421,13 +429,7 @@
/* BSC <- MSC: Expect paging. FIXME: By TMSI or not? */
BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi));
 
-   /* 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, EST_TYPE_PAG_RESP);
+   f_establish_fully(EST_TYPE_PAG_RESP);
 
/* MS <- MSC: Expect CC SETUP */
BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_SETUP(cpars.transaction_id, 
*, cpars.called_party)));
@@ -498,21 +500,14 @@
 function f_mo_call_establish(inout CallParameters cpars)
 runs on BSC_ConnHdlr {
 
-   var MobileIdentityLV mi;
var MNCC_PDU mncc;
var MgcpCommand mgcp_cmd;
var boolean respond_to_dlcx;
 
-   /* 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));
-   }
if (cpars.emergency) {
-   f_establish_fully(mi, EST_TYPE_EMERG_CALL);
+   f_establish_fully(EST_TYPE_EMERG_CALL);
} else {
-   f_establish_fully(mi, EST_TYPE_MO_CALL);
+   f_establish_fully(EST_TYPE_MO_CALL);
}
 
/* Create MNCC and MGCP expect */
@@ -664,18 +659,11 @@
 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);
+   f_establish_fully();
 
/* Create MNCC and MGCP expect */
f_create_mncc_expect(hex2str(cpars.called_party));
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 6ec08bb..503f98b 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1137,7 +1137,7 @@
 
f_perform_lu();
 
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+   f_establish_fully();
f_expect_clear();
 }
 testcase TC_establish_and_nothing() runs on MTC_CT {
@@ -1156,7 +1156,7 @@
 
f_perform_lu();
 
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+   f_establish_fully();
f_create_mncc_expect(hex2str(cpars.called_party));
f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1181,7 +1181,7 @@
 
f_perform_lu();
 
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+   f_establish_fully();
f_create_mncc_expect(hex2str(cpars.called_party));
f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1220,7 +1220,7 @@
 
f_perform_lu();
 
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
+   f_establish_fully();
f_create_mncc_expect(hex2str(cpars.called_party));
f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1312,7 +1312,7 @@
/* MSC->BSC: expect PAGING from MSC */
BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi));
/* MS -> MSC: PAGING RESPONSE */
-   f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)), 
EST_TYPE_PAG_RESP);
+   

[PATCH] osmo-ttcn3-hacks[master]: L3_Templates: Introudce constants for tiFlag

2018-04-09 Thread Harald Welte

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

L3_Templates: Introudce constants for tiFlag

... this makes the code more readable/understandable.

Change-Id: Ic06eb2016eb9979b8556366e4a909f3c0336aa92
---
M library/L3_Templates.ttcn
M msc/gen_links.sh
M msc/regen_makefile.sh
3 files changed, 29 insertions(+), 21 deletions(-)


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

diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index a2b872c..3203b0e 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -19,6 +19,9 @@
 import from MobileL3_GMM_SM_Types all;
 //import from MobileL3_SMS_Types all;
 
+/* TS 24.007 Table 11.3 TI Flag */
+const BIT1 c_TIF_ORIG := '0'B;
+const BIT1 c_TIF_REPL := '1'B;
 
 type enumerated CmServiceType {
CM_TYPE_MO_CALL ('0001'B),
@@ -704,7 +707,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
}
@@ -776,7 +779,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -818,7 +821,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -890,7 +893,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -912,7 +915,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -934,7 +937,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -958,7 +961,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -982,7 +985,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -1001,7 +1004,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -1202,7 +1205,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '1'B, /* response from destination */
+   tiFlag := c_TIF_REPL, /* response from destination */
tIExtension := omit
}
},
@@ -1231,7 +1234,7 @@
tiOrSkip := {
transactionId := {
tio := int2bit(tid, 3),
-   tiFlag := '0'B, /* from originator */
+   tiFlag := c_TIF_ORIG, /* from originator */
tIExtension := omit
}
},
@@ -1887,7 +1890,7 @@
tiOrSkip := {
transactionId := {
tio := tid,
-   tiFlag := '0'B,
+   tiFlag := c_TIF_ORIG,
tIExtension := omit
}
},
@@ -1920,7 +1923,7 @@
tiOrSkip := {
transactionId := {
tio := tid,
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -1945,7 +1948,7 @@
tiOrSkip := {
transactionId := {
tio := tid,
-   tiFlag := '1'B,
+   tiFlag := c_TIF_REPL,
tIExtension := omit
}
},
@@ -1979,7 +1982,7 @@
tiOrSkip := {
transactionId := {

osmo-msc[master]: libmsc/ussd.c: cosmetic: correct logging level

2018-04-09 Thread Vadim Yanitskiy

Patch Set 2:

> > The MS is getting rejected in such cases.
 > 
 > what do you mean with "the MS is rejected"?

I mean that a GSM 04.80 message with REJECT component is sent.

 > do we send a proper
 > error message, as required by the relevant spec (typically the
 > "procedures" part) in case of the MS sending a message the MSC
 > doesn't understand?

At the moment, we don't.

The hard-coded GSM_0480_GEN_PROB_CODE_UNRECOGNISED problem code
is always sent. I am going to add an argument to this function
in order to allow specifying required problem code.

But this is the topic for a separate change.

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

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


osmo-msc[master]: libmsc/ussd.c: cosmetic: correct logging level

2018-04-09 Thread Vadim Yanitskiy

Patch Set 2:

> My point is that we're actually reporting a parser error here, not
 > an "unhandled message".  "unhandled" sounds to me like "unhandled
 > because there's no USSD code present".

I am not the author of the original logging message.

As I pointed out, the gsm0480_decode_ss_request() may
return 1 either in case of parsing error, either in case
if there's no USSD code present, either in case of any
other internal API problem :/

The main idea of this change is just to make such cases
*visible* for the OsmoMSC user. Usually, 'error' logging
level is used, so an USSD-request could be rejected without
any traces in the logging output.

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

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


osmo-msc[master]: libmsc/gsm_04_80.c: drop unused 'in_msg' argument

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] osmo-ttcn3-hacks[master]: update expected HLR test results to prevent unexpected 'pass'

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: update expected HLR test results to prevent unexpected 'pass'
..


update expected HLR test results to prevent unexpected 'pass'

With https://gerrit.osmocom.org/#/c/7685/ the test TC_vty_msisdn_isd
is now passing. Update expected log output accordingly.

Change-Id: Ie8cfbef5a0adcb927917b0623f89309479a60001
Depends: Iffe1d7afb9fc7dbae542f70bbf5391ddc08a14b4
Related: OS#2785
---
M hlr/expected-results.log
1 file changed, 4 insertions(+), 9 deletions(-)

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



diff --git a/hlr/expected-results.log b/hlr/expected-results.log
index be8000c..4d95479 100644
--- a/hlr/expected-results.log
+++ b/hlr/expected-results.log
@@ -1,8 +1,8 @@
 
-
-  
+
+  
 Unexpected SAI ERROR Cause
-  HLR_Tests.ttcn:558 HLR_Tests control part
+  HLR_Tests.ttcn:562 HLR_Tests control part
   HLR_Tests.ttcn:364 TC_gsup_sai_err_invalid_imsi testcase
 
   
@@ -11,12 +11,7 @@
   
   
   
-  
-Timeout waiting for ISD.req
-  HLR_Tests.ttcn:564 HLR_Tests control part
-  HLR_Tests.ttcn:485 TC_vty_msisdn_isd testcase
-
-  
+  
   
   
   

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie8cfbef5a0adcb927917b0623f89309479a60001
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


osmo-msc[master]: libmsc/ussd.c: cosmetic: correct logging level

2018-04-09 Thread Harald Welte

Patch Set 2:

> The MS is getting rejected in such cases.

what do you mean with "the MS is rejected"?  do we send a proper error message, 
as required by the relevant spec (typically the "procedures" part) in case of 
the MS sending a message the MSC doesn't understand?

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

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


Jenkins build is back to normal : master-osmo-bts » lc15,origin/nrw/litecell15-next,default,osmocom-master-debian9 #488

2018-04-09 Thread jenkins
See 




osmo-msc[master]: libmsc/ussd.c: cosmetic: correct logging level

2018-04-09 Thread Harald Welte

Patch Set 2:

My point is that we're actually reporting a parser error here, not an 
"unhandled message".  "unhandled" sounds to me like "unhandled because there's 
no USSD code present".

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

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


[MERGED] osmo-bsc[master]: fix initialization of acc ramping

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: fix initialization of acc ramping
..


fix initialization of acc ramping

Remove a redundant call to acc_ramp_init() during bootstrap_bts().
ACC ramping state is already initialized during VTY config parsing,
and bootstrap_bts() accidentally disabled ACC ramping again even
if it was enabled in the configuration.

This bug was introduced in last-minute refactoring during
review of https://gerrit.osmocom.org/#/c/6324/ when the
acc_ramping_enabled flag was moved from struct gsm_bts to
the acc_ramp structure itself.

Also remove an acc_ramp_init() call in bootstrap_rsl().
It is no longer needed as it serves no purpose other than
initializing the bitmasks of barred ACCs. To ensure that
ACC ramping configuration provided to the BTS via system
information stays correct, we move the call to acc_ramp_start(),
which has the same effect on barred ACCs, further up.

Change-Id: Ib7d99c9d3d5d424e21bb7710f719c42f9aef3e95
Fixes: 6442e4327b1100ecfed7a242e397ac37b7529bea
Related: OS#2591
---
M src/libbsc/bsc_init.c
1 file changed, 4 insertions(+), 10 deletions(-)

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/src/libbsc/bsc_init.c b/src/libbsc/bsc_init.c
index ba8b8e6..d1173e0 100644
--- a/src/libbsc/bsc_init.c
+++ b/src/libbsc/bsc_init.c
@@ -332,16 +332,13 @@
trx->bts->location_area_code,
trx->bts->cell_identity, trx->bts->bsic);
 
-   /*
-* Re-initialize ACC ramping to ensure ACCs are barred/allowed
-* according to our current VTY configuration.
-*/
-   acc_ramp_init(>bts->acc_ramp, 
acc_ramp_is_enabled(>bts->acc_ramp), trx->bts);
-
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
rsl_nokia_si_begin(trx);
}
 
+   /* Configure ACC ramping before sending system information to BTS. */
+   if (acc_ramp_is_enabled(>bts->acc_ramp))
+   acc_ramp_start(>bts->acc_ramp);
gsm_bts_trx_set_system_infos(trx);
 
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
@@ -354,9 +351,6 @@
generate_ma_for_ts(>ts[i]);
dyn_ts_init(>ts[i]);
}
-
-   if (acc_ramp_is_enabled(>bts->acc_ramp))
-   acc_ramp_start(>bts->acc_ramp);
 }
 
 /* Callback function to be called every time we receive a signal from INPUT */
@@ -539,7 +533,7 @@
 
bts->chan_load_samples_idx = 0;
 
-   acc_ramp_init(>acc_ramp, false, bts);
+   /* ACC ramping is initialized from vty/config */
 
/* Initialize the BTS state */
gsm_bts_mo_reset(bts);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib7d99c9d3d5d424e21bb7710f719c42f9aef3e95
Gerrit-PatchSet: 4
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


[MERGED] openbsc[master]: fix initialization of acc ramping

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: fix initialization of acc ramping
..


fix initialization of acc ramping

Remove a redundant call to acc_ramp_init() during bootstrap_bts().
ACC ramping state is already initialized during VTY config parsing,
and bootstrap_bts() accidentally disabled ACC ramping again even
if it was enabled in the configuration.

This bug was introduced in last-minute refactoring during
review of https://gerrit.osmocom.org/#/c/6324/ when the
acc_ramping_enabled flag was moved from struct gsm_bts to
the acc_ramp structure itself.

Also remove an acc_ramp_init() call in bootstrap_rsl().
It is no longer needed as it serves no purpose other than
initializing the bitmasks of barred ACCs. To ensure that
ACC ramping configuration provided to the BTS via system
information stays correct, we move the call to acc_ramp_start(),
which has the same effect on barred ACCs, further up.

Port of osmo-bsc commit f34fb4828249eab44b4515e0e54b3ee0491d0051
Fixes: 8469818e33ef81e9f707a0c4dd13d7b91ecf83f5
Related: OS#2591

Change-Id: I5834fd953e65b8453dee0a7751d5a4cae12be83a
---
M openbsc/src/libbsc/bsc_init.c
1 file changed, 4 insertions(+), 4 deletions(-)

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/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 9389c43..6147257 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -321,6 +321,9 @@
rsl_nokia_si_begin(trx);
}
 
+   /* Configure ACC ramping before sending system information to BTS. */
+   if (acc_ramp_is_enabled(>bts->acc_ramp))
+   acc_ramp_start(>bts->acc_ramp);
gsm_bts_trx_set_system_infos(trx);
 
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
@@ -331,9 +334,6 @@
 
for (i = 0; i < ARRAY_SIZE(trx->ts); i++)
generate_ma_for_ts(>ts[i]);
-
-   if (acc_ramp_is_enabled(>bts->acc_ramp))
-   acc_ramp_start(>bts->acc_ramp);
 }
 
 /* Callback function to be called every time we receive a signal from INPUT */
@@ -521,7 +521,7 @@
 
bts->chan_load_samples_idx = 0;
 
-   acc_ramp_init(>acc_ramp, false, bts);
+   /* ACC ramping is initialized from vty/config */
 
/* Initialize the BTS state */
gsm_bts_mo_reset(bts);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5834fd953e65b8453dee0a7751d5a4cae12be83a
Gerrit-PatchSet: 3
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


openbsc[master]: fix initialization of acc ramping

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5834fd953e65b8453dee0a7751d5a4cae12be83a
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No



osmo-bsc[master]: fix initialization of acc ramping

2018-04-09 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7d99c9d3d5d424e21bb7710f719c42f9aef3e95
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-msc[master]: DTAP: Ensure proper DLCI is used in MSC-originated DTAP

2018-04-09 Thread Harald Welte

Patch Set 2: Verified+1

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

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


Build failed in Jenkins: master-osmo-gmr » a1=default,a2=default,a3=default,osmocom-master-debian9 #349

2018-04-09 Thread jenkins
See 


--
Started by upstream project "master-osmo-gmr" build number 349
originally caused by:
 Started by upstream project "master-libosmocore" build number 199
 originally caused by:
  Started by an SCM change
Building remotely on build2-deb9build-ansible (ttcn3 osmo-gsm-tester-build 
osmocom-gerrit-debian9 osmocom-master-debian9 coverity) in workspace 

 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git://git.osmocom.org/osmo-gmr # timeout=10
Fetching upstream changes from git://git.osmocom.org/osmo-gmr
 > git --version # timeout=10
 > git fetch --tags --progress git://git.osmocom.org/osmo-gmr 
 > +refs/heads/*:refs/remotes/origin/*
Checking out Revision adb8cc6aa9453dfc339de53ae641067136a031ec 
(refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f adb8cc6aa9453dfc339de53ae641067136a031ec
Commit message: "Add contrib/jenkins.sh script, like other osmo-* repositories"
 > git rev-list --no-walk adb8cc6aa9453dfc339de53ae641067136a031ec # timeout=10
[osmocom-master-debian9] $ /bin/sh -xe /tmp/jenkins4539616154744402206.sh
+ ./contrib/jenkins.sh
+ 
base=
+ 
deps=
+ 
inst=
+ export deps inst
+ osmo-clean-workspace.sh
+ chmod -R +w .
+ git checkout -f HEAD
+ git clean -dxf -e 

 -e layer1-headers
Skipping repository deps/libosmocore
+ [ -d 

 ]
+ git -C 

 checkout -f HEAD
error: pathspec 'HEAD' did not match any file(s) known to git.
Build step 'Execute shell' marked build as failure
[WARNINGS]Skipping publisher since build result is FAILURE


[MERGED] osmo-bsc[master]: fix a format string error in bts_update_t3122_chan_load()

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: fix a format string error in bts_update_t3122_chan_load()
..


fix a format string error in bts_update_t3122_chan_load()

In a debug log message, an unsigned 64-bit value was printed with
%lu but it should be printed with PRIu64 from inttypes.h instead.

Change-Id: I09bb519e68886e650647b1369fd49d1964e76c7e
---
M src/libbsc/chan_alloc.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/src/libbsc/chan_alloc.c b/src/libbsc/chan_alloc.c
index 284cb21..a08fdee 100644
--- a/src/libbsc/chan_alloc.c
+++ b/src/libbsc/chan_alloc.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -660,7 +661,7 @@
 
/* Log channel load average. */
load = ((used / total) * 100);
-   LOGP(DRLL, LOGL_DEBUG, "(bts=%d) channel load average is %lu.%.2lu%%\n",
+   LOGP(DRLL, LOGL_DEBUG, "(bts=%d) channel load average is 
%"PRIu64".%.2"PRIu64"%%\n",
 bts->nr, (load & 0xff00) >> 8, (load & 0xff) / 10);
bts->chan_load_avg = ((load & 0xff00) >> 8);
OSMO_ASSERT(bts->chan_load_avg <= 100);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I09bb519e68886e650647b1369fd49d1964e76c7e
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


[MERGED] openbsc[master]: fix a format string error in bts_update_t3122_chan_load()

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: fix a format string error in bts_update_t3122_chan_load()
..


fix a format string error in bts_update_t3122_chan_load()

In a debug log message, an unsigned 64-bit value was printed with
%lu but it should be printed with PRIu64 from inttypes.h instead.

Port of osmo-bsc commit 5b6aa650f1a6df22ec99797bd3635ea791998a88
https://gerrit.osmocom.org/#/c/7687/

Change-Id: Ia29feec023117734e4f50ae3487871e715821fed
---
M openbsc/src/libbsc/chan_alloc.c
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index 5fa20af..c4bc949 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -607,7 +608,7 @@
 
/* Log channel load average. */
load = ((used / total) * 100);
-   LOGP(DRLL, LOGL_DEBUG, "(bts=%d) channel load average is %lu.%.2lu%%\n",
+   LOGP(DRLL, LOGL_DEBUG, "(bts=%d) channel load average is 
%"PRIu64".%.2"PRIu64"%%\n",
 bts->nr, (load & 0xff00) >> 8, (load & 0xff) / 10);
bts->chan_load_avg = ((load & 0xff00) >> 8);
OSMO_ASSERT(bts->chan_load_avg <= 100);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia29feec023117734e4f50ae3487871e715821fed
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


openbsc[master]: fix a format string error in bts_update_t3122_chan_load()

2018-04-09 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia29feec023117734e4f50ae3487871e715821fed
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No



osmo-bsc[master]: fix a format string error in bts_update_t3122_chan_load()

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: update expected HLR test results to prevent unexpected 'pass'

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


osmo-hlr[master]: notify GSUP clients when HLR subscriber information changes

2018-04-09 Thread Harald Welte

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/7685/1/src/hlr.c
File src/hlr.c:

Line 49: /* Trigger 'Insert Subscriber Data' messages to all connected GSUP 
clients.
to all GSUP clients is ok for now, as we only expect a single MSC+SGSN to be 
connected.  However, in larger scale networks we should check to update only 
those MSC/SGSN which are listed in the subscriber data as the "current serving 
VLR/SGSN" for that subscriber.  I believe we already have those fields in our 
database model, not sure if they're already populated though.   In any case, we 
should at least have a a FIXME here to keep remembering something must be done 
in the future to avoid ISD into VLRs/SGSNs that are not even serving the 
subscriber.  At that point, the respective "vlr_subscriber" would be 
allocated/created in them, despite the subscriber not existing.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iffe1d7afb9fc7dbae542f70bbf5391ddc08a14b4
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


meta-telephony[201705]: openbsc: remove c-ares dependency

2018-04-09 Thread Harald Welte

Patch Set 1: Verified+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1bee6e0132252d0e5adc3517908dcf05021547ea
Gerrit-PatchSet: 1
Gerrit-Project: meta-telephony
Gerrit-Branch: 201705
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[MERGED] meta-telephony[201705]: openbsc: enable smpp

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: openbsc: enable smpp
..


openbsc: enable smpp

libsmpp34 was listed in DEPENDS but it's use was not enabled.

Change-Id: I20c77346e4894d6d146863fd79f6d27ef12cb3ee
---
M recipes-osmocom/openbsc/openbsc.inc
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/recipes-osmocom/openbsc/openbsc.inc 
b/recipes-osmocom/openbsc/openbsc.inc
index 3c1b98f..90a0398 100644
--- a/recipes-osmocom/openbsc/openbsc.inc
+++ b/recipes-osmocom/openbsc/openbsc.inc
@@ -11,10 +11,10 @@
   file://osmo-bsc-sccplite.service \
   "
 
-INC_PR = "r24.${META_TELEPHONY_OSMO_INC}"
+INC_PR = "r25.${META_TELEPHONY_OSMO_INC}"
 
 
-EXTRA_OECONF += "--enable-osmo-bsc --enable-mgcp-transcoding --with-g729"
+EXTRA_OECONF += "--enable-osmo-bsc --enable-smpp --enable-mgcp-transcoding 
--with-g729"
 
 inherit autotools update-rc.d pkgconfig
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I20c77346e4894d6d146863fd79f6d27ef12cb3ee
Gerrit-PatchSet: 1
Gerrit-Project: meta-telephony
Gerrit-Branch: 201705
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 


[MERGED] libosmocore[master]: fix issue on big endian architecture

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: fix issue on big endian architecture
..


fix issue on big endian architecture

OSMO_IS_LITTLE_ENDIAN is always defined and has a value of
either 0 or 1
as a result in byteswap.h the corresponding swap functions
will be always called, independent of the endianess

Signed-off-by: Thorsten Alteholz 
Change-Id: I4a09d2d8ccf155e70a3977ae1747758b6bc5125e
---
M include/osmocom/core/byteswap.h
1 file changed, 1 insertion(+), 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/include/osmocom/core/byteswap.h b/include/osmocom/core/byteswap.h
index 1ea5b3d..cecdc63 100644
--- a/include/osmocom/core/byteswap.h
+++ b/include/osmocom/core/byteswap.h
@@ -32,7 +32,7 @@
return out;
 }
 
-#ifdef OSMO_IS_LITTLE_ENDIAN
+#if OSMO_IS_LITTLE_ENDIAN == 1
 #define osmo_ntohl(x)  osmo_swab32(x)
 #define osmo_ntohs(x)  osmo_swab16(x)
 #define osmo_htonl(x)  osmo_swab32(x)

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

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


[MERGED] meta-telephony[201705]: openbsc: remove c-ares dependency

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: openbsc: remove c-ares dependency
..


openbsc: remove c-ares dependency

Since openbsc ed03661871ac8ee1715c04390d25631537b084ac, the c-ares
dependency has been removed.

Change-Id: I1bee6e0132252d0e5adc3517908dcf05021547ea
---
M recipes-osmocom/openbsc/openbsc.inc
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/recipes-osmocom/openbsc/openbsc.inc 
b/recipes-osmocom/openbsc/openbsc.inc
index 90a0398..ba0d75c 100644
--- a/recipes-osmocom/openbsc/openbsc.inc
+++ b/recipes-osmocom/openbsc/openbsc.inc
@@ -1,5 +1,5 @@
 DESCRIPTION = "OpenBSC a Free Software GSM BaseStationController"
-DEPENDS = "libdbi libosmocore libosmo-sccp libosmo-abis libosmo-netif 
osmo-ggsn libsmpp34 bcg729 libgsm libpcap c-ares"
+DEPENDS = "libdbi libosmocore libosmo-sccp libosmo-abis libosmo-netif 
osmo-ggsn libsmpp34 bcg729 libgsm libpcap"
 HOMEPAGE = "http://openbsc.osmocom.org/;
 LICENSE = "AGPLv3+"
 LIC_FILES_CHKSUM = "file://COPYING;md5=73f1eb20517c55bf9493b7dd6e480788"

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1bee6e0132252d0e5adc3517908dcf05021547ea
Gerrit-PatchSet: 1
Gerrit-Project: meta-telephony
Gerrit-Branch: 201705
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 


libosmocore[master]: fix issue on big endian architecture

2018-04-09 Thread Harald Welte

Patch Set 1:

thanks.  I think however that there are *many* more big endian related problems 
all over the Osmocom code base.  So I'd not be surprised if you run into all 
kinds of trouble on such systems (e.g. PPC, MIPS).  Fixes are appreciated, but 
nobody of the core developers is using any related big endian hardware, so 
there's not even manual testing for it.

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

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


meta-telephony[201705]: openbsc: enable smpp

2018-04-09 Thread Harald Welte

Patch Set 1: Verified+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I20c77346e4894d6d146863fd79f6d27ef12cb3ee
Gerrit-PatchSet: 1
Gerrit-Project: meta-telephony
Gerrit-Branch: 201705
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[MERGED] osmo-ttcn3-hacks[master]: improve failure diagnostics in TC_vty_msisdn_isd HLR test

2018-04-09 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: improve failure diagnostics in TC_vty_msisdn_isd HLR test
..


improve failure diagnostics in TC_vty_msisdn_isd HLR test

Check for reception of an Insert Subscriber Data with outdated MSISDN.
This happened to me while working on a fix for issue OS#2785, and it
seems to be an easy mistake implementations can make. Catch this
situation in the test and log an explicit message about the problem.

Related: OS#2785
Change-Id: Ib0809617cca621cc22f29b078828057fd49f27e5
---
M hlr/HLR_Tests.ttcn
1 file changed, 4 insertions(+), 0 deletions(-)

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



diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index 8b21626..90a00bf 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -480,6 +480,10 @@
sub.msisdn := new_msisdn;
setverdict(pass);
}
+   [] GSUP.receive(tr_GSUP_ISD_REQ(sub.imsi, sub.msisdn)) {
+   log("received ISD req with old MSISDN");
+   setverdict(fail);
+   }
[] GSUP.receive { repeat; }
[] T.timeout {
setverdict(fail, "Timeout waiting for ISD.req");

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0809617cca621cc22f29b078828057fd49f27e5
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: fix issue on big endian architecture

2018-04-09 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: improve failure diagnostics in TC_vty_msisdn_isd HLR test

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


osmo-msc[master]: Permit any Sender MSISDN when sending SMS from VTY

2018-04-09 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+1

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

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


osmo-msc[master]: libmsc/gsm_04_80.c: drop unused 'in_msg' argument

2018-04-09 Thread Harald Welte

Patch Set 1:

> About indenting style, personally I don't like this style. [..]

Everyone of course has their own preference, and everyone is entitled to have 
that.

However, in any software project it is generally good if there is a common 
style to be
followed by all the code, as it enhances readability across the project.  It 
doesn't
really matter which style it is, just as long as everyone is following it.

In Osmocom, we indent additional argument to the point behind the opening 
parenthesis.

So I would like to ask you to follow that, thanks!

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-msc[master]: ussd.h: cosmetic: remove useless comment

2018-04-09 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6b0d1d9e1a1b1ffb71cb9905e74f6fad2333bb65
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-msc[master]: VTY: add USSD processing back-end configuration

2018-04-09 Thread Harald Welte

Patch Set 2:

I think this may end up being too inflexible.

For MNCC, it makes sense to distinguish between "internal" and "external 
socket": Both can deal with voice calls to all (reachable) subscribers.

For SMS, we have any number of ESMEs, and we can configure prefix-based matches 
to look up the respective ESMEs when delivering SMS, which is flexible.

For USSD, I don't think the internal handler would ever have much more than the 
*#100#, particularly not as we're introducing an external interface now.

As the USSD external interface doesn't support multiple different external USSD 
applications (we want to stay close to MAP for new interfaces), it's not 
possible to do something like we do with ESMEs.

So in short, I think we should simply have a binary flag that decides whether 
the internal *#100# should be enabled or disabled, and anything beyond that 
should always unconditionally be forwarded via GSUP to the HLR (or any future 
MAP gateway).

The HLR can then decide how to handle those USSD messages and offer whatever 
non-3GPP external interfaces/APIS and route based on pattern matching, etc.

What do you think?

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

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


[PATCH] osmo-msc[master]: Permit any Sender MSISDN when sending SMS from VTY

2018-04-09 Thread Harald Welte

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

Permit any Sender MSISDN when sending SMS from VTY

In the old days, OsmoNITB couldn't process any SMS that wasn't between
two subscribers on the same NITB.

We've long re-worked the internals in order to process SMS with
arbitrary sender MSISDN (e.g. from SMPP). However, the VTY command
"subscriber ... sms" was never updated, it seems.

Change-Id: I62b17e0a67989484415f0df2c8cb4ff1f94dbf2b
Closes: OS#3151
---
M include/osmocom/msc/gsm_04_11.h
M src/libmsc/gsm_04_11.c
M src/libmsc/msc_vty.c
M tests/msc_vlr/msc_vlr_tests.c
4 files changed, 32 insertions(+), 26 deletions(-)


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

diff --git a/include/osmocom/msc/gsm_04_11.h b/include/osmocom/msc/gsm_04_11.h
index 3305e3e..e3ff4ba 100644
--- a/include/osmocom/msc/gsm_04_11.h
+++ b/include/osmocom/msc/gsm_04_11.h
@@ -34,7 +34,7 @@
 struct gsm_sms *sms_alloc(void);
 void sms_free(struct gsm_sms *sms);
 struct gsm_sms *sms_from_text(struct vlr_subscr *receiver,
- struct vlr_subscr *sender,
+ const char *sender_msisdn,
  int dcs, const char *text);
 
 void _gsm411_sms_trans_free(struct gsm_trans *trans);
diff --git a/src/libmsc/gsm_04_11.c b/src/libmsc/gsm_04_11.c
index aa60490..077c8d8 100644
--- a/src/libmsc/gsm_04_11.c
+++ b/src/libmsc/gsm_04_11.c
@@ -82,7 +82,7 @@
 }
 
 struct gsm_sms *sms_from_text(struct vlr_subscr *receiver,
- struct vlr_subscr *sender,
+ const char *sender_msisdn,
   int dcs, const char *text)
 {
struct gsm_sms *sms = sms_alloc();
@@ -93,7 +93,7 @@
sms->receiver = vlr_subscr_get(receiver);
OSMO_STRLCPY_ARRAY(sms->text, text);
 
-   OSMO_STRLCPY_ARRAY(sms->src.addr, sender->msisdn);
+   OSMO_STRLCPY_ARRAY(sms->src.addr, sender_msisdn);
sms->reply_path_req = 0;
sms->status_rep_req = 0;
sms->ud_hdr_ind = 0;
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 33613e9..84d4d14 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -705,13 +705,13 @@
 }
 
 static int _send_sms_str(struct vlr_subscr *receiver,
-struct vlr_subscr *sender,
+const char *sender_msisdn,
 char *str, uint8_t tp_pid)
 {
struct gsm_network *net = receiver->vlr->user_ctx;
struct gsm_sms *sms;
 
-   sms = sms_from_text(receiver, sender, 0, str);
+   sms = sms_from_text(receiver, sender_msisdn, 0, str);
sms->protocol_id = tp_pid;
 
/* store in database for the queue */
@@ -813,7 +813,7 @@
SUBSCR_HELP "SMS Operations\n" SUBSCR_HELP "Send SMS\n" "Actual SMS 
Text\n")
 {
struct vlr_subscr *vsub = get_vsub_by_argv(gsmnet, argv[0], argv[1]);
-   struct vlr_subscr *sender = get_vsub_by_argv(gsmnet, argv[2], argv[3]);
+   const char *sender_msisdn;
char *str;
int rc;
 
@@ -824,21 +824,24 @@
goto err;
}
 
-   if (!sender) {
-   vty_out(vty, "%% No sender found for %s %s%s",
-   argv[2], argv[3], VTY_NEWLINE);
-   rc = CMD_WARNING;
-   goto err;
+   if (!strcmp(argv[2], "msisdn"))
+   sender_msisdn = argv[3];
+   else {
+   struct vlr_subscr *sender = get_vsub_by_argv(gsmnet, argv[2], 
argv[3]);
+   if (!sender) {
+   vty_out(vty, "%% No sender found for %s %s%s", argv[2], 
argv[3], VTY_NEWLINE);
+   rc = CMD_WARNING;
+   goto err;
+   }
+   sender_msisdn = sender->msisdn;
+   vlr_subscr_put(sender);
}
 
str = argv_concat(argv, argc, 4);
-   rc = _send_sms_str(vsub, sender, str, 0);
+   rc = _send_sms_str(vsub, sender_msisdn, str, 0);
talloc_free(str);
 
 err:
-   if (sender)
-   vlr_subscr_put(sender);
-
if (vsub)
vlr_subscr_put(vsub);
 
@@ -852,7 +855,7 @@
SUBSCR_HELP "Silent SMS Operations\n" SUBSCR_HELP "Send SMS\n" "Actual 
SMS Text\n")
 {
struct vlr_subscr *vsub = get_vsub_by_argv(gsmnet, argv[0], argv[1]);
-   struct vlr_subscr *sender = get_vsub_by_argv(gsmnet, argv[2], argv[3]);
+   const char *sender_msisdn;
char *str;
int rc;
 
@@ -863,21 +866,24 @@
goto err;
}
 
-   if (!sender) {
-   vty_out(vty, "%% No sender found for %s %s%s",
-   argv[2], argv[3], VTY_NEWLINE);
-   rc = CMD_WARNING;
-   goto err;
+   if (!strcmp(argv[2], "msisdn")) {
+   sender_msisdn = argv[3];
+   } else {
+   struct vlr_subscr *sender = get_vsub_by_argv(gsmnet, argv[2], 
argv[3]);
+   if (!sender) {
+   vty_out(vty, "%% 

osmo-msc[master]: libmsc/gsm_04_80.c: drop unused 'in_msg' argument

2018-04-09 Thread Vadim Yanitskiy

Patch Set 2:

About indenting style, personally I don't like this style.
This occupies the potential space, that could be used
for listing arguments, by useless spaces and tabs
just in order to make the code look aligned...

Also, some parts of this code are to be modified in the
near future, so I would not care too much about it.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-msc[master]: ussd.h: cosmetic: remove useless comment

2018-04-09 Thread Vadim Yanitskiy

Patch Set 2:

> we put comments for functions typically in the .c file, by the
 > implementation of the function. .h files are usually plain listings
 > of the API without comments.

Neels, ok, removed.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6b0d1d9e1a1b1ffb71cb9905e74f6fad2333bb65
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-msc[master]: VTY: add USSD processing back-end configuration

2018-04-09 Thread Vadim Yanitskiy

Patch Set 2:

> Let's call it "internal", not " local", to use the same naming as
 > for mncc handlers

Done. Also I've updated the configuration examples.

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

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


[PATCH] osmo-msc[master]: VTY: add USSD processing back-end configuration

2018-04-09 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/7677

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

VTY: add USSD processing back-end configuration

This change is a preparation for the upcoming remote USSD
processing back-end support. It extends the VTY in order
to allow one to choose preferred USSD handler.

At the moment, the following handlers are available:

OsmoMSC# configure terminal
OsmoMSC(config)# ussd
OsmoMSC(config-ussd)# handler 
  none  Do not handle USSD requests
  internal  Built-in USSD handlers (e.g. *#100#)

Please note that the internal back-end (good old *#100#)
is still used by default due to the compatibility reasons.

Change-Id: I0b3c5ccea4054113e8e23109b1ab68d9f0e18497
---
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 include/osmocom/msc/ussd.h
M include/osmocom/msc/vty.h
M src/libmsc/msc_vty.c
M src/libmsc/ussd.c
M src/osmo-msc/msc_main.c
M tests/msc_vlr/msc_vlr_tests.c
10 files changed, 176 insertions(+), 19 deletions(-)


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

diff --git a/doc/examples/osmo-msc/osmo-msc.cfg 
b/doc/examples/osmo-msc/osmo-msc.cfg
index 91c9eee..9fa2977 100644
--- a/doc/examples/osmo-msc/osmo-msc.cfg
+++ b/doc/examples/osmo-msc/osmo-msc.cfg
@@ -17,3 +17,5 @@
  assign-tmsi
  auth-tuple-max-reuse-count 3
  auth-tuple-reuse-on-error 1
+ussd
+ handler internal
diff --git a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg 
b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
index 0b9fd2a..d012f16 100644
--- a/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_custom-sccp.cfg
@@ -23,3 +23,5 @@
  cs7-instance-iu 0
  mgw remote-ip 10.23.24.1
  assign-tmsi
+ussd
+ handler internal
diff --git a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg 
b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
index 44ac3f8..b2c0c1d 100644
--- a/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
+++ b/doc/examples/osmo-msc/osmo-msc_multi-cs7.cfg
@@ -25,3 +25,5 @@
  cs7-instance-iu 1
  mgw remote-ip 10.23.24.1
  assign-tmsi
+ussd
+ handler internal
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index f3e1b94..1ba03e3 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -14,6 +14,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -321,6 +322,11 @@
/* MSISDN to which to route MO emergency calls */
char *route_to_msisdn;
} emergency;
+
+   struct {
+   /* USSD handler, e.g. internal */
+   enum ussd_handler_type handler;
+   } ussd;
 };
 
 struct osmo_esme;
diff --git a/include/osmocom/msc/ussd.h b/include/osmocom/msc/ussd.h
index bc4227b..6c821b1 100644
--- a/include/osmocom/msc/ussd.h
+++ b/include/osmocom/msc/ussd.h
@@ -2,4 +2,18 @@
 
 #include 
 
+enum ussd_handler_type {
+   /* Do not handle USSD requests */
+   USSD_HANDLER_NONE = 0,
+   /* Built-in USSD handlers (e.g. *#100#) */
+   USSD_HANDLER_INTERNAL,
+};
+
+/* Forward declarations to avoid mutual include */
+struct gsm_subscriber_connection;
+struct gsm_network;
+
+int ussd_init(struct gsm_network *net);
+void ussd_shutdown(struct gsm_network *net);
+
 int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg);
diff --git a/include/osmocom/msc/vty.h b/include/osmocom/msc/vty.h
index 6a55df7..068683f 100644
--- a/include/osmocom/msc/vty.h
+++ b/include/osmocom/msc/vty.h
@@ -23,6 +23,7 @@
SMPP_NODE,
SMPP_ESME_NODE,
HLR_NODE,
+   USSD_NODE,
 };
 
 int bsc_vty_init_extra(void);
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 33613e9..e5887fe 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1380,6 +1381,61 @@
return CMD_SUCCESS;
 }
 
+static struct cmd_node ussd_node = {
+   USSD_NODE,
+   "%s(config-ussd)# ",
+   1,
+};
+
+DEFUN(cfg_ussd, cfg_ussd_cmd,
+  "ussd", "Configure USSD handling")
+{
+   vty->node = USSD_NODE;
+   return CMD_SUCCESS;
+}
+
+#define USSD_HANDLERS "(none|internal)"
+#define USSD_HANDLERS_HELP \
+   "Do not handle USSD requests\n" \
+   "Built-in USSD handlers (e.g. *#100#)\n"
+
+DEFUN(cfg_ussd_handler, cfg_ussd_handler_cmd,
+  "handler " USSD_HANDLERS,
+  "USSD processing back-end\n"
+  USSD_HANDLERS_HELP)
+{
+   const char *handler_str = argv[0];
+
+   /* Parse handler type */
+   if (!strcasecmp(handler_str, "none"))
+   gsmnet->ussd.handler = USSD_HANDLER_NONE;
+   else if (!strcasecmp(handler_str, "internal"))
+   gsmnet->ussd.handler = USSD_HANDLER_INTERNAL;
+   else {
+   vty_out(vty, "Incorrect USSD handler%s", VTY_NEWLINE);
+   

[PATCH] osmo-msc[master]: ussd.h: cosmetic: remove useless comment

2018-04-09 Thread Vadim Yanitskiy
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/7672

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

ussd.h: cosmetic: remove useless comment

We usually put comments for functions in *.c files, while header
files are usually plain listings of the API without comments.

Change-Id: I6b0d1d9e1a1b1ffb71cb9905e74f6fad2333bb65
---
M include/osmocom/msc/ussd.h
1 file changed, 0 insertions(+), 2 deletions(-)


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

diff --git a/include/osmocom/msc/ussd.h b/include/osmocom/msc/ussd.h
index 2665468..84a3d6a 100644
--- a/include/osmocom/msc/ussd.h
+++ b/include/osmocom/msc/ussd.h
@@ -1,8 +1,6 @@
 #ifndef _USSD_H
 #define _USSD_H
 
-/* Handler function for mobile-originated USSD messages */
-
 #include 
 
 int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6b0d1d9e1a1b1ffb71cb9905e74f6fad2333bb65
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 


openbsc[master]: fix a format string error in bts_update_t3122_chan_load()

2018-04-09 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ia29feec023117734e4f50ae3487871e715821fed
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] openbsc[master]: fix a format string error in bts_update_t3122_chan_load()

2018-04-09 Thread Stefan Sperling

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

fix a format string error in bts_update_t3122_chan_load()

In a debug log message, an unsigned 64-bit value was printed with
%lu but it should be printed with PRIu64 from inttypes.h instead.

Port of osmo-bsc commit 5b6aa650f1a6df22ec99797bd3635ea791998a88
https://gerrit.osmocom.org/#/c/7687/

Change-Id: Ia29feec023117734e4f50ae3487871e715821fed
---
M openbsc/src/libbsc/chan_alloc.c
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/93/7693/1

diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index 5fa20af..c4bc949 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -607,7 +608,7 @@
 
/* Log channel load average. */
load = ((used / total) * 100);
-   LOGP(DRLL, LOGL_DEBUG, "(bts=%d) channel load average is %lu.%.2lu%%\n",
+   LOGP(DRLL, LOGL_DEBUG, "(bts=%d) channel load average is 
%"PRIu64".%.2"PRIu64"%%\n",
 bts->nr, (load & 0xff00) >> 8, (load & 0xff) / 10);
bts->chan_load_avg = ((load & 0xff00) >> 8);
OSMO_ASSERT(bts->chan_load_avg <= 100);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia29feec023117734e4f50ae3487871e715821fed
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 


openbsc[master]: fix initialization of acc ramping

2018-04-09 Thread Pau Espin Pedrol

Patch Set 2: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5834fd953e65b8453dee0a7751d5a4cae12be83a
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


osmo-bsc[master]: fix initialization of acc ramping

2018-04-09 Thread Pau Espin Pedrol

Patch Set 3: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib7d99c9d3d5d424e21bb7710f719c42f9aef3e95
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: No


[PATCH] openbsc[master]: fix initialization of acc ramping

2018-04-09 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/7692

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

fix initialization of acc ramping

Remove a redundant call to acc_ramp_init() during bootstrap_bts().
ACC ramping state is already initialized during VTY config parsing,
and bootstrap_bts() accidentally disabled ACC ramping again even
if it was enabled in the configuration.

This bug was introduced in last-minute refactoring during
review of https://gerrit.osmocom.org/#/c/6324/ when the
acc_ramping_enabled flag was moved from struct gsm_bts to
the acc_ramp structure itself.

Also remove an acc_ramp_init() call in bootstrap_rsl().
It is no longer needed as it serves no purpose other than
initializing the bitmasks of barred ACCs. To ensure that
ACC ramping configuration provided to the BTS via system
information stays correct, we move the call to acc_ramp_start(),
which has the same effect on barred ACCs, further up.

Port of osmo-bsc commit f34fb4828249eab44b4515e0e54b3ee0491d0051
Fixes: 8469818e33ef81e9f707a0c4dd13d7b91ecf83f5
Related: OS#2591

Change-Id: I5834fd953e65b8453dee0a7751d5a4cae12be83a
---
M openbsc/src/libbsc/bsc_init.c
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/92/7692/2

diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c
index 9389c43..6147257 100644
--- a/openbsc/src/libbsc/bsc_init.c
+++ b/openbsc/src/libbsc/bsc_init.c
@@ -321,6 +321,9 @@
rsl_nokia_si_begin(trx);
}
 
+   /* Configure ACC ramping before sending system information to BTS. */
+   if (acc_ramp_is_enabled(>bts->acc_ramp))
+   acc_ramp_start(>bts->acc_ramp);
gsm_bts_trx_set_system_infos(trx);
 
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
@@ -331,9 +334,6 @@
 
for (i = 0; i < ARRAY_SIZE(trx->ts); i++)
generate_ma_for_ts(>ts[i]);
-
-   if (acc_ramp_is_enabled(>bts->acc_ramp))
-   acc_ramp_start(>bts->acc_ramp);
 }
 
 /* Callback function to be called every time we receive a signal from INPUT */
@@ -521,7 +521,7 @@
 
bts->chan_load_samples_idx = 0;
 
-   acc_ramp_init(>acc_ramp, false, bts);
+   /* ACC ramping is initialized from vty/config */
 
/* Initialize the BTS state */
gsm_bts_mo_reset(bts);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I5834fd953e65b8453dee0a7751d5a4cae12be83a
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-bsc[master]: fix initialization of acc ramping

2018-04-09 Thread Stefan Sperling
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/7691

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

fix initialization of acc ramping

Remove a redundant call to acc_ramp_init() during bootstrap_bts().
ACC ramping state is already initialized during VTY config parsing,
and bootstrap_bts() accidentally disabled ACC ramping again even
if it was enabled in the configuration.

This bug was introduced in last-minute refactoring during
review of https://gerrit.osmocom.org/#/c/6324/ when the
acc_ramping_enabled flag was moved from struct gsm_bts to
the acc_ramp structure itself.

Also remove an acc_ramp_init() call in bootstrap_rsl().
It is no longer needed as it serves no purpose other than
initializing the bitmasks of barred ACCs. To ensure that
ACC ramping configuration provided to the BTS via system
information stays correct, we move the call to acc_ramp_start(),
which has the same effect on barred ACCs, further up.

Change-Id: Ib7d99c9d3d5d424e21bb7710f719c42f9aef3e95
Fixes: 6442e4327b1100ecfed7a242e397ac37b7529bea
Related: OS#2591
---
M src/libbsc/bsc_init.c
1 file changed, 4 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/91/7691/3

diff --git a/src/libbsc/bsc_init.c b/src/libbsc/bsc_init.c
index ba8b8e6..d1173e0 100644
--- a/src/libbsc/bsc_init.c
+++ b/src/libbsc/bsc_init.c
@@ -332,16 +332,13 @@
trx->bts->location_area_code,
trx->bts->cell_identity, trx->bts->bsic);
 
-   /*
-* Re-initialize ACC ramping to ensure ACCs are barred/allowed
-* according to our current VTY configuration.
-*/
-   acc_ramp_init(>bts->acc_ramp, 
acc_ramp_is_enabled(>bts->acc_ramp), trx->bts);
-
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
rsl_nokia_si_begin(trx);
}
 
+   /* Configure ACC ramping before sending system information to BTS. */
+   if (acc_ramp_is_enabled(>bts->acc_ramp))
+   acc_ramp_start(>bts->acc_ramp);
gsm_bts_trx_set_system_infos(trx);
 
if (trx->bts->type == GSM_BTS_TYPE_NOKIA_SITE) {
@@ -354,9 +351,6 @@
generate_ma_for_ts(>ts[i]);
dyn_ts_init(>ts[i]);
}
-
-   if (acc_ramp_is_enabled(>bts->acc_ramp))
-   acc_ramp_start(>bts->acc_ramp);
 }
 
 /* Callback function to be called every time we receive a signal from INPUT */
@@ -539,7 +533,7 @@
 
bts->chan_load_samples_idx = 0;
 
-   acc_ramp_init(>acc_ramp, false, bts);
+   /* ACC ramping is initialized from vty/config */
 
/* Initialize the BTS state */
gsm_bts_mo_reset(bts);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ib7d99c9d3d5d424e21bb7710f719c42f9aef3e95
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder


osmo-msc[master]: libmsc/gsm_04_80.c: drop unused 'in_msg' argument

2018-04-09 Thread Neels Hofmeyr

Patch Set 1: Code-Review+1

(2 comments)

https://gerrit.osmocom.org/#/c/7674/1/include/osmocom/msc/gsm_04_80.h
File include/osmocom/msc/gsm_04_80.h:

Line 10:const char* response_text, const struct ss_request *req);
(I would rather keep the same indenting style as below, and for added bonus 
just modify the single line so the patch touches as few lines as possible)


https://gerrit.osmocom.org/#/c/7674/1/src/libmsc/ussd.c
File src/libmsc/ussd.c:

Line 44:const struct ss_request *req)
(again, indent: rather stay with the style of surrounding code. Most editors do 
that indenting automatically)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4248ebf8626d3f7f0bf273fd20cc4f64e979938b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: Yes


Build failed in Jenkins: master-osmo-hlr » a1=default,a2=default,a3=default,osmocom-master-debian9 #432

2018-04-09 Thread jenkins
See 


--
[...truncated 27.08 KB...]
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared 
libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for pkg-config... /usr/bin/pkg-config
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.20... yes
checking for ANSI C header files... (cached) yes
checking execinfo.h usability... yes
checking execinfo.h presence... yes
checking for execinfo.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking syslog.h usability... yes
checking syslog.h presence... yes
checking for syslog.h... yes
checking ctype.h usability... yes
checking ctype.h presence... yes
checking for ctype.h... yes
checking netinet/tcp.h usability... yes
checking netinet/tcp.h presence... yes
checking for netinet/tcp.h... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for library containing dlopen... -ldl
checking for backtrace in -lexecinfo... no
checking for doxygen... (cached) false
checking whether SYS_getrandom is declared... yes
checking if gcc supports -fvisibility=hidden... yes
checking whether struct tm has tm_gmtoff member... yes
checking for TALLOC... yes
checking for PCSC... yes
checking for LIBGNUTLS... yes
checking whether C compiler accepts -mavx2... yes
checking whether C compiler accepts -mssse3... yes
checking whether C compiler accepts -msse4.1... yes
checking whether gcc has __builtin_cpu_supports built-in... yes
CFLAGS="-g -O2 -DBUILDING_LIBOSMOCORE -Wall"
CPPFLAGS=" -DBUILDING_LIBOSMOCORE -Wall"
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libosmocore.pc
config.status: creating libosmocodec.pc
config.status: creating libosmocoding.pc
config.status: creating libosmovty.pc
config.status: creating libosmogsm.pc
config.status: creating libosmogb.pc
config.status: creating libosmoctrl.pc
config.status: creating libosmosim.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating src/vty/Makefile
config.status: creating src/codec/Makefile
config.status: creating src/coding/Makefile
config.status: creating src/sim/Makefile
config.status: creating src/gsm/Makefile
config.status: creating src/gb/Makefile
config.status: creating src/ctrl/Makefile
config.status: creating src/pseudotalloc/Makefile
config.status: creating tests/Makefile
config.status: creating tests/atlocal
config.status: creating utils/Makefile
config.status: creating Doxyfile.core
config.status: creating Doxyfile.gsm
config.status: creating Doxyfile.vty
config.status: creating Doxyfile.codec
config.status: creating Doxyfile.coding
config.status: creating Doxyfile.gb
config.status: creating Makefile
config.status: creating config.h
config.status: executing tests/atconfig commands
config.status: executing depfiles commands
config.status: executing libtool commands
+ make -j 8 install
echo 0.10.2.254-aead2 > .version-t && mv .version-t .version
make  install-recursive
make[1]: Entering directory 
'
Making install in include
make[2]: Entering directory 
'
  GEN  osmocom/gsm/gsm0503.h
Generating header file...
Generate 'xcch' declaration
Generate 'rach' declaration
Generate 'rach_ext' declaration
Generate 'sch' declaration
Generate 'cs2' declaration
Generate 'cs3' declaration
Generate 'cs2_np' declaration
Generate 'cs3_np' declaration
Generate 'tch_afs_12_2' declaration
Generate 'tch_afs_10_2' declaration
Generate 'tch_afs_7_95' declaration
Generate 'tch_afs_7_4' declaration
Generate 'tch_afs_6_7' declaration
Generate 'tch_afs_5_9' declaration
Generate 

Build failed in Jenkins: master-osmo-bts » lc15, origin/nrw/litecell15-next,default,osmocom-master-debian9 #487

2018-04-09 Thread jenkins
See 


--
[...truncated 87.56 KB...]
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu 
format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... 
func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared 
libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for pkg-config... /usr/bin/pkg-config
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.20... yes
checking if gcc supports -fvisibility=hidden... yes
checking for LIBOSMOCORE... yes
checking for LIBOSMOVTY... yes
checking for LIBOSMOGSM... yes
checking for ORTP... yes
checking dahdi/user.h usability... no
checking dahdi/user.h presence... no
checking for dahdi/user.h... no
configure: WARNING: DAHDI input driver will not be built
CFLAGS="-g -O2 -Wall"
CPPFLAGS=" -Wall"
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating libosmoabis.pc
config.status: creating libosmotrau.pc
config.status: creating include/Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating Makefile
config.status: creating config.h
config.status: executing tests/atconfig commands
config.status: executing depfiles commands
config.status: executing libtool commands
+ make -j 8 install
echo 0.3.2.104-db07 > .version-t && mv .version-t .version
make  install-recursive
make[1]: Entering directory 
'
Making install in include
make[2]: Entering directory 
'
make[3]: Entering directory 

  1   2   >