Re: Change in osmo-hlr[master]: Add vty `imsi unknown cause` to set the reject cause

2020-01-19 Thread Harald Welte
On Sun, Jan 19, 2020 at 03:10:26AM +, lynxis lazus wrote:

> @laforge which of the values do you prefer? For the causes we have 
> gsm48_gmm_cause_names. Which entries have whitespaces in there. Do you want 
> to see "GMM_CAUSE_NO_GPRS_PLMN" or "GPRS services not allowed in this PLMN" 
> in the vty configuration? I would prefer "GMM_CAUSE_NO_GPRS_PLMN".

I would prefer something like "no-gprs-plmn" or NO_GPRS_PLMN.  The first would 
be the most natural from
the vty perspective.

-- 
- Harald Weltehttp://laforge.gnumonks.org/

"Privacy in residential applications is a desirable marketing option."
  (ETSI EN 300 175-7 Ch. A6)


Change in ...osmo-msc[master]: db_sms_test: Remove libdbi expected driver load errors

2019-06-05 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/14362 )

Change subject: db_sms_test: Remove libdbi expected driver load errors
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14362
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Iec78826d28435f464be22e81b3776a6ae8326d59
Gerrit-Change-Number: 14362
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Assignee: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 05 Jun 2019 16:25:48 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: debian/control: add missing libdbd-sqlite3 to Build-Depends

2019-06-05 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/14380 )

Change subject: debian/control: add missing libdbd-sqlite3 to Build-Depends
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14380
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ice9fb11f5b8a39abecee426d2fadcf62b7ee47c4
Gerrit-Change-Number: 14380
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 05 Jun 2019 16:24:43 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-bts[master]: Use #define RSL_CHAN_RACH for RSL Channel Number of RACH

2019-06-05 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/14381 )

Change subject: Use #define RSL_CHAN_RACH for RSL Channel Number of RACH
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/14381
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I7f54fccdae6799e5f4d956a101e11c2d6f998546
Gerrit-Change-Number: 14381
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 05 Jun 2019 16:25:06 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: debian/control: add missing libdbd-sqlite3 to Build-Depends

2019-06-05 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/14380 )

Change subject: debian/control: add missing libdbd-sqlite3 to Build-Depends
..

debian/control: add missing libdbd-sqlite3 to Build-Depends

The libdbd-sqlite3 provides SQLite3 driver for libdbi. We use it
by default for the built-in SMS Centre. Since [1], we have unit
test coverage for the db_sms_* API, thus we need libdbd-sqlite3
to be installed at build-time.

[1] Id94ad35b6f78f839137db2e17010fbf9b40111a3

Change-Id: Ice9fb11f5b8a39abecee426d2fadcf62b7ee47c4
---
M debian/control
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/debian/control b/debian/control
index 8b0d690..887e386 100644
--- a/debian/control
+++ b/debian/control
@@ -10,6 +10,7 @@
libtool,
pkg-config,
libdbi-dev,
+   libdbd-sqlite3,
libsctp-dev,
libtalloc-dev,
libsmpp34-dev (>= 1.12),

--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14380
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ice9fb11f5b8a39abecee426d2fadcf62b7ee47c4
Gerrit-Change-Number: 14380
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-bts[master]: Use #define RSL_CHAN_RACH for RSL Channel Number of RACH

2019-06-05 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/14381 )

Change subject: Use #define RSL_CHAN_RACH for RSL Channel Number of RACH
..

Use #define RSL_CHAN_RACH for RSL Channel Number of RACH

Change-Id: I7f54fccdae6799e5f4d956a101e11c2d6f998546
---
M src/common/rsl.c
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-oc2g/l1_if.c
M src/osmo-bts-octphy/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
5 files changed, 5 insertions(+), 5 deletions(-)

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



diff --git a/src/common/rsl.c b/src/common/rsl.c
index 410b38a..7630a8c 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -883,7 +883,7 @@
/* 9.3.17 Access Delay */
msgb_tv_put(nmsg, RSL_IE_ACCESS_DELAY, acc_delay);

-   rsl_cch_push_hdr(nmsg, RSL_MT_CHAN_RQD, 0x88); // FIXME
+   rsl_cch_push_hdr(nmsg, RSL_MT_CHAN_RQD, RSL_CHAN_RACH); // FIXME
nmsg->trx = trx;

return abis_bts_rsl_sendmsg(nmsg);
diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index 99852e3..3710fa8 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -1035,7 +1035,7 @@
if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
-   rach_ind_param.chan_nr = 0x88;
+   rach_ind_param.chan_nr = RSL_CHAN_RACH;
else
rach_ind_param.chan_nr = gsm_lchan2chan_nr(lchan);

diff --git a/src/osmo-bts-oc2g/l1_if.c b/src/osmo-bts-oc2g/l1_if.c
index 87c7cf7..d9c8da0 100644
--- a/src/osmo-bts-oc2g/l1_if.c
+++ b/src/osmo-bts-oc2g/l1_if.c
@@ -1091,7 +1091,7 @@
if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
-   rach_ind_param.chan_nr = 0x88;
+   rach_ind_param.chan_nr = RSL_CHAN_RACH;
else
rach_ind_param.chan_nr = gsm_lchan2chan_nr(lchan);

diff --git a/src/osmo-bts-octphy/l1_if.c b/src/osmo-bts-octphy/l1_if.c
index f149c04..32e738f 100644
--- a/src/osmo-bts-octphy/l1_if.c
+++ b/src/osmo-bts-octphy/l1_if.c
@@ -1195,7 +1195,7 @@

if (ra_ind->LchId.bySubChannelNb == 
cOCTVC1_GSM_ID_SUB_CHANNEL_NB_ENUM_ALL &&
ra_ind->LchId.bySAPI == cOCTVC1_GSM_SAPI_ENUM_RACH) {
-   rach_ind_param.chan_nr = 0x88;
+   rach_ind_param.chan_nr = RSL_CHAN_RACH;
} else {
struct gsm_lchan *lchan = get_lchan_by_lchid(trx, 
_ind->LchId);
rach_ind_param.chan_nr = gsm_lchan2chan_nr(lchan);
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 6f61c67..0777d0e 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -1030,7 +1030,7 @@
if (!lchan || lchan->ts->pchan == GSM_PCHAN_CCCH ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4 ||
lchan->ts->pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH)
-   rach_ind_param.chan_nr = 0x88;
+   rach_ind_param.chan_nr = RSL_CHAN_RACH;
else
rach_ind_param.chan_nr = gsm_lchan2chan_nr(lchan);


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/14381
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

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


Change in ...libosmocore[master]: fsm: Reduce amount of copy+pasted LOGPFSMSRC() statements

2019-06-05 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14363 )

Change subject: fsm: Reduce amount of copy+pasted LOGPFSMSRC() statements
..

fsm: Reduce amount of copy+pasted LOGPFSMSRC() statements

Instead of copy+pasting the same LOGPFSMSRC("State change to " ...)
with slightly different trailer depending on the FSM timer, let's first
snprintf() to a stack variable and then have a single log statement.

Change-Id: I49528c4ca1fa11aef09c2092615dccca450b847c
---
M src/fsm.c
1 file changed, 15 insertions(+), 17 deletions(-)

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



diff --git a/src/fsm.c b/src/fsm.c
index 37da9f9..337786d 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -609,33 +609,31 @@
st->onleave(fi, new_state);

if (fsm_log_timeouts) {
+   char trailer[64];
+   trailer[0] = '\0';
if (keep_timer && fi->timer.active) {
/* This should always give us a timeout, but just in 
case the return value indicates error, omit
 * logging the remaining time. */
if (osmo_timer_remaining(>timer, NULL, ))
-   LOGPFSMSRC(fi, file, line,
-  "State change to %s (keeping " 
OSMO_T_FMT ")\n",
-  osmo_fsm_state_name(fsm, new_state),
-  OSMO_T_FMT_ARGS(fi->T));
+   snprintf(trailer, sizeof(trailer), "(keeping " 
OSMO_T_FMT ")",
+OSMO_T_FMT_ARGS(fi->T));
else
-   LOGPFSMSRC(fi, file, line,
-  "State change to %s (keeping " 
OSMO_T_FMT ", %ld.%03lds remaining)\n",
-  osmo_fsm_state_name(fsm, new_state),
-  OSMO_T_FMT_ARGS(fi->T), 
remaining.tv_sec, remaining.tv_usec / 1000);
+   snprintf(trailer, sizeof(trailer), "(keeping " 
OSMO_T_FMT
+ ", %ld.%03lds remaining)", 
OSMO_T_FMT_ARGS(fi->T),
+ remaining.tv_sec, remaining.tv_usec / 
1000);
} else if (timeout_ms) {
-   if (timeout_ms % 1000 == 0) {
+   if (timeout_ms % 1000 == 0)
/* keep log output legacy compatible to avoid 
autotest failures */
-   LOGPFSMSRC(fi, file, line, "State change to %s 
(" OSMO_T_FMT ", %lus)\n",
-  osmo_fsm_state_name(fsm, new_state),
+   snprintf(trailer, sizeof(trailer), "(" 
OSMO_T_FMT ", %lus)",
   OSMO_T_FMT_ARGS(T), timeout_ms/1000);
-   } else {
-   LOGPFSMSRC(fi, file, line, "State change to %s 
(" OSMO_T_FMT ", %lums)\n",
-  osmo_fsm_state_name(fsm, new_state),
+   else
+   snprintf(trailer, sizeof(trailer), "(" 
OSMO_T_FMT ", %lums)",
   OSMO_T_FMT_ARGS(T), timeout_ms);
-   }
} else
-   LOGPFSMSRC(fi, file, line, "State change to %s (no 
timeout)\n",
-  osmo_fsm_state_name(fsm, new_state));
+   snprintf(trailer, sizeof(trailer), "(no timeout)");
+
+   LOGPFSMSRC(fi, file, line, "State change to %s %s\n",
+  osmo_fsm_state_name(fsm, new_state), trailer);
} else {
LOGPFSMSRC(fi, file, line, "state_chg to %s\n",
   osmo_fsm_state_name(fsm, new_state));

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14363
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I49528c4ca1fa11aef09c2092615dccca450b847c
Gerrit-Change-Number: 14363
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...libosmocore[master]: lapdm: Allow user to specify T200 values; Use correct N200 values

2019-06-05 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14339 )

Change subject: lapdm: Allow user to specify T200 values; Use correct N200 
values
..

lapdm: Allow user to specify T200 values; Use correct N200 values

TS 04.06 specifies a N200 re-transmission counter that depends on the
channel type, which we didn't care about at all so far.  Let's have the
caller tell us the channel type so we can internally look up the correct
N200 value for it.

At the same time, permit the user to specify T200 re-transmission timer
values for each SAPI on both DCCH and ACCH, which is required at least
in the BTS as per GSM TS 12.21.  Also, extend the timer resolution of
the API from seconds to milli-seconds, which is more applicable as
particularly on the FACCH the recommended values are in the 200ms range.

Change-Id: I90fdc4dd4720d4e02213197c894eb0a55a39158c
Related: OS#3906
Related: OS#2294
Related: OS#4037
---
M include/osmocom/gsm/lapdm.h
M src/gsm/lapdm.c
M src/gsm/libosmogsm.map
3 files changed, 85 insertions(+), 15 deletions(-)

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



diff --git a/include/osmocom/gsm/lapdm.h b/include/osmocom/gsm/lapdm.h
index e01d065..931de80 100644
--- a/include/osmocom/gsm/lapdm.h
+++ b/include/osmocom/gsm/lapdm.h
@@ -1,6 +1,7 @@
 #pragma once

 #include 
+#include 
 #include 

 /*! \defgroup lapdm LAPDm implementation according to GSM TS 04.06
@@ -81,9 +82,14 @@
 struct lapdm_datalink *lapdm_datalink_for_sapi(struct lapdm_entity *le, 
uint8_t sapi);

 /* initialize a LAPDm entity */
-void lapdm_entity_init(struct lapdm_entity *le, enum lapdm_mode mode, int 
t200);
-void lapdm_channel_init(struct lapdm_channel *lc, enum lapdm_mode mode);
-
+void lapdm_entity_init(struct lapdm_entity *le, enum lapdm_mode mode, int t200)
+   OSMO_DEPRECATED("Use lapdm_entity_init2() instead");
+void lapdm_entity_init2(struct lapdm_entity *le, enum lapdm_mode mode,
+   const int *t200_ms, int n200);
+void lapdm_channel_init(struct lapdm_channel *lc, enum lapdm_mode mode)
+   OSMO_DEPRECATED("Use lapdm_channel_init2() instead");
+int lapdm_channel_init2(struct lapdm_channel *lc, enum lapdm_mode mode,
+   const int *t200_ms_dcch, const int *t200_ms_acch, enum 
gsm_chan_t chan_t);
 /* deinitialize a LAPDm entity */
 void lapdm_entity_exit(struct lapdm_entity *le);
 void lapdm_channel_exit(struct lapdm_channel *lc);
diff --git a/src/gsm/lapdm.c b/src/gsm/lapdm.c
index f1651d6..8084029 100644
--- a/src/gsm/lapdm.c
+++ b/src/gsm/lapdm.c
@@ -1,7 +1,7 @@
 /*! \file lapdm.c
  * GSM LAPDm (TS 04.06) implementation. */
 /*
- * (C) 2010-2017 by Harald Welte 
+ * (C) 2010-2019 by Harald Welte 
  * (C) 2010-2011 by Andreas Eversberg 
  * (C) 2014-2016 by sysmocom - s.f.m.c GmbH
  *
@@ -132,7 +132,7 @@
 static int update_pending_frames(struct lapd_msg_ctx *lctx);

 static void lapdm_dl_init(struct lapdm_datalink *dl,
- struct lapdm_entity *entity, int t200)
+ struct lapdm_entity *entity, int t200_ms, uint32_t 
n200)
 {
memset(dl, 0, sizeof(*dl));
dl->entity = entity;
@@ -142,39 +142,101 @@
dl->dl.send_dlsap = send_rslms_dlsap;
dl->dl.update_pending_frames = update_pending_frames;
dl->dl.n200_est_rel = N200_EST_REL;
-   dl->dl.n200 = N200;
+   dl->dl.n200 = n200;
dl->dl.t203_sec = 0; dl->dl.t203_usec = 0;
-   dl->dl.t200_sec = t200; dl->dl.t200_usec = 0;
+   dl->dl.t200_sec = t200_ms / 1000; dl->dl.t200_usec = (t200_ms % 1000) * 
1000;
 }

 /*! initialize a LAPDm entity and all datalinks inside
  *  \param[in] le LAPDm entity
  *  \param[in] mode \ref lapdm_mode (BTS/MS)
+ *  \param[in] t200 T200 re-transmission timer for all SAPIs in seconds
+ *
+ *  Don't use this function; It doesn't support different T200 values per API
+ *  and doesn't permit the caller to specify the N200 counter, both of which
+ *  are required by GSM specs and supported by lapdm_entity_init2().
  */
 void lapdm_entity_init(struct lapdm_entity *le, enum lapdm_mode mode, int t200)
 {
+   /* convert from single full-second value to per-SAPI milli-second value 
*/
+   int t200_ms_sapi_arr[_NR_DL_SAPI];
+   int i;
+
+   for (i = 0; i < ARRAY_SIZE(t200_ms_sapi_arr); i++)
+   t200_ms_sapi_arr[i] = t200 * 1000;
+
+   return lapdm_entity_init2(le, mode, t200_ms_sapi_arr, N200);
+}
+
+/*! initialize a LAPDm entity and all datalinks inside
+ *  \param[in] le LAPDm entity
+ *  \param[in] mode lapdm_mode (BTS/MS)
+ *  \param[in] t200_ms per-SAPI array of T200 re-transmission timer in 
milli-seconds
+ *  \param[in] n200 N200 re-transmisison count
+ */
+void lapdm_entity_init2(struct lapdm_entity *le, enum lapdm_mode mode,
+   const int *t2

Change in ...libosmocore[master]: fsm: Allow millisecond granularity in osmo_fsm built-in timer

2019-06-05 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14200 )

Change subject: fsm: Allow millisecond granularity in osmo_fsm built-in timer
..


Patch Set 7: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14200
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I35b330e460e80bb67376c77e997e464439ac5397
Gerrit-Change-Number: 14200
Gerrit-PatchSet: 7
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 05 Jun 2019 10:01:16 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: fsm: Reduce amount of copy+pasted LOGPFSMSRC() statements

2019-06-05 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14363 )

Change subject: fsm: Reduce amount of copy+pasted LOGPFSMSRC() statements
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14363
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I49528c4ca1fa11aef09c2092615dccca450b847c
Gerrit-Change-Number: 14363
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 05 Jun 2019 10:01:19 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: fsm: Allow millisecond granularity in osmo_fsm built-in timer

2019-06-05 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14200 )

Change subject: fsm: Allow millisecond granularity in osmo_fsm built-in timer
..

fsm: Allow millisecond granularity in osmo_fsm built-in timer

So far, the public API of osmo_fsm only allowed integral seconds as
timeout.  Let's change that to milli-seconds in order to cover more
use cases.

This introduces
* osmo_fsm_inst_state_chg_ms()
* osmo_fsm_inst_state_chg_keep_or_start_timer_ms()

Which both work exactly like their previous counterparts without the _ms
suffix - the only difference being that the timeout parameter is
specified in milli-seconds, not in seconds.

The value range for an unsigned long in milli-seconds even on a 32bit
platform extends to about 48 days.

This patch also removes the documentation notice about limiting the
maximum value to 0x7fff due to time_t signed-ness.  We don't use
time_t but unsigned long.

Change-Id: I35b330e460e80bb67376c77e997e464439ac5397
---
M include/osmocom/core/fsm.h
M src/fsm.c
2 files changed, 46 insertions(+), 23 deletions(-)

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



diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h
index 41d01a5..1701c45 100644
--- a/include/osmocom/core/fsm.h
+++ b/include/osmocom/core/fsm.h
@@ -243,6 +243,13 @@
 unsigned long timeout_secs, int T,
 const char *file, int line);

