osmo-tetra[laforge/sq5bpf-rebase-20161218]: adding dmo support:

2018-01-23 Thread allesklar2

Patch Set 3:

> Patch Set 3: Published edit on patch set 2.

I found out that a file (tetra_burst.h) was uploaded without changes in my 
first commit and there was also a type in tetra-rx.c

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifa5521d7313595384e74dd790a56550755b93fe9
Gerrit-PatchSet: 3
Gerrit-Project: osmo-tetra
Gerrit-Branch: laforge/sq5bpf-rebase-20161218
Gerrit-Owner: allesklar2 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: allesklar2 
Gerrit-HasComments: No


[PATCH] osmo-tetra[laforge/sq5bpf-rebase-20161218]: adding dmo support:

2018-01-23 Thread allesklar2
Hello Harald Welte,

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

https://gerrit.osmocom.org/2817

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

adding dmo support:

physical layer: If DMO preamble bits are present, burst are send to DMO SAPs

lower mac layer: Decoding DMO Bursts and adding a new SAP for DMO. This SAP 
forwards all requests to the TMO SAP because the processing is quite similar. 
Nevertheless this SAP is important because in further developments you can 
change the lower mac without addopting the physical layer.

Change-Id: Ifa5521d7313595384e74dd790a56550755b93fe9
---
M AUTHORS
M src/conv_enc_test.c
M src/lower_mac/tetra_lower_mac.c
M src/lower_mac/tetra_scramb.c
M src/lower_mac/tetra_scramb.h
M src/phy/tetra_burst.c
M src/phy/tetra_burst.h
M src/phy/tetra_burst_sync.c
M src/phy/tetra_burst_sync.h
M src/tetra-rx.c
M src/tetra_common.h
M src/tetra_gsmtap.c
12 files changed, 477 insertions(+), 26 deletions(-)


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

diff --git a/AUTHORS b/AUTHORS
index a0c987b..7702664 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,5 @@
 Harald Welte 
 Sylvain Munaut 
 Holger Hans Peter Freyther 
+Jan-Pascal Kwiotek 
+Jannik Jürgens 
diff --git a/src/conv_enc_test.c b/src/conv_enc_test.c
index 303ef31..e714ec6 100644
--- a/src/conv_enc_test.c
+++ b/src/conv_enc_test.c
@@ -49,6 +49,11 @@
 {
 }
 
+/* incoming DP-SAP UNITDATA.ind  from PHY into lower MAC */
+void dp_sap_udata_ind(enum tp_sap_data_type type, const uint8_t *bits, 
unsigned int len, void *priv)
+{
+}
+
 static void decode_schf(const uint8_t *bits)
 {
uint8_t type4[1024];
diff --git a/src/lower_mac/tetra_lower_mac.c b/src/lower_mac/tetra_lower_mac.c
index 53fe73a..b0f95ed 100644
--- a/src/lower_mac/tetra_lower_mac.c
+++ b/src/lower_mac/tetra_lower_mac.c
@@ -103,6 +103,42 @@
.type2_bits = 30,
.type1_bits = 14,
},
+   /* DMO Synchronization Burst Block 1 */
+   [DPSAP_SCH_S] = {
+   .name   = "SCH/S",
+   .type345_bits   = 120,
+   .type2_bits = 80,
+   .type1_bits = 60,
+   .interleave_a   = 11,
+   .have_crc16 = 1,
+   },
+   /* DMO Synchronization Burst Block 2 */
+   [DPSAP_SCH_H] = {
+   .name   = "SCH/H",
+   .type345_bits   = 216,
+   .type2_bits = 144,
+   .type1_bits = 124,
+   .interleave_a   = 101,
+   .have_crc16 = 1,
+   },
+   /* DMO Normal Burst Block 1+2 */
+   [DPSAP_SCH_F] = {
+   .name   = "SCH/F",
+   .type345_bits   = 432,
+   .type2_bits = 288,
+   .type1_bits = 268,
+   .interleave_a   = 103,
+   .have_crc16 = 1,
+   },
+   /* DMO Normal Burst with Slot Flag */
+   [DPSAP_STCH] = {
+   .name   = "STCH",
+   .type345_bits   = 216,
+   .type2_bits = 144,
+   .type1_bits = 124,
+   .interleave_a   = 101,
+   .have_crc16 = 1,
+   },
 };
 
 struct tetra_cell_data {
@@ -112,6 +148,7 @@
struct tetra_tdma_time time;
 
uint32_t scramb_init;
+   uint32_t textmessage_length;
 };
 
 static struct tetra_cell_data _tcd, *tcd = &_tcd;
@@ -151,6 +188,7 @@
uint8_t type3dp[512*4];
uint8_t type3[512];
uint8_t type2[512];
+   uint8_t frag_offset;/* for variable fields in DPSAP_SCH_H */
 
const struct tetra_blk_param *tbp = _blk_param[type];
struct tetra_mac_state *tms = priv;
@@ -181,7 +219,7 @@
 
/* De-scramble, pay special attention to SB1 pre-defined scrambling */
memcpy(type4, bits, tbp->type345_bits);
-   if (type == TPSAP_T_SB1) {
+   if (type == TPSAP_T_SB1 || type == DPSAP_SCH_S  || type == DPSAP_SCH_H) 
{
tetra_scramb_bits(SCRAMB_INIT, type4, tbp->type345_bits);
tup->scrambling_code = SCRAMB_INIT;
} else {
@@ -235,7 +273,7 @@
printf("MN %s(%2u) ", osmo_ubit_dump(type2+17, 6), 
bits_to_uint(type2+17, 6));
printf("MCC %s(%u) ", osmo_ubit_dump(type2+31, 10), 
bits_to_uint(type2+31, 10));
printf("MNC %s(%u)\n", osmo_ubit_dump(type2+41, 14), 
bits_to_uint(type2+41, 14));
-   /* obtain information from SYNC PDU */
+   /* obtain information from SYNC PDU - 21.4.4.2 */
tcd->colour_code = bits_to_uint(type2+4, 6);
tcd->time.tn = bits_to_uint(type2+10, 2);
tcd->time.fn = bits_to_uint(type2+12, 5);
@@ -296,6 +334,294 @@
}
/* sq5bpf: koniec */
break;
+   case DPSAP_SCH_F:
+   /* 396-3 9.2 */

[PATCH] osmo-pcu[master]: Remove ASAN preprocessor warning

2018-01-23 Thread Max

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

Remove ASAN preprocessor warning

We have ASAN integrated into CI tests directly so there's no need in
additional manual warnings at compile time.

Change-Id: Idaabb4203a282be6779d7ab29de3f827b0ca6462
---
M src/gprs_bssgp_pcu.cpp
1 file changed, 2 insertions(+), 3 deletions(-)


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

diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index a86e09d..a9d4617 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -964,10 +964,9 @@
 
/* FIXME: move this to libgb: btsctx_free() */
llist_del(_pcu.bctx->list);
-#warning "This causes ASAN to complain. It is not critical for normal 
operation but should be fixed nevertheless"
-#if 0
+
talloc_free(the_pcu.bctx);
-#endif
+
the_pcu.bctx = NULL;
 }
 

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

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