+#define osmo_fsm_inst_state_chg_ms(fi, new_state, timeout_ms, T) \
+   _osmo_fsm_inst_state_chg_ms(fi, new_state, timeout_ms, T, \
+__FILE__, __LINE__)
+int _osmo_fsm_inst_state_chg_ms(struct osmo_fsm_inst *fi, uint32_t new_state,
+   unsigned long timeout_ms, int T,
+   const char *file, int line);
+
 /*! perform a state change while keeping the current timer running.
  *
  *  This is useful to keep a timeout across several states (without having to 
round the
@@ -273,6 +280,14 @@
 unsigned long timeout_secs, 
int T,
 const char *file, int line);

+#define osmo_fsm_inst_state_chg_keep_or_start_timer_ms(fi, new_state, 
timeout_ms, T) \
+   _osmo_fsm_inst_state_chg_keep_or_start_timer_ms(fi, new_state, 
timeout_ms, T, \
+__FILE__, __LINE__)
+int _osmo_fsm_inst_state_chg_keep_or_start_timer_ms(struct osmo_fsm_inst *fi, 
uint32_t new_state,
+  unsigned long timeout_ms, 
int T,
+  const char *file, int line);
+
+
 /*! dispatch an event to an osmocom finite state machine instance
  *
  *  This is a macro that calls _osmo_fsm_inst_dispatch() with the given
diff --git a/src/fsm.c b/src/fsm.c
index 411797d..37da9f9 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -1,7 +1,7 @@
 /*! \file fsm.c
  * Osmocom generic Finite State Machine implementation. */
 /*
- * (C) 2016 by Harald Welte 
+ * (C) 2016-2019 by Harald Welte 
  *
  * SPDX-License-Identifier: GPL-2.0+
  *
@@ -584,7 +584,7 @@
 }

 static int state_chg(struct osmo_fsm_inst *fi, uint32_t new_state,
-bool keep_timer, unsigned long timeout_secs, int T,
+bool keep_timer, unsigned long timeout_ms, int T,
 const char *file, int line)
 {
struct osmo_fsm *fsm = fi->fsm;
@@ -592,11 +592,6 @@
const struct osmo_fsm_state *st = >states[fi->state];
struct timeval remaining;

-   /* Limit to 0x7fff seconds as explained by
-* _osmo_fsm_inst_state_chg()'s API doc. */
-   if (timeout_secs > 0x7fff)
-   timeout_secs = 0x7fff;
-
/* validate if new_state is a valid state */
if (!(st->out_state_mask & (1 << new_state))) {
LOGPFSMLSRC(fi, LOGL_ERROR, file, line,
@@ -627,11 +622,18 @@
   "State change to %s (keeping " 
OSMO_T_FMT ", %ld.%03lds remaining)\n",
   osmo_fsm_state_name(fsm, new_state),
   OSMO_T_FMT_ARGS(fi->T), 
remaining.tv_sec, remaining.tv_usec / 1000);
-   } else if (timeout_secs)
-   LOGPFSMSRC(fi, file, line, "State change to %s (" 
OSMO_T_FMT ", %lus)\n",
-  osmo_fsm_state_name(fsm, new_state),
-  OSMO_T_FMT_ARGS(T), timeout_secs);
-   else
+   } else if (timeout_ms) {
+   if (timeout_ms % 1000 == 0) {
+   /* keep log output legacy compatible to avoid 
autotest failures */
+ 

Change in ...libosmocore[master]: lapd_core: Perform N200 retransmissions, not N200-1

2019-06-05 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14347 )

Change subject: lapd_core: Perform N200 retransmissions, not N200-1
..

lapd_core: Perform N200 retransmissions, not N200-1

During testing with BTS_Tests_LAPDm.TC_t200_n200() it was discovered
that the existing LAPD[m] implementation always gave up at N200-1
retransmissions, rather than N200 retransmissions.

The first transmission doesn't count, and hence we must have N200
actual re-transmissions.  The Error message is then described as
"T200 expired N200+1 times", i.e. we start T200 one more time after
the last re-transmission and only give up if it expires again (i.e.
no ACK received)

Change-Id: Ic33854ee61311f73b7db55eeef10280349151097
Related: OS4037
---
M src/gsm/lapd_core.c
1 file changed, 4 insertions(+), 4 deletions(-)

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



diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index a2ff230..19dff4f 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -564,7 +564,7 @@
switch (dl->state) {
case LAPD_STATE_SABM_SENT:
/* 5.4.1.3 */
-   if (dl->retrans_ctr + 1 >= dl->n200_est_rel + 1) {
+   if (dl->retrans_ctr >= dl->n200_est_rel + 1) {
/* flush tx and send buffers */
lapd_dl_flush_tx(dl);
lapd_dl_flush_send(dl);
@@ -589,7 +589,7 @@
break;
case LAPD_STATE_DISC_SENT:
/* 5.4.4.3 */
-   if (dl->retrans_ctr + 1 >= dl->n200_est_rel + 1) {
+   if (dl->retrans_ctr >= dl->n200_est_rel + 1) {
/* send MDL ERROR INIDCATION to L3 */
mdl_error(MDL_CAUSE_T200_EXPIRED, >lctx);
/* send RELEASE INDICATION to L3 */
@@ -618,7 +618,7 @@
/* fall through */
case LAPD_STATE_TIMER_RECOV:
dl->retrans_ctr++;
-   if (dl->retrans_ctr < dl->n200) {
+   if (dl->retrans_ctr <= dl->n200) {
uint8_t vs = sub_mod(dl->v_send, 1, dl->v_range);
uint8_t h = do_mod(vs, dl->range_hist);
/* retransmit I frame (V_s-1) with P=1, if any */
@@ -671,7 +671,7 @@
/* reestablish */
if (!dl->reestablish)
break;
-   LOGP(DLLAPD, LOGL_NOTICE, "N200 reached, performing "
+   LOGP(DLLAPD, LOGL_NOTICE, "N200+1 reached, performing "
"reestablishment. (dl=%p)\n", dl);
lapd_reestablish(dl);
}

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14347
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic33854ee61311f73b7db55eeef10280349151097
Gerrit-Change-Number: 14347
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...libosmocore[master]: lapdm: Allow user to specify T200 values; Use correct N200 values

2019-06-05 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14339 )

Change subject: lapdm: Allow user to specify T200 values; Use correct N200 
values
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14339
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I90fdc4dd4720d4e02213197c894eb0a55a39158c
Gerrit-Change-Number: 14339
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Wed, 05 Jun 2019 10:00:25 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: lapd_core: Perform N200 retransmissions, not N200-1

2019-06-05 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14347 )

Change subject: lapd_core: Perform N200 retransmissions, not N200-1
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14347
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ic33854ee61311f73b7db55eeef10280349151097
Gerrit-Change-Number: 14347
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 05 Jun 2019 10:00:47 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Check if BTS_TRXC port is mapped before attempting UDP socket co...

2019-06-05 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14379 )

Change subject: bts: Check if BTS_TRXC port is mapped before attempting UDP 
socket connect
..

bts: Check if BTS_TRXC port is mapped before attempting UDP socket connect

A large number of our tests is currently failing with
BTS_Tests.ttcn:341 Dynamic test case error: IPL4 Test Port not mapped
which was introduced by Change-Id Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1

Change-Id: Ia1ef4ac7dcfec137a8613bc49a7f312d81a86153
---
M bts/BTS_Tests.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index e10d967..9371612 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -505,7 +505,7 @@
map(self:L1CTL, system:L1CTL);
f_connect_reset(L1CTL);

-   if (mp_bts_trxc_port != -1) {
+   if (mp_bts_trxc_port != -1 and BTS_TRXC.checkstate("Mapped")) {
f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id);
}


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14379
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

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


Change in ...osmo-ttcn3-hacks[master]: bts: Check if BTS_TRXC port is mapped before attempting UDP socket co...

2019-06-05 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14379 )

Change subject: bts: Check if BTS_TRXC port is mapped before attempting UDP 
socket connect
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14379
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia1ef4ac7dcfec137a8613bc49a7f312d81a86153
Gerrit-Change-Number: 14379
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 05 Jun 2019 08:26:12 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Check if BTS_TRXC port is mapped before attempting UDP socket co...

2019-06-05 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14379


Change subject: bts: Check if BTS_TRXC port is mapped before attempting UDP 
socket connect
..

bts: Check if BTS_TRXC port is mapped before attempting UDP socket connect

A large number of our tests is currently failing with
BTS_Tests.ttcn:341 Dynamic test case error: IPL4 Test Port not mapped
which was introduced by Change-Id Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1

Change-Id: Ia1ef4ac7dcfec137a8613bc49a7f312d81a86153
---
M bts/BTS_Tests.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)



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

diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index e10d967..9371612 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -505,7 +505,7 @@
map(self:L1CTL, system:L1CTL);
f_connect_reset(L1CTL);

-   if (mp_bts_trxc_port != -1) {
+   if (mp_bts_trxc_port != -1 and BTS_TRXC.checkstate("Mapped")) {
f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id);
}


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14379
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia1ef4ac7dcfec137a8613bc49a7f312d81a86153
Gerrit-Change-Number: 14379
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-MessageType: newchange


Change in ...libosmocore[master]: lapdm: Allow user to specify T200 values; Use correct N200 values

2019-06-04 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/libosmocore/+/14339

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

Change subject: lapdm: Allow user to specify T200 values; Use correct N200 
values
..

lapdm: Allow user to specify T200 values; Use correct N200 values

TS 04.06 specifies a N200 re-transmission counter that depends on the
channel type, which we didn't care about at all so far.  Let's have the
caller tell us the channel type so we can internally look up the correct
N200 value for it.

At the same time, permit the user to specify T200 re-transmission timer
values for each SAPI on both DCCH and ACCH, which is required at least
in the BTS as per GSM TS 12.21.  Also, extend the timer resolution of
the API from seconds to milli-seconds, which is more applicable as
particularly on the FACCH the recommended values are in the 200ms range.

Change-Id: I90fdc4dd4720d4e02213197c894eb0a55a39158c
Related: OS#3906
Related: OS#2294
Related: OS#4037
---
M include/osmocom/gsm/lapdm.h
M src/gsm/lapdm.c
M src/gsm/libosmogsm.map
3 files changed, 85 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/39/14339/4
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14339
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I90fdc4dd4720d4e02213197c894eb0a55a39158c
Gerrit-Change-Number: 14339
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: fixeria 
Gerrit-MessageType: newpatchset


Change in ...osmo-msc[master]: libmsc/db.c: get rid of hard-coded SMS expiry threshold

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/13631 )

Change subject: libmsc/db.c: get rid of hard-coded SMS expiry threshold
..


Patch Set 6: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/13631
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I0ce6b1ab50986dc69a2be4ea62b6a24c7f3f8f0a
Gerrit-Change-Number: 13631
Gerrit-PatchSet: 6
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: fixeria 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:36:31 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: libmsc/db.c: introduce and use parse_sm_ud_from_result()

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/13488 )

Change subject: libmsc/db.c: introduce and use parse_sm_ud_from_result()
..


Patch Set 7: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/13488
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: If67dfb9f7d2a55fa3d45dc4689a2acff9909faf6
Gerrit-Change-Number: 13488
Gerrit-PatchSet: 7
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:36:04 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: libmsc/db.c: warn user about SMS text truncation

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/13489 )

Change subject: libmsc/db.c: warn user about SMS text truncation
..


Patch Set 7: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/13489
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I75e852ebe44ba4784572cbffa029e13f0d3c430c
Gerrit-Change-Number: 13489
Gerrit-PatchSet: 7
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:36:17 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: libmsc/db.c: fix potential integer overflow

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/13470 )

Change subject: libmsc/db.c: fix potential integer overflow
..


Patch Set 9: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/13470
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ibbd588545e1a4817504c806a3d02cf59d5938ee2
Gerrit-Change-Number: 13470
Gerrit-PatchSet: 9
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:35:48 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: osmo-sgsn: add VTY parameter to toggle authentication

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/14194 )

Change subject: osmo-sgsn: add VTY parameter to toggle authentication
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/14194
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I9909145e7e0af587c28827e16301a61b13eedaa9
Gerrit-Change-Number: 14194
Gerrit-PatchSet: 3
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:31:32 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: doc/manuals/vty: regenerate sgsn_vty_reference.xml

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/14377 )

Change subject: doc/manuals/vty: regenerate sgsn_vty_reference.xml
..

doc/manuals/vty: regenerate sgsn_vty_reference.xml

Change-Id: I3dfe3598055457cc9724a371590e676f1920652b
---
M doc/manuals/vty/sgsn_vty_reference.xml
1 file changed, 21 insertions(+), 7 deletions(-)

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



diff --git a/doc/manuals/vty/sgsn_vty_reference.xml 
b/doc/manuals/vty/sgsn_vty_reference.xml
index 52d4213..7619215 100644
--- a/doc/manuals/vty/sgsn_vty_reference.xml
+++ b/doc/manuals/vty/sgsn_vty_reference.xml
@@ -187,7 +187,7 @@
 
   
 
-
+
   
 
 
@@ -222,6 +222,7 @@
 
 
 
+
 
 
 
@@ -733,7 +734,7 @@
 
   
 
-
+
   
 
 
@@ -768,6 +769,7 @@
 
 
 
+
 
 
 
@@ -1488,7 +1490,8 @@
 
 
 
-  
+  
+
 
   
 
@@ -1518,7 +1521,7 @@
 
   
 
-
+
   
 
 
@@ -1553,6 +1556,7 @@
 
 
 
+
 
 
 
@@ -1696,10 +1700,11 @@
 
   
 
-
+
   
 
 
+
   
 
   
@@ -1762,7 +1767,7 @@
 
   
 
-
+
   
 
 
@@ -1772,6 +1777,7 @@
 
 
 
+
 
   
 
@@ -2234,6 +2240,13 @@
 
   
 
+
+  
+
+
+
+  
+
 
   
 
@@ -2325,7 +2338,8 @@
 
 
 
-  
+  
+
 
   
 

--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/14377
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I3dfe3598055457cc9724a371590e676f1920652b
Gerrit-Change-Number: 14377
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...osmo-sgsn[master]: doc/manuals/vty: regenerate sgsn_vty_reference.xml

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/14377 )

Change subject: doc/manuals/vty: regenerate sgsn_vty_reference.xml
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/14377
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: I3dfe3598055457cc9724a371590e676f1920652b
Gerrit-Change-Number: 14377
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:31:43 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-sgsn[master]: osmo-sgsn: get rid of OSMO_ASSERT() in 'auth-policy' handler

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-sgsn/+/14195 )

Change subject: osmo-sgsn: get rid of OSMO_ASSERT() in 'auth-policy' handler
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-sgsn/+/14195
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Change-Id: If9b0c0d031477ca87786aab5c269d00748e896c8
Gerrit-Change-Number: 14195
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:31:12 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Add LAPDm test for SABM with wrong C/R bit

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14378 )

Change subject: bts: Add LAPDm test for SABM with wrong C/R bit
..

bts: Add LAPDm test for SABM with wrong C/R bit

Test that the BTS will take no action when it receives an SABM frame
with the C bit set wrong (R); Inspired by TS 51.010-1 25.2.5.2

Implemented as TC_sabm_incorrect_c().

Related: OS#4032
Change-Id: I4fbe7e708c9b1a2c04e5d24a205b5b5af20ff8c7
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 50 insertions(+), 0 deletions(-)

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



diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index 12f24eb..edbd37b 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -1052,6 +1052,55 @@
var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
f_testmatrix_each_chan(pars, refers(f_TC_incorrect_cr));
 }
+
+/* test that the BTS will take no action when it receives an SABM frame with 
the C bit set wrong (R)
+   Inspired by TS 51.010-1 25.2.5.2 */
+private function f_TC_sabm_incorrect_c(charstring id) runs on ConnHdlr {
+   var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0));
+   var integer sapi := link_id.sapi;
+   var boolean is_sacch := false;
+   if (link_id.c == SACCH) {
+   is_sacch := true;
+   }
+   timer T := 3.0;
+   var default d;
+
+   fp_common_init();
+
+   /* some common altstep for meas res and other background noise */
+   d := activate(as_ignore_background(true));
+   RSL.clear;
+   LAPDM.clear;
+
+   f_establish_mo(link_id);
+
+   /* Send I-frame SAPI = 0, C = 1, P = 0, M = 0, L = 3, N(S) = 0, N(R) = 
0 */
+   var octetstring l3_mo := '010203'O;
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_I(sapi, c_r:=cr_MO_CMD, 
p:=false, nr:=0, ns:=0,
+l3:=l3_mo)));
+   /* Expect RR SAPI = 0, R = 1, F = 0, M = 0, L = 0, N(R) = 1 */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, 
p:=false, nr:=1)));
+   RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3_mo));
+   /* Send SABM SAPI = 0, C = 0, P = 1, M = 0, L = 0 */
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_RSP, 
p:=true, l3:=''O)));
+   /* Expect RSL ERR IND */
+   RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, '0C'O));
+   /* Expect fill frame C = 0, P = 0, M = 0, L = 0 */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UI(0, ?, ''O)));
+   /* Send RR command (P=1) SAPI = 0, C = 1, P = 1, M = 0, L = 0, N(R) = 0 
*/
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, 
p:=true, nr:=0)));
+   /* Expect RR response (F=1) SAPI = 0, R = 1, F = 1, M = 0, L = 0, N(R) 
= 1 */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, 
p:=true, nr:=1)));
+
+   deactivate(d);
+
+   fp_common_fini();
+}
+testcase TC_sabm_incorrect_c() runs on test_CT {
+   var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
+   f_testmatrix_each_chan(pars, refers(f_TC_sabm_incorrect_c));
+}
+
 control {
execute(TC_foo());
execute(TC_sabm_ua_dcch_sapi0());
@@ -1071,6 +1120,7 @@
execute(TC_t200_n200());
execute(TC_rr_response_frame_loss());
execute(TC_incorrect_cr());
+   execute(TC_sabm_incorrect_c());
 }

 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14378
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

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


Change in ...osmo-ttcn3-hacks[master]: bts: Add test csse for I frame with wrong C/R value

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14350 )

Change subject: bts: Add test csse for I frame with wrong C/R value
..

bts: Add test csse for I frame with wrong C/R value

Implemented as BTS_Tests_LAPDm.TC_incorrect_cr()

Related: OS#4032
Change-Id: I19e50049625bd31662a1e22b1394b69b2d249104
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 54 insertions(+), 0 deletions(-)

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



diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index bf359f2..12f24eb 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -999,6 +999,59 @@
f_testmatrix_each_chan(pars, refers(f_TC_rr_response_frame_loss));
 }

+/* Ensure BTS ignores I frames with wrong C/R bit; Inspired by TS 51.010-1 
25.2.5.1 */
+private function f_TC_incorrect_cr(charstring id) runs on ConnHdlr {
+   var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0));
+   var integer sapi := link_id.sapi;
+   var boolean is_sacch := false;
+   if (link_id.c == SACCH) {
+   is_sacch := true;
+   }
+   timer T := 3.0;
+   var default d;
+
+   fp_common_init();
+
+   /* some common altstep for meas res and other background noise */
+   d := activate(as_ignore_background(true));
+   RSL.clear;
+   LAPDM.clear;
+
+   f_establish_mo(link_id);
+
+   var octetstring l3_mo := f_rnd_octstring(10);
+   /* Send an I frame to the BTS: SAPI = 0, C = 0, P = 1, M = 0, L = 3, 
N(S) = 0, N(R) = 0 */
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_I(sapi, c_r:=cr_MO_RSP, 
p:=true, nr:=0, ns:=0,
+l3:=l3_mo)));
+   T.start;
+   alt {
+   [] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3_mo)) {
+   setverdict(fail, "BTS didn't ignore I frame with wrong C/R 
bit");
+   }
+   [] RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, '0C'O)) {
+   repeat;
+   }
+   /* ensure BTS still sends idle frames */
+   [] as_lapdm_idle() {
+   setverdict(pass, "still sending idle frames");
+   }
+   [] T.timeout {}
+   }
+
+   /* Send RR command P=1 */
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, 
p:=true, nr:=0)));
+
+   /* The BTS shall respond with a RR response, F bit set to 1. */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, 
p:=true, nr:=0)));
+
+   deactivate(d);
+
+   fp_common_fini();
+}
+testcase TC_incorrect_cr() runs on test_CT {
+   var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
+   f_testmatrix_each_chan(pars, refers(f_TC_incorrect_cr));
+}
 control {
execute(TC_foo());
execute(TC_sabm_ua_dcch_sapi0());
@@ -1017,6 +1070,7 @@
execute(TC_segm_concat_sacch());
execute(TC_t200_n200());
execute(TC_rr_response_frame_loss());
+   execute(TC_incorrect_cr());
 }

 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14350
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I19e50049625bd31662a1e22b1394b69b2d249104
Gerrit-Change-Number: 14350
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: bts: Add LAPDm test for SABM with wrong C/R bit

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14378 )

Change subject: bts: Add LAPDm test for SABM with wrong C/R bit
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14378
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4fbe7e708c9b1a2c04e5d24a205b5b5af20ff8c7
Gerrit-Change-Number: 14378
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:30:05 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Add test csse for I frame with wrong C/R value

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14350 )

Change subject: bts: Add test csse for I frame with wrong C/R value
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14350
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I19e50049625bd31662a1e22b1394b69b2d249104
Gerrit-Change-Number: 14350
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 21:30:04 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Add LAPDm test for SABM with wrong C/R bit

2019-06-04 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14378


Change subject: bts: Add LAPDm test for SABM with wrong C/R bit
..

bts: Add LAPDm test for SABM with wrong C/R bit

Test that the BTS will take no action when it receives an SABM frame
with the C bit set wrong (R); Inspired by TS 51.010-1 25.2.5.2

Implemented as TC_sabm_incorrect_c().

Related: OS#4032
Change-Id: I4fbe7e708c9b1a2c04e5d24a205b5b5af20ff8c7
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 50 insertions(+), 0 deletions(-)



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

diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index 12f24eb..edbd37b 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -1052,6 +1052,55 @@
var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
f_testmatrix_each_chan(pars, refers(f_TC_incorrect_cr));
 }
+
+/* test that the BTS will take no action when it receives an SABM frame with 
the C bit set wrong (R)
+   Inspired by TS 51.010-1 25.2.5.2 */
+private function f_TC_sabm_incorrect_c(charstring id) runs on ConnHdlr {
+   var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0));
+   var integer sapi := link_id.sapi;
+   var boolean is_sacch := false;
+   if (link_id.c == SACCH) {
+   is_sacch := true;
+   }
+   timer T := 3.0;
+   var default d;
+
+   fp_common_init();
+
+   /* some common altstep for meas res and other background noise */
+   d := activate(as_ignore_background(true));
+   RSL.clear;
+   LAPDM.clear;
+
+   f_establish_mo(link_id);
+
+   /* Send I-frame SAPI = 0, C = 1, P = 0, M = 0, L = 3, N(S) = 0, N(R) = 
0 */
+   var octetstring l3_mo := '010203'O;
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_I(sapi, c_r:=cr_MO_CMD, 
p:=false, nr:=0, ns:=0,
+l3:=l3_mo)));
+   /* Expect RR SAPI = 0, R = 1, F = 0, M = 0, L = 0, N(R) = 1 */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, 
p:=false, nr:=1)));
+   RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3_mo));
+   /* Send SABM SAPI = 0, C = 0, P = 1, M = 0, L = 0 */
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_RSP, 
p:=true, l3:=''O)));
+   /* Expect RSL ERR IND */
+   RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, '0C'O));
+   /* Expect fill frame C = 0, P = 0, M = 0, L = 0 */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UI(0, ?, ''O)));
+   /* Send RR command (P=1) SAPI = 0, C = 1, P = 1, M = 0, L = 0, N(R) = 0 
*/
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_RR(sapi, c_r:=cr_MO_CMD, 
p:=true, nr:=0)));
+   /* Expect RR response (F=1) SAPI = 0, R = 1, F = 1, M = 0, L = 0, N(R) 
= 1 */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, 
p:=true, nr:=1)));
+
+   deactivate(d);
+
+   fp_common_fini();
+}
+testcase TC_sabm_incorrect_c() runs on test_CT {
+   var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
+   f_testmatrix_each_chan(pars, refers(f_TC_sabm_incorrect_c));
+}
+
 control {
execute(TC_foo());
execute(TC_sabm_ua_dcch_sapi0());
@@ -1071,6 +1120,7 @@
execute(TC_t200_n200());
execute(TC_rr_response_frame_loss());
execute(TC_incorrect_cr());
+   execute(TC_sabm_incorrect_c());
 }

 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14378
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4fbe7e708c9b1a2c04e5d24a205b5b5af20ff8c7
Gerrit-Change-Number: 14378
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-MessageType: newchange


Change in ...osmo-ttcn3-hacks[master]: bts: Add test csse for I frame with wrong C/R value

2019-06-04 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14350

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

Change subject: bts: Add test csse for I frame with wrong C/R value
..

bts: Add test csse for I frame with wrong C/R value

Implemented as BTS_Tests_LAPDm.TC_incorrect_cr()

Related: OS#4032
Change-Id: I19e50049625bd31662a1e22b1394b69b2d249104
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 54 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/50/14350/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14350
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I19e50049625bd31662a1e22b1394b69b2d249104
Gerrit-Change-Number: 14350
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in ...osmo-ggsn[master]: ggsn: vty: Require ggsn param in cmd

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14298 )

Change subject: ggsn: vty: Require ggsn param in  cmd
..

ggsn: vty: Require ggsn param in  cmd

Other similar commands already do it. This way we also get rid of
deprecated APIs, supporting search when more than one GSN is set up.

Related: OS#2873
Change-Id: I8357e20076348c8ded5e9f5b8e7252566b0fbfea
---
M doc/manuals/vty/ggsn_vty_reference.xml
M ggsn/ggsn_vty.c
2 files changed, 22 insertions(+), 8 deletions(-)

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



diff --git a/doc/manuals/vty/ggsn_vty_reference.xml 
b/doc/manuals/vty/ggsn_vty_reference.xml
index a226f8f..a395b23 100644
--- a/doc/manuals/vty/ggsn_vty_reference.xml
+++ b/doc/manuals/vty/ggsn_vty_reference.xml
@@ -351,10 +351,12 @@
 
   
 
-
+
   
 
 
+
+
 
 
 
@@ -709,10 +711,12 @@
 
   
 
-
+
   
 
 
+
+
 
 
 
diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index 9101361..eb7cca7 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -764,25 +764,35 @@
 }

 DEFUN(show_pdpctx_imsi, show_pdpctx_imsi_cmd,
-   "show pdp-context imsi IMSI [<0-15>]",
+   "show pdp-context ggsn NAME imsi IMSI [<0-15>]",
SHOW_STR "Display information on PDP Context\n"
+   GGSN_STR "GGSN Name\n"
"PDP contexts for given IMSI\n"
"PDP context for given NSAPI\n")
 {
-   uint64_t imsi = strtoull(argv[0], NULL, 10);
+   struct ggsn_ctx *ggsn;
+   uint64_t imsi;
unsigned int nsapi;
struct pdp_t *pdp;
int num_found = 0;

-   if (argc > 1) {
-   nsapi = atoi(argv[1]);
-   if (pdp_getimsi(, imsi, nsapi)) {
+   ggsn = ggsn_find(argv[0]);
+   if (!ggsn) {
+   vty_out(vty, "%% No such GGSN '%s'%s", argv[0], VTY_NEWLINE);
+   return CMD_WARNING;
+   }
+
+   imsi = strtoull(argv[1], NULL, 10);
+
+   if (argc > 2) {
+   nsapi = atoi(argv[2]);
+   if (gtp_pdp_getimsi(ggsn->gsn, , imsi, nsapi)) {
show_one_pdp(vty, pdp);
num_found++;
}
} else {
for (nsapi = 0; nsapi < PDP_MAXNSAPI; nsapi++) {
-   if (pdp_getimsi(, imsi, nsapi))
+   if (gtp_pdp_getimsi(ggsn->gsn, , imsi, nsapi))
continue;
show_one_pdp(vty, pdp);
num_found++;

--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14298
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I8357e20076348c8ded5e9f5b8e7252566b0fbfea
Gerrit-Change-Number: 14298
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in ...osmo-ggsn[master]: sgsnemu: Replace use of deprecated libgtp API pdp_newpdp with new one

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14299 )

Change subject: sgsnemu: Replace use of deprecated libgtp API pdp_newpdp with 
new one
..

sgsnemu: Replace use of deprecated libgtp API pdp_newpdp with new one

Related: OS#2873
Change-Id: I9742b82c382ae2e63f8aff4c5c32e2450059082b
---
M sgsnemu/sgsnemu.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/sgsnemu/sgsnemu.c b/sgsnemu/sgsnemu.c
index 225dc59..36b52fc 100644
--- a/sgsnemu/sgsnemu.c
+++ b/sgsnemu/sgsnemu.c
@@ -1614,7 +1614,7 @@
/* Allocated here. */
/* If create context failes we have to deallocate ourselves. */
/* Otherwise it is deallocated by gtplib */
-   pdp_newpdp(, myimsi, options.nsapi, NULL);
+   gtp_pdp_newpdp(gsn, , myimsi, options.nsapi, NULL);

pdp->peer[0] = [n]; /* FIXME: support v4v6, have 2 peers 
*/
pdp->ipif = tun;/* TODO */

--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14299
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I9742b82c382ae2e63f8aff4c5c32e2450059082b
Gerrit-Change-Number: 14299
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-MessageType: merged


Change in ...osmo-ggsn[master]: ggsn_vty_reference.xml: Update from last code changes

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14358 )

Change subject: ggsn_vty_reference.xml: Update from last code changes
..

ggsn_vty_reference.xml: Update from last code changes

Change-Id: I5de2e5223e4532bbbec77b928fbdecb57ef2bca7
---
M doc/manuals/vty/ggsn_vty_reference.xml
1 file changed, 52 insertions(+), 11 deletions(-)

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



diff --git a/doc/manuals/vty/ggsn_vty_reference.xml 
b/doc/manuals/vty/ggsn_vty_reference.xml
index 7460026..a226f8f 100644
--- a/doc/manuals/vty/ggsn_vty_reference.xml
+++ b/doc/manuals/vty/ggsn_vty_reference.xml
@@ -187,7 +187,7 @@
 
   
 
-
+
   
 
 
@@ -214,6 +214,7 @@
 
 
 
+
 
 
 
@@ -332,14 +333,22 @@
 
   
 
-
+
   
 
 
 
 
-
-
+  
+
+
+  
+
+
+
+
+
+
   
 
 
@@ -351,6 +360,16 @@
 
   
 
+
+  
+
+
+
+
+
+
+  
+
 
   
 
@@ -526,7 +545,7 @@
 
   
 
-
+
   
 
 
@@ -553,6 +572,7 @@
 
 
 
+
 
 
 
@@ -671,14 +691,22 @@
 
   
 
-
+
   
 
 
 
 
-
-
+  
+
+
+  
+
+
+
+
+
+
   
 
 
@@ -690,6 +718,16 @@
 
   
 
+
+  
+
+
+
+
+
+
+  
+
 
   
 
@@ -821,7 +859,8 @@
 
   
 
-
+
+
   
 
 
@@ -1020,7 +1059,7 @@
 
   
 
-
+
   
 
 
@@ -1047,6 +1086,7 @@
 
 
 
+
 
 
 
@@ -1169,10 +1209,11 @@
 
   
 
-
+
   
 
 
+
   
 
   

--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14358
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

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


Change in ...osmo-ggsn[master]: gtp: Make use of new libgtp APIs with multi-gsn support

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14297 )

Change subject: gtp: Make use of new libgtp APIs with multi-gsn support
..

gtp: Make use of new libgtp APIs with multi-gsn support

Drop use of deprecated APIs everywhere in libgtp and use the new ones instead.

Related: OS#2873
Change-Id: Ibf56a063f01d1f95a2a3271416da6e062e85fdfa
---
M gtp/gtp.c
1 file changed, 22 insertions(+), 23 deletions(-)

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



diff --git a/gtp/gtp.c b/gtp/gtp.c
index 84b8844..94c3245 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -156,9 +156,8 @@

for (n = 0; n < PDP_MAXNSAPI; n++) {
if (pdp->secondary_tei[n]) {
-   if (pdp_getgtp1
-   (_pdp,
-pdp->secondary_tei[n])) {
+   if (gtp_pdp_getgtp1(gsn, _pdp,
+pdp->secondary_tei[n])) {
LOGP(DLGTP, LOGL_ERROR,
"Unknown secondary PDP context\n");
continue;
@@ -1150,7 +1149,7 @@
   Protocol Configuration Options */

if (pdp->secondary) {
-   if (pdp_getgtp1(_pdp, pdp->teic_own)) {
+   if (gtp_pdp_getgtp1(gsn, _pdp, pdp->teic_own)) {
LOGP(DLGTP, LOGL_ERROR,
"Unknown linked PDP context: %u\n", 
pdp->teic_own);
return EOF;
@@ -1430,7 +1429,7 @@
if (!gtpie_gettv1(ie, GTPIE_NSAPI, 1, _nsapi)) {

/* Find the primary PDP context */
-   if (pdp_getgtp1(_pdp, get_tei(pack))) {
+   if (gtp_pdp_getgtp1(gsn, _pdp, get_tei(pack))) {
gsn->incorrect++;
GTP_LOGPKG(LOGL_ERROR, peer,
pack, len,
@@ -1613,9 +1612,9 @@
in_addr2gsna(>gsnlc, >gsnc);
in_addr2gsna(>gsnlu, >gsnu);

-   DEBUGP(DLGTP, "gtp_create_pdp_ind: Before pdp_tidget\n");
+   DEBUGP(DLGTP, "gtp_create_pdp_ind: Before gtp_pdp_tidget\n");

-   if (!pdp_getimsi(_old, pdp->imsi, pdp->nsapi)) {
+   if (!gtp_pdp_getimsi(gsn, _old, pdp->imsi, pdp->nsapi)) {
/* Found old pdp with same tid. Now the voodoo begins! */
/* 09.60 / 29.060 allows create on existing context to "steal" 
*/
/* the context which was allready established */
@@ -1709,7 +1708,7 @@
return EOF;

/* Find the context in question */
-   if (pdp_getgtp1(, get_tei(pack))) {
+   if (gtp_pdp_getgtp1(gsn, , get_tei(pack))) {
gsn->err_unknownpdp++;
GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
"Unknown PDP context: %u\n", get_tei(pack));
@@ -2091,7 +2090,7 @@
pdp_set_imsi_nsapi(pdp, tid);

/* Find the context in question */
-   if (pdp_getimsi(, imsi, nsapi)) {
+   if (gtp_pdp_getimsi(gsn, , imsi, nsapi)) {
gsn->err_unknownpdp++;
GTP_LOGPKG(LOGL_ERROR, peer, pack,
len, "Unknown PDP context\n");
@@ -2113,7 +2112,7 @@
/* IMSI (conditional) */
if (gtpie_gettv0(ie, GTPIE_IMSI, 0, , sizeof(imsi))) {
/* Find the context in question */
-   if (pdp_getgtp1(, get_tei(pack))) {
+   if (gtp_pdp_getgtp1(gsn, , get_tei(pack))) {
gsn->err_unknownpdp++;
GTP_LOGPKG(LOGL_ERROR, peer,
pack, len, "Unknown PDP context: %u\n",
@@ -2124,7 +2123,7 @@
}
} else {
/* Find the context in question */
-   if (pdp_getimsi(, imsi, nsapi)) {
+   if (gtp_pdp_getimsi(gsn, , imsi, nsapi)) {
gsn->err_unknownpdp++;
GTP_LOGPKG(LOGL_ERROR, peer,
pack, len, "Unknown PDP context\n");
@@ -2290,7 +2289,7 @@
return EOF;

/* Find the context in question */
-   if (pdp_getgtp1(, get_tei(pack))) {
+   if (gtp_pdp_getgtp1(gsn, , get_tei(pack))) {
gsn->err_unknownpdp++;
GTP_LOGPKG(LOGL_ERROR, peer, pack, len,
"Unknown PDP context: %u\n", get_tei(pack));
@@ -2391,7 +2390,7 @@
 {
struct pdp_t *linked_pdp;

-   if 

Change in ...osmo-ggsn[master]: gtp: Introduce new pdp APIs (and deprecate old ones) to support multi...

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14296 )

Change subject: gtp: Introduce new pdp APIs (and deprecate old ones) to support 
multiple GSN
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14296
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I653cbdc185165592d985e3efab6e3f1add97877b
Gerrit-Change-Number: 14296
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 18:46:45 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: gtp: Make use of new libgtp APIs with multi-gsn support

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14297 )

Change subject: gtp: Make use of new libgtp APIs with multi-gsn support
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14297
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ibf56a063f01d1f95a2a3271416da6e062e85fdfa
Gerrit-Change-Number: 14297
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 18:46:47 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: sgsnemu: Replace use of deprecated libgtp API pdp_newpdp with new one

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14299 )

Change subject: sgsnemu: Replace use of deprecated libgtp API pdp_newpdp with 
new one
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14299
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I9742b82c382ae2e63f8aff4c5c32e2450059082b
Gerrit-Change-Number: 14299
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Comment-Date: Tue, 04 Jun 2019 18:46:41 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: ggsn_vty_reference.xml: Update from last code changes

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14358 )

Change subject: ggsn_vty_reference.xml: Update from last code changes
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14358
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I5de2e5223e4532bbbec77b928fbdecb57ef2bca7
Gerrit-Change-Number: 14358
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 18:46:49 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: ggsn: vty: Require ggsn param in cmd

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14298 )

Change subject: ggsn: vty: Require ggsn param in  cmd
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14298
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I8357e20076348c8ded5e9f5b8e7252566b0fbfea
Gerrit-Change-Number: 14298
Gerrit-PatchSet: 4
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 18:46:51 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: gtp: Introduce new pdp APIs (and deprecate old ones) to support multi...

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14296 )

Change subject: gtp: Introduce new pdp APIs (and deprecate old ones) to support 
multiple GSN
..

gtp: Introduce new pdp APIs (and deprecate old ones) to support multiple GSN

Move static global pdp storage arrays to be per GSN. This way now
several GSN per process are supported without collisions.

* pdp_init() is defined in public API but it's actually only intended
for use (and currently only used) internally in gtp_new(). So let's
document that and re-use it for backward compatibility with now
deprecated API, where only one GSN per process is supported.

* Back pointer to gsn_t (pdp->gsn) moved from gtp.c:gtp_new() to
gtp_pdp_newpdp(), since it makes more sense to have it there. This way
backpointer is always set, even in case were app calls pdp_newpdp() API
directly instead of creating them through gtp.c, like osmo-sgsn does.

* Create new versions of required APIs with a pointer to gsn_t where the
pdp ctx is to be created/found. Some APIs receiving a pointer to a pdp
ctx can be left intact because we have a backpointer to its gsn_t.

* pdp_getpdp() is nowhere used, and makes little sense now that we have
pdpa reachable in gsn->pdpa, so let's deprecate it without adding a
replacement.

* Deprecate gtp.h gtp_newpdp(), since it's nowhere used and useless
(does same as new gtp_pdp_newpdp() and doesn't allow for old_pdp to be
passed as parameter).

Fixes: OS#2873
Change-Id: I653cbdc185165592d985e3efab6e3f1add97877b
---
M TODO-RELEASE
M gtp/gtp.c
M gtp/gtp.h
M gtp/pdp.c
M gtp/pdp.h
5 files changed, 90 insertions(+), 37 deletions(-)

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



diff --git a/TODO-RELEASE b/TODO-RELEASE
index d0852fc..a3d63ac 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,6 @@
 # If any interfaces have been added since the last public release: c:r:a + 1.
 # If any interfaces have been removed or changed since the last public 
release: c:r:0.
 #library   whatdescription / commit summary line
+libgtp Several new APIs added  see I653cbdc185165592d985e3efab6e3f1add97877b
+libgtp API (non-used externally) pdp_init modified see 
I653cbdc185165592d985e3efab6e3f1add97877b
+libgtp Several pdp_* APIs marked as deprecated see 
I653cbdc185165592d985e3efab6e3f1add97877b
diff --git a/gtp/gtp.c b/gtp/gtp.c
index 2b14026..84b8844 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -131,16 +131,12 @@
{ 0, NULL }
 };

-/* gtp_new */
-/* gtp_free */
-
+/* Deprecated, use gtp_pdp_newpdp() instead */
 int gtp_newpdp(struct gsn_t *gsn, struct pdp_t **pdp,
   uint64_t imsi, uint8_t nsapi)
 {
int rc;
-   rc = pdp_newpdp(pdp, imsi, nsapi, NULL);
-   if (!rc && *pdp)
-   (*pdp)->gsn = gsn;
+   rc = gtp_pdp_newpdp(gsn, pdp, imsi, nsapi, NULL);
return rc;
 }

@@ -849,7 +845,7 @@
queue_new(&(*gsn)->queue_resp);

/* Initialise pdp table */
-   pdp_init();
+   pdp_init(*gsn);

/* Initialise call back functions */
(*gsn)->cb_create_context_ind = 0;
@@ -1681,9 +1677,7 @@
}
}

-   pdp_newpdp(, pdp->imsi, pdp->nsapi, pdp);
-   if (pdp)
-   pdp->gsn = gsn;
+   gtp_pdp_newpdp(gsn, , pdp->imsi, pdp->nsapi, pdp);

/* Callback function to validate login */
if (gsn->cb_create_context_ind != 0)
diff --git a/gtp/gtp.h b/gtp/gtp.h
index ec6aef3..c2c5122 100644
--- a/gtp/gtp.h
+++ b/gtp/gtp.h
@@ -15,6 +15,8 @@
 #include 
 #include 

+#include "pdp.h"
+
 #define GTP_MODE_GGSN 1
 #define GTP_MODE_SGSN 2

@@ -263,6 +265,9 @@
struct queue_t *queue_req;  /* Request queue */
struct queue_t *queue_resp; /* Response queue */

+   struct pdp_t pdpa[PDP_MAX]; /* PDP storage */
+   struct pdp_t *hashtid[PDP_MAX]; /* Hash table for IMSI + NSAPI */
+
/* Call back functions */
int (*cb_delete_context) (struct pdp_t *);
int (*cb_create_context_ind) (struct pdp_t *);
@@ -307,7 +312,7 @@
 extern int gtp_free(struct gsn_t *gsn);

 extern int gtp_newpdp(struct gsn_t *gsn, struct pdp_t **pdp,
- uint64_t imsi, uint8_t nsapi);
+ uint64_t imsi, uint8_t nsapi) OSMO_DEPRECATED("Use 
gtp_pdp_newpdp() instead");
 extern int gtp_freepdp(struct gsn_t *gsn, struct pdp_t *pdp);
 extern int gtp_freepdp_teardown(struct gsn_t *gsn, struct pdp_t *pdp);

diff --git a/gtp/pdp.c b/gtp/pdp.c
index a5146e9..d745916 100644
--- a/gtp/pdp.c
+++ b/gtp/pdp.c
@@ -33,13 +33,6 @@
 #include "lookupa.h"

 /* ***
- * Global variables TODO: most should be moved to gsn_t
- */
-
-static struct pdp_t pdpa[PDP_

Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix name of f_trx_fake_toffs256()

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14371 )

Change subject: BTS_Tests.ttcn: fix name of f_trx_fake_toffs256()
..

BTS_Tests.ttcn: fix name of f_trx_fake_toffs256()

Change-Id: I83a1d68ffbfc4d588e143fecc62517baac9b31af
---
M bts/BTS_Tests.ttcn
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 98d439a..e10d967 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -491,7 +491,7 @@
ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, 
valueof(ts_TRXC_FAKE_RSSI(rssi)));
 }

-private function f_trx_fake_toffs256(int16_t toffs256) runs on ConnHdlr {
+private function f_trxc_fake_toffs256(int16_t toffs256) runs on ConnHdlr {
var TrxcMessage ret;
ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, 
valueof(ts_TRXC_FAKE_TIMING(toffs256)));
 }
@@ -1863,7 +1863,7 @@

if (mp_bts_trxc_port != -1) {
f_trxc_fake_rssi(rxlev2dbm(mp_ul_rxlev_exp));
-   f_trx_fake_toffs256(g_pars.l1_pars.timing_offset_256syms);
+   f_trxc_fake_toffs256(g_pars.l1_pars.timing_offset_256syms);
}

f_est_dchan();
@@ -2031,7 +2031,7 @@
RSL.clear;

/* tell fake_trx to use a given timing offset for all bursts */
-   f_trx_fake_toffs256(ta_to_test*256);
+   f_trxc_fake_toffs256(ta_to_test*256);

f_est_dchan(more_ies :={valueof(t_RSL_IE(RSL_IE_TIMING_ADVANCE, 
RSL_IE_Body:{timing_adv := ta_to_test}))} );


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14371
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I83a1d68ffbfc4d588e143fecc62517baac9b31af
Gerrit-Change-Number: 14371
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: correct error messages about TRXC connection

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14369 )

Change subject: BTS_Tests.ttcn: correct error messages about TRXC connection
..

BTS_Tests.ttcn: correct error messages about TRXC connection

Change-Id: Ie3dbe925b8840c0c8d8047ee5878fcdaa1395ab3
---
M bts/BTS_Tests.ttcn
1 file changed, 6 insertions(+), 2 deletions(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index e48c05a..ba67889 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -465,7 +465,9 @@
res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BTS_TRXC, 
mp_bts_trxc_ip, mp_bts_trxc_port,
"", -1, -1, {udp:={}}, 
{});
if (not ispresent(res.connId)) {
-   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Could not 
connect to trx-control interface of trxcon, check your configuration");
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Could not connect to the control 
(TRXC) interface " &
+   "of FakeTRX, check your configuration");
}
g_bts_trxc_conn_id := res.connId;
 }
@@ -1436,7 +1438,9 @@
res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(BTS_TRXC, 
mp_bts_trxc_ip, mp_bts_trxc_port,
"", -1, -1, {udp:={}}, 
{});
if (not ispresent(res.connId)) {
-   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Could not 
connect to trx-control interface of trxcon, check your configuration");
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Could not connect to the control 
(TRXC) interface " &
+   "of FakeTRX, check your configuration");
}
g_bts_trxc_conn_id := res.connId;
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14369
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie3dbe925b8840c0c8d8047ee5878fcdaa1395ab3
Gerrit-Change-Number: 14369
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370 )

Change subject: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and 
ConnHdlr
..

BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

Before this patch, sending special TRXC commands to FakeTRX, such as
FAKE_TOA and FAKE_RSSI, from ConnHdlr resulted in a receive timeout
waiting for the response.

As it turned out, both the test_CT and the ConnHdlr have a TRXC port,
as depending on the test one would want to globally control it
from test_CT or from within a ConnHdlr.

However, only one of the two should be active (connected) at any given
point in time. Otherwise we'll have two UDP sockets on the same bind
port, and it's more or less random on which of them it ends up.

Let's add an optional parameter 'trxc_comp', which would indicate
whether we need to control TRXC from ConnHdlr or not.

Let's get rid of both f_trxc_connect() and f_main_trxc_connect(),
which basically do the same, but run on different components.

Change-Id: Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1
Closes: OS#4039
---
M bts/BTS_Tests.ttcn
1 file changed, 37 insertions(+), 37 deletions(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index ba67889..50aaee7 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -117,7 +117,7 @@
/* L1CTL port (for classic tests) */
port L1CTL_PT L1CTL;

-   /* TRXC port (for classic tests) */
+   /* Optional TRXC connection to FakeTRX (BTS side) */
port TRXC_CODEC_PT BTS_TRXC;
var integer g_bts_trxc_conn_id;

@@ -160,6 +160,7 @@
 type component ConnHdlr extends RSL_DchanHdlr, lapdm_test_CT {
port L1CTL_PT L1CTL;

+   /* Optional TRXC connection to FakeTRX (BTS side) */
port TRXC_CODEC_PT BTS_TRXC;
var integer g_bts_trxc_conn_id;

@@ -333,6 +334,20 @@
}
 }

+private function f_init_trxc(TRXC_CODEC_PT pt, charstring id,
+out integer trxc_conn_id) {
+   var Result res;
+
+   res := TRXC_CodecPort_CtrlFunct.f_IPL4_connect(pt, mp_bts_trxc_ip, 
mp_bts_trxc_port,
+  "", -1, -1, { udp := {} 
}, {});
+   if (not ispresent(res.connId)) {
+   Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
+   "Could not connect to the control 
(TRXC) interface " &
+   "of FakeTRX, check your configuration");
+   }
+   trxc_conn_id := res.connId;
+}
+
 /* global init function */
 function f_init() runs on test_CT {
var charstring id := testcasename();
@@ -398,8 +413,12 @@

if (mp_bts_trxc_port != -1) {
var TrxcMessage ret;
+
+   /* Init TRXC interface to FakeTRX */
+   map(self:BTS_TRXC, system:BTS_TRXC);
+   f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id);
+
/* start with a default moderate timing offset equalling TA=2 */
-   f_main_trxc_connect();
ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, 
valueof(ts_TRXC_FAKE_TIMING(2*256)));
}

@@ -417,7 +436,9 @@
 type function void_fn(charstring id) runs on ConnHdlr;

 /* create a new test component */
-function f_start_handler(void_fn fn, ConnHdlrPars pars, boolean pcu_comp := 
false)
+function f_start_handler(void_fn fn, ConnHdlrPars pars,
+boolean pcu_comp := false,
+boolean trxc_comp := false)
 runs on test_CT return ConnHdlr {
var charstring id := testcasename();
var ConnHdlr vc_conn;
@@ -426,13 +447,18 @@
/* connect to RSL Emulation main component */
connect(vc_conn:RSL, vc_RSL:CLIENT_PT);
connect(vc_conn:RSL_PROC, vc_RSL:RSL_PROC);
+
+   /* The ConnHdlr component may want to talk to some ports directly,
+* so we disconnect it from the test_CT and connect it to the component.
+* This obviously only works for one component, i.e. no concurrency. */
if (pcu_comp) {
-   /* the ConnHdlr component wants to talk directly to the PCU, so 
disconnect
-* it from the test_CT and connect it to the component.  This 
obviously only
-* works for one component, i.e. no concurrency */
unmap(self:PCU, system:PCU);
map(vc_conn:PCU, system:PCU);
}
+   if (trxc_comp) {
+   unmap(self:BTS_TRXC, system:BTS_TRXC);
+   map(vc_conn:BTS_TRXC, system:BTS_TRXC);
+   }

vc_conn.start(f_handler_init(fn, id, pars));
return vc_conn;
@@ -459,19 +485,6 @@
f_L1CTL_FBSB(L1CTL, { false, mp_trx

Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: indicate default RSSI=-60 to FakeTRX

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14375 )

Change subject: BTS_Tests.ttcn: indicate default RSSI=-60 to FakeTRX
..

BTS_Tests.ttcn: indicate default RSSI=-60 to FakeTRX

Change-Id: Ib13e3f8d9fbcd2722c6522a1bb5c513e34adfb18
---
M bts/BTS_Tests.ttcn
1 file changed, 2 insertions(+), 1 deletion(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 50aaee7..98d439a 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -418,8 +418,9 @@
map(self:BTS_TRXC, system:BTS_TRXC);
f_init_trxc(BTS_TRXC, id, g_bts_trxc_conn_id);

-   /* start with a default moderate timing offset equalling TA=2 */
+   /* Start with a default moderate timing offset equalling TA=2, 
and RSSI=-60 */
ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, 
valueof(ts_TRXC_FAKE_TIMING(2*256)));
+   ret := f_TRXC_transceive(BTS_TRXC, g_bts_trxc_conn_id, 
valueof(ts_TRXC_FAKE_RSSI(-60)));
}

/* Wait some extra time to make sure the BTS emits a stable carrier.

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14375
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib13e3f8d9fbcd2722c6522a1bb5c513e34adfb18
Gerrit-Change-Number: 14375
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and ConnHdlr

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370 )

Change subject: BTS_Tests.ttcn: fix TRXC port mapping between test_CT and 
ConnHdlr
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14370
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie7d311bf8f03bf9b1d29b5bb28ffad793f215fd1
Gerrit-Change-Number: 14370
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 04 Jun 2019 18:46:00 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...docker-playground[master]: ttcn3-bts-tests: Add BTS_Tests_LAPDm.control to config file

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/docker-playground/+/14376 )

Change subject: ttcn3-bts-tests: Add BTS_Tests_LAPDm.control to config file
..


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


--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/14376
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I3bfb4483f39d4dbf3f506f86470e4f2d3b6b7af2
Gerrit-Change-Number: 14376
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Comment-Date: Tue, 04 Jun 2019 16:36:42 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...docker-playground[master]: ttcn3-bts-tests: Add BTS_Tests_LAPDm.control to config file

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/docker-playground/+/14376 )

Change subject: ttcn3-bts-tests: Add BTS_Tests_LAPDm.control to config file
..

ttcn3-bts-tests: Add BTS_Tests_LAPDm.control to config file

There's a number of new tests that aren't executed yet.

Change-Id: I3bfb4483f39d4dbf3f506f86470e4f2d3b6b7af2
---
M ttcn3-bts-test/BTS_Tests.cfg
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/ttcn3-bts-test/BTS_Tests.cfg b/ttcn3-bts-test/BTS_Tests.cfg
index 9567845..7e734c8 100644
--- a/ttcn3-bts-test/BTS_Tests.cfg
+++ b/ttcn3-bts-test/BTS_Tests.cfg
@@ -20,3 +20,4 @@
 [EXECUTE]
 BTS_Tests.control
 BTS_Tests_SMSCB.control
+BTS_Tests_LAPDm.control

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/14376
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I3bfb4483f39d4dbf3f506f86470e4f2d3b6b7af2
Gerrit-Change-Number: 14376
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-MessageType: merged


Change in ...osmo-bts[master]: bts-trx: trx_if.c: Introduce logging macro LOGPPHI

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/14373 )

Change subject: bts-trx: trx_if.c: Introduce logging macro LOGPPHI
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/14373
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5b17a01638ade9a6c41da73e550d5947fa92f568
Gerrit-Change-Number: 14373
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 16:36:20 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-bts[master]: bts-trx: trx_if.c: Introduce logging macro LOGPPHI

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/14373 )

Change subject: bts-trx: trx_if.c: Introduce logging macro LOGPPHI
..

bts-trx: trx_if.c: Introduce logging macro LOGPPHI

This way we unify format. We take the chance to add related information
to some log messages which were not printing that information (and was
confusing when using more than one phy instance).

Change-Id: I5b17a01638ade9a6c41da73e550d5947fa92f568
---
M include/osmo-bts/phy_link.h
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/trx_if.c
3 files changed, 38 insertions(+), 44 deletions(-)

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



diff --git a/include/osmo-bts/phy_link.h b/include/osmo-bts/phy_link.h
index 812f186..273103c 100644
--- a/include/osmo-bts/phy_link.h
+++ b/include/osmo-bts/phy_link.h
@@ -173,3 +173,5 @@
 }

 int bts_model_phy_link_open(struct phy_link *plink);
+
+#define LOGPPHI(pinst, section, lvl, fmt, args...) LOGP(section, lvl, "%s: " 
fmt, phy_instance_name(pinst), ##args)
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index 290ceee..e6e384a 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -159,20 +159,20 @@
enum gsm_phys_chan_config pchan;

if (tn >= TRX_NR_TS) {
-   LOGP(DL1C, LOGL_ERROR, "transceiver (%s) SETSLOT invalid param 
TN (%" PRIu8 ")\n",
-phy_instance_name(pinst), tn);
+   LOGPPHI(pinst, DL1C, LOGL_ERROR, "transceiver SETSLOT invalid 
param TN (%" PRIu8 ")\n",
+   tn);
return;
}

pchan = transceiver_chan_type_2_pchan(type);
if (pchan == GSM_PCHAN_UNKNOWN) {
-   LOGP(DL1C, LOGL_ERROR, "transceiver (%s) SETSLOT invalid param 
TS_TYPE (%" PRIu8 ")\n",
-phy_instance_name(pinst), type);
+   LOGPPHI(pinst, DL1C, LOGL_ERROR, "transceiver SETSLOT invalid 
param TS_TYPE (%" PRIu8 ")\n",
+   type);
return;
}

ts = >ts[tn];
-   LOGP(DL1C, LOGL_DEBUG, "%s l1if_setslot_cb(as_pchan=%s),"
+   LOGPPHI(pinst, DL1C, LOGL_DEBUG, "%s l1if_setslot_cb(as_pchan=%s),"
 " calling cb_ts_connected(rc=%d)\n",
 gsm_ts_name(ts), gsm_pchan_name(pchan), rc);
cb_ts_connected(ts, rc);
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index ec879c7..2805260 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -155,7 +155,7 @@
len = snprintf(buf, sizeof(buf), "CMD %s%s%s", tcm->cmd, 
tcm->params_len ? " ":"", tcm->params);
OSMO_ASSERT(len < sizeof(buf));
 
-   LOGP(DTRX, LOGL_DEBUG, "Sending control '%s' to %s\n", buf, 
phy_instance_name(l1h->phy_inst));
+   LOGPPHI(l1h->phy_inst, DTRX, LOGL_DEBUG, "Sending control '%s'\n", buf);
/* send command */
send(l1h->trx_ofd_ctrl.fd, buf, len+1, 0);

@@ -173,8 +173,7 @@
OSMO_ASSERT(!llist_empty(>trx_ctrl_list));
tcm = llist_entry(l1h->trx_ctrl_list.next, struct trx_ctrl_msg, list);

-   LOGP(DTRX, LOGL_NOTICE, "No satisfactory response from transceiver for 
%s (CMD %s%s%s)\n",
-   phy_instance_name(l1h->phy_inst),
+   LOGPPHI(l1h->phy_inst, DTRX, LOGL_NOTICE, "No satisfactory response 
from transceiver(CMD %s%s%s)\n",
tcm->cmd, tcm->params_len ? " ":"", tcm->params);

trx_ctrl_send(l1h);
@@ -208,8 +207,8 @@

if (!transceiver_available &&
!(!strcmp(cmd, "POWEROFF") || !strcmp(cmd, "POWERON"))) {
-   LOGP(DTRX, LOGL_ERROR, "CTRL %s ignored: No clock from "
-"transceiver, please fix!\n", cmd);
+   LOGPPHI(l1h->phy_inst, DTRX, LOGL_ERROR, "CTRL %s ignored: No 
clock from "
+   "transceiver, please fix!\n", cmd);
return -EIO;
}

@@ -241,7 +240,7 @@

if (!pending ||
!(strcmp(tcm->cmd, prev->cmd) == 0 && strcmp(tcm->params, 
prev->params) == 0)) {
-   LOGP(DTRX, LOGL_INFO, "Enqueuing TRX control command 'CMD 
%s%s%s'\n",
+   LOGPPHI(l1h->phy_inst, DTRX, LOGL_INFO, "Enqueuing TRX control 
command 'CMD %s%s%s'\n",
tcm->cmd, tcm->params_len ? " ":"", tcm->params);
llist_add_tail(>list, >trx_ctrl_list);
}
@@ -449,14 +448,13 @@
unsigned int tn, ts_type;

if (rsp->status)
-   LOGP(DTRX, LOGL_E

Change in ...osmo-ggsn[master]: gtp: Make use of new libgtp APIs with multi-gsn support

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14297 )

Change subject: gtp: Make use of new libgtp APIs with multi-gsn support
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14297
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ibf56a063f01d1f95a2a3271416da6e062e85fdfa
Gerrit-Change-Number: 14297
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 16:35:46 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...docker-playground[master]: ttcn3-bts-tests: Add BTS_Tests_LAPDm.control to config file

2019-06-04 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/docker-playground/+/14376


Change subject: ttcn3-bts-tests: Add BTS_Tests_LAPDm.control to config file
..

ttcn3-bts-tests: Add BTS_Tests_LAPDm.control to config file

There's a number of new tests that aren't executed yet.

Change-Id: I3bfb4483f39d4dbf3f506f86470e4f2d3b6b7af2
---
M ttcn3-bts-test/BTS_Tests.cfg
1 file changed, 1 insertion(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground 
refs/changes/76/14376/1

diff --git a/ttcn3-bts-test/BTS_Tests.cfg b/ttcn3-bts-test/BTS_Tests.cfg
index 9567845..7e734c8 100644
--- a/ttcn3-bts-test/BTS_Tests.cfg
+++ b/ttcn3-bts-test/BTS_Tests.cfg
@@ -20,3 +20,4 @@
 [EXECUTE]
 BTS_Tests.control
 BTS_Tests_SMSCB.control
+BTS_Tests_LAPDm.control

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/14376
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I3bfb4483f39d4dbf3f506f86470e4f2d3b6b7af2
Gerrit-Change-Number: 14376
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-MessageType: newchange


Change in ...osmo-bts[master]: l1sap: Compute statistics on FN advance in PH-RTS.ind

2019-06-04 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-bts/+/14336

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

Change subject: l1sap: Compute statistics on FN advance in PH-RTS.ind
..

l1sap: Compute statistics on FN advance in PH-RTS.ind

Let's keep some statistics about the min/max/average frame number
advance that we're observing above L1SAP when comparing the time in the
PH-RTS.ind and the frame number we observe in PH-DATA.ind of data
that was received on the uplink.

The statistics are currently only shown in the VTY, but this is a
precursor to using them to correctly advance the LAPDm timers in a
follow-up patch.

Change-Id: I8f739fdb808a614f080afbc4654641ec3df19eb2
Related: OS#2294
Related: OS#3906
---
M include/osmo-bts/bts.h
M include/osmo-bts/gsm_data_shared.h
M src/common/bts.c
M src/common/l1sap.c
M src/common/vty.c
5 files changed, 46 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/36/14336/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/14336
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I8f739fdb808a614f080afbc4654641ec3df19eb2
Gerrit-Change-Number: 14336
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in ...osmo-bts[master]: common/scheduler.c: refactor description of TRXC_* lchans

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/14322 )

Change subject: common/scheduler.c: refactor description of TRXC_* lchans
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/14322
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I9d5d49ec569f133d37b8164b22607d4700474315
Gerrit-Change-Number: 14322
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:31:17 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: gsm0808_utils: Add gsm0808_decode_cell_id_u()

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/13888 )

Change subject: gsm0808_utils: Add gsm0808_decode_cell_id_u()
..

gsm0808_utils: Add gsm0808_decode_cell_id_u()

This function parses a single Cell ID list element into a
'union gsm0808_cell_id_u'.  This function is going to be used
by the upcoming CBSP support.

Related: OS#3537
Change-Id: I08b33881667aa32f01e53ccb70d44d5b79c7c986
---
M include/osmocom/gsm/gsm0808_utils.h
M src/gsm/gsm0808_utils.c
M src/gsm/libosmogsm.map
3 files changed, 60 insertions(+), 11 deletions(-)

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



diff --git a/include/osmocom/gsm/gsm0808_utils.h 
b/include/osmocom/gsm/gsm0808_utils.h
index 9cfaea6..76db2b6 100644
--- a/include/osmocom/gsm/gsm0808_utils.h
+++ b/include/osmocom/gsm/gsm0808_utils.h
@@ -94,6 +94,7 @@
  const struct osmo_cell_global_id *cgi);
 int gsm0808_cell_id_to_cgi(struct osmo_cell_global_id *cgi, const struct 
gsm0808_cell_id *cid);
 void gsm0808_msgb_put_cell_id_u(struct msgb *msg, enum CELL_IDENT id_discr, 
const union gsm0808_cell_id_u *u);
+int gsm0808_decode_cell_id_u(union gsm0808_cell_id_u *out, enum CELL_IDENT 
discr, const uint8_t *buf, unsigned int len);

 uint8_t gsm0808_enc_cause(struct msgb *msg, uint16_t cause);
 uint8_t gsm0808_enc_aoip_trasp_addr(struct msgb *msg,
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 70eed15..afff59a 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -193,6 +193,17 @@

 #endif /* HAVE_SYS_SOCKET_H */

+/* Decode 5-byte LAI list element data (see TS 08.08 3.2.2.27) into 
MCC/MNC/LAC. */
+static void decode_lai(const uint8_t *data, struct osmo_location_area_id 
*decoded)
+{
+   struct gsm48_loc_area_id lai;
+
+   /* Copy data to stack to prevent unaligned access in 
gsm48_decode_lai2(). */
+   memcpy(, data, sizeof(lai)); /* don't byte swap yet */
+
+   gsm48_decode_lai2(, decoded);
+}
+
 /* Helper function for gsm0808_enc_speech_codec()
  * and gsm0808_enc_speech_codec_list() */
 static uint8_t enc_speech_codec(struct msgb *msg,
@@ -756,6 +767,53 @@
return (int)(elem - old_elem);
 }

+/*! Decode a single GSM 08.08 Cell ID list element payload
+ *  \param[out] out caller-provided output union
+ *  \param[in] discr Cell ID discriminator describing type to be decoded
+ *  \param[in] buf User-provided input buffer containing binary Cell ID list 
element
+ *  \param[in] len Length of buf
+ *  \returns 0 on success; negative on error */
+int gsm0808_decode_cell_id_u(union gsm0808_cell_id_u *out, enum CELL_IDENT 
discr, const uint8_t *buf, unsigned int len)
+{
+   switch (discr) {
+   case CELL_IDENT_WHOLE_GLOBAL:
+   if (len < 7)
+   return -EINVAL;
+   decode_lai(buf, >global.lai);
+   out->global.cell_identity = osmo_load16be(buf + sizeof(struct 
gsm48_loc_area_id));
+   break;
+   case CELL_IDENT_LAC_AND_CI:
+   if (len < 4)
+   return -EINVAL;
+   out->lac_and_ci.lac = osmo_load16be(buf);
+   out->lac_and_ci.ci = osmo_load16be(buf + sizeof(uint16_t));
+   break;
+   case CELL_IDENT_CI:
+   if (len < 2)
+   return -EINVAL;
+   out->ci = osmo_load16be(buf);
+   break;
+   case CELL_IDENT_LAI_AND_LAC:
+   if (len < 5)
+   return -EINVAL;
+   decode_lai(buf, >lai_and_lac);
+   break;
+   case CELL_IDENT_LAC:
+   if (len < 2)
+   return -EINVAL;
+   out->lac = osmo_load16be(buf);
+   break;
+   case CELL_IDENT_BSS:
+   case CELL_IDENT_NO_CELL:
+   /* Does not have any list items */
+   break;
+   default:
+   /* Remaining cell identification types are not implemented. */
+   return -EINVAL;
+   }
+   return 0;
+}
+
 void gsm0808_msgb_put_cell_id_u(struct msgb *msg, enum CELL_IDENT id_discr, 
const union gsm0808_cell_id_u *u)
 {
switch (id_discr) {
@@ -865,17 +923,6 @@
return *tlv_len + 2;
 }

-/* Decode 5-byte LAI list element data (see TS 08.08 3.2.2.27) into 
MCC/MNC/LAC. */
-static void decode_lai(const uint8_t *data, struct osmo_location_area_id 
*decoded)
-{
-   struct gsm48_loc_area_id lai;
-
-   /* Copy data to stack to prevent unaligned access in 
gsm48_decode_lai2(). */
-   memcpy(, data, sizeof(lai)); /* don't byte swap yet */
-
-   gsm48_decode_lai2(, decoded);
-}
-
 static int parse_cell_id_global_list(struct gsm0808_cell_id_list2 *cil, const 
uint8_t *data, size_t remain,
 size_t *consumed)
 {
diff --git a/src/gsm/lib

Change in ...libosmocore[master]: gsm0808_utils: Add gsm0808_decode_cell_id_u()

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/13888 )

Change subject: gsm0808_utils: Add gsm0808_decode_cell_id_u()
..


Patch Set 5: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13888
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I08b33881667aa32f01e53ccb70d44d5b79c7c986
Gerrit-Change-Number: 13888
Gerrit-PatchSet: 5
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:30:47 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: indicate default RSSI=-60 to FakeTRX

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14375 )

Change subject: BTS_Tests.ttcn: indicate default RSSI=-60 to FakeTRX
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14375
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib13e3f8d9fbcd2722c6522a1bb5c513e34adfb18
Gerrit-Change-Number: 14375
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:30:15 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: lms: Fix stream_stats checks with overrun/underrun

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/14368 )

Change subject: lms: Fix stream_stats checks with overrun/underrun
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14368
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I677232a7b12ee83d26aa34d92f76a91d4b5a63a6
Gerrit-Change-Number: 14368
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:29:50 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: lms: Drop unusued variable masterClockRate

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/14367 )

Change subject: lms: Drop unusued variable masterClockRate
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14367
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I19192925d008046f474615a0476b52ddee9a9d78
Gerrit-Change-Number: 14367
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:29:35 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: Rename and move STOP signal from Transceiver to main

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/14366 )

Change subject: Rename and move STOP signal from Transceiver to main
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14366
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: Id4159e64225c6606fef34a74b24f37c3a071aceb
Gerrit-Change-Number: 14366
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:27:03 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-trx[master]: Add rate_ctr support to store/retrieve SDR errors through VTY

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/14167 )

Change subject: Add rate_ctr support to store/retrieve SDR errors through VTY
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/14167
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I78b158141697e5714d04db8b9ccc96f31f34f439
Gerrit-Change-Number: 14167
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:26:41 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: library/TRXC_CodecPort.ttcn: add debug print on Rx / Tx of messages

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14372 )

Change subject: library/TRXC_CodecPort.ttcn: add debug print on Rx / Tx of 
messages
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/14372/2/library/TRXC_CodecPort.ttcn
File library/TRXC_CodecPort.ttcn:

https://gerrit.osmocom.org/#/c/14372/2/library/TRXC_CodecPort.ttcn@31
PS2, Line 31:   log("Rx TRXC message: ", oct2char(pin.msg));
doesn't the IPL4asp_PT log that by itself?  Or, if it doesn't, can't we simply 
enable related logging of it by tuning the logging parameters?  This looks like 
something that we shouldn't [have to] do by hand.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14372
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I04af0043c67c5904d034b60b39ddce44aa4beba9
Gerrit-Change-Number: 14372
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:23:35 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: fix name of f_trx_fake_toffs256()

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14371 )

Change subject: BTS_Tests.ttcn: fix name of f_trx_fake_toffs256()
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14371
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I83a1d68ffbfc4d588e143fecc62517baac9b31af
Gerrit-Change-Number: 14371
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:22:29 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: BTS_Tests.ttcn: correct error messages about TRXC connection

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14369 )

Change subject: BTS_Tests.ttcn: correct error messages about TRXC connection
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14369
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ie3dbe925b8840c0c8d8047ee5878fcdaa1395ab3
Gerrit-Change-Number: 14369
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:21:24 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-bts[master]: bts-trx: trx_if.c: Introduce logging macro LOGPL1H

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/14373 )

Change subject: bts-trx: trx_if.c: Introduce logging macro LOGPL1H
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/14373/1/src/osmo-bts-trx/trx_if.c
File src/osmo-bts-trx/trx_if.c:

https://gerrit.osmocom.org/#/c/14373/1/src/osmo-bts-trx/trx_if.c@61
PS1, Line 61: LOGPL1H
a) this is not "L1 handle" (which is bts model specific) but "phy instance" so 
something like LOGPPHI or the like would be more logical.

b) as phy_instance is common, the macro should be shared wih other backends so 
they can use it, too.