[PATCH] osmo-pcu[master]: AllocTest: remove assumption on max MS class

2018-01-23 Thread Max
Hello Jenkins Builder, Holger Freyther,

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

https://gerrit.osmocom.org/4958

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

AllocTest: remove assumption on max MS class

So far the allocation was only tested up to hardcoded MS class 29. Drop
that assumption and test for all supported MS classes. Adjust expected
test output as necessary.

Note: using mslot_class_max() forces allocation for MS classes 30 and 31
for which no actual data is available (will be added in follow-up
patches) which current implementation treats differently depending on
TX/RX direction - see gprs_alloc_max_dl_slots_per_ms(). Because of that
we have to adjust the expected number of allocations in
test_successive_allocation() as well.

Change-Id: I7737f303d97197ef159b14a19c3312a11f07b433
Related: OS#2282
---
M tests/alloc/AllocTest.cpp
M tests/alloc/AllocTest.err
M tests/alloc/AllocTest.ok
3 files changed, 4,536 insertions(+), 3,196 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/58/4958/5


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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7737f303d97197ef159b14a19c3312a11f07b433
Gerrit-PatchSet: 5
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-pcu[master]: Add multislot classes from latest spec

2018-01-23 Thread Max
Hello Harald Welte, Jenkins Builder, Holger Freyther,

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

https://gerrit.osmocom.org/4072

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

Add multislot classes from latest spec

The table B.1 is copy-pasted from 3GPP TS 45.002 and reformatted via
Emacs macros into C struct to avoid typos. The test output expanded
accordingly.

The allocation test expectations and output are adjusted accordingly.

Note: classes 35-45 which need TA offset are not properly supported
yet. This can be extended once we have such devices available for tests.

Change-Id: I1ef2eb99c517f25e7d1e71b985a3e0eb3879eb2c
Related: OS#2282
---
M src/gprs_rlcmac_ts_alloc.cpp
M src/mslot_class.c
M src/mslot_class.h
M tests/alloc/AllocTest.cpp
M tests/alloc/AllocTest.err
M tests/alloc/AllocTest.ok
M tests/alloc/MslotTest.ok
7 files changed, 72,880 insertions(+), 3,439 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/72/4072/8


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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I1ef2eb99c517f25e7d1e71b985a3e0eb3879eb2c
Gerrit-PatchSet: 8
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[PATCH] osmo-pcu[master]: TBF: make poll state internal

2018-01-23 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/5864

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

TBF: make poll state internal

* add functions/macros for setting TBF's poll state
* add function for checking TBF's poll state
* update TBF test output due to extended state transition logging

Change-Id: I6db1c4e7bd0a49aeb5e391afe371c36b96c6a702
Related: OS#1539
---
M src/bts.cpp
M src/gprs_rlcmac_sched.cpp
M src/poll_controller.cpp
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M src/tbf_ul.cpp
M tests/tbf/TbfTest.err
8 files changed, 59 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/64/5864/2

diff --git a/src/bts.cpp b/src/bts.cpp
index f614c1a..94354f2 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -399,7 +399,7 @@
 
 static inline bool tbf_check(gprs_rlcmac_tbf *tbf, uint32_t fn, uint8_t 
trx_no, uint8_t ts)
 {
-   if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) && tbf->poll_state == 
GPRS_RLCMAC_POLL_SCHED
+   if (tbf->state_is_not(GPRS_RLCMAC_RELEASING) && tbf->poll_scheduled()
&& tbf->poll_fn == fn && tbf->trx->trx_no == trx_no && tbf->poll_ts 
== ts)
return true;
 
@@ -1010,7 +1010,7 @@
tbf->update_ms(tlli, GPRS_RLCMAC_UL_TBF);
 
LOGPTBF(tbf, LOGL_DEBUG, "RX: [PCU <- BTS] Packet Control Ack\n");
-   tbf->poll_state = GPRS_RLCMAC_POLL_NONE;
+   TBF_POLL_SCHED_UNSET(tbf);
 
/* check if this control ack belongs to packet uplink ack */
ul_tbf = as_ul_tbf(tbf);
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 3f9fcb1..ebf4714 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -49,8 +49,7 @@
if (ul_tbf->trx->trx_no != trx || !ul_tbf->is_control_ts(ts))
continue;
/* polling for next uplink block */
-   if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
-&& ul_tbf->poll_fn == poll_fn)
+   if (ul_tbf->poll_scheduled() && ul_tbf->poll_fn == poll_fn)
*poll_tbf = ul_tbf;
if (ul_tbf->ul_ack_state_is(GPRS_RLCMAC_UL_ACK_SEND_ACK))
*ul_ack_tbf = ul_tbf;
@@ -69,8 +68,7 @@
if (dl_tbf->trx->trx_no != trx || !dl_tbf->is_control_ts(ts))
continue;
/* polling for next uplink block */
-   if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
-&& dl_tbf->poll_fn == poll_fn)
+   if (dl_tbf->poll_scheduled() && dl_tbf->poll_fn == poll_fn)
*poll_tbf = dl_tbf;
if (dl_tbf->dl_ass_state_is(GPRS_RLCMAC_DL_ASS_SEND_ASS))
*dl_ass_tbf = dl_tbf;
diff --git a/src/poll_controller.cpp b/src/poll_controller.cpp
index f8ab6c9..5c5a717 100644
--- a/src/poll_controller.cpp
+++ b/src/poll_controller.cpp
@@ -47,14 +47,14 @@
 