--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/14373
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5b17a01638ade9a6c41da73e550d5947fa92f568
Gerrit-Change-Number: 14373
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-CC: Harald Welte 
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:21:04 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: start-testsuite.sh: do not override LD_LIBRARY_PATH

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14374 )

Change subject: start-testsuite.sh: do not override LD_LIBRARY_PATH
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14374
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I1ec28e8c3081d5de1bea90a7451791ac8cbbd27c
Gerrit-Change-Number: 14374
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria 
Gerrit-Reviewer: Harald Welte 
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 15:19:00 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: gtp: Replace old pdp APIs with new ones with multi-gsn support

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14297 )

Change subject: gtp: Replace old pdp APIs with new ones with multi-gsn support
..


Patch Set 2:

> > Patch Set 2:
 > >
 > > this is about replacing API usage / API calls, right?  It's not
 > changing the actual API implementation?
 >
 > Yes indeed, I prefered splitting into different commits, since
 > anyway I keep backwards compatibility. So first commit adds new
 > APIs (and change implementation of old ones). Then for each user of
 > the API, I add a commit with changes to move to use the new API
 > (libgtp, osmo-ggsn, sgsnemu, osmo-sgsn).

my point is that the commit log message does not reflect that it's about API 
usage.


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14297
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ibf56a063f01d1f95a2a3271416da6e062e85fdfa
Gerrit-Change-Number: 14297
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 14:42:09 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...libosmocore[master]: fsm: Allow millisecond granularity in osmo_fsm built-in timer

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14200 )

Change subject: fsm: Allow millisecond granularity in osmo_fsm built-in timer
..


Set Ready For Review


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14200
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I35b330e460e80bb67376c77e997e464439ac5397
Gerrit-Change-Number: 14200
Gerrit-PatchSet: 6
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 10:13:10 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...libosmocore[master]: fsm: Reduce amount of copy+pasted LOGPFSMSRC() statements

2019-06-04 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14363


Change subject: fsm: Reduce amount of copy+pasted LOGPFSMSRC() statements
..

fsm: Reduce amount of copy+pasted LOGPFSMSRC() statements

Instead of copy+pasting the same LOGPFSMSRC("State change to " ...)
with slightly different trailer depending on the FSM timer, let's first
snprintf() to a stack variable and then have a single log statement.

Change-Id: I49528c4ca1fa11aef09c2092615dccca450b847c
---
M src/fsm.c
1 file changed, 15 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/63/14363/1

diff --git a/src/fsm.c b/src/fsm.c
index 37da9f9..337786d 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -609,33 +609,31 @@
st->onleave(fi, new_state);

if (fsm_log_timeouts) {
+   char trailer[64];
+   trailer[0] = '\0';
if (keep_timer && fi->timer.active) {
/* This should always give us a timeout, but just in 
case the return value indicates error, omit
 * logging the remaining time. */
if (osmo_timer_remaining(>timer, NULL, ))
-   LOGPFSMSRC(fi, file, line,
-  "State change to %s (keeping " 
OSMO_T_FMT ")\n",
-  osmo_fsm_state_name(fsm, new_state),
-  OSMO_T_FMT_ARGS(fi->T));
+   snprintf(trailer, sizeof(trailer), "(keeping " 
OSMO_T_FMT ")",
+OSMO_T_FMT_ARGS(fi->T));
else
-   LOGPFSMSRC(fi, file, line,
-  "State change to %s (keeping " 
OSMO_T_FMT ", %ld.%03lds remaining)\n",
-  osmo_fsm_state_name(fsm, new_state),
-  OSMO_T_FMT_ARGS(fi->T), 
remaining.tv_sec, remaining.tv_usec / 1000);
+   snprintf(trailer, sizeof(trailer), "(keeping " 
OSMO_T_FMT
+ ", %ld.%03lds remaining)", 
OSMO_T_FMT_ARGS(fi->T),
+ remaining.tv_sec, remaining.tv_usec / 
1000);
} else if (timeout_ms) {
-   if (timeout_ms % 1000 == 0) {
+   if (timeout_ms % 1000 == 0)
/* keep log output legacy compatible to avoid 
autotest failures */
-   LOGPFSMSRC(fi, file, line, "State change to %s 
(" OSMO_T_FMT ", %lus)\n",
-  osmo_fsm_state_name(fsm, new_state),
+   snprintf(trailer, sizeof(trailer), "(" 
OSMO_T_FMT ", %lus)",
   OSMO_T_FMT_ARGS(T), timeout_ms/1000);
-   } else {
-   LOGPFSMSRC(fi, file, line, "State change to %s 
(" OSMO_T_FMT ", %lums)\n",
-  osmo_fsm_state_name(fsm, new_state),
+   else
+   snprintf(trailer, sizeof(trailer), "(" 
OSMO_T_FMT ", %lums)",
   OSMO_T_FMT_ARGS(T), timeout_ms);
-   }
} else
-   LOGPFSMSRC(fi, file, line, "State change to %s (no 
timeout)\n",
-  osmo_fsm_state_name(fsm, new_state));
+   snprintf(trailer, sizeof(trailer), "(no timeout)");
+
+   LOGPFSMSRC(fi, file, line, "State change to %s %s\n",
+  osmo_fsm_state_name(fsm, new_state), trailer);
} else {
LOGPFSMSRC(fi, file, line, "state_chg to %s\n",
   osmo_fsm_state_name(fsm, new_state));

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14363
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

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


Change in ...osmo-msc[master]: db_sms_test: Do not print exact memcmp result

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/14357 )

Change subject: db_sms_test: Do not print exact memcmp result
..

db_sms_test: Do not print exact memcmp result

man memcp doesn't define exact values for returned integer, it only
specifices a meaning for the sign of it.
So it happens that different versions/implementations actually return
different values when this test is run, making it fail.
Let's simply drop that info from logs since anyways it's not useful.

Change-Id: I771fb8f4fc56f337b16561d005ff1803a386d1c6
---
M tests/db_sms/db_sms_test.c
M tests/db_sms/db_sms_test.err
2 files changed, 11 insertions(+), 13 deletions(-)

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



diff --git a/tests/db_sms/db_sms_test.c b/tests/db_sms/db_sms_test.c
index a97f7c7..24c86e5 100644
--- a/tests/db_sms/db_sms_test.c
+++ b/tests/db_sms/db_sms_test.c
@@ -357,16 +357,14 @@
rc = memcmp(sms->user_data, test->sms.user_data,
 sizeof(sms->user_data));
if (rc) {
-   LOGPC(DDB, LOGL_ERROR, "TP-User-Data mismatch (diff=%d/%zu)\n",
- rc, sizeof(sms->user_data));
+   LOGPC(DDB, LOGL_ERROR, "TP-User-Data mismatch\n");
return -EINVAL;
}

/* Compare decoded text */
rc = strncmp(sms->text, test->sms.text, sizeof(sms->text));
if (rc) {
-   LOGPC(DDB, LOGL_ERROR, "TP-User-Data (text) mismatch 
(diff=%d/%zu)\n",
- rc, sizeof(sms->text));
+   LOGPC(DDB, LOGL_ERROR, "TP-User-Data (text) mismatch\n");
return -EINVAL;
}

diff --git a/tests/db_sms/db_sms_test.err b/tests/db_sms/db_sms_test.err
index e0a329d..c61b1f4 100644
--- a/tests/db_sms/db_sms_test.err
+++ b/tests/db_sms/db_sms_test.err
@@ -18,15 +18,15 @@
 DDB NOTICE test_db_sms_get('Regular MT SMS'): success, as expected
 DDB NOTICE verify_sms('Regular MT SMS'): match
 DDB NOTICE test_db_sms_get('Complete TP-UD (160 septets, 7-bit encoding)'): 
success, as expected
-DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): 
TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): 
TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Complete TP-UD (140 octets, 8-bit encoding)'): 
success, as expected
-DDB NOTICE verify_sms('Complete TP-UD (140 octets, 8-bit encoding)'): 
TP-User-Data mismatch (diff=-66/256)
+DDB NOTICE verify_sms('Complete TP-UD (140 octets, 8-bit encoding)'): 
TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('TP-UD buffer overflow (UDH-Length > UD-Length)'): 
success, as expected
 DDB NOTICE verify_sms('TP-UD buffer overflow (UDH-Length > UD-Length)'): match
 DDB NOTICE test_db_sms_get('Truncated TP-UD (200 septets, 7-bit encoding)'): 
success, as expected
-DDB NOTICE verify_sms('Truncated TP-UD (200 septets, 7-bit encoding)'): 
TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Truncated TP-UD (200 septets, 7-bit encoding)'): 
TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Truncated TP-UD (255 octets, 8-bit encoding)'): 
success, as expected
-DDB NOTICE verify_sms('Truncated TP-UD (255 octets, 8-bit encoding)'): 
TP-User-Data mismatch (diff=-16896/256)
+DDB NOTICE verify_sms('Truncated TP-UD (255 octets, 8-bit encoding)'): 
TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Same MSISDN #1'): success, as expected
 DDB NOTICE verify_sms('Same MSISDN #1'): match
 DDB NOTICE test_db_sms_get('Same MSISDN #2'): success, as expected
@@ -43,7 +43,7 @@
 DDB DEBUG Marking #1 as delivered: rc=0
 DDB DEBUG Marking #2 as delivered: rc=0
 DDB NOTICE db_sms_get_next_unsent(starting from #1): found
-DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): 
TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): 
TP-User-Data mismatch
 DDB INFO Testing db_sms_delete_sent_message_by_id()...
 DDB NOTICE db_sms_delete_sent_message_by_id(#1, sent): rc=0
 DDB NOTICE db_sms_delete_sent_message_by_id(#3, not sent): rc=0
@@ -57,15 +57,15 @@
 DDB NOTICE test_db_sms_get('Regular MT SMS'): success, as expected
 DDB NOTICE verify_sms('Regular MT SMS'): match
 DDB NOTICE test_db_sms_get('Complete TP-UD (160 septets, 7-bit encoding)'): 
success, as expected
-DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): 
TP-User-Data mismatch (diff=-65/256)
+DDB NOTICE verify_sms('Complete TP-UD (160 septets, 7-bit encoding)'): 
TP-User-Data mismatch
 DDB NOTICE test_db_sms_get('Complete TP-UD (140 octets, 8-bit encoding)'): 
success, as expected
-DDB NOTICE verify_sms('Complete TP-UD (140 octets, 8-bit encoding)'): 
TP-User-Data mismatch (diff=-66/256)
+DDB NOTICE verify_sms('Comp

Change in ...osmo-msc[master]: db_sms_test: Do not print exact memcmp result

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/14357 )

Change subject: db_sms_test: Do not print exact memcmp result
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14357
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I771fb8f4fc56f337b16561d005ff1803a386d1c6
Gerrit-Change-Number: 14357
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:51:31 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Extend LAPDm test suite with a number of new tests

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14341 )

Change subject: bts: Extend LAPDm test suite with a number of new tests
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14341
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I4e1136c0c0f10d5bc8d01e826ae5d92f17a0b2aa
Gerrit-Change-Number: 14341
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:11:36 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Factor out mobile-originated LAPDm establishment

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14348 )

Change subject: bts: Factor out mobile-originated LAPDm establishment
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14348
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8da753bb3d809ec09f9380bb4bac666ceaf61f00
Gerrit-Change-Number: 14348
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:11:53 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Implement testcase for RR response frame loss

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14349 )

Change subject: bts: Implement testcase for RR response frame loss
..


Patch Set 3: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14349
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I32340ffffee0ebfb9b31b55e0982d0d917a1
Gerrit-Change-Number: 14349
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:11:55 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Implement testcase for RR response frame loss

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14349 )

Change subject: bts: Implement testcase for RR response frame loss
..

bts: Implement testcase for RR response frame loss

Test is implemented as BTS_Tests_LAPDm.TC_rr_response_frame_loss()

Change-Id: I32340ffffee0ebfb9b31b55e0982d0d917a1
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 58 insertions(+), 0 deletions(-)

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



diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index 3c39a5a..bf359f2 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -942,6 +942,63 @@
f_testmatrix_each_chan(pars, refers(f_TC_t200_n200));
 }

+/* Ensure BTS repeats RR frame after retransmitting I frame to emulate RR loss;
+   Inspired by TS 51.010-1 25.2.4.3 */
+private function f_TC_rr_response_frame_loss(charstring id) runs on ConnHdlr {
+   var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0));
+   var integer sapi := link_id.sapi;
+   var boolean is_sacch := false;
+   if (link_id.c == SACCH) {
+   is_sacch := true;
+   }
+   timer T := 3.0;
+   var default d;
+
+   fp_common_init();
+
+   /* some common altstep for meas res and other background noise */
+   d := activate(as_ignore_background(true));
+   RSL.clear;
+   LAPDM.clear;
+
+   f_establish_mo(link_id);
+
+   var octetstring l3_mo := f_rnd_octstring(10);
+   /* Send an I frame to the BTS: SAPI = 0, C = 1, P = 0, M = 0, L = 3, 
N(S) = 0, N(R) = 0 */
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_I(sapi, c_r:=cr_MO_CMD, 
p:=false, nr:=0, ns:=0,
+l3:=l3_mo)));
+   RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3_mo));
+   /* SAPI = 0, R = 1, F = 0, M = 0, L = 0, N(R) = 1. */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, c_r:=cr_MT_RSP, 
p:=false, nr:=1)));
+
+   /* Re-send I frame: SAPI = 0, C = 1, P = 1, M = 0, L = 3, N(S) = 0, 
N(R) = 0. */
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_I(sapi, c_r:=cr_MO_CMD, 
p:=true, nr:=0, ns:=0,
+l3:=l3_mo)));
+
+   T.start;
+   alt {
+   /* RR: SAPI = 0, R = 1, F = 1, M = 0, L = 0, N(R) = 1. */
+   [] LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_RR(sapi, 
c_r:=cr_MT_RSP, p:=true, nr:=1))) {
+   setverdict(pass);
+   }
+   /* REJ: SAPI = 0, R = 1, F = 1, M = 0, L = 0, N(R) = 1. */
+   [] LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_REJ(sapi, 
c_r:=cr_MT_RSP, p:=true, nr:=1))) {
+   setverdict(pass);
+   }
+   [] T.timeout {
+   setverdict(fail, "Timeout waiting for RR or REJ");
+   }
+   }
+
+   deactivate(d);
+
+   fp_common_fini();
+}
+testcase TC_rr_response_frame_loss() runs on test_CT {
+   var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
+   f_testmatrix_each_chan(pars, refers(f_TC_rr_response_frame_loss));
+}
+
 control {
execute(TC_foo());
execute(TC_sabm_ua_dcch_sapi0());
@@ -959,6 +1016,7 @@
execute(TC_segm_concat_dcch());
execute(TC_segm_concat_sacch());
execute(TC_t200_n200());
+   execute(TC_rr_response_frame_loss());
 }

 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14349
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I32340ffffee0ebfb9b31b55e0982d0d917a1
Gerrit-Change-Number: 14349
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: bts: Add test for expiring T200 N200+1 times

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14346 )

Change subject: bts: Add test for expiring T200 N200+1 times
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14346
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9e1dbc889575f8952a4581551076829825b3b1cd
Gerrit-Change-Number: 14346
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:11:50 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Add test for expiring T200 N200+1 times

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14346 )

Change subject: bts: Add test for expiring T200 N200+1 times
..

bts: Add test for expiring T200 N200+1 times

Change-Id: I9e1dbc889575f8952a4581551076829825b3b1cd
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 91 insertions(+), 0 deletions(-)

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



diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index 07b785e..ffa3aa9 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -845,7 +845,97 @@
f_testmatrix_each_chan(pars, refers(f_TC_segm_concat_sacch));
 }

+/* TS 04.06 Section 5.8.2.1 */
+private function f_n200_by_chan_nr(RslChannelNr chan_nr, RslLinkId link_id) 
return integer {
+   /* SACCH irrespective of physical channel type */
+   if (match(link_id, tr_RslLinkID_SACCH(?))) {
+   return 5;
+   }
+   /* DCCH below */
+   select (chan_nr) {
+   case (t_RslChanNr_SDCCH4(?, ?)) { return 23; }
+   case (t_RslChanNr_SDCCH8(?, ?)) { return 23; }
+   case (t_RslChanNr_Bm(?)) { return 34; }
+   case (t_RslChanNr_Lm(?, ?)) { return 29; }
+   }
+   setverdict(fail, "Unknown chan_nr ", chan_nr, " or link_id ", link_id);
+   return -1;
+}

+/* Test if there are exactly N200+1 transmissions of I frames; inspired by 
25.2.4.1 */
+private function f_TC_t200_n200(charstring id) runs on ConnHdlr {
+   var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(0));
+   var integer sapi := link_id.sapi;
+   var boolean is_sacch := false;
+   if (link_id.c == SACCH) {
+   is_sacch := true;
+   }
+   var integer n200 := f_n200_by_chan_nr(g_chan_nr, link_id);
+   var integer num_retrans := 0;
+   timer T := 3.0;
+   var default d;
+
+   fp_common_init();
+
+   /* some common altstep for meas res and other background noise */
+   d := activate(as_ignore_background(true));
+   RSL.clear;
+   LAPDM.clear;
+
+   var octetstring l3_mo := f_rnd_octstring(20);
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, 
p:=true, l3:=l3_mo)));
+   RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, 
f:=true, l3:=l3_mo)));
+
+   var octetstring l3_mt := f_rnd_octstring(20);
+   RSL.send(ts_RSL_DATA_REQ(g_chan_nr, link_id, l3_mt));
+   /* first transmission, P = 0 */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_I(sapi, c_r:=cr_MT_CMD, 
p:=false,
+   nr:=0, ns:=0, 
l3:=l3_mt)));
+   deactivate(d);
+
+   alt {
+   /* re-transmission, P = 1 */
+   [] LAPDM.receive(t_PH_DATA(0, is_sacch,
+   tr_LAPDm_I(sapi, c_r:=cr_MT_CMD, p:=true, 
nr:=0, ns:=0, l3:=l3_mt))) {
+   num_retrans := num_retrans + 1;
+   if (num_retrans < n200) {
+   repeat;
+   } else if (num_retrans == n200) {
+   T.start; /* wait for some more time if there are more 
retransmissions */
+   repeat;
+   } else {
+   /* break */
+   }
+   }
+   [] LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_I(sapi, ?, ?, ?, ?, ?))) {
+   setverdict(fail, "Received unexpected I frame");
+   }
+   [not is_sacch] as_lapdm_acch();
+   [is_sacch] as_lapdm_dcch();
+   [] as_lapdm_idle();
+   [] as_rsl_meas_rep();
+   [num_retrans == n200] RSL.receive(tr_RSL_ERROR_IND(g_chan_nr, link_id, 
'01'O)) {
+   /* break */
+   }
+   [] T.timeout {
+   setverdict(fail, "Missing RSL RLL ERROR INDICATION");
+   }
+   }
+
+   if (num_retrans == n200) {
+   setverdict(pass, "Received ", num_retrans, " on channel ", 
g_chan_nr, " link ", link_id);
+   } else if (num_retrans < n200) {
+   setverdict(fail, "Too few retransmissions (", num_retrans, "); 
N200=", n200,
+  " on channel ", g_chan_nr, " link ", link_id);
+   }
+
+   fp_common_fini();
+}
+testcase TC_t200_n200() runs on test_CT {
+   var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
+   f_testmatrix_each_chan(pars, refers(f_TC_t200_n200));
+}

 control {
execute(TC_foo());
@@ -863,6 +953,7 @@
execute(TC_iframe_timer_recovery());
execute(TC_segm_concat_dcch());
execute(TC_segm_concat_sacch());
+   execute(TC_t200_n200());
 }

 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14346
To unsubsc

Change in ...osmo-ttcn3-hacks[master]: bts: Add TC_segm_concat to test segmentation+concatenation

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14342 )

Change subject: bts: Add TC_segm_concat to test segmentation+concatenation
..

bts: Add TC_segm_concat to test segmentation+concatenation

Change-Id: I6a9ce3e27f4a01412186b3b5d8d2b86573b6f8ac
---
M bts/BTS_Tests_LAPDm.ttcn
M library/LAPDm_Types.ttcn
2 files changed, 129 insertions(+), 4 deletions(-)

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



diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index 2eade0a..2738477 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -694,6 +694,129 @@
f_testmatrix_each_chan(pars, refers(f_TC_iframe_timer_recovery));
 }