llist_for_each(pos, _bts.ul_tbfs()) {
ul_tbf = as_ul_tbf(pos->entry());
-   if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) {
+   if (ul_tbf->poll_scheduled()) {
if (elapsed_fn_check(max_delay, frame_number, 
ul_tbf->poll_fn))
ul_tbf->poll_timeout();
}
}
llist_for_each(pos, _bts.dl_tbfs()) {
dl_tbf = as_dl_tbf(pos->entry());
-   if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED) {
+   if (dl_tbf->poll_scheduled()) {
if (elapsed_fn_check(max_delay, frame_number, 
dl_tbf->poll_fn))
dl_tbf->poll_timeout();
}
diff --git a/src/tbf.cpp b/src/tbf.cpp
index b99c521..672c296 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -45,6 +45,12 @@
 
 static void tbf_timer_cb(void *_tbf);
 
+const struct value_string gprs_rlcmac_tbf_poll_state_names[] = {
+   OSMO_VALUE_STRING(GPRS_RLCMAC_POLL_NONE),
+   OSMO_VALUE_STRING(GPRS_RLCMAC_POLL_SCHED), /* a polling was scheduled */
+   { 0, NULL }
+};
+
 const struct value_string gprs_rlcmac_tbf_dl_ass_state_names[] = {
OSMO_VALUE_STRING(GPRS_RLCMAC_DL_ASS_NONE),
OSMO_VALUE_STRING(GPRS_RLCMAC_DL_ASS_SEND_ASS),
@@ -172,7 +178,6 @@
first_ts(0),
first_common_ts(0),
control_ts(0xff),
-   poll_state(GPRS_RLCMAC_POLL_NONE),
poll_fn(0),
poll_ts(0),
n3105(0),
@@ -192,6 +197,7 @@
dl_ass_state(GPRS_RLCMAC_DL_ASS_NONE),
ul_ass_state(GPRS_RLCMAC_UL_ASS_NONE),
ul_ack_state(GPRS_RLCMAC_UL_ACK_NONE),
+   poll_state(GPRS_RLCMAC_POLL_NONE),
m_list(this),
m_ms_list(this),
m_egprs_enabled(false)
diff --git a/src/tbf.h b/src/tbf.h
index 2828772..bb5fd0a 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -64,6 +64,8 @@
GPRS_RLCMAC_POLL_SCHED, /* a polling was scheduled */
 };
 
+extern const struct value_string 

[PATCH] osmo-pcu[master]: TBF: make UL ack state internal

2018-01-23 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/5863

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

TBF: make UL ack state internal

* add functions/macros for setting TBF's UL ack state
* add functions for checking TBF's UL ack state
* update TBF test output due to extended state transition logging

N. B: this should not be confused with TBF-UL state.

Change-Id: I144483447d4b0b93e775da0e926ee45eb8ab39f3
Related: OS#1539
---
M src/gprs_rlcmac_sched.cpp
M src/tbf.cpp
M src/tbf.h
M src/tbf_ul.cpp
M tests/tbf/TbfTest.cpp
M tests/tbf/TbfTest.err
6 files changed, 49 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/63/5863/2

diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index a87217f..3f9fcb1 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -52,7 +52,7 @@
if (ul_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
 && ul_tbf->poll_fn == poll_fn)
*poll_tbf = ul_tbf;
-   if (ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_SEND_ACK)
+   if (ul_tbf->ul_ack_state_is(GPRS_RLCMAC_UL_ACK_SEND_ACK))
*ul_ack_tbf = ul_tbf;
if (ul_tbf->dl_ass_state_is(GPRS_RLCMAC_DL_ASS_SEND_ASS))
*dl_ass_tbf = ul_tbf;
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 0cb54bc..b99c521 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -60,6 +60,13 @@
{ 0, NULL }
 };
 
+const struct value_string gprs_rlcmac_tbf_ul_ack_state_names[] = {
+   OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ACK_NONE),
+   OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ACK_SEND_ACK), /* send acknowledge on 
next RTS */
+   OSMO_VALUE_STRING(GPRS_RLCMAC_UL_ACK_WAIT_ACK), /* wait for PACKET 
CONTROL ACK */
+   { 0, NULL }
+};
+
 static const struct value_string tbf_timers_names[] = {
OSMO_VALUE_STRING(T0),
OSMO_VALUE_STRING(T3169),
@@ -165,7 +172,6 @@
first_ts(0),
first_common_ts(0),
control_ts(0xff),
-   ul_ack_state(GPRS_RLCMAC_UL_ACK_NONE),
poll_state(GPRS_RLCMAC_POLL_NONE),
poll_fn(0),
poll_ts(0),
@@ -185,6 +191,7 @@
state(GPRS_RLCMAC_NULL),
dl_ass_state(GPRS_RLCMAC_DL_ASS_NONE),
ul_ass_state(GPRS_RLCMAC_UL_ASS_NONE),
+   ul_ack_state(GPRS_RLCMAC_UL_ACK_NONE),
m_list(this),
m_ms_list(this),
m_egprs_enabled(false)
diff --git a/src/tbf.h b/src/tbf.h
index 2d51945..2828772 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -87,6 +87,8 @@
GPRS_RLCMAC_UL_ACK_WAIT_ACK, /* wait for PACKET CONTROL ACK */
 };
 
+extern const struct value_string gprs_rlcmac_tbf_ul_ack_state_names[];
+
 enum gprs_rlcmac_tbf_direction {
GPRS_RLCMAC_DL_TBF,
GPRS_RLCMAC_UL_TBF
@@ -183,6 +185,7 @@
 #define TBF_SET_STATE(t, st) do { t->set_state(st, __FILE__, __LINE__); } 
while(0)
 #define TBF_SET_ASS_STATE_DL(t, st) do { t->set_ass_state_dl(st, __FILE__, 
__LINE__); } while(0)
 #define TBF_SET_ASS_STATE_UL(t, st) do { t->set_ass_state_ul(st, __FILE__, 