+type record LapdmDlConfig {
+   integer n201,
+   integer t200
+};
+
+type record LapdmDlState {
+   integer v_s,
+   integer v_a,
+   integer v_r
+};
+
+template (value) LapdmDlState t_init_LapdmDlState := {
+   v_s := 0,
+   v_a := 0,
+   v_r := 0
+}
+
+private function inc_mod8(inout integer v)
+{
+   v := (v + 1) mod 8;
+}
+
+private function f_lapdm_transceive_mo(inout LapdmDlState dls, RslLinkId 
link_id, octetstring l3)
+runs on ConnHdlr {
+   var LAPDm_ph_data pd;
+   var integer offset := 0;
+   var integer n201 := 20;
+   var boolean is_sacch := false;
+   if (link_id.c == SACCH) {
+   n201 := 18;
+   is_sacch := true;
+   }
+
+   while (offset < lengthof(l3)) {
+   var integer remain_len := lengthof(l3) - offset;
+   var integer seg_len := remain_len;
+   if (remain_len > n201) {
+   seg_len := n201;
+   }
+   var octetstring segment := substr(l3, offset, seg_len);
+   var boolean more;
+   if (offset + lengthof(segment) < lengthof(l3)) {
+   more := true;
+   } else {
+   more := false;
+   }
+   /* send the next segment */
+   LAPDM.send(t_PH_DATA(0, is_sacch,
+ts_LAPDm_I(link_id.sapi, c_r:=cr_MO_CMD, 
p:=false,
+   nr:=dls.v_a, ns:=dls.v_s, 
l3:=segment, m:=more)));
+   inc_mod8(dls.v_s);
+   offset := offset + lengthof(segment);
+
+   /* wait for it to be acknowledged */
+   alt {
+   [] LAPDM.receive(t_PH_DATA(0, is_sacch, 
tr_LAPDm_RR(link_id.sapi, c_r:=cr_MT_RSP,
+   p:=false, 
nr:=(dls.v_s) mod 8)));
+   [] as_ignore_background();
+   [] LAPDM.receive(t_PH_DATA(0, is_sacch, ?)) -> value pd {
+   setverdict(fail, "received unexpected LAPDm ", pd);
+   repeat;
+   }
+   [] LAPDM.receive(t_PH_DATA(0, ?, ?)) { repeat; }
+   [offset < lengthof(l3)] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, 
link_id, ?)) {
+   setverdict(fail, "received RSL DATA IND before message 
complete");
+   }
+   }
+   }
+
+   timer T := 1.0;
+   T.start;
+   alt {
+   [] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, l3)) {
+   setverdict(pass);
+   }
+   [] RSL.receive(tr_RSL_DATA_IND(g_chan_nr, link_id, ?)) {
+   setverdict(fail, "Received RSL DATA IND with wrong payload");
+   }
+   [] T.timeout {
+   setverdict(fail, "Timeout waiting for RSL DATA IND of 
de-segmented message");
+   }
+   }
+}
+
+/* Section 5.8.5 of TS 04.06 */
+const integer c_TS0406_MAX_L3_OCTETS := 251;
+
+private function f_TC_segm_concat(charstring id) runs on ConnHdlr {
+   const integer sapi := 0;
+   var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(sapi));
+   var default d;
+   timer T := 3.0;
+
+   fp_common_init();
+
+   /* some common altstep for meas res and other background noise */
+   d := activate(as_ignore_background());
+   RSL.clear;
+   LAPDM.clear;
+
+   var octetstring l3_mo := f_rnd_octstring(5);
+
+   /*  1) The BTS is brought into the multiple frame established state */
+
+   /* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L 
≤ N201.. */
+   LAPDM.send(t_PH_DATA(0, false, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, 
p:=true, l3:=l3_mo)));
+   RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
+   /* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
+   LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, 
l3:=l3_mo)));
+
+   l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS);
+
+   deactivate(d);
+
+   

Change in ...osmo-msc[master]: db_sms_test: Remove libdbi expected driver load errors

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/14356 )

Change subject: db_sms_test: Remove libdbi expected driver load errors
..


Patch Set 1:

the problem with mixing stderr and stdout is that it's race-condition prone.  
So if for some reason on some system under some circumstances two lines get 
swapped, the test output wouldn't match again either :/


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14356
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I06dfdc5a7415a4d3b34a3b25f11c8abda1a63f92
Gerrit-Change-Number: 14356
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:11:24 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Also test SACCH in TC_segm_concat

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14343 )

Change subject: bts: Also test SACCH in TC_segm_concat
..

bts: Also test SACCH in TC_segm_concat

Change-Id: If9b51b4d6c357aa015f31e1e6851d4d1bb71a58f
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 46 insertions(+), 17 deletions(-)

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



diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index 2738477..07b785e 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -503,9 +503,13 @@
 private altstep as_lapdm_acch() runs on ConnHdlr {
[] LAPDM.receive(t_PH_DATA(0, true, ?)) { repeat; }
 }
+/* ignore all DCCH frames */
+private altstep as_lapdm_dcch() runs on ConnHdlr {
+   [] LAPDM.receive(t_PH_DATA(0, false, ?)) { repeat; }
+}
 /* ignore all LAPDm idle frames (UI) */
 private altstep as_lapdm_idle() runs on ConnHdlr {
-   [] LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_UI(0, ?, ''O))) { repeat; 
}
+   [] LAPDM.receive(t_PH_DATA(0, ?, tr_LAPDm_UI(?, ?, ''O))) { repeat; }
 }
 /* ignore all measurement reports */
 private altstep as_rsl_meas_rep() runs on ConnHdlr {
@@ -519,8 +523,9 @@
}
 }
 /* all of the above */
-private altstep as_ignore_background() runs on ConnHdlr {
-   [] as_lapdm_acch();
+private altstep as_ignore_background(boolean want_dcch := true) runs on 
ConnHdlr {
+   [want_dcch] as_lapdm_acch();
+   [not want_dcch] as_lapdm_dcch();
[] as_lapdm_idle();
[] as_rsl_meas_rep();
[] as_rsl_fail_err();
@@ -751,7 +756,7 @@
alt {
[] LAPDM.receive(t_PH_DATA(0, is_sacch, 
tr_LAPDm_RR(link_id.sapi, c_r:=cr_MT_RSP,
p:=false, 
nr:=(dls.v_s) mod 8)));
-   [] as_ignore_background();
+   [] as_ignore_background(not is_sacch);
[] LAPDM.receive(t_PH_DATA(0, is_sacch, ?)) -> value pd {
setverdict(fail, "received unexpected LAPDm ", pd);
repeat;
@@ -781,28 +786,38 @@
 /* Section 5.8.5 of TS 04.06 */
 const integer c_TS0406_MAX_L3_OCTETS := 251;

-private function f_TC_segm_concat(charstring id) runs on ConnHdlr {
-   const integer sapi := 0;
-   var RslLinkId link_id := valueof(ts_RslLinkID_DCCH(sapi));
+/* test segmentation and de-segmentation (concatenation) of a large message in 
uplink
+ * on specified SAPI/channel */
+private function f_TC_segm_concat(charstring id, RslLinkId link_id) runs on 
ConnHdlr {
+   var integer sapi := link_id.sapi;
+   var boolean is_sacch := false;
+   if (link_id.c == SACCH) {
+   is_sacch := true;
+   }
var default d;
timer T := 3.0;

fp_common_init();

/* some common altstep for meas res and other background noise */
-   d := activate(as_ignore_background());
+   d := activate(as_ignore_background(not is_sacch));
RSL.clear;
LAPDM.clear;

var octetstring l3_mo := f_rnd_octstring(5);

-   /*  1) The BTS is brought into the multiple frame established state */
-
/* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L 
≤ N201.. */
-   LAPDM.send(t_PH_DATA(0, false, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, 
p:=true, l3:=l3_mo)));
-   RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
+   if (is_sacch) {
+   /* no payload permitted, as this is not contention resolution */
+   l3_mo := ''O;
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, 
c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
+   RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id));
+   } else {
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, 
c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
+   RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
+   }
/* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
-   LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, 
l3:=l3_mo)));
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, 
f:=true, l3:=l3_mo)));

l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS);

@@ -813,10 +828,23 @@

fp_common_fini();
 }
-testcase TC_segm_concat() runs on test_CT {
-   var ConnHdlrPars pars := valueof(t_Pars(t_RslChanNr_Bm(1), 
ts_RSL_ChanMode_SIGN));
-   f_testmatrix_each_chan(pars, refers(f_TC_segm_concat));
+private function f_TC_segm_concat_dcch(charstring id) runs on ConnHdlr {
+   f_TC_segm_concat(id, valueof(ts_RslLinkID_DCCH(0)));
 }
+private function f_TC_segm_concat_sacch(charstring id) runs on ConnHdlr {
+   f_TC_segm_concat(id, link_id :=valueof(ts_RslLinkID_SACCH(0)));
+}
+/* test mobile-originated segmentation/de-segmentation on DCCH

Change in ...osmo-ttcn3-hacks[master]: bts: Add TC_segm_concat to test segmentation+concatenation

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14342 )

Change subject: bts: Add TC_segm_concat to test segmentation+concatenation
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14342
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I6a9ce3e27f4a01412186b3b5d8d2b86573b6f8ac
Gerrit-Change-Number: 14342
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:11:41 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: bts: Extend LAPDm test suite with a number of new tests

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14341 )

Change subject: bts: Extend LAPDm test suite with a number of new tests
..

bts: Extend LAPDm test suite with a number of new tests

This adds the following test cases to BTS_Tests_LAPDm.ttcn:
* TC_sabm_retransmit_bts()
* TC_sabm_invalid_resp()
* TC_sabm_dm()
* TC_establish_ign_first_sabm()
* TC_iframe_seq_and_ack()
* TC_iframe_timer_recovery()

Change-Id: I4e1136c0c0f10d5bc8d01e826ae5d92f17a0b2aa
---
M bts/BTS_Tests.ttcn
M bts/BTS_Tests_LAPDm.ttcn
M library/LAPDm_Types.ttcn
3 files changed, 511 insertions(+), 7 deletions(-)

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



diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index c43774d..e48c05a 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -61,9 +61,11 @@

 import from Osmocom_VTY_Functions all;
 import from TELNETasp_PortType all;
+import from BTS_Tests_LAPDm all;

 friend module BTS_Tests_SMSCB;
 friend module BTS_Tests_virtphy;
+friend module BTS_Tests_LAPDm;

 /* The tests assume a BTS with the following timeslot configuration:
  * TS0 : Combined CCCH + SDCCH/4
@@ -155,7 +157,7 @@
 }

 /* an individual call / channel */
-type component ConnHdlr extends RSL_DchanHdlr {
+type component ConnHdlr extends RSL_DchanHdlr, lapdm_test_CT {
port L1CTL_PT L1CTL;

port TRXC_CODEC_PT BTS_TRXC;
@@ -551,7 +553,7 @@
"RF CHAN REL", true);
 }

-private template ConnHdlrPars t_Pars(template RslChannelNr chan_nr,
+friend template ConnHdlrPars t_Pars(template RslChannelNr chan_nr,
template RSL_IE_ChannelMode chan_mode,
float t_guard := 20.0) := {
chan_nr := valueof(chan_nr),
@@ -699,7 +701,7 @@
 }

 /* execute the same callback function on a variety of logical channels */
-private function f_testmatrix_each_chan(ConnHdlrPars pars, void_fn fn) runs on 
test_CT {
+friend function f_testmatrix_each_chan(ConnHdlrPars pars, void_fn fn) runs on 
test_CT {
var ConnHdlr vc_conn;
f_init();

diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index 33aa174..2eade0a 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -4,7 +4,9 @@
 import from Osmocom_Types all;
 import from LAPDm_RAW_PT all;
 import from LAPDm_Types all;
+import from RSL_Types all;
 import from BTS_Tests all;
+import from Misc_Helpers all;

 /* test that use exclusively only LAPDm over L1CTL */
 type component lapdm_test_CT {
@@ -14,8 +16,6 @@

 /* contrary to BTS_Tests.ttcn, we use LAPDm_PT here, a convenience wrapper
  * around L1CTL to perform encode/decode of abstract LAPDm frames */
-type component lapdm_bts_CT extends lapdm_test_CT, test_CT {
-}

 
/*
  * Test using only L1CTL/LAPDm
@@ -34,9 +34,15 @@
lapdm_component.start(LAPDmStart());
 }

+function f_lapdm_exit() runs on lapdm_test_CT {
+   lapdm_component.stop;
+   lapdm_component.done;
+   unmap(lapdm_component:L1CTL, system:L1CTL);
+}
+
 /* master function establishing a dedicated radio channel (takes care of 
RACH/IMM.ASS handling) */
 function f_establish_dcch() runs on lapdm_test_CT {
-   var BCCH_tune_req tune_req := { arfcn := { false, 871 }, combined_ccch 
:= true };
+   var BCCH_tune_req tune_req := { arfcn := { false, mp_trx0_arfcn }, 
combined_ccch := true };
var DCCH_establish_req est_req := { ra := 23 };

LAPDM.send(tune_req);
@@ -44,6 +50,16 @@
LAPDM.receive(DCCH_establish_res:?);
 }

+/* master function switching to a dedicated radio channel */
+function f_switch_dcch(Arfcn arfcn, RslChannelNr chan_nr, GsmTsc tsc) runs on 
lapdm_test_CT {
+   var BCCH_tune_req tune_req := { arfcn := arfcn, combined_ccch := true };
+   var DCCH_switch_req sw_req := { arfcn, chan_nr, tsc };
+
+   LAPDM.send(tune_req);
+   LAPDM.send(sw_req);
+   LAPDM.receive(DCCH_switch_res:?);
+}
+
 /* helper function releasing dedicated radio channel physically (no Um 
signaling!) */
 function f_release_dcch() runs on lapdm_test_CT {
var DCCH_release_req rel_req := {};
@@ -252,6 +268,434 @@
log("DEC: ", 
dec_LapdmFrameAB('0303012B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B'O));
 }

+/*
+ * Test using both L1CTL/LAPDm and RSL
+ 
*/
+
+private function fp_common_init() runs on ConnHdlr
+{
+   /* undo what f_start_handler is doing and pull LAPDm_CT into the loop */
+   unmap(self:L1CTL, system:L1CTL);
+   f_lapdm_init();
+   /* activate the channel on the BTS side */
+   f_rsl_chan_act(g_p

Change in ...osmo-ttcn3-hacks[master]: bts: Factor out mobile-originated LAPDm establishment

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14348 )

Change subject: bts: Factor out mobile-originated LAPDm establishment
..

bts: Factor out mobile-originated LAPDm establishment

which avoids us to have to copy+pate this between several test cases.

Change-Id: I8da753bb3d809ec09f9380bb4bac666ceaf61f00
---
M bts/BTS_Tests_LAPDm.ttcn
1 file changed, 29 insertions(+), 24 deletions(-)

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



diff --git a/bts/BTS_Tests_LAPDm.ttcn b/bts/BTS_Tests_LAPDm.ttcn
index ffa3aa9..3c39a5a 100644
--- a/bts/BTS_Tests_LAPDm.ttcn
+++ b/bts/BTS_Tests_LAPDm.ttcn
@@ -290,6 +290,31 @@
f_lapdm_exit();
 }

+/* Mobile-Originated LAPDm establishment on given Link ID */
+private function f_establish_mo(RslLinkId link_id) runs on ConnHdlr
+{
+   var integer sapi := link_id.sapi;
+   var boolean is_sacch := false;
+   if (link_id.c == SACCH) {
+   is_sacch := true;
+   }
+
+   var octetstring l3_mo := f_rnd_octstring(5);
+
+   /* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L 
≤ N201.. */
+   if (is_sacch) {
+   /* no payload permitted, as this is not contention resolution */
+   l3_mo := ''O;
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, 
c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
+   RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id));
+   } else {
+   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, 
c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
+   RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
+   }
+   /* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
+   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, 
f:=true, l3:=l3_mo)));
+}
+
 /* Verify that the BTS is re-transmitting SABM messages after T200 timeout, 
inspired
by 3GPP TS 51.010-1 25.2.1.1.2.1 + 25.2.1.2.4 */
 private function f_TC_sabm_retransmit_bts(charstring id) runs on ConnHdlr {
@@ -547,11 +572,7 @@
RSL.clear;
LAPDM.clear;

-   /* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L 
≤ N201.. */
-   LAPDM.send(t_PH_DATA(0, false, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, 
p:=true, l3:=l3)));
-   RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3));
-   /* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
-   LAPDM.receive(t_PH_DATA(0, false, tr_LAPDm_UA(sapi, cr_MT_RSP, f:=true, 
l3:=l3)));
+   f_establish_mo(link_id);

var integer last_ns_rx := 0;

@@ -804,22 +825,9 @@
RSL.clear;
LAPDM.clear;

-   var octetstring l3_mo := f_rnd_octstring(5);
+   f_establish_mo(link_id);

-   /* MO Establish Request via LADPm: SAPI = 0, C = 0, P = 1, M = 0, 0 ≤ L 
≤ N201.. */
-   if (is_sacch) {
-   /* no payload permitted, as this is not contention resolution */
-   l3_mo := ''O;
-   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, 
c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
-   RSL.receive(tr_RSL_EST_IND_NOL3(g_chan_nr, link_id));
-   } else {
-   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, 
c_r:=cr_MO_CMD, p:=true, l3:=l3_mo)));
-   RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
-   }
-   /* UA: SAPI = 0, R = 0, F = 1, M = 0, L = L of SABM. */
-   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, 
f:=true, l3:=l3_mo)));
-
-   l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS);
+   var octetstring l3_mo := f_rnd_octstring(c_TS0406_MAX_L3_OCTETS);

deactivate(d);

@@ -882,10 +890,7 @@
RSL.clear;
LAPDM.clear;

-   var octetstring l3_mo := f_rnd_octstring(20);
-   LAPDM.send(t_PH_DATA(0, is_sacch, ts_LAPDm_SABM(sapi, c_r:=cr_MO_CMD, 
p:=true, l3:=l3_mo)));
-   RSL.receive(tr_RSL_EST_IND(g_chan_nr, link_id, l3_mo));
-   LAPDM.receive(t_PH_DATA(0, is_sacch, tr_LAPDm_UA(sapi, cr_MT_RSP, 
f:=true, l3:=l3_mo)));
+   f_establish_mo(link_id);

var octetstring l3_mt := f_rnd_octstring(20);
RSL.send(ts_RSL_DATA_REQ(g_chan_nr, link_id, l3_mt));

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14348
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8da753bb3d809ec09f9380bb4bac666ceaf61f00
Gerrit-Change-Number: 14348
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: bts: Also test SACCH in TC_segm_concat

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14343 )

Change subject: bts: Also test SACCH in TC_segm_concat
..


Patch Set 4: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14343
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If9b51b4d6c357aa015f31e1e6851d4d1bb71a58f
Gerrit-Change-Number: 14343
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:11:44 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-msc[master]: db_sms_test: Remove libdbi expected driver load errors

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/14356 )

Change subject: db_sms_test: Remove libdbi expected driver load errors
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-msc/+/14356
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I06dfdc5a7415a4d3b34a3b25f11c8abda1a63f92
Gerrit-Change-Number: 14356
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: fixeria 
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:10:35 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: gtp: Replace old pdp APIs with new ones with multi-gsn support

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14297 )

Change subject: gtp: Replace old pdp APIs with new ones with multi-gsn support
..


Patch Set 2:

this is about replacing API usage / API calls, right?  It's not changing the 
actual API implementation?


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14297
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: Ibf56a063f01d1f95a2a3271416da6e062e85fdfa
Gerrit-Change-Number: 14297
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 09:09:13 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...libosmocore[master]: gsm0808_utils: Add gsm0808_decode_cell_id_u()

2019-06-04 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/libosmocore/+/13888

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

Change subject: gsm0808_utils: Add gsm0808_decode_cell_id_u()
..

gsm0808_utils: Add gsm0808_decode_cell_id_u()

This function parses a single Cell ID list element into a
'union gsm0808_cell_id_u'.  This function is going to be used
by the upcoming CBSP support.

Related: OS#3537
Change-Id: I08b33881667aa32f01e53ccb70d44d5b79c7c986
---
M include/osmocom/gsm/gsm0808_utils.h
M src/gsm/gsm0808_utils.c
M src/gsm/libosmogsm.map
3 files changed, 60 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/88/13888/5
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13888
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I08b33881667aa32f01e53ccb70d44d5b79c7c986
Gerrit-Change-Number: 13888
Gerrit-PatchSet: 5
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in ...libosmocore[master]: make use of OTC_GLOBAL when allocating library-internal contexts

2019-06-04 Thread Harald Welte
Hello fixeria, Jenkins Builder,

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

https://gerrit.osmocom.org/c/libosmocore/+/13338

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

Change subject: make use of OTC_GLOBAL when allocating library-internal contexts
..

make use of OTC_GLOBAL when allocating library-internal contexts