__LINE__); } while(0)
+#define TBF_SET_ACK_STATE(t, st) do { t->set_ack_state(st, __FILE__, 
__LINE__); } while(0)
 #define TBF_SET_ASS_ON(t, fl, chk) do { t->set_assigned_on(fl, chk, __FILE__, 
__LINE__); } while(0)
 
 struct gprs_rlcmac_tbf {
@@ -195,9 +198,11 @@
bool state_is_not(enum gprs_rlcmac_tbf_state rhs) const;
bool dl_ass_state_is(enum gprs_rlcmac_tbf_dl_ass_state rhs) const;
bool ul_ass_state_is(enum gprs_rlcmac_tbf_ul_ass_state rhs) const;
+   bool ul_ack_state_is(enum gprs_rlcmac_tbf_ul_ack_state rhs) const;
void set_state(enum gprs_rlcmac_tbf_state new_state, const char *file, 
int line);
void set_ass_state_dl(enum gprs_rlcmac_tbf_dl_ass_state new_state, 
const char *file, int line);
void set_ass_state_ul(enum gprs_rlcmac_tbf_ul_ass_state new_state, 
const char *file, int line);
+   void set_ack_state(enum gprs_rlcmac_tbf_ul_ack_state new_state, const 
char *file, int line);
void check_pending_ass();
bool check_n_clear(uint8_t state_flag);
void set_assigned_on(uint8_t state_flag, bool check_ccch, const char 
*file, int line);
@@ -279,8 +284,6 @@
 
gprs_llc m_llc;
 
-   enum gprs_rlcmac_tbf_ul_ack_state ul_ack_state;
-
enum gprs_rlcmac_tbf_poll_state poll_state;
uint32_t poll_fn; /* frame number to poll */
uint8_t poll_ts; /* TS to poll */
@@ -343,6 +346,7 @@
enum gprs_rlcmac_tbf_state state;
enum gprs_rlcmac_tbf_dl_ass_state dl_ass_state;
enum gprs_rlcmac_tbf_ul_ass_state ul_ass_state;
+   enum gprs_rlcmac_tbf_ul_ack_state ul_ack_state;
LListHead m_list;
LListHead m_ms_list;
bool m_egprs_enabled;
@@ -383,6 +387,11 @@
 inline bool gprs_rlcmac_tbf::ul_ass_state_is(enum gprs_rlcmac_tbf_ul_ass_state 
rhs) const
 {
return ul_ass_state == rhs;
+}
+
+inline bool 

[PATCH] osmo-pcu[master]: TBF: adjust test log levels

2018-01-23 Thread Max

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

TBF: adjust test log levels

* enable debugging for DTBF*
* disable excessive DRLCMAC*

Change-Id: I122620941e7939d513742c8589a75e0ab76f79ab
---
M tests/tbf/TbfTest.cpp
M tests/tbf/TbfTest.err
2 files changed, 4,665 insertions(+), 1,175 deletions(-)


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


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

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


[PATCH] osmo-pcu[master]: TBF: make UL/DL state internal

2018-01-23 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/5862

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

TBF: make UL/DL state internal

* add functions/macros for setting TBF's UL/DL state
* add functions for checking TBF's UL/DL state
* move pre-free check into separate function
* update TBF test output due to extended state transition logging

N. B: this should not be confused with TBF-UL or TBF-DL state.

Change-Id: Idcbf5775d17b1247f2ed01788f9b0788ce66e871
Related: OS#1539
---
M src/bts.cpp
M src/gprs_rlcmac_sched.cpp
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M tests/tbf/TbfTest.cpp
M tests/tbf/TbfTest.err
7 files changed, 170 insertions(+), 44 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/62/5862/2

diff --git a/src/bts.cpp b/src/bts.cpp
index 873af73..f614c1a 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1022,11 +1022,11 @@
tbf_free(tbf);
return;
}
-   if (tbf->dl_ass_state == GPRS_RLCMAC_DL_ASS_WAIT_ACK) {
+   if (tbf->dl_ass_state_is(GPRS_RLCMAC_DL_ASS_WAIT_ACK)) {
LOGPTBF(tbf, LOGL_DEBUG, "[UPLINK] DOWNLINK ASSIGNED\n");
/* reset N3105 */
tbf->n3105 = 0;
-   tbf->dl_ass_state = GPRS_RLCMAC_DL_ASS_NONE;
+   TBF_SET_ASS_STATE_DL(tbf, GPRS_RLCMAC_DL_ASS_NONE);
 
new_tbf = tbf->ms() ? tbf->ms()->dl_tbf() : NULL;
if (!new_tbf) {
@@ -1054,11 +1054,11 @@
tbf_assign_control_ts(new_tbf);
return;
}
-   if (tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_WAIT_ACK) {
+   if (tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_WAIT_ACK)) {
LOGPTBF(tbf, LOGL_DEBUG, "[DOWNLINK] UPLINK ASSIGNED\n");
/* reset N3105 */
tbf->n3105 = 0;
-   tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_NONE;
+   TBF_SET_ASS_STATE_UL(tbf, GPRS_RLCMAC_UL_ASS_NONE);
 
new_tbf = tbf->ms() ? tbf->ms()->ul_tbf() : NULL;
if (!new_tbf) {
@@ -1156,10 +1156,10 @@
/* schedule uplink assignment or reject */
if (ul_tbf) {
LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack message, 
so we provide one:\n");
-   tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS;
+   TBF_SET_ASS_STATE_UL(tbf, GPRS_RLCMAC_UL_ASS_SEND_ASS);
} else {
LOGP(DRLCMAC, LOGL_DEBUG, "MS requests UL TBF in ack message, 
so we packet access reject:\n");
-   tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ;
+   TBF_SET_ASS_STATE_UL(tbf, GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ);
}
 }
 
@@ -1403,7 +1403,7 @@
 
ul_tbf->control_ts = ts_no;
/* schedule uplink assignment */
-   ul_tbf->ul_ass_state = GPRS_RLCMAC_UL_ASS_SEND_ASS;
+   TBF_SET_ASS_STATE_UL(ul_tbf, GPRS_RLCMAC_UL_ASS_SEND_ASS);
 
/* get capabilities */
if (ul_tbf->ms())
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index 8925032..a87217f 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -54,11 +54,10 @@
*poll_tbf = ul_tbf;
if (ul_tbf->ul_ack_state == GPRS_RLCMAC_UL_ACK_SEND_ACK)
*ul_ack_tbf = ul_tbf;
-   if (ul_tbf->dl_ass_state == GPRS_RLCMAC_DL_ASS_SEND_ASS)
+   if (ul_tbf->dl_ass_state_is(GPRS_RLCMAC_DL_ASS_SEND_ASS))
*dl_ass_tbf = ul_tbf;
-   if (ul_tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_SEND_ASS
-   || ul_tbf->ul_ass_state ==
-   GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ)
+   if (ul_tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS)
+   || ul_tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ))
*ul_ass_tbf = ul_tbf;
 /* FIXME: Is this supposed to be fair? The last TBF for each wins? Maybe use 
llist_add_tail and skip once we have all
 states? */
@@ -73,10 +72,10 @@
if (dl_tbf->poll_state == GPRS_RLCMAC_POLL_SCHED
 && dl_tbf->poll_fn == poll_fn)
*poll_tbf = dl_tbf;
-   if (dl_tbf->dl_ass_state == GPRS_RLCMAC_DL_ASS_SEND_ASS)
+   if (dl_tbf->dl_ass_state_is(GPRS_RLCMAC_DL_ASS_SEND_ASS))
*dl_ass_tbf = dl_tbf;
-   if (dl_tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_SEND_ASS
-|| dl_tbf->ul_ass_state == GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ)
+   if (dl_tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS)
+   || dl_tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ))
*ul_ass_tbf = dl_tbf;
}
 
@@ -139,13 +138,11 @@
 * because they may kill the TBF when the CONTROL ACK is
 * received, thus preventing the others from being 

[MERGED] osmo-trx[master]: Remove unneeded libdl dependency

2018-01-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Remove unneeded libdl dependency
..


Remove unneeded libdl dependency

Closes: OS#1929

Change-Id: I0caea2a2a8e6bd07432fd73bae72b42b1ce022cd
---
M CommonLibs/Makefile.am
M Makefile.am
M Transceiver52M/Makefile.am
3 files changed, 5 insertions(+), 5 deletions(-)

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



diff --git a/CommonLibs/Makefile.am b/CommonLibs/Makefile.am
index 46cc143..fa0b285 100644
--- a/CommonLibs/Makefile.am
+++ b/CommonLibs/Makefile.am
@@ -22,7 +22,7 @@
 include $(top_srcdir)/Makefile.common
 
 AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
-AM_CXXFLAGS = -Wall -O3 -g -ldl -lpthread
+AM_CXXFLAGS = -Wall -O3 -g -lpthread
 
 EXTRA_DIST = \
example.config \
diff --git a/Makefile.am b/Makefile.am
index 1e659a0..71f7b91 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,9 +22,9 @@
 
 ACLOCAL_AMFLAGS = -I config
 AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(USB_INCLUDES) $(WITH_INCLUDES)
-AM_CXXFLAGS = -Wall -pthread -ldl
-#AM_CXXFLAGS = -Wall -O2 -NDEBUG -pthread -ldl
-#AM_CFLAGS = -Wall -O2 -NDEBUG -pthread -ldl
+AM_CXXFLAGS = -Wall -pthread
+#AM_CXXFLAGS = -Wall -O2 -NDEBUG -pthread
+#AM_CFLAGS = -Wall -O2 -NDEBUG -pthread
 
 # Order must be preserved
 SUBDIRS = \
diff --git a/Transceiver52M/Makefile.am b/Transceiver52M/Makefile.am
index 5b5fafa..f36f4d4 100644
--- a/Transceiver52M/Makefile.am
+++ b/Transceiver52M/Makefile.am
@@ -22,7 +22,7 @@
 include $(top_srcdir)/Makefile.common
 
 AM_CPPFLAGS = -Wall $(STD_DEFINES_AND_INCLUDES) -I${srcdir}/common
-AM_CXXFLAGS = -ldl -lpthread
+AM_CXXFLAGS = -lpthread
 
 SUBDIRS = arm x86
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0caea2a2a8e6bd07432fd73bae72b42b1ce022cd
Gerrit-PatchSet: 2
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: ttsou 


[MERGED] libosmo-sccp[master]: sccp_types.h: Fix value for SCCP_REFUSAL_UNEQUIPPED_USER

2018-01-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: sccp_types.h: Fix value for SCCP_REFUSAL_UNEQUIPPED_USER
..


sccp_types.h: Fix value for SCCP_REFUSAL_UNEQUIPPED_USER

It seems we have been sending the wrong numeric value in SCCP connection
refusal due to an unqeuipped user.  It turns out our list of refusal
causes was missing one entry, causing an off-by-one for this refusal
cause.  While at it, add a comment which section of which spec is
relevant for this enum.

Change-Id: I113645bd6df1ec9ae5137977028df38560fc4789
---
M include/sccp/sccp_types.h
1 file changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/include/sccp/sccp_types.h b/include/sccp/sccp_types.h
index 962bde4..ab7f74f 100644
--- a/include/sccp/sccp_types.h
+++ b/include/sccp/sccp_types.h
@@ -245,6 +245,7 @@
SCCP_ERROR_UNQUALIFIED  = 4,
 };
 