As libosmcore is now managing the global talloc contexts, there's
no point in having APIs where the user tells the library about
which talloc contexts to use for a given sub-system.

Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1
---
M include/osmocom/core/signal.h
M src/counter.c
M src/ctrl/control_vty.c
M src/gb/gprs_bssgp.c
M src/gsm/lapd_core.c
M src/logging.c
M src/signal.c
M src/stats.c
M src/vty/telnet_interface.c
M tests/ctrl/ctrl_test.c
10 files changed, 42 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/38/13338/9
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13338
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I48f475efd3ee0d5120b8fc30861e852d1a6920b1
Gerrit-Change-Number: 13338
Gerrit-PatchSet: 9
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-MessageType: newpatchset


Change in ...libosmocore[master]: make all library-internal static buffers thread-local

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/13436 )

Change subject: make all library-internal static buffers thread-local
..

make all library-internal static buffers thread-local

We have a number of library-internal static global buffers which are
mainly used for various stringification functions.  This worked as
all of the related Osmocom programs were strictly single-threaded.

Let's make those buffers at least thread-local.  This way every thread
gets their own set of buffers, and it's safe for multiple threads to
execute the same functions once.  They're of course still not
re-entrant.  If you need re-entrancy, you will need to use the _c()
or _buf() suffix version of those functions and work with your own
(stack or heap) buffers.

Change-Id: I50eb2436a7c1261d79a9d2955584dce92780ca07
---
M src/fsm.c
M src/gb/gprs_ns.c
M src/gsm/abis_nm.c
M src/gsm/apn.c
M src/gsm/gsm0808_utils.c
M src/gsm/gsm23003.c
M src/gsm/gsm48.c
M src/gsm/gsm_utils.c
M src/gsm/rsl.c
M src/msgb.c
M src/sim/core.c
M src/socket.c
M src/utils.c
13 files changed, 32 insertions(+), 33 deletions(-)

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



diff --git a/src/fsm.c b/src/fsm.c
index 882a2b4..411797d 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -545,7 +545,7 @@
  */
 const char *osmo_fsm_event_name(struct osmo_fsm *fsm, uint32_t event)
 {
-   static char buf[32];
+   static __thread char buf[32];
if (!fsm->event_names) {
snprintf(buf, sizeof(buf), "%"PRIu32, event);
return buf;
@@ -575,7 +575,7 @@
  */
 const char *osmo_fsm_state_name(struct osmo_fsm *fsm, uint32_t state)
 {
-   static char buf[32];
+   static __thread char buf[32];
if (state >= fsm->num_states) {
snprintf(buf, sizeof(buf), "unknown %"PRIu32, state);
return buf;
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index cee4885..c77ebb3 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1552,7 +1552,7 @@

 const char *gprs_ns_ll_str(const struct gprs_nsvc *nsvc)
 {
-   static char buf[80];
+   static __thread char buf[80];
return gprs_ns_ll_str_buf(buf, sizeof(buf), nsvc);
 }

diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index a4c0e41..3fb8f0f 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -939,7 +939,7 @@

 const char *abis_nm_dump_foh(const struct abis_om_fom_hdr *foh)
 {
-   static char foh_buf[128];
+   static __thread char foh_buf[128];
return abis_nm_dump_foh_buf(foh_buf, sizeof(foh_buf), foh);
 }

diff --git a/src/gsm/apn.c b/src/gsm/apn.c
index 88b45a4..a7074ea 100644
--- a/src/gsm/apn.c
+++ b/src/gsm/apn.c
@@ -31,7 +31,7 @@
 #define APN_OI_GPRS_FMT"mnc%03u.mcc%03u.gprs"
 #define APN_GPRS_FMT   "%s.mnc%03u.mcc%03u.gprs"

-static char apn_strbuf[APN_MAXLEN+1];
+static __thread char apn_strbuf[APN_MAXLEN+1];

 char *osmo_apn_qualify_buf(char *buf, size_t buf_len, unsigned int mcc, 
unsigned int mnc, const char *ni)
 {
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 26f7944..70eed15 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -611,7 +611,7 @@
return ret;
 }

-static char dbuf[256];
+static __thread char dbuf[256];

 /*! Dump LCLS parameters (GCR excluded) into string for printing.
  *  \param[out] buf caller-allocated output string buffer
@@ -1819,7 +1819,7 @@
  */
 const char *gsm0808_cell_id_name(const struct gsm0808_cell_id *cid)
 {
-   static char buf[64];
+   static __thread char buf[64];
return gsm0808_cell_id_name_buf(buf, sizeof(buf), cid);
 }

@@ -1829,7 +1829,7 @@
  */
 const char *gsm0808_cell_id_name2(const struct gsm0808_cell_id *cid)
 {
-   static char buf[64];
+   static __thread char buf[64];
return gsm0808_cell_id_name_buf(buf, sizeof(buf), cid);
 }

@@ -1886,7 +1886,7 @@
  * See also gsm0808_cell_id_list_name_buf(). */
 const char *gsm0808_cell_id_list_name(const struct gsm0808_cell_id_list2 *cil)
 {
-   static char buf[1024];
+   static __thread char buf[1024];
gsm0808_cell_id_list_name_buf(buf, sizeof(buf), cil);
return buf;
 }
@@ -1913,7 +1913,7 @@

 const char *gsm0808_channel_type_name(const struct gsm0808_channel_type *ct)
 {
-   static char buf[128];
+   static __thread char buf[128];
return gsm0808_channel_type_name_buf(buf, sizeof(buf), ct);
 }

diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c
index a97ed07..4cc2671 100644
--- a/src/gsm/gsm23003.c
+++ b/src/gsm/gsm23003.c
@@ -107,7 +107,7 @@
  */
 const char *osmo_mcc_name(uint16_t mcc)
 {
-   static char buf[8];
+   static __thread char buf[8];
return osmo_mcc_name_buf(buf, sizeof(buf), mcc);
 }

@@ -158,7 +158,7 @@
  */
 const char *osmo_mnc_name(uint16_t mnc, bool mnc_3_digi

Change in ...libosmocore[master]: make all library-internal static buffers thread-local

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/13436 )

Change subject: make all library-internal static buffers thread-local
..


Patch Set 9: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13436
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I50eb2436a7c1261d79a9d2955584dce92780ca07
Gerrit-Change-Number: 13436
Gerrit-PatchSet: 9
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: Max 
Gerrit-Comment-Date: Tue, 04 Jun 2019 08:52:55 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: make all library-internal static buffers thread-local

2019-06-04 Thread Harald Welte
Hello fixeria, Jenkins Builder,

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

https://gerrit.osmocom.org/c/libosmocore/+/13436

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

Change subject: make all library-internal static buffers thread-local
..

make all library-internal static buffers thread-local

We have a number of library-internal static global buffers which are
mainly used for various stringification functions.  This worked as
all of the related Osmocom programs were strictly single-threaded.

Let's make those buffers at least thread-local.  This way every thread
gets their own set of buffers, and it's safe for multiple threads to
execute the same functions once.  They're of course still not
re-entrant.  If you need re-entrancy, you will need to use the _c()
or _buf() suffix version of those functions and work with your own
(stack or heap) buffers.

Change-Id: I50eb2436a7c1261d79a9d2955584dce92780ca07
---
M src/fsm.c
M src/gb/gprs_ns.c
M src/gsm/abis_nm.c
M src/gsm/apn.c
M src/gsm/gsm0808_utils.c
M src/gsm/gsm23003.c
M src/gsm/gsm48.c
M src/gsm/gsm_utils.c
M src/gsm/rsl.c
M src/msgb.c
M src/sim/core.c
M src/socket.c
M src/utils.c
13 files changed, 32 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/36/13436/9
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13436
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I50eb2436a7c1261d79a9d2955584dce92780ca07
Gerrit-Change-Number: 13436
Gerrit-PatchSet: 9
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: Max 
Gerrit-MessageType: newpatchset


Change in ...libosmocore[master]: fsm.c: Print error message for FSM with allstate_action but no events

2019-06-04 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14361


Change subject: fsm.c: Print error message for FSM with allstate_action but no 
events
..

fsm.c: Print error message for FSM with allstate_action but no events

As suggested by Vadim while reviewing a related fix for ipa_keepalive.c
in libosmo-abis (see https://gerrit.osmocom.org/#/c/libosmo-abis/+/13540/),
it makes sense to print an error message if anyone registers a FSM
that specifies an allstate_action callback but at the same time no
events that would ever end up in that callback.

Change-Id: I9e73f7363ab15a00843e3f0d1e5776f4be7ebc46
---
M src/fsm.c
1 file changed, 3 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/61/14361/1

diff --git a/src/fsm.c b/src/fsm.c
index 411797d..ac9e055 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -256,6 +256,9 @@
return -EEXIST;
if (fsm->event_names == NULL)
LOGP(DLGLOBAL, LOGL_ERROR, "FSM '%s' has no event names! Please 
fix!\n", fsm->name);
+
+   if (fsm->allstate_action && !fsm->allstate_event_mask)
+   LOGP(DLGLOBAL, LOGL_ERROR, "FSM '%s' has allstate_action but no 
allstate_event_mask\n",fsm->name);
llist_add_tail(>list, _g_fsms);
INIT_LLIST_HEAD(>instances);


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14361
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

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


Change in ...libosmocore[master]: make all library-internal static buffers thread-local

2019-06-04 Thread Harald Welte
Hello fixeria, Jenkins Builder,

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

https://gerrit.osmocom.org/c/libosmocore/+/13436

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

Change subject: make all library-internal static buffers thread-local
..

make all library-internal static buffers thread-local

We have a number of library-internal static global buffers which are
mainly used for various stringification functions.  This worked as
all of the related Osmocom programs were strictly single-threaded.

Let's make those buffers at least thread-local.  This way every thread
gets their own set of buffers, and it's safe for multiple threads to
execute the same functions once.  They're of course still not
re-entrant.  If you need re-entrancy, you will need to use the _c()
or _buf() suffix version of those functions and work with your own
(stack or heap) buffers.

Change-Id: I50eb2436a7c1261d79a9d2955584dce92780ca07
---
M src/fsm.c
M src/gb/gprs_ns.c
M src/gsm/abis_nm.c
M src/gsm/apn.c
M src/gsm/gsm0808_utils.c
M src/gsm/gsm23003.c
M src/gsm/gsm48.c
M src/gsm/gsm_utils.c
M src/gsm/rsl.c
M src/msgb.c
M src/sim/core.c
M src/socket.c
M src/utils.c
13 files changed, 32 insertions(+), 33 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/36/13436/8
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/13436
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I50eb2436a7c1261d79a9d2955584dce92780ca07
Gerrit-Change-Number: 13436
Gerrit-PatchSet: 8
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-CC: Max 
Gerrit-MessageType: newpatchset


Change in ...osmo-ggsn[master]: ggsn: Fix undefined behaviour shifting beyond sign bit

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14287 )

Change subject: ggsn: Fix undefined behaviour shifting beyond sign bit
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14287
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I2b8d163dbc108b0fb5a1e820dc23181835d12869
Gerrit-Change-Number: 14287
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Comment-Date: Tue, 04 Jun 2019 08:43:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: ggsn: Fix undefined behaviour shifting beyond sign bit

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14287 )

Change subject: ggsn: Fix undefined behaviour shifting beyond sign bit
..

ggsn: Fix undefined behaviour shifting beyond sign bit

Fixes following ASan complaint during VTY "show running-config":
osmo-ggsn/ggsn/ggsn_vty.c:657:37: runtime error: left shift of 1 by 31 places 
cannot be represented in type 'int'

Change-Id: I2b8d163dbc108b0fb5a1e820dc23181835d12869
---
M ggsn/ggsn_vty.c
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/ggsn/ggsn_vty.c b/ggsn/ggsn_vty.c
index 3f012d2..9101361 100644
--- a/ggsn/ggsn_vty.c
+++ b/ggsn/ggsn_vty.c
@@ -654,9 +654,9 @@
vty_out(vty, "  ipdown-script %s%s", 
apn->tun.cfg.ipdown_script, VTY_NEWLINE);

for (i = 0; i < 32; i++) {
-   if (!(apn->cfg.apn_type_mask & (1 << i)))
+   if (!(apn->cfg.apn_type_mask & (UINT32_C(1) << i)))
continue;
-   vty_out(vty, "  type-support %s%s", 
get_value_string(pdp_type_names, (1 << i)),
+   vty_out(vty, "  type-support %s%s", 
get_value_string(pdp_type_names, (UINT32_C(1) << i)),
VTY_NEWLINE);
}
 

--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14287
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I2b8d163dbc108b0fb5a1e820dc23181835d12869
Gerrit-Change-Number: 14287
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-MessageType: merged


Change in ...osmo-ttcn3-hacks[master]: sgsn: Add tests to check GTP retransmit queue

2019-06-04 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14262 )

Change subject: sgsn: Add tests to check GTP retransmit queue
..

sgsn: Add tests to check GTP retransmit queue

Change-Id: I3c4a3573482bb1fa1549c732a0f78c2d00eadd86
---
M sgsn/SGSN_Tests.ttcn
M sgsn/expected-results.xml
2 files changed, 121 insertions(+), 0 deletions(-)

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



diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 5633183..1f63dfa 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -1536,6 +1536,123 @@
vc_conn.done;
 }

+/* ATTACH + PDP CTX ACT dropped + retrans */
+private function f_TC_attach_pdp_act_deact_gtp_retrans(charstring id) runs on 
BSSGP_ConnHdlr {
+   var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+   var Gtp1cUnitdata g_ud_first, g_ud_second;
+   /* first perform regular attach */
+   f_TC_attach(id);
+
+   /* then activate PDP context on the Gb side */
+   f_send_l3_gmm_llc(ts_SM_ACT_PDP_REQ(apars.tid, apars.nsapi, apars.sapi, 
apars.qos, apars.addr,
+apars.apn, apars.pco), 0);
+
+   GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) -> value 
g_ud_first {}
+   log("First createPDPContextRequest received, dropping & waiting for 
retransmission");
+   GTP.receive(tr_GTPC_MsgType(?, createPDPContextRequest, ?)) -> value 
g_ud_second {
+   if (g_ud_first != g_ud_second) {
+   setverdict(fail, "Retransmitted GTP message 
createPDPContextRequest is different from original one!");
+   mtc.stop;
+   }
+   f_process_gtp_ctx_act_req(apars, g_ud_second.gtpc);
+   var integer seq_nr := 
oct2int(g_ud_second.gtpc.opt_part.sequenceNumber);
+   GTP.send(ts_GTPC_CreatePdpResp(g_ud_second.peer, seq_nr,
+   apars.sgsn_tei_c, 
apars.gtp_resp_cause,
+   apars.ggsn_tei_c, 
apars.ggsn_tei_u,
+   apars.nsapi,
+   apars.ggsn_ip_c, 
apars.ggsn_ip_u, apars.chg_id,
+   omit, omit));
+   }
+   BSSGP[0].receive(tr_BD_L3_MT(tr_SM_ACT_PDP_ACCEPT)) {}
+
+   /* Now the same with Deact */
+   f_send_l3_gmm_llc(ts_SM_DEACT_PDP_REQ_MO(apars.tid, '00'O, false, 
omit), 0);
+   GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, 
apars.ggsn_tei_c)) -> value g_ud_first {}
+   log("First deletePDPContextRequest received, dropping & waiting for 
retransmission");
+   GTP.receive(tr_GTPC_MsgType(?, deletePDPContextRequest, 
apars.ggsn_tei_c)) -> value g_ud_second {
+   if (g_ud_first != g_ud_second) {
+   setverdict(fail, "Retransmitted GTP message 
deletePDPContextRequest is different from original one!");
+   mtc.stop;
+   }
+   var integer seq_nr := 
oct2int(g_ud_second.gtpc.opt_part.sequenceNumber);
+   BSSGP[0].clear;
+   GTP.send(ts_GTPC_DeletePdpResp(g_ud_second.peer, seq_nr, 
apars.sgsn_tei_c, '7F'O));
+   }
+   alt {
+   [] BSSGP[0].receive(tr_BD_L3_MT(tr_SM_DEACT_PDP_ACCEPT_MT(apars.tid))) {
+   setverdict(pass);
+   }
+   [] as_xid(apars, 0);
+   }
+
+   setverdict(pass);
+}
+testcase TC_attach_pdp_act_deact_gtp_retrans() runs on test_CT {
+   var BSSGP_ConnHdlr vc_conn;
+   f_init();
+   vc_conn := 
f_start_handler(refers(f_TC_attach_pdp_act_deact_gtp_retrans), testcasename(), 
g_gb, 27);
+   vc_conn.done;
+}
+
+/* Test that SGSN GTP response retransmit queue works fine */
+private function f_TC_attach_pdp_act_deact_gtp_retrans_resp(charstring id) 
runs on BSSGP_ConnHdlr {
+   var PdpActPars apars := valueof(t_PdpActPars(mp_ggsn_ip));
+   var integer seq_nr := 23;
+   var Gtp1cUnitdata g_ud_first, g_ud_second;
+   var template Gtp1cUnitdata g_delete_req;
+   /* first perform regular attach + PDP context act */
+   f_TC_attach(id);
+   f_pdp_ctx_act(apars);
+
+   /* Now perform an MT DeleteCtxReq and emulate GGSN didn't receive 
response and sends a duplicated DeleteCtxReq */
+   BSSGP[0].clear;
+   var GtpPeer peer := valueof(ts_GtpPeerC(apars.sgsn_ip_c));
+   g_delete_req := ts_GTPC_DeletePDP(peer, seq_nr, apars.sgsn_tei_c, 
apars.nsapi, '1'B);
+   GTP.send(g_delete_req);
+   alt {
+   [] BSSGP[0].receive(tr_BD_L3_MT(tr_SM_DEACT_PDP_REQ_MT(apars.tid, ?, 
true))) {
+   f_send_l3_gmm_llc(ts_SM_DEACT_PDP_ACCEPT_MO(apars.tid), 
0);
+   }
+   [] as_

Change in ...osmo-ggsn[master]: ggsn_vty_reference.xml: Update from last code changes

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14358 )

Change subject: ggsn_vty_reference.xml: Update from last code changes
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14358
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I5de2e5223e4532bbbec77b928fbdecb57ef2bca7
Gerrit-Change-Number: 14358
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 08:37:45 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ttcn3-hacks[master]: sgsn: Add tests to check GTP retransmit queue

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14262 )

Change subject: sgsn: Add tests to check GTP retransmit queue
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/14262
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I3c4a3573482bb1fa1549c732a0f78c2d00eadd86
Gerrit-Change-Number: 14262
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 04 Jun 2019 08:38:12 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...osmo-ggsn[master]: ggsn: vty: Require ggsn param in cmd

2019-06-04 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ggsn/+/14298 )

Change subject: ggsn: vty: Require ggsn param in  cmd
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-ggsn/+/14298
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Change-Id: I8357e20076348c8ded5e9f5b8e7252566b0fbfea
Gerrit-Change-Number: 14298
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 04 Jun 2019 08:37:31 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


  1   2   3   4   5   6   7   8   9   10   >