+/* ITU=T Q.713 Section 3.15 */
 enum sccp_refusal_cause {
SCCP_REFUSAL_END_USER_ORIGINATED= 0,
SCCP_REFUSAL_END_USER_CONGESTION= 1,
@@ -264,7 +265,8 @@
SCCP_REFUSAL_UNQUALIFIED= 15,
SCCP_REFUSAL_HOP_COUNTER_VIOLATION  = 16,
SCCP_REFUSAL_SCCP_FAILURE   = 17,
-   SCCP_REFUSAL_UNEQUIPPED_USER= 18,
+   SCCP_REFUSAL_NO_TRANS_FOR_ADDRESS_NATURE= 18,
+   SCCP_REFUSAL_UNEQUIPPED_USER= 19,
 };
 
 /*

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I113645bd6df1ec9ae5137977028df38560fc4789
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


libosmo-sccp[master]: sccp_types.h: Fix value for SCCP_REFUSAL_UNEQUIPPED_USER

2018-01-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[ABANDON] osmo-ci[master]: gerrit: remove obsolete openggsn job

2018-01-23 Thread Max
Max has abandoned this change.

Change subject: gerrit: remove obsolete openggsn job
..


Abandoned

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: If9ea1511fe628b9796b1df55d26b75bbe47d5c15
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: lynxis lazus 


[MERGED] osmo-ci[master]: jenkins: fix jobs template

2018-01-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: jenkins: fix jobs template
..


jenkins: fix jobs template

The sequential parameter was silently skipped because it was absent from
the project template. Fix this for both master- and gerrit- jobs.

Change-Id: I0bc28695f4f270bc7b1cc4bcd5d4d43ede6172f3
---
M jobs/gerrit-verifications.yml
M jobs/master-builds.yml
2 files changed, 4 insertions(+), 0 deletions(-)

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



diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml
index ce9d084..3789353 100644
--- a/jobs/gerrit-verifications.yml
+++ b/jobs/gerrit-verifications.yml
@@ -18,6 +18,7 @@
 a4_name: a4
 a4: !!python/tuple [default]
 combination_filter: ''
+sequential: false
 # most common build invocation
 cmd: ./contrib/jenkins.sh
 repos_url: 'ssh://jenk...@gerrit.osmocom.org:29418/{repos}'
@@ -211,6 +212,7 @@
   Auto-generated using Jenkins Job Builder. DO NOT EDIT MANUALLY!
 
 execution-strategy:
+  sequential: '{obj:sequential}'
   combination-filter: |
 {obj:combination_filter}
 axes:
diff --git a/jobs/master-builds.yml b/jobs/master-builds.yml
index 0f9bb1e..8cacf27 100644
--- a/jobs/master-builds.yml
+++ b/jobs/master-builds.yml
@@ -15,6 +15,7 @@
 a3_name: a3
 a3: !!python/tuple [default]
 combination_filter: ''
+sequential: false
 # most common build invocation
 cmd: ./contrib/jenkins.sh
 trigger:
@@ -261,6 +262,7 @@
   Auto-generated using Jenkins Job Builder. DO NOT EDIT MANUALLY!
 
 execution-strategy:
+  sequential: '{obj:sequential}'
   combination-filter: |
 {obj:combination_filter}
 axes:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0bc28695f4f270bc7b1cc4bcd5d4d43ede6172f3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: lynxis lazus 


osmo-ci[master]: jenkins: fix jobs template

2018-01-23 Thread Harald Welte

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

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0bc28695f4f270bc7b1cc4bcd5d4d43ede6172f3
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


osmo-ci[master]: gerrit: remove obsolete openggsn job

2018-01-23 Thread Harald Welte

Patch Set 1: Code-Review-1

We might still need to apply some bug fixes or the like, I don't want to remove 
the job

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

Gerrit-MessageType: comment
Gerrit-Change-Id: If9ea1511fe628b9796b1df55d26b75bbe47d5c15
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


osmo-mgw[master]: client: eliminate destructive head parsing

2018-01-23 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] osmo-msc[master]: MNCC: Add input validation

2018-01-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: MNCC: Add input validation
..


MNCC: Add input validation

There appears to have been no input validation whatsoever on MNCC
messages.  Hence it was very easy for an external MNCC handler to
crash OsmoMSC, such as in OS#2853

Change-Id: Idaf3b8e409c84564b1eb26d01a19c605f89b14f4
Closes: OS#2853
---
M include/osmocom/msc/mncc.h
M src/libmsc/mncc.c
M src/libmsc/mncc_sock.c
3 files changed, 188 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/msc/mncc.h b/include/osmocom/msc/mncc.h
index 49f0c8b..d2f0541 100644
--- a/include/osmocom/msc/mncc.h
+++ b/include/osmocom/msc/mncc.h
@@ -215,5 +215,6 @@
|| msg_type == GSM_TCH_FRAME_AMR \
|| msg_type == GSM_BAD_FRAME)
 
+int mncc_prim_check(const struct gsm_mncc *mncc_prim, unsigned int len);
 
 #endif
diff --git a/src/libmsc/mncc.c b/src/libmsc/mncc.c
index 4e88bc6..3b4c41d 100644
--- a/src/libmsc/mncc.c
+++ b/src/libmsc/mncc.c
@@ -1,7 +1,7 @@
 /* mncc.c - utility routines for the MNCC API between the 04.08
  * message parsing and the actual Call Control logic */
 
-/* (C) 2008-2009 by Harald Welte 
+/* (C) 2008-2018 by Harald Welte 
  * (C) 2009 by Andreas Eversberg 
  * All Rights Reserved
  *
@@ -105,3 +105,185 @@
data->cause.value = val;
 }
 
+
+/***
+ * MNCC validation code. Move to libosmocore once headers are merged
+ /
+
+#define MNCC_F_ALL 0x3fff
+
+static int check_string_terminated(const char *str, unsigned int size)
+{
+   int i;
+   for (i = 0; i < size; i++) {
+   if (str[i] == 0)
+   return 0;
+   }
+   return -EINVAL;
+}
+
+static int mncc_check_number(const struct gsm_mncc_number *num, const char 
*str)
+{
+   int rc;
+   rc = check_string_terminated(num->number, ARRAY_SIZE(num->number));
+   if (rc < 0)
+   LOGP(DMNCC, LOGL_ERROR, "MNCC %s number not terminated\n", str);
+   return rc;
+}
+
+static int mncc_check_cause(const struct gsm_mncc_cause *cause)
+{
+   if (cause->diag_len > sizeof(cause->diag))
+   return -EINVAL;
+   return 0;
+}
+
+static int mncc_check_useruser(const struct gsm_mncc_useruser *uu)
+{
+   return check_string_terminated(uu->info, ARRAY_SIZE(uu->info));
+}
+
+static int mncc_check_facility(const struct gsm_mncc_facility *fac)
+{
+   return check_string_terminated(fac->info, ARRAY_SIZE(fac->info));
+}
+
+static int mncc_check_ssversion(const struct gsm_mncc_ssversion *ssv)
+{
+   return check_string_terminated(ssv->info, ARRAY_SIZE(ssv->info));
+}
+
+static int mncc_prim_check_sign(const struct gsm_mncc *mncc_prim)
+{
+   int rc;
+
+   if (mncc_prim->fields & ~ MNCC_F_ALL) {
+   LOGP(DMNCC, LOGL_ERROR, "Unknown MNCC field mask 0x%x\n", 
mncc_prim->fields);
+   return -EINVAL;
+   }
+
+   rc = check_string_terminated(mncc_prim->imsi, sizeof(mncc_prim->imsi));
+   if (rc < 0) {
+   LOGP(DMNCC, LOGL_ERROR, "MNCC IMSI not terminated\n");
+   return rc;
+   }
+
+   if (mncc_prim->fields & MNCC_F_CALLED) {
+   rc = mncc_check_number(_prim->called, "called");
+   if (rc < 0)
+   return rc;
+   }
+
+   if (mncc_prim->fields & MNCC_F_CALLING) {
+   rc = mncc_check_number(_prim->calling, "calling");
+   if (rc < 0)
+   return rc;
+   }
+
+   if (mncc_prim->fields & MNCC_F_REDIRECTING) {
+   rc = mncc_check_number(_prim->redirecting, "redirecting");
+   if (rc < 0)
+   return rc;
+   }
+
+   if (mncc_prim->fields & MNCC_F_CONNECTED) {
+   rc = mncc_check_number(_prim->connected, "connected");
+   if (rc < 0)
+   return rc;
+   }
+
+   if (mncc_prim->fields & MNCC_F_CAUSE) {
+   rc = mncc_check_cause(_prim->cause);
+   if (rc < 0)
+   return rc;
+   }
+
+   if (mncc_prim->fields & MNCC_F_USERUSER) {
+   rc = mncc_check_useruser(_prim->useruser);
+   if (rc < 0)
+   return rc;
+   }
+
+   if (mncc_prim->fields & MNCC_F_FACILITY) {
+   rc = mncc_check_facility(_prim->facility);
+   if (rc < 0)
+   return rc;
+   }
+
+   if (mncc_prim->fields & MNCC_F_SSVERSION) {
+   rc = mncc_check_ssversion(_prim->ssversion);
+   if (rc < 0)
+   return rc;
+   }
+
+   if 

osmo-pcu[master]: Simplify TS alloc: use defines for constants

2018-01-23 Thread Harald Welte

Patch Set 7: Code-Review-1

Not all of holgers comments adrresed

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2699ceebf0cbec01652a02fa68ccc9e9419d0293
Gerrit-PatchSet: 7
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Holger Freyther 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-msc[master]: Fix value of stored SMS validity time.

2018-01-23 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Icf786f9b1efabfe7407fb6414ec0d326d8f7244a
Gerrit-PatchSet: 2
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Keith Whyte 
Gerrit-HasComments: No


[MERGED] osmo-msc[master]: Fix value of stored SMS validity time.

2018-01-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Fix value of stored SMS validity time.
..


Fix value of stored SMS validity time.

Quote the argument to sqlite's datetime(). Otherwise, the timestamp
stored in the database reads back as a negative value for some reason.

Before:

1032validity_timestamp = dbi_result_get_datetime(result, 
"valid_until");
(gdb) p validity_timestamp
$2 = -1516814654

After:

1032validity_timestamp = dbi_result_get_datetime(result, 
"valid_until");
(gdb) p validity_timestamp
$2 = 1516814654

Change-Id: Icf786f9b1efabfe7407fb6414ec0d326d8f7244a
---
M src/libmsc/db.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/libmsc/db.c b/src/libmsc/db.c
index 4bf9b1f..b48d137 100644
--- a/src/libmsc/db.c
+++ b/src/libmsc/db.c
@@ -711,7 +711,7 @@
 "user_data, text, "
 "dest_addr, dest_ton, dest_npi, "
 "src_addr, src_ton, src_npi) VALUES "
-   "(datetime('%lld', 'unixepoch'), datetime(%lld, 'unixepoch'), "
+   "(datetime('%lld', 'unixepoch'), datetime('%lld', 'unixepoch'), 
"
"%u, %u, %u, "
"%u, %u, %u, "
"%u, "

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icf786f9b1efabfe7407fb6414ec0d326d8f7244a
Gerrit-PatchSet: 3
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Keith Whyte 


[MERGED] osmo-pcu[master]: TBF: add dedicated log categories

2018-01-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: TBF: add dedicated log categories
..


TBF: add dedicated log categories

Previously all TBF-related events were logged as part of DRLCMAC which
is too broad to make it practically useful due to excessive amount of
log messages generated. Introduce dedicated log categories for
TBF-related events. Adjust test output as necessary.

Change-Id: I64d660e5971263d5c63d2ba95d50625c16a594aa
---
M src/gprs_debug.cpp
M src/gprs_debug.h
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M src/tbf_ul.cpp
M tests/alloc/AllocTest.err
M tests/tbf/TbfTest.err
8 files changed, 136,637 insertions(+), 4,992 deletions(-)

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




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

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


osmo-pcu[master]: TBF: add dedicated log categories

2018-01-23 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-sgsn[master]: configure.ac: Enable Wall in CFLAGS

2018-01-23 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] osmo-sgsn[master]: configure.ac: Enable Wall in CFLAGS

2018-01-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: configure.ac: Enable Wall in CFLAGS
..


configure.ac: Enable Wall in CFLAGS

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

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



diff --git a/configure.ac b/configure.ac
index b89c046..ba82eb1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,6 +104,9 @@
 CFLAGS="$saved_CFLAGS"
 AC_SUBST(SYMBOL_VISIBILITY)
 
+CPPFLAGS="$CPPFLAGS -Wall"
+CFLAGS="$CFLAGS -Wall"
+
 AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
 AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS 
-Werror=maybe-uninitialized"])
 AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS 
-Werror=memset-transposed-args"])

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

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


[ABANDON] osmo-ci[master]: jobs: Add IPv6 build option to osmo-ggsn job

2018-01-23 Thread Pau Espin Pedrol
Pau Espin Pedrol has abandoned this change.

Change subject: jobs: Add IPv6 build option to osmo-ggsn job
..


Abandoned

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: I3f97bcd163b0458d00c0def7982cdaa349f08747
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 


[ABANDON] osmo-ggsn[master]: Add configure flag to disable ipv6 support

2018-01-23 Thread Pau Espin Pedrol
Pau Espin Pedrol has abandoned this change.

Change subject: Add configure flag to disable ipv6 support
..


Abandoned

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

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


[PATCH] osmo-sgsn[master]: configure.ac: Enable Wall in CFLAGS

2018-01-23 Thread Pau Espin Pedrol
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/5673

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

configure.ac: Enable Wall in CFLAGS

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


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

diff --git a/configure.ac b/configure.ac
index b89c046..ba82eb1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,6 +104,9 @@
 CFLAGS="$saved_CFLAGS"
 AC_SUBST(SYMBOL_VISIBILITY)
 
+CPPFLAGS="$CPPFLAGS -Wall"
+CFLAGS="$CFLAGS -Wall"
+
 AX_CHECK_COMPILE_FLAG([-Werror=implicit], [CFLAGS="$CFLAGS -Werror=implicit"])
 AX_CHECK_COMPILE_FLAG([-Werror=maybe-uninitialized], [CFLAGS="$CFLAGS 
-Werror=maybe-uninitialized"])
 AX_CHECK_COMPILE_FLAG([-Werror=memset-transposed-args], [CFLAGS="$CFLAGS 
-Werror=memset-transposed-args"])

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I042b4918bc74955cc5162fad8c16d989402c29a1
Gerrit-PatchSet: 2
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


osmo-iuh[master]: configure.ac: Enable -Wall flag

2018-01-23 Thread Max

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib05f7862081708d578d8f0302d926aab42897dc2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


[MERGED] pysim[master]: Revert "pySim-prog: ADM code can be longer 8 digits, it's im...

2018-01-23 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: Revert "pySim-prog: ADM code can be longer 8 digits, it's 
implementation specific."
..


Revert "pySim-prog: ADM code can be longer 8 digits, it's implementation 
specific."

This reverts commit a51592e1807c1d13f88b32275aa4a8a77d7d3b40, which
broke the use of ADM pins on sysmoUSIM-SJS1 (and possibly others?)

The ADM pins have so far always been specified as ASCII decimal digits,
i.e. something like "-a 53204025" gets translated to hex "3533323034303235"

After the above patch this is broken and gets instead translated to
"53204025" in hex which obviously breaks.  Let's revert back to
the old behavior to make it work again.

Change-Id: I3d68b7e09938a2fcb7a9a6a31048388cc3141f79
---
M pySim-prog.py
1 file changed, 4 insertions(+), 3 deletions(-)

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



diff --git a/pySim-prog.py b/pySim-prog.py
index c08f43b..f27daf0 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -361,9 +361,10 @@
opc = ''.join(['%02x' % random.randrange(0,256) for i in 
range(16)])
 
if opts.pin_adm is not None:
-   pin_adm = opts.pin_adm
-   if not re.match('^([0-9a-fA-F][0-9a-fA-F])+$', pin_adm):
-   raise ValueError('ADM pin needs to be in hex format 
(even number of hex digits)')
+   if len(opts.pin_adm) > 8:
+   raise ValueError("PIN-ADM needs to be <=8 digits")
+   pin_adm = ''.join(['%02x'%(ord(x)) for x in opts.pin_adm])
+   pin_adm = rpad(pin_adm, 16)
else:
pin_adm = None
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3d68b7e09938a2fcb7a9a6a31048388cc3141f79
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 


pysim[master]: Revert "pySim-prog: ADM code can be longer 8 digits, it's im...

2018-01-23 Thread Harald Welte

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

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3d68b7e09938a2fcb7a9a6a31048388cc3141f79
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-HasComments: No


[PATCH] pysim[master]: Revert "pySim-prog: ADM code can be longer 8 digits, it's im...

2018-01-23 Thread Harald Welte

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

Revert "pySim-prog: ADM code can be longer 8 digits, it's implementation 
specific."

This reverts commit a51592e1807c1d13f88b32275aa4a8a77d7d3b40, which
broke the use of ADM pins on sysmoUSIM-SJS1 (and possibly others?)

The ADM pins have so far always been specified as ASCII decimal digits,
i.e. something like "-a 53204025" gets translated to hex "3533323034303235"

After the above patch this is broken and gets instead translated to
"53204025" in hex which obviously breaks.  Let's revert back to
the old behavior to make it work again.

Change-Id: I3d68b7e09938a2fcb7a9a6a31048388cc3141f79
---
M pySim-prog.py
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/99/5999/1

diff --git a/pySim-prog.py b/pySim-prog.py
index c08f43b..f27daf0 100755
--- a/pySim-prog.py
+++ b/pySim-prog.py
@@ -361,9 +361,10 @@
opc = ''.join(['%02x' % random.randrange(0,256) for i in 
range(16)])
 
if opts.pin_adm is not None:
-   pin_adm = opts.pin_adm
-   if not re.match('^([0-9a-fA-F][0-9a-fA-F])+$', pin_adm):
-   raise ValueError('ADM pin needs to be in hex format 
(even number of hex digits)')
+   if len(opts.pin_adm) > 8:
+   raise ValueError("PIN-ADM needs to be <=8 digits")
+   pin_adm = ''.join(['%02x'%(ord(x)) for x in opts.pin_adm])
+   pin_adm = rpad(pin_adm, 16)
else:
pin_adm = None
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d68b7e09938a2fcb7a9a6a31048388cc3141f79
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 


[PATCH] osmo-iuh[master]: configure.ac: Enable -Wall flag

2018-01-23 Thread Pau Espin Pedrol

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

configure.ac: Enable -Wall flag

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


  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/98/5998/1

diff --git a/configure.ac b/configure.ac
index 2b8974f..dd1d75e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,9 @@
CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined"
 fi
 
+CFLAGS="$CFLAGS -Wall"
+CPPFLAGS="$CPPFLAGS -Wall"
+
 AC_OUTPUT(
libosmo-ranap.pc
src/Makefile

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib05f7862081708d578d8f0302d926aab42897dc2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 


osmo-msc[master]: Accept SMS for any receiver

2018-01-23 Thread Pau Espin Pedrol

Patch Set 1:

Shouldn't we be checking if we can find the subscriber in the VLR/HLR instead 
of blindly accepting?

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

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