Build failure of network:osmocom:latest/openbsc in Debian_9.0/x86_64

2018-01-30 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:latest/openbsc/Debian_9.0/x86_64

Package network:osmocom:latest/openbsc failed to build in Debian_9.0/x86_64

Check out the package for editing:
  osc checkout network:osmocom:latest openbsc

Last lines of build log:
[  144s] 
[  144s] Makefile:736: recipe for target 'check-local' failed
[  144s] make[5]: *** [check-local] Error 1
[  144s] make[5]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests'
[  144s] Makefile:586: recipe for target 'check-am' failed
[  144s] make[4]: *** [check-am] Error 2
[  144s] make[4]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests'
[  144s] Makefile:438: recipe for target 'check-recursive' failed
[  144s] make[3]: *** [check-recursive] Error 1
[  144s] make[3]: Leaving directory '/usr/src/packages/BUILD/openbsc/tests'
[  144s] Makefile:520: recipe for target 'check-recursive' failed
[  144s] make[2]: *** [check-recursive] Error 1
[  144s] make[2]: Leaving directory '/usr/src/packages/BUILD/openbsc'
[  144s] Makefile:811: recipe for target 'check' failed
[  144s] make[1]: *** [check] Error 2
[  144s] make[1]: Leaving directory '/usr/src/packages/BUILD/openbsc'
[  144s] dh_auto_test: make -j1 check VERBOSE=1 returned exit code 2
[  144s] debian/rules:13: recipe for target 'build' failed
[  144s] make: *** [build] Error 2
[  144s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  144s] 
[  144s] lamb20 failed "build openbsc_1.0.0.dsc" at Tue Jan 30 08:41:59 UTC 
2018.
[  144s] 
[  144s] ### VM INTERACTION START ###
[  147s] [  138.964226] reboot: Power down
[  147s] ### VM INTERACTION END ###
[  147s] 
[  147s] lamb20 failed "build openbsc_1.0.0.dsc" at Tue Jan 30 08:42:02 UTC 
2018.
[  147s] 

-- 
Configure notifications at https://build.opensuse.org/user/notifications
openSUSE Build Service (https://build.opensuse.org/)


[PATCH] osmo-sgsn[master]: gtphub: check for gsn_addr_from_sockaddr() error

2018-01-30 Thread Max

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

gtphub: check for gsn_addr_from_sockaddr() error

Change-Id: I2d80b5a488e7daa0bc8f57ea304e0e1f10f6c1f5
Fixes: CID182472
---
M src/gprs/gtphub.c
1 file changed, 3 insertions(+), 1 deletion(-)


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

diff --git a/src/gprs/gtphub.c b/src/gprs/gtphub.c
index 2ff1b7c..4ee20cd 100644
--- a/src/gprs/gtphub.c
+++ b/src/gprs/gtphub.c
@@ -2649,7 +2649,9 @@
 {
struct gsn_addr gsna;
uint16_t port;
-   gsn_addr_from_sockaddr(&gsna, &port, addr);
+   if (gsn_addr_from_sockaddr(&gsna, &port, addr) != 0)
+   return NULL;
+
return gtphub_port_find(bind, &gsna, port);
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d80b5a488e7daa0bc8f57ea304e0e1f10f6c1f5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: Max 


[PATCH] osmo-msc[master]: a_iface: correct data type for a.conn_id in gsm_subscriber_c...

2018-01-30 Thread dexter

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

a_iface: correct data type for a.conn_id in gsm_subscriber_connection

conn_id is modeled as int, but should be uint32_t.

- change conn_id from int to uint32_t

Change-Id: Ibf14d7c9a547c4eeb873975e7dcddef223e7df46
Related: OS#2769
---
M include/osmocom/msc/gsm_data.h
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 27324d7..f50ebd6 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -209,7 +209,7 @@
/* The connection identifier that is used
 * to reference the SCCP connection that is
 * associated with this subscriber connection */
-   int conn_id;
+   uint32_t conn_id;
} a;
 };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf14d7c9a547c4eeb873975e7dcddef223e7df46
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] osmo-msc[master]: Make sending an SMS to an unknown subscriber B work over SMPP.

2018-01-30 Thread Stefan Sperling

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

Make sending an SMS to an unknown subscriber B work over SMPP.

Make the submit_to_sms() funcion aware of the message mode. If the
message does not require real-time "transactional/forward mode" we
can store it in the SMS database even if subscriber B cannot be
found in the VLR at this point in time.

This should should make the esme_ms_sms_storeforward test in
osmo-gsm-tester pass (a tweak to this test's expectations will
be needed as well, because the test currently assumes that an
invalid phone number for subscriber B will fail immediately,
rather than cause the message to eventually expire).

Change-Id: Ic3d78919568ad9252b4d19c3ddab5068d1c52db2
Related: OS#2354
---
M src/libmsc/smpp_openbsc.c
1 file changed, 9 insertions(+), 3 deletions(-)


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

diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index 4e2fb55..b0469f9 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -99,11 +99,12 @@
struct gsm_sms *sms;
struct tlv_t *t;
int mode;
+   int can_store_sms = ((submit->esm_class & SMPP34_MSG_MODE_MASK) != 2); 
/* != forward mode */
 
dest = subscr_by_dst(net, submit->dest_addr_npi,
 submit->dest_addr_ton,
 (const char *)submit->destination_addr);
-   if (!dest) {
+   if (!dest && !can_store_sms) {
LOGP(DLSMS, LOGL_NOTICE, "SMPP SUBMIT-SM for unknown 
subscriber: "
 "%s (NPI=%u)\n", submit->destination_addr,
 submit->dest_addr_npi);
@@ -115,7 +116,8 @@
case TLVID_message_payload:
if (smpp34_submit_tlv_msg_payload(t, submit, &sms_msg,
  &sms_msg_len) < 0) {
-   vlr_subscr_put(dest);
+   if (dest)
+   vlr_subscr_put(dest);
return ESME_ROPTPARNOTALLWD;
}
break;
@@ -149,7 +151,11 @@
sms->receiver = dest;
sms->dst.ton = submit->dest_addr_ton;
sms->dst.npi = submit->dest_addr_npi;
-   osmo_strlcpy(sms->dst.addr, dest->msisdn, sizeof(sms->dst.addr));
+   if (dest)
+   osmo_strlcpy(sms->dst.addr, dest->msisdn, 
sizeof(sms->dst.addr));
+   else
+   osmo_strlcpy(sms->dst.addr, (const char 
*)submit->destination_addr,
+sizeof(sms->dst.addr));
 
/* fill in the source address */
sms->src.ton = submit->source_addr_ton;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3d78919568ad9252b4d19c3ddab5068d1c52db2
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling 


[PATCH] osmo-pcu[master]: Move paging generation into PDCH

2018-01-30 Thread Max

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

Move paging generation into PDCH

Previously paging was prepared inside BTS function and than handed over
to PDCH function. Move the actual preparation into PDCH to better
decouple PDCH from BTS.

Change-Id: I389fb16b6e54040770c21f88edbcb8e045636928
---
M src/bts.cpp
M src/bts.h
2 files changed, 14 insertions(+), 12 deletions(-)


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

diff --git a/src/bts.cpp b/src/bts.cpp
index 918f7a5..496dc4a 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -308,7 +308,6 @@
uint8_t l, trx, ts, any_tbf = 0;
struct gprs_rlcmac_tbf *tbf;
LListHead *pos;
-   struct gprs_rlcmac_paging *pag;
uint8_t slot_mask[8];
int8_t first_ts; /* must be signed */
 
@@ -364,16 +363,10 @@
for (ts = 0; ts < 8; ts++) {
if ((slot_mask[trx] & (1 << ts))) {
/* schedule */
-   pag = talloc_zero(tall_pcu_ctx,
-   struct gprs_rlcmac_paging);
-   if (!pag)
+   if 
(!m_bts.trx[trx].pdch[ts].add_paging(chan_needed, identity_lv))
return -ENOMEM;
-   pag->chan_needed = chan_needed;
-   memcpy(pag->identity_lv, identity_lv,
-   identity_lv[0] + 1);
-   m_bts.trx[trx].pdch[ts].add_paging(pag);
-   LOGP(DRLCMAC, LOGL_INFO, "Paging on PACCH of "
-   "TRX=%d TS=%d\n", trx, ts);
+
+   LOGP(DRLCMAC, LOGL_INFO, "Paging on PACCH of 
TRX=%d TS=%d\n", trx, ts);
any_tbf = 1;
}
}
@@ -976,9 +969,18 @@
return msg;
 }
 
-void gprs_rlcmac_pdch::add_paging(struct gprs_rlcmac_paging *pag)
+bool gprs_rlcmac_pdch::add_paging(uint8_t chan_needed, uint8_t *identity_lv)
 {
+   struct gprs_rlcmac_paging *pag = talloc_zero(tall_pcu_ctx, struct 
gprs_rlcmac_paging);
+   if (!pag)
+   return false;
+
+   pag->chan_needed = chan_needed;
+   memcpy(pag->identity_lv, identity_lv, identity_lv[0] + 1);
+
llist_add(&pag->list, &paging_list);
+
+   return true;
 }
 
 void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t 
*packet, uint32_t fn)
diff --git a/src/bts.h b/src/bts.h
index 5d143d2..c3bee12 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -73,7 +73,7 @@
struct gprs_rlcmac_paging *dequeue_paging();
struct msgb *packet_paging_request();
 
-   void add_paging(struct gprs_rlcmac_paging *pag);
+   bool add_paging(uint8_t chan_needed, uint8_t *identity_lv);
 
void free_resources();
 

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

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


[PATCH] osmo-pcu[master]: Update header includes

2018-01-30 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6100

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

Update header includes

Many files include unnecessary headers and don't include headers which
are actually used. Because of that combined with the fact that OsmoPCU
is a mixture of C and C++, it makes it hard to modularize code. Fix
this (using iwyu [1] tool):

* add missing headers
* remove unused headers

[1] https://include-what-you-use.org/

Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
---
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_ms.cpp
M src/gprs_ms.h
M src/gprs_ms_storage.cpp
M src/gprs_rlcmac.cpp
M src/gprs_rlcmac_sched.cpp
M src/gprs_rlcmac_ts_alloc.cpp
M src/llc.h
M src/osmobts_sock.cpp
M src/pcu_l1_if.cpp
M src/pcu_main.cpp
M src/pcu_vty_functions.cpp
M src/poll_controller.cpp
M src/poll_controller.h
M src/rlc.cpp
M src/sba.cpp
M src/sba.h
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M src/tbf_ul.cpp
M tests/edge/EdgeTest.cpp
M tests/tbf/TbfTest.cpp
25 files changed, 118 insertions(+), 26 deletions(-)


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

diff --git a/src/bts.cpp b/src/bts.cpp
index 1669739..918f7a5 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -25,9 +25,10 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
+#include 
 
 extern "C" {
#include 
@@ -37,6 +38,10 @@
#include 
#include 
#include 
+   #include 
+   #include 
+   #include 
+   #include 
 }
 
 #include 
diff --git a/src/bts.h b/src/bts.h
index 5679b98..5d143d2 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -26,17 +26,17 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 }
 
+#include 
 #include "poll_controller.h"
 #include "sba.h"
 #include "tbf.h"
 #include "gprs_ms_storage.h"
 #include "gprs_coding_scheme.h"
+#include 
 #endif
 
 #include 
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index a86e09d..e0d756a 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -21,8 +21,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #define BSSGP_TIMER_T1 30  /* Guards the (un)blocking procedures */
 #define BSSGP_TIMER_T2 30  /* Guards the reset procedure */
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 33d9cad..740ef6b 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -20,7 +20,7 @@
 
 
 #include "gprs_ms.h"
-
+#include 
 #include "bts.h"
 #include "tbf.h"
 #include "gprs_debug.h"
@@ -33,6 +33,7 @@
#include 
#include 
#include 
+   #include 
 }
 
 #define GPRS_CODEL_SLOW_INTERVAL_MS 4000
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
index f094e96..857f0c9 100644
--- a/src/gprs_ms.h
+++ b/src/gprs_ms.h
@@ -22,13 +22,16 @@
 
 struct gprs_codel;
 
+#include 
 #include "cxx_linuxlist.h"
 #include "llc.h"
 #include "tbf.h"
 #include "pcu_l1_if.h"
+#include 
 
 extern "C" {
#include 
+   #include 
 }
 
 #include 
diff --git a/src/gprs_ms_storage.cpp b/src/gprs_ms_storage.cpp
index 6a7f336..c7de6d3 100644
--- a/src/gprs_ms_storage.cpp
+++ b/src/gprs_ms_storage.cpp
@@ -23,7 +23,10 @@
 
 #include "tbf.h"
 #include "bts.h"
-#include "gprs_debug.h"
+
+extern "C" {
+   #include 
+}
 
 #define GPRS_UNDEFINED_IMSI "000"
 
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 06c5479..da5c541 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-
+#include 
 
 extern void *tall_pcu_ctx;
 
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index ebf4714..e4e40b1 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -22,9 +22,16 @@
 #include 
 #include 
 #include 
-
+#include 
+#include 
+#include 
+#include 
 #include "pcu_utils.h"
 
+extern "C" {
+   #include 
+}
+
 static uint32_t sched_poll(BTS *bts,
uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr,
struct gprs_rlcmac_tbf **poll_tbf,
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index e394a6e..e555466 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -31,6 +31,9 @@
 
 extern "C" {
 #include "mslot_class.h"
+#include 
+#include 
+#include 
 }
 
 /* Consider a PDCH as idle if has at most this number of TBFs assigned to it */
diff --git a/src/llc.h b/src/llc.h
index 9d402c3..2e7229c 100644
--- a/src/llc.h
+++ b/src/llc.h
@@ -29,7 +29,6 @@
 #define LLC_MAX_LEN 1543
 
 struct BTS;
-struct msgb;
 
 /**
  * I represent the LLC data to a MS
diff --git a/src/osmobts_sock.cpp b/src/osmobts_sock.cpp
index 577d41e..f56332e 100644
--- a/src/osmobts_sock.cpp
+++ b/src/osmobts_sock.cpp
@@ -29,9 +29,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 }
 
-#include 
 #include 
 #include 
 #include 
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 7112b04..2a354d8 100644

[PATCH] osmo-gsm-tester[master]: aoip_smpp: Since recent osmo-msc, we accept all sms in store...

2018-01-30 Thread Pau Espin Pedrol

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

aoip_smpp: Since recent osmo-msc, we accept all sms in store&forward mode

Change-Id: Ieb5656f3ca93f4343441d90e30fbe904382c44e3
---
M suites/aoip_smpp/esme_ms_sms_storeforward.py
1 file changed, 8 insertions(+), 2 deletions(-)


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

diff --git a/suites/aoip_smpp/esme_ms_sms_storeforward.py 
b/suites/aoip_smpp/esme_ms_sms_storeforward.py
index 543170e..74765bc 100755
--- a/suites/aoip_smpp/esme_ms_sms_storeforward.py
+++ b/suites/aoip_smpp/esme_ms_sms_storeforward.py
@@ -38,9 +38,11 @@
 hlr.subscriber_add(ms)
 
 wrong_msisdn = ms.msisdn + esme.msisdn
-print('sending sms with wrong msisdn %s, it will fail' % wrong_msisdn)
+print('sending sms with wrong msisdn %s, it will be stored but not delivered' 
% wrong_msisdn)
 msg = Sms(esme.msisdn, wrong_msisdn, 'smpp message with wrong dest')
-esme.run_method_expect_failure(SMPP_ESME_RINVDSTADR, esme.sms_send_wait_resp, 
msg, esme.MSGMODE_STOREFORWARD)
+# Since osmo-msc 1e67fea7ba5c6336, we accept all sms in store&forward mode 
without looking at HLR
+# esme.run_method_expect_failure(SMPP_ESME_RINVDSTADR, 
esme.sms_send_wait_resp, msg, esme.MSGMODE_STOREFORWARD)
+umref_wrong = esme.sms_send_wait_resp(msg, esme.MSGMODE_STOREFORWARD, 
receipt=True)
 
 print('sending sms, it will be stored...')
 msg = Sms(esme.msisdn, ms.msisdn, 'smpp send not-yet-registered message')
@@ -60,4 +62,8 @@
 wait(ms.sms_was_received, msg)
 print('Waiting to receive and consume sms receipt with reference', umref)
 wait(esme.receipt_was_received, umref)
+
+print('Asserting the sms with wrong msisdn was not delivered', umref_wrong)
+assert not esme.receipt_was_received(umref_wrong)
+
 esme.disconnect()

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

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


[PATCH] osmo-pcu[master]: Move PDCH-related functions into separate file

2018-01-30 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6053

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

Move PDCH-related functions into separate file

The PDCH class and corresponding functions are rather self-contained and
independent from BTS implementation. Let's move them into separate file
to make bts.cpp more manageable. As additional benefit it allow us to
somewhat untangle all the different cross-dependent includes.

Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683
Related: OS#1539
---
M src/Makefile.am
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_bssgp_pcu.h
M src/gprs_rlcmac_sched.cpp
M src/gprs_rlcmac_ts_alloc.cpp
M src/osmobts_sock.cpp
M src/pcu_l1_if.cpp
M src/pcu_vty_functions.cpp
A src/pdch.cpp
A src/pdch.h
M src/sba.cpp
M src/tbf.cpp
14 files changed, 1,119 insertions(+), 1,024 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/6053/3

diff --git a/src/Makefile.am b/src/Makefile.am
index 7d2a62e..b2f64f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -54,6 +54,7 @@
tbf_ul.cpp \
tbf_dl.cpp \
bts.cpp \
+   pdch.cpp \
poll_controller.cpp \
encoding.cpp \
sba.cpp \
@@ -85,6 +86,7 @@
mslot_class.h \
tbf.h \
bts.h \
+   pdch.h \
poll_controller.h \
encoding.h \
sba.h \
diff --git a/src/bts.cpp b/src/bts.cpp
index 496dc4a..096d3af 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern "C" {
#include 
@@ -43,8 +44,6 @@
#include 
#include 
 }
-
-#include 
 
 #include 
 #include 
@@ -843,801 +842,6 @@
return ms;
 }
 
-/*
- * PDCH code below. TODO: move to a separate file
- */
-
-void gprs_rlcmac_pdch::enable()
-{
-   /* TODO: Check if there are still allocated resources.. */
-   INIT_LLIST_HEAD(&paging_list);
-   m_is_enabled = 1;
-}
-
-void gprs_rlcmac_pdch::disable()
-{
-   /* TODO.. kick free_resources once we know the TRX/TS we are on */
-   m_is_enabled = 0;
-}
-
-void gprs_rlcmac_pdch::free_resources()
-{
-   struct gprs_rlcmac_paging *pag;
-
-   /* we are not enabled. there should be no resources */
-   if (!is_enabled())
-   return;
-
-   /* kick all TBF on slot */
-   gprs_rlcmac_tbf::free_all(this);
-
-   /* flush all pending paging messages */
-   while ((pag = dequeue_paging()))
-   talloc_free(pag);
-
-   trx->bts->sba()->free_resources(this);
-}
-
-struct gprs_rlcmac_paging *gprs_rlcmac_pdch::dequeue_paging()
-{
-   struct gprs_rlcmac_paging *pag;
-
-   if (llist_empty(&paging_list))
-   return NULL;
-   pag = llist_entry(paging_list.next, struct gprs_rlcmac_paging, list);
-   llist_del(&pag->list);
-
-   return pag;
-}
-
-struct msgb *gprs_rlcmac_pdch::packet_paging_request()
-{
-   struct gprs_rlcmac_paging *pag;
-   struct msgb *msg;
-   unsigned wp = 0, len;
-
-   /* no paging, no message */
-   pag = dequeue_paging();
-   if (!pag)
-   return NULL;
-
-   LOGP(DRLCMAC, LOGL_DEBUG, "Scheduling paging\n");
-
-   /* alloc message */
-   msg = msgb_alloc(23, "pag ctrl block");
-   if (!msg) {
-   talloc_free(pag);
-   return NULL;
-   }
-   bitvec *pag_vec = bitvec_alloc(23, tall_pcu_ctx);
-   if (!pag_vec) {
-   msgb_free(msg);
-   talloc_free(pag);
-   return NULL;
-   }
-   wp = Encoding::write_packet_paging_request(pag_vec);
-
-   /* loop until message is full */
-   while (pag) {
-   /* try to add paging */
-   if ((pag->identity_lv[1] & 0x07) == 4) {
-   /* TMSI */
-   LOGP(DRLCMAC, LOGL_DEBUG, "- TMSI=0x%08x\n",
-   ntohl(*((uint32_t *)(pag->identity_lv + 1;
-   len = 1 + 1 + 1 + 32 + 2 + 1;
-   if (pag->identity_lv[0] != 5) {
-   LOGP(DRLCMAC, LOGL_ERROR, "TMSI paging with "
-   "MI != 5 octets!\n");
-   goto continue_next;
-   }
-   } else {
-   /* MI */
-   LOGP(DRLCMAC, LOGL_DEBUG, "- MI=%s\n",
-   osmo_hexdump(pag->identity_lv + 1,
-   pag->identity_lv[0]));
-   len = 1 + 1 + 1 + 4 + (pag->identity_lv[0]<<3) + 2 + 1;
-   if (pag->identity_lv[0] > 8) {
-   LOGP(DRLCMAC, LOGL_ERROR, "Paging with "
-   "MI > 8 octets!\n");
-   goto continue_next;
-   }
-   }
-   if (wp + len > 184) {
-   LOG

osmo-ttcn3-hacks[master]: ggsn_tests: Add test case to validate packets forwarded vs d...

2018-01-30 Thread Pau Espin Pedrol

Patch Set 1:

Added pcap + description in https://osmocom.org/issues/2422#note-7

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

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


osmo-msc[master]: Make sending an SMS to an unknown subscriber B work over SMPP.

2018-01-30 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+1

Solves the issue in osmo-gsm-tester together with 
https://gerrit.osmocom.org/#/c/6194/

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

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


[PATCH] osmo-pcu[master]: Update header includes

2018-01-30 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6100

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

Update header includes

Many files include unnecessary headers and don't include headers which
are actually used. Because of that combined with the fact that OsmoPCU
is a mixture of C and C++, it makes it hard to modularize code. Fix
this (using iwyu [1] tool):

* add missing headers
* remove unused headers

[1] https://include-what-you-use.org/

Related: OS#1539
Change-Id: I8c9f488a43b099c72b2d30d3245e7ba50872fc00
---
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_bssgp_pcu.h
M src/gprs_ms.cpp
M src/gprs_ms.h
M src/gprs_ms_storage.cpp
M src/gprs_rlcmac.cpp
M src/gprs_rlcmac_sched.cpp
M src/gprs_rlcmac_ts_alloc.cpp
M src/llc.h
M src/osmobts_sock.cpp
M src/pcu_l1_if.cpp
M src/pcu_main.cpp
M src/pcu_vty_functions.cpp
M src/poll_controller.cpp
M src/poll_controller.h
M src/rlc.cpp
M src/sba.cpp
M src/sba.h
M src/tbf.cpp
M src/tbf.h
M src/tbf_dl.cpp
M src/tbf_ul.cpp
M tests/edge/EdgeTest.cpp
M tests/tbf/TbfTest.cpp
26 files changed, 118 insertions(+), 30 deletions(-)


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

diff --git a/src/bts.cpp b/src/bts.cpp
index 1d5b29f..24be5d4 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -25,9 +25,10 @@
 #include 
 #include 
 #include 
-
+#include 
 #include 
 #include 
+#include 
 
 extern "C" {
#include 
@@ -37,9 +38,11 @@
#include 
#include 
#include 
+   #include 
+   #include 
+   #include 
+   #include 
 }
-
-#include 
 
 #include 
 #include 
diff --git a/src/bts.h b/src/bts.h
index 173e6e8..c3bee12 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -26,17 +26,17 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 }
 
+#include 
 #include "poll_controller.h"
 #include "sba.h"
 #include "tbf.h"
 #include "gprs_ms_storage.h"
 #include "gprs_coding_scheme.h"
+#include 
 #endif
 
 #include 
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index a86e09d..e0d756a 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -21,8 +21,10 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #define BSSGP_TIMER_T1 30  /* Guards the (un)blocking procedures */
 #define BSSGP_TIMER_T2 30  /* Guards the reset procedure */
diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h
index bb44903..4eda57d 100644
--- a/src/gprs_bssgp_pcu.h
+++ b/src/gprs_bssgp_pcu.h
@@ -42,8 +42,6 @@
 #define NS_HDR_LEN 4
 #define IE_LLC_PDU 14
 
-struct gprs_rlcmac_bts;
-
 struct gprs_bssgp_pcu {
struct gprs_nsvc *nsvc;
struct bssgp_bvc_ctx *bctx;
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 33d9cad..740ef6b 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -20,7 +20,7 @@
 
 
 #include "gprs_ms.h"
-
+#include 
 #include "bts.h"
 #include "tbf.h"
 #include "gprs_debug.h"
@@ -33,6 +33,7 @@
#include 
#include 
#include 
+   #include 
 }
 
 #define GPRS_CODEL_SLOW_INTERVAL_MS 4000
diff --git a/src/gprs_ms.h b/src/gprs_ms.h
index f094e96..857f0c9 100644
--- a/src/gprs_ms.h
+++ b/src/gprs_ms.h
@@ -22,13 +22,16 @@
 
 struct gprs_codel;
 
+#include 
 #include "cxx_linuxlist.h"
 #include "llc.h"
 #include "tbf.h"
 #include "pcu_l1_if.h"
+#include 
 
 extern "C" {
#include 
+   #include 
 }
 
 #include 
diff --git a/src/gprs_ms_storage.cpp b/src/gprs_ms_storage.cpp
index 6a7f336..c7de6d3 100644
--- a/src/gprs_ms_storage.cpp
+++ b/src/gprs_ms_storage.cpp
@@ -23,7 +23,10 @@
 
 #include "tbf.h"
 #include "bts.h"
-#include "gprs_debug.h"
+
+extern "C" {
+   #include 
+}
 
 #define GPRS_UNDEFINED_IMSI "000"
 
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 06c5479..da5c541 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -24,7 +24,7 @@
 #include 
 #include 
 #include 
-
+#include 
 
 extern void *tall_pcu_ctx;
 
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index ebf4714..e4e40b1 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -22,9 +22,16 @@
 #include 
 #include 
 #include 
-
+#include 
+#include 
+#include 
+#include 
 #include "pcu_utils.h"
 
+extern "C" {
+   #include 
+}
+
 static uint32_t sched_poll(BTS *bts,
uint8_t trx, uint8_t ts, uint32_t fn, uint8_t block_nr,
struct gprs_rlcmac_tbf **poll_tbf,
diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp
index e394a6e..e555466 100644
--- a/src/gprs_rlcmac_ts_alloc.cpp
+++ b/src/gprs_rlcmac_ts_alloc.cpp
@@ -31,6 +31,9 @@
 
 extern "C" {
 #include "mslot_class.h"
+#include 
+#include 
+#include 
 }
 
 /* Consider a PDCH as idle if has at most this number of TBFs assigned to it */
diff --git a/src/llc.h b/src/llc.h
index 9d402c3..2e7229c 100644
--- a/src/llc.h
+++ b/src/llc.h
@@ -29,7 +29,6 @@
 #define LLC_MAX_LEN 1543
 
 struct BTS;
-struct msgb;
 
 /**
  

[PATCH] osmo-pcu[master]: Move paging generation into PDCH

2018-01-30 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6193

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

Move paging generation into PDCH

Previously paging was prepared inside BTS function and than handed over
to PDCH function. Move the actual preparation into PDCH to better
decouple PDCH from BTS.

Related: OS#1539
Change-Id: I389fb16b6e54040770c21f88edbcb8e045636928
---
M src/bts.cpp
M src/bts.h
2 files changed, 14 insertions(+), 12 deletions(-)


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

diff --git a/src/bts.cpp b/src/bts.cpp
index 1669739..1d5b29f 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -303,7 +303,6 @@
uint8_t l, trx, ts, any_tbf = 0;
struct gprs_rlcmac_tbf *tbf;
LListHead *pos;
-   struct gprs_rlcmac_paging *pag;
uint8_t slot_mask[8];
int8_t first_ts; /* must be signed */
 
@@ -359,16 +358,10 @@
for (ts = 0; ts < 8; ts++) {
if ((slot_mask[trx] & (1 << ts))) {
/* schedule */
-   pag = talloc_zero(tall_pcu_ctx,
-   struct gprs_rlcmac_paging);
-   if (!pag)
+   if 
(!m_bts.trx[trx].pdch[ts].add_paging(chan_needed, identity_lv))
return -ENOMEM;
-   pag->chan_needed = chan_needed;
-   memcpy(pag->identity_lv, identity_lv,
-   identity_lv[0] + 1);
-   m_bts.trx[trx].pdch[ts].add_paging(pag);
-   LOGP(DRLCMAC, LOGL_INFO, "Paging on PACCH of "
-   "TRX=%d TS=%d\n", trx, ts);
+
+   LOGP(DRLCMAC, LOGL_INFO, "Paging on PACCH of 
TRX=%d TS=%d\n", trx, ts);
any_tbf = 1;
}
}
@@ -971,9 +964,18 @@
return msg;
 }
 
-void gprs_rlcmac_pdch::add_paging(struct gprs_rlcmac_paging *pag)
+bool gprs_rlcmac_pdch::add_paging(uint8_t chan_needed, uint8_t *identity_lv)
 {
+   struct gprs_rlcmac_paging *pag = talloc_zero(tall_pcu_ctx, struct 
gprs_rlcmac_paging);
+   if (!pag)
+   return false;
+
+   pag->chan_needed = chan_needed;
+   memcpy(pag->identity_lv, identity_lv, identity_lv[0] + 1);
+
llist_add(&pag->list, &paging_list);
+
+   return true;
 }
 
 void gprs_rlcmac_pdch::rcv_control_ack(Packet_Control_Acknowledgement_t 
*packet, uint32_t fn)
diff --git a/src/bts.h b/src/bts.h
index 5679b98..173e6e8 100644
--- a/src/bts.h
+++ b/src/bts.h
@@ -73,7 +73,7 @@
struct gprs_rlcmac_paging *dequeue_paging();
struct msgb *packet_paging_request();
 
-   void add_paging(struct gprs_rlcmac_paging *pag);
+   bool add_paging(uint8_t chan_needed, uint8_t *identity_lv);
 
void free_resources();
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I389fb16b6e54040770c21f88edbcb8e045636928
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-pcu[master]: Move PDCH-related functions into separate file

2018-01-30 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6053

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

Move PDCH-related functions into separate file

The PDCH class and corresponding functions are rather self-contained and
independent from BTS implementation. Let's move them into separate file
to make bts.cpp more manageable. As additional benefit it allow us to
somewhat untangle all the different cross-dependent includes.

Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683
Related: OS#1539
---
M src/Makefile.am
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_rlcmac_sched.cpp
M src/gprs_rlcmac_ts_alloc.cpp
M src/osmo-bts-sysmo/sysmo_l1_if.c
M src/osmobts_sock.cpp
M src/pcu_l1_if.cpp
M src/pcu_vty.c
M src/pcu_vty_functions.cpp
A src/pdch.cpp
A src/pdch.h
M src/sba.cpp
M src/tbf.cpp
15 files changed, 1,121 insertions(+), 1,020 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/53/6053/4

diff --git a/src/Makefile.am b/src/Makefile.am
index 7d2a62e..b2f64f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -54,6 +54,7 @@
tbf_ul.cpp \
tbf_dl.cpp \
bts.cpp \
+   pdch.cpp \
poll_controller.cpp \
encoding.cpp \
sba.cpp \
@@ -85,6 +86,7 @@
mslot_class.h \
tbf.h \
bts.h \
+   pdch.h \
poll_controller.h \
encoding.h \
sba.h \
diff --git a/src/bts.cpp b/src/bts.cpp
index 24be5d4..096d3af 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern "C" {
#include 
@@ -841,801 +842,6 @@
return ms;
 }
 
-/*
- * PDCH code below. TODO: move to a separate file
- */
-
-void gprs_rlcmac_pdch::enable()
-{
-   /* TODO: Check if there are still allocated resources.. */
-   INIT_LLIST_HEAD(&paging_list);
-   m_is_enabled = 1;
-}
-
-void gprs_rlcmac_pdch::disable()
-{
-   /* TODO.. kick free_resources once we know the TRX/TS we are on */
-   m_is_enabled = 0;
-}
-
-void gprs_rlcmac_pdch::free_resources()
-{
-   struct gprs_rlcmac_paging *pag;
-
-   /* we are not enabled. there should be no resources */
-   if (!is_enabled())
-   return;
-
-   /* kick all TBF on slot */
-   gprs_rlcmac_tbf::free_all(this);
-
-   /* flush all pending paging messages */
-   while ((pag = dequeue_paging()))
-   talloc_free(pag);
-
-   trx->bts->sba()->free_resources(this);
-}
-
-struct gprs_rlcmac_paging *gprs_rlcmac_pdch::dequeue_paging()
-{
-   struct gprs_rlcmac_paging *pag;
-
-   if (llist_empty(&paging_list))
-   return NULL;
-   pag = llist_entry(paging_list.next, struct gprs_rlcmac_paging, list);
-   llist_del(&pag->list);
-
-   return pag;
-}
-
-struct msgb *gprs_rlcmac_pdch::packet_paging_request()
-{
-   struct gprs_rlcmac_paging *pag;
-   struct msgb *msg;
-   unsigned wp = 0, len;
-
-   /* no paging, no message */
-   pag = dequeue_paging();
-   if (!pag)
-   return NULL;
-
-   LOGP(DRLCMAC, LOGL_DEBUG, "Scheduling paging\n");
-
-   /* alloc message */
-   msg = msgb_alloc(23, "pag ctrl block");
-   if (!msg) {
-   talloc_free(pag);
-   return NULL;
-   }
-   bitvec *pag_vec = bitvec_alloc(23, tall_pcu_ctx);
-   if (!pag_vec) {
-   msgb_free(msg);
-   talloc_free(pag);
-   return NULL;
-   }
-   wp = Encoding::write_packet_paging_request(pag_vec);
-
-   /* loop until message is full */
-   while (pag) {
-   /* try to add paging */
-   if ((pag->identity_lv[1] & 0x07) == 4) {
-   /* TMSI */
-   LOGP(DRLCMAC, LOGL_DEBUG, "- TMSI=0x%08x\n",
-   ntohl(*((uint32_t *)(pag->identity_lv + 1;
-   len = 1 + 1 + 1 + 32 + 2 + 1;
-   if (pag->identity_lv[0] != 5) {
-   LOGP(DRLCMAC, LOGL_ERROR, "TMSI paging with "
-   "MI != 5 octets!\n");
-   goto continue_next;
-   }
-   } else {
-   /* MI */
-   LOGP(DRLCMAC, LOGL_DEBUG, "- MI=%s\n",
-   osmo_hexdump(pag->identity_lv + 1,
-   pag->identity_lv[0]));
-   len = 1 + 1 + 1 + 4 + (pag->identity_lv[0]<<3) + 2 + 1;
-   if (pag->identity_lv[0] > 8) {
-   LOGP(DRLCMAC, LOGL_ERROR, "Paging with "
-   "MI > 8 octets!\n");
-   goto continue_next;
-   }
-   }
-   if (wp + len > 184) {
-   LOGP(DRLCMAC, LOGL_DEBUG, "- Does not fit, so schedule "
-   

[PATCH] osmo-pcu[master]: Move include guard to the top

2018-01-30 Thread Max

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

Move include guard to the top

Having explicit include above the douible-include guard defines is
potential source for hard to track bugs. Let's move it inside the guard
statement.

Change-Id: I5114a63ce00b03c8eed23565d52969250bd505cc
Related: OS#1539
---
M src/csn1.h
M src/gsm_rlcmac.h
2 files changed, 6 insertions(+), 5 deletions(-)


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

diff --git a/src/csn1.h b/src/csn1.h
index 3f5b849..1015e69 100644
--- a/src/csn1.h
+++ b/src/csn1.h
@@ -25,15 +25,15 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#ifndef _PACKET_CSN1_H_
+#define _PACKET_CSN1_H_
+
 extern "C" {
 #include 
 }
 
 #include 
 #include 
-#ifndef _PACKET_CSN1_H_
-#define _PACKET_CSN1_H_
-
 
 #define MIN(a,b) (((a)<(b))?(a):(b))
 //#define max(a,b) (((a)>(b))?(a):(b))
diff --git a/src/gsm_rlcmac.h b/src/gsm_rlcmac.h
index 8f4039c..2ad1937 100644
--- a/src/gsm_rlcmac.h
+++ b/src/gsm_rlcmac.h
@@ -29,11 +29,12 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+#ifndef __PACKET_GSM_RLCMAC_H__
+#define __PACKET_GSM_RLCMAC_H__
+
 #include "csn1.h"
 #include 
 #include 
-#ifndef __PACKET_GSM_RLCMAC_H__
-#define __PACKET_GSM_RLCMAC_H__
 
 #ifndef PRE_PACKED
 #define PRE_PACKED

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

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


[PATCH] osmo-pcu[master]: Move PDCH-related functions into separate files

2018-01-30 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6053

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

Move PDCH-related functions into separate files

The PDCH class and corresponding functions are rather self-contained and
independent from BTS implementation. Let's move them into separate file
to make bts.cpp more manageable. As additional benefit it allow us to
somewhat untangle all the different cross-dependent includes.

Change-Id: Ie05e25361e6741a81b024679f9675c98d4923683
Related: OS#1539
---
M src/Makefile.am
M src/bts.cpp
M src/bts.h
M src/gprs_bssgp_pcu.cpp
M src/gprs_rlcmac_sched.cpp
M src/gprs_rlcmac_ts_alloc.cpp
M src/osmo-bts-litecell15/lc15_l1_if.c
M src/osmo-bts-sysmo/sysmo_l1_if.c
M src/osmobts_sock.cpp
M src/pcu_l1_if.cpp
M src/pcu_vty.c
M src/pcu_vty_functions.cpp
A src/pdch.cpp
A src/pdch.h
M src/sba.cpp
M src/tbf.cpp
16 files changed, 1,122 insertions(+), 1,020 deletions(-)


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

diff --git a/src/Makefile.am b/src/Makefile.am
index 7d2a62e..b2f64f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -54,6 +54,7 @@
tbf_ul.cpp \
tbf_dl.cpp \
bts.cpp \
+   pdch.cpp \
poll_controller.cpp \
encoding.cpp \
sba.cpp \
@@ -85,6 +86,7 @@
mslot_class.h \
tbf.h \
bts.h \
+   pdch.h \
poll_controller.h \
encoding.h \
sba.h \
diff --git a/src/bts.cpp b/src/bts.cpp
index 24be5d4..096d3af 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern "C" {
#include 
@@ -841,801 +842,6 @@
return ms;
 }
 
-/*
- * PDCH code below. TODO: move to a separate file
- */
-
-void gprs_rlcmac_pdch::enable()
-{
-   /* TODO: Check if there are still allocated resources.. */
-   INIT_LLIST_HEAD(&paging_list);
-   m_is_enabled = 1;
-}
-
-void gprs_rlcmac_pdch::disable()
-{
-   /* TODO.. kick free_resources once we know the TRX/TS we are on */
-   m_is_enabled = 0;
-}
-
-void gprs_rlcmac_pdch::free_resources()
-{
-   struct gprs_rlcmac_paging *pag;
-
-   /* we are not enabled. there should be no resources */
-   if (!is_enabled())
-   return;
-
-   /* kick all TBF on slot */
-   gprs_rlcmac_tbf::free_all(this);
-
-   /* flush all pending paging messages */
-   while ((pag = dequeue_paging()))
-   talloc_free(pag);
-
-   trx->bts->sba()->free_resources(this);
-}
-
-struct gprs_rlcmac_paging *gprs_rlcmac_pdch::dequeue_paging()
-{
-   struct gprs_rlcmac_paging *pag;
-
-   if (llist_empty(&paging_list))
-   return NULL;
-   pag = llist_entry(paging_list.next, struct gprs_rlcmac_paging, list);
-   llist_del(&pag->list);
-
-   return pag;
-}
-
-struct msgb *gprs_rlcmac_pdch::packet_paging_request()
-{
-   struct gprs_rlcmac_paging *pag;
-   struct msgb *msg;
-   unsigned wp = 0, len;
-
-   /* no paging, no message */
-   pag = dequeue_paging();
-   if (!pag)
-   return NULL;
-
-   LOGP(DRLCMAC, LOGL_DEBUG, "Scheduling paging\n");
-
-   /* alloc message */
-   msg = msgb_alloc(23, "pag ctrl block");
-   if (!msg) {
-   talloc_free(pag);
-   return NULL;
-   }
-   bitvec *pag_vec = bitvec_alloc(23, tall_pcu_ctx);
-   if (!pag_vec) {
-   msgb_free(msg);
-   talloc_free(pag);
-   return NULL;
-   }
-   wp = Encoding::write_packet_paging_request(pag_vec);
-
-   /* loop until message is full */
-   while (pag) {
-   /* try to add paging */
-   if ((pag->identity_lv[1] & 0x07) == 4) {
-   /* TMSI */
-   LOGP(DRLCMAC, LOGL_DEBUG, "- TMSI=0x%08x\n",
-   ntohl(*((uint32_t *)(pag->identity_lv + 1;
-   len = 1 + 1 + 1 + 32 + 2 + 1;
-   if (pag->identity_lv[0] != 5) {
-   LOGP(DRLCMAC, LOGL_ERROR, "TMSI paging with "
-   "MI != 5 octets!\n");
-   goto continue_next;
-   }
-   } else {
-   /* MI */
-   LOGP(DRLCMAC, LOGL_DEBUG, "- MI=%s\n",
-   osmo_hexdump(pag->identity_lv + 1,
-   pag->identity_lv[0]));
-   len = 1 + 1 + 1 + 4 + (pag->identity_lv[0]<<3) + 2 + 1;
-   if (pag->identity_lv[0] > 8) {
-   LOGP(DRLCMAC, LOGL_ERROR, "Paging with "
-   "MI > 8 octets!\n");
-   goto continue_next;
-   }
-   }
-   if (wp + len > 184) {
-   LOGP(DRLCMAC, LOGL_DEBUG, "- 

[PATCH] osmo-ggsn[master]: sgsnemu: created "pinghost" and "createif" modes for mutual ...

2018-01-30 Thread Viktor Tsymbalyuk

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

sgsnemu: created "pinghost" and "createif" modes for mutual exclusion

No warnings when used options from "pinghost" and "createif" groups
in a same time. sgsnemu created tun0 interface and send pings inside
G-PDU, but didn't calculate replys. Added options modes to avoid
mutual exclusion options.

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


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

diff --git a/sgsnemu/cmdline.c b/sgsnemu/cmdline.c
index 1c02baa..412e484 100644
--- a/sgsnemu/cmdline.c
+++ b/sgsnemu/cmdline.c
@@ -65,12 +65,14 @@
"  --charging=INTCharging characteristics  
(default=`0x0800')",
"  -u, --uid=STRING  Login user ID  (default=`mig')",
"  -p, --pwd=STRING  Login password  (default=`hemmelig')",
+   "\n Mode: createif\n  any option of this mode is related to tun 
interface, all payload going in and\n  out  via tunN interface",
"  --createifCreate local network interface  
(default=off)",
"  -n, --net=STRING  Network address for local interface",
"  --defaultrouteCreate default route  (default=off)",
"  --ipup=STRING Script to run after link-up",
"  --ipdown=STRING   Script to run after link-down",
"  --tun-device=STRING   Name of the local network interface",
+   "\n Mode: pinghost\n  generate ICMP payload inside G-PDU without 
setting up tun interface",
"  --pinghost=STRING Ping remote host",
"  --pingrate=INTNumber of ping req per second  
(default=`1')",
"  --pingsize=INTNumber of ping data bytes  
(default=`56')",
@@ -168,6 +170,8 @@
args_info->pingquiet_given = 0;
args_info->no_tx_gpdu_seq_given = 0;
args_info->pdp_type_given = 0;
+   args_info->createif_mode_counter = 0;
+   args_info->pinghost_mode_counter = 0;
 }
 
 static
@@ -290,19 +294,19 @@
args_info->charging_help = gengetopt_args_info_help[28];
args_info->uid_help = gengetopt_args_info_help[29];
args_info->pwd_help = gengetopt_args_info_help[30];
-   args_info->createif_help = gengetopt_args_info_help[31];
-   args_info->net_help = gengetopt_args_info_help[32];
-   args_info->defaultroute_help = gengetopt_args_info_help[33];
-   args_info->ipup_help = gengetopt_args_info_help[34];
-   args_info->ipdown_help = gengetopt_args_info_help[35];
-   args_info->tun_device_help = gengetopt_args_info_help[36];
-   args_info->pinghost_help = gengetopt_args_info_help[37];
-   args_info->pingrate_help = gengetopt_args_info_help[38];
-   args_info->pingsize_help = gengetopt_args_info_help[39];
-   args_info->pingcount_help = gengetopt_args_info_help[40];
-   args_info->pingquiet_help = gengetopt_args_info_help[41];
-   args_info->no_tx_gpdu_seq_help = gengetopt_args_info_help[42];
-   args_info->pdp_type_help = gengetopt_args_info_help[43];
+   args_info->createif_help = gengetopt_args_info_help[32];
+   args_info->net_help = gengetopt_args_info_help[33];
+   args_info->defaultroute_help = gengetopt_args_info_help[34];
+   args_info->ipup_help = gengetopt_args_info_help[35];
+   args_info->ipdown_help = gengetopt_args_info_help[36];
+   args_info->tun_device_help = gengetopt_args_info_help[37];
+   args_info->pinghost_help = gengetopt_args_info_help[39];
+   args_info->pingrate_help = gengetopt_args_info_help[40];
+   args_info->pingsize_help = gengetopt_args_info_help[41];
+   args_info->pingcount_help = gengetopt_args_info_help[42];
+   args_info->pingquiet_help = gengetopt_args_info_help[43];
+   args_info->no_tx_gpdu_seq_help = gengetopt_args_info_help[44];
+   args_info->pdp_type_help = gengetopt_args_info_help[45];
 
 }
 
@@ -361,8 +365,7 @@
 
 struct cmdline_parser_params *cmdline_parser_params_create(void)
 {
-   struct cmdline_parser_params *params =
-   (struct cmdline_parser_params *)
+   struct cmdline_parser_params *params = (struct cmdline_parser_params *)
malloc(sizeof(struct cmdline_parser_params));
cmdline_parser_params_init(params);
return params;
@@ -853,6 +856,30 @@
return 0;   /* OK */
 }
 
+static int check_modes(int given1[], const char *options1[],
+  int given2[], const char *options2[])
+{
+   int i = 0, j = 0, errors = 0;
+
+   while (given1[i] >= 0) {
+   if (given1[i]) {
+   while (given2[j] >= 0) {
+   if (given2[j]) {
+   ++errors;
+   fprintf(stderr,
+  

[PATCH] libosmocore[master]: GSUP: add helper wrapper for setting IMSI

2018-01-30 Thread Max

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

GSUP: add helper wrapper for setting IMSI

Related: OS#2864
Change-Id: I03d0d3d32a8d572ad573d03c603e14cdc27a3f7b
---
M include/osmocom/gsm/gsup.h
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/97/6197/1

diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index 1a8a3b2..f358ff8 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -115,6 +115,7 @@
 #define OSMO_GSUP_IS_MSGT_REQUEST(msgt) (((msgt) & 0b0011) == 0b00)
 #define OSMO_GSUP_IS_MSGT_ERROR(msgt)   (((msgt) & 0b0011) == 0b01)
 #define OSMO_GSUP_TO_MSGT_ERROR(msgt)   (((msgt) & 0b1100) | 0b01)
+#define OSMO_GSUP_COPY_IMSI(msg, _imsi) osmo_strlcpy((msg)->imsi, _imsi, 
GSM23003_IMSI_MAX_DIGITS + 2)
 
 extern const struct value_string osmo_gsup_message_type_names[];
 static inline const char *

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03d0d3d32a8d572ad573d03c603e14cdc27a3f7b
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 


osmo-ggsn[master]: sgsnemu: created "pinghost" and "createif" modes for mutual ...

2018-01-30 Thread Viktor Tsymbalyuk

Patch Set 1:

some cli output for understanding

## original
```
ubuntu@test:~/osmo-ggsn$ sudo sgsnemu --listen 10.121.0.18 --remote 
93.124.95.120  --contexts 1 --apn internet.ge.beeline.net --imsi 
282040234567890  --rai=282.04.0001.0001 --nsapi=5 --qos=34824735 --charging=2 
--createif --defaultroute -d --pingcount=3 --pinghost=10.123.0.18
remote: 93.124.95.120
listen: 10.121.0.18
debug: 1
imsi: 282040234567890
qos: 0x213621f
qose1: 0x9396404074f9
qose2: 0x11
qose3: 0x0101
qose4: 0x4040
charging: 0x02
apn: internet.ge.beeline.net
msisdn: 46702123456
uid: mig
pwd: hemmelig
pidfile: ./sgsnemu.pid
statedir: ./
contexts: 1
timelimit: 0
createif: 1
defaultroute: 1
pinghost: 10.123.0.18
pingrate: 1
pingsize: 56
pingcount: 3
pingquiet: 0
norecovery: 0
no-tx-gpdu-seq: 0

Using default DNS server
Local IP address is:   10.121.0.18 (10.121.0.18)
Remote IP address is:  93.124.95.120 (93.124.95.120)
IMSI is:   282040234567890 (0xf098765432040282)
Using NSAPI:   5
Using GTP version: 1
Using APN: internet
Using selection mode:  1
Using RAI:  282.04.0001.0001
->mcc : 282
->mnc : 04
->LAC: 0001
->RAC : 0001
Using MSISDN:  46702123456
Using ping host:   10.123.0.18 (10.123.0.18)

Initialising GTP library
<000d> gtp.c:757 GTP: gtp_newgsn() started at 10.121.0.18
Setting up interface
Done initialising GTP library

Sending off echo request
Setting up PDP context #0
Waiting for response from ggsn

idletime.tv_sec 3, idleTime.tv_usec 0
Received echo response
idletime.tv_sec 3, idleTime.tv_usec 0
Received create PDP context response. IP address: 10.16.0.2
Create_ping 0
idletime.tv_sec 0, idleTime.tv_usec 52
Create_ping -1140
idletime.tv_sec 0, idleTime.tv_usec 998791
idletime.tv_sec 0, idleTime.tv_usec 998218
Create_ping -1039
idletime.tv_sec 10, idleTime.tv_usec 0
idletime.tv_sec 10, idleTime.tv_usec 0
Disconnecting PDP context #0


10.123.0.18 PING Statistics
3 packets transmitted in 12.012 seconds, 0 packets received, 100% packet loss
0 packets received in total
0 packets transmitted
idletime.tv_sec 3, idleTime.tv_usec 0
Received delete PDP context response. Cause value: 128
```
 in tcptdump thereis gtp-u with icmp (requests and replys)

# PATCH
## mutual exclusion
```
ubuntu@test:~/osmo-ggsn$ sudo sgsnemu --listen 10.121.0.18 --remote 
93.124.95.120  --contexts 1 --apn internet.ge.beeline.net --imsi 
282040234567890  --rai=282.04.0001.0001 --nsapi=5 --qos=34824735 --charging=2  
--defaultroute -d --pingcount=3 --pinghost=10.123.0.18sgsnemu: option 
--defaultroute conflicts with option --pinghost
sgsnemu: option --defaultroute conflicts with option --pingcount
sgsnemu: '--defaultroute' option depends on option 'createif'
```

## replys calculated
```
ubuntu@test:~/osmo-ggsn$ sudo sgsnemu --listen 10.121.0.18 --remote 
93.124.95.120  --contexts 1 --apn internet.ge.beeline.net --imsi 
282040234567890  --rai=282.04.0001.0001 --nsapi=5 --qos=34824735 --charging=2  
--pingcount=3 --pinghost=10.123.0.18

Using default DNS server
Local IP address is:   10.121.0.18 (10.121.0.18)
Remote IP address is:  93.124.95.120 (93.124.95.120)
IMSI is:   282040234567890 (0xf098765432040282)
Using NSAPI:   5
Using GTP version: 1
Using APN: internet
Using selection mode:  1
Using RAI:  282.04.0001.0001
->mcc : 282
->mnc : 04
->LAC: 0001
->RAC : 0001
Using MSISDN:  46702123456
Using ping host:   10.123.0.18 (10.123.0.18)

Initialising GTP library
<000d> gtp.c:757 GTP: gtp_newgsn() started at 10.121.0.18
Done initialising GTP library

Sending off echo request
Setting up PDP context #0
Waiting for response from ggsn

Received echo response
Received create PDP context response. IP address: 10.16.0.1
84 bytes from 10.123.0.18: icmp_seq=1 time=0.665 ms
84 bytes from 10.123.0.18: icmp_seq=2 time=0.647 ms
Disconnecting PDP context #0


10.123.0.18 PING Statistics
3 packets transmitted in 12.012 seconds, 2 packets received, 33% packet loss
round-trip (ms)  min/avg/max = 0.647/0.656/0.665

2 packets transmitted
Received delete PDP context response. Cause value: 128
ubuntu@test:~/osmo-ggsn$
```

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I196df7838212dcddecd64a64a6cba613b6cfced0
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Viktor Tsymbalyuk 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Viktor Tsymbalyuk 
Gerrit-HasComments: No


[PATCH] osmo-msc[master]: Use helper for adding IMSI to GSUP message

2018-01-30 Thread Max

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

Use helper for adding IMSI to GSUP message

N. B: requires I03d0d3d32a8d572ad573d03c603e14cdc27a3f7b in libosmocore.

Change-Id: I67b482dedfa11237ac21894fc5930039e12434ab
Related: OS#2864
---
M src/libcommon/gsup_test_client.c
M src/libvlr/vlr.c
2 files changed, 7 insertions(+), 6 deletions(-)


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

diff --git a/src/libcommon/gsup_test_client.c b/src/libcommon/gsup_test_client.c
index ceac414..2f495c7 100644
--- a/src/libcommon/gsup_test_client.c
+++ b/src/libcommon/gsup_test_client.c
@@ -108,7 +108,7 @@
struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__);
int rc;
 
-   osmo_strlcpy(gsup.imsi, io->imsi, sizeof(gsup.imsi));
+   OSMO_GSUP_COPY_IMSI(&gsup, io->imsi);
gsup.message_type = OSMO_GSUP_MSGT_SEND_AUTH_INFO_REQUEST;
 
rc = osmo_gsup_encode(msg, &gsup);
@@ -128,7 +128,7 @@
struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__);
int rc;
 
-   osmo_strlcpy(gsup.imsi, io->imsi, sizeof(gsup.imsi));
+   OSMO_GSUP_COPY_IMSI(&gsup, io->imsi);
gsup.message_type = OSMO_GSUP_MSGT_UPDATE_LOCATION_REQUEST;
 
rc = osmo_gsup_encode(msg, &gsup);
@@ -146,7 +146,7 @@
struct msgb *msg = msgb_alloc_headroom(1200, 200, __func__);
int rc;
 
-   osmo_strlcpy(gsup.imsi, io->imsi, sizeof(gsup.imsi));
+   OSMO_GSUP_COPY_IMSI(&gsup, io->imsi);
gsup.message_type = OSMO_GSUP_MSGT_INSERT_DATA_RESULT;
 
rc = osmo_gsup_encode(msg, &gsup);
diff --git a/src/libvlr/vlr.c b/src/libvlr/vlr.c
index a87c4b2..292edb0 100644
--- a/src/libvlr/vlr.c
+++ b/src/libvlr/vlr.c
@@ -156,7 +156,7 @@
struct vlr_instance *vlr = vsub->vlr;
 
if (strlen(gsup_msg->imsi) == 0)
-   osmo_strlcpy(gsup_msg->imsi, vsub->imsi, 
sizeof(gsup_msg->imsi));
+   OSMO_GSUP_COPY_IMSI(gsup_msg, vsub->imsi);
 
return vlr_tx_gsup_message(vlr, gsup_msg);
 }
@@ -168,7 +168,7 @@
 {
struct osmo_gsup_message gsup_reply = {0};
 
-   osmo_strlcpy(gsup_reply.imsi, gsup_orig->imsi, sizeof(gsup_reply.imsi));
+   OSMO_GSUP_COPY_IMSI(&gsup_reply, gsup_orig->imsi);
gsup_reply.cause = cause;
gsup_reply.message_type =
OSMO_GSUP_TO_MSGT_ERROR(gsup_orig->message_type);
@@ -570,7 +570,8 @@
struct osmo_gsup_message gsup_msg = {0};
 
gsup_msg.message_type = OSMO_GSUP_MSGT_AUTH_FAIL_REPORT;
-   osmo_strlcpy(gsup_msg.imsi, vsub->imsi, sizeof(gsup_msg.imsi));
+   OSMO_GSUP_COPY_IMSI(&gsup_msg, vsub->imsi);
+
return vlr_tx_gsup_message(vsub->vlr, &gsup_msg);
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67b482dedfa11237ac21894fc5930039e12434ab
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Max 


[PATCH] osmo-pcu[master]: TBF: decrease logging verbosity for traffic

2018-01-30 Thread Max

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

TBF: decrease logging verbosity for traffic

Change-Id: If43aa9895abf58602556c986a633ff93a6f00b06
---
M src/tbf_dl.cpp
M src/tbf_ul.cpp
2 files changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index e8aec23..0587a4a 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -517,7 +517,7 @@
if (!msg)
return;
 
-   LOGPTBFDL(this, LOGL_INFO, "Dequeue next LLC (len=%d)\n", msg->len);
+   LOGPTBFDL(this, LOGL_DEBUG, "Dequeue next LLC (len=%d)\n", msg->len);
 
m_llc.put_frame(msg->data, msg->len);
bts->llc_frame_sched();
@@ -599,7 +599,7 @@
if (ar == Encoding::AR_NEED_MORE_BLOCKS)
break;
 
-   LOGPTBFDL(this, LOGL_INFO, "Complete DL frame, len=%d\n", 
m_llc.frame_length());
+   LOGPTBFDL(this, LOGL_DEBUG, "Complete DL frame, len=%d\n", 
m_llc.frame_length());
gprs_rlcmac_dl_bw(this, m_llc.frame_length());
bts->llc_dl_bytes(m_llc.frame_length());
m_llc.reset();
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index 1560eb0..46d4d12 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -84,7 +84,7 @@
 
if (frame->is_complete) {
/* send frame to SGSN */
-   LOGPTBFUL(this, LOGL_INFO, "complete UL frame 
len=%d\n", m_llc.frame_length());
+   LOGPTBFUL(this, LOGL_DEBUG, "complete UL frame 
len=%d\n", m_llc.frame_length());
snd_ul_ud();
bts->llc_ul_bytes(m_llc.frame_length());
m_llc.reset();

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

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


[PATCH] osmo-ggsn[master]: ggsn.c: cb_tun_ind: Convert ifelse to switch statement

2018-01-30 Thread Pau Espin Pedrol

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

ggsn.c: cb_tun_ind: Convert ifelse to switch statement

Change-Id: I4fc97f367ae615cdf0a9501f89419990c2fd4599
---
M ggsn/ggsn.c
1 file changed, 7 insertions(+), 4 deletions(-)


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

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index de8090b..37a2fca 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -726,13 +726,15 @@
struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
struct ippool_t *pool;
 
-   if (iph->version == 4) {
+   switch (iph->version) {
+   case 4:
if (len < sizeof(*iph) || len < 4*iph->ihl)
return -1;
dst.len = 4;
dst.v4.s_addr = iph->daddr;
pool = apn->v4.pool;
-   } else if (iph->version == 6) {
+   break;
+   case 6:
/* Due to the fact that 3GPP requires an allocation of a
 * /64 prefix to each MS, we must instruct
 * ippool_getip() below to match only the leading /64
@@ -740,7 +742,8 @@
dst.len = 8;
dst.v6 = ip6h->ip6_dst;
pool = apn->v6.pool;
-   } else {
+   break;
+   default:
LOGP(DTUN, LOGL_NOTICE, "non-IPv%u packet received from tun\n", 
iph->version);
return -1;
}
@@ -752,7 +755,7 @@
DEBUGP(DTUN, "Received packet for APN(%s) from tun %s", apn->cfg.name, 
tun->devname);
 
if (ippool_getip(pool, &ipm, &dst)) {
-   DEBUGPC(DTUN, " with no PDP contex!!\n");
+   DEBUGPC(DTUN, " with no PDP contex! (%s)\n", );
return 0;
}
DEBUGPC(DTUN, "\n");

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

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


[PATCH] osmo-ggsn[master]: ggsn.c: cb_tun_ind: Don't drop packets targeting pdp ctx ll ...

2018-01-30 Thread Pau Espin Pedrol

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

ggsn.c: cb_tun_ind: Don't drop packets targeting pdp ctx ll addr

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


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

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index fed8f73..caf6151 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -726,6 +726,7 @@
struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
struct ippool_t *pool;
char straddr[INET6_ADDRSTRLEN];
+   uint8_t pref_offset;
 
switch (iph->version) {
case 4:
@@ -739,9 +740,12 @@
/* Due to the fact that 3GPP requires an allocation of a
 * /64 prefix to each MS, we must instruct
 * ippool_getip() below to match only the leading /64
-* prefix, i.e. the first 8 bytes of the address */
+* prefix, i.e. the first 8 bytes of the address. If the ll addr
+* is used, then the match should be done on the trailing 64
+* bits. */
dst.len = 8;
-   dst.v6 = ip6h->ip6_dst;
+   pref_offset = IN6_IS_ADDR_LINKLOCAL(&ip6h->ip6_dst) ? 8 : 0;
+   memcpy(&dst.v6, ((uint8_t*)&ip6h->ip6_dst) + pref_offset, 8);
pool = apn->v6.pool;
break;
default:

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

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


[PATCH] osmo-ggsn[master]: ggsn.c: cb_tun_ind: log dst addr of packet without pdp ctx

2018-01-30 Thread Pau Espin Pedrol

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

ggsn.c: cb_tun_ind: log dst addr of packet without pdp ctx

Change-Id: Ib3a87ec2b2d0014376295028a648750fa3124485
---
M ggsn/ggsn.c
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index 37a2fca..fed8f73 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -725,6 +725,7 @@
struct iphdr *iph = (struct iphdr *)pack;
struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
struct ippool_t *pool;
+   char straddr[INET6_ADDRSTRLEN];
 
switch (iph->version) {
case 4:
@@ -755,7 +756,9 @@
DEBUGP(DTUN, "Received packet for APN(%s) from tun %s", apn->cfg.name, 
tun->devname);
 
if (ippool_getip(pool, &ipm, &dst)) {
-   DEBUGPC(DTUN, " with no PDP contex! (%s)\n", );
+   DEBUGPC(DTUN, " with no PDP contex! (%s)\n", iph->version == 4 ?
+   inet_ntop(AF_INET, &iph->saddr, straddr, 
sizeof(straddr)) :
+   inet_ntop(AF_INET6, &ip6h->ip6_src, straddr, 
sizeof(straddr)));
return 0;
}
DEBUGPC(DTUN, "\n");

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

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


[PATCH] osmo-ttcn3-hacks[master]: ggsn_tests: Add test case to validate packets forwarded vs d...

2018-01-30 Thread Pau Espin Pedrol
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6158

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

ggsn_tests: Add test case to validate packets forwarded vs dropped

New dependency is required: titan.ProtocolModules.ICMP
It tests that ICMP echo packets can be sent successfully (reply is
received or otherwise dest unreachable if routing is not set up
correctly during the test). It also tests some cases in which osmo-ggsn
is required to drop the packets (eg. unknown src ip unrelated to pdp
ctx). It also checks that IPv6 packets are dropped in IPv4 pdp ctx and
viceversa It also checks that IPv6 packets are dropped in IPv4 pdp ctx
and vice versa.

Change-Id: Ib9c6043a6cd3b6622782ec7e7fcd2815101755ba
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/gen_links.sh
M ggsn_tests/regen_makefile.sh
4 files changed, 262 insertions(+), 1 deletion(-)


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

diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index d8994df..bf82057 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -26,9 +26,11 @@
 GGSN_Tests.TC_pdp4_act_deact
 GGSN_Tests.TC_pdp4_act_deact_ipcp
 GGSN_Tests.TC_pdp4_act_deact_pcodns
+GGSN_Tests.TC_pdp4_act_deact_gtpu_access
 
 GGSN_Tests.TC_pdp6_act_deact
 GGSN_Tests.TC_pdp6_act_deact_pcodns
 GGSN_Tests.TC_pdp6_act_deact_icmp6
+GGSN_Tests.TC_pdp6_act_deact_gtpu_access
 
 GGSN_Tests.TC_echo_req_resp
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index f7814db..a982e42 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -10,6 +10,7 @@
import from GTPU_Types all;
import from IPCP_Types all;
import from IP_Types all;
+   import from ICMP_Types all;
import from ICMPv6_Types all;
import from Native_Functions all;
 
@@ -734,6 +735,63 @@
/* IPv6 neighbor solicitation fe80::2 -> ff02::1:ff00:2 from 
02:88:b5:1f:25:59 */
const octetstring c_neigh_solicit:= 
'60203afffe82ff020001ff0287009f96fe8201010288b51f2559'O;
 
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMP ts_ICMPv4_ERQ := {
+   echo := {
+   type_field := 8,
+   code := 0,
+   checksum := ''O,
+   identifier := '0345'O,
+   sequence_number := '0001'O,
+   data := ''O
+   }
+   }
+
+   /* template for an ICMPv4 echo reply */
+   template PDU_ICMP tr_ICMPv4_ERP(octetstring data := ''O) := {
+   echo_reply := {
+   type_field := 0,
+   code := 0,
+   checksum := ?,
+   identifier := ?,
+   sequence_number := ?,
+   data := data
+   }
+   }
+
+   /* template for receiving/matching an ICMPv6 Destination Unreachable  */
+   template PDU_ICMP tr_ICMPv4_DU := {
+   destination_unreachable := {
+   type_field := 1,
+   code := ?,
+   checksum := ?,
+   unused := ?,
+   original_ip_msg  := ?
+   }
+   }
+
+   /* template to construct IPv4_packet from input arguments, ready for 
use in f_IPv4_enc() */
+   template IPv4_packet ts_IP4(OCT4 srcaddr, OCT4 dstaddr, LIN1 proto, 
LIN2_BO_LAST tlen, octetstring payload) := {
+   header := {
+   ver := 4,
+   hlen := 5,
+   tos := 0,
+   tlen := tlen,
+   id := 35902,
+   res := '0'B,
+   dfrag := '1'B,
+   mfrag := '0'B,
+   foffset := 0,
+   ttl := 64,
+   proto := proto,
+   cksum := 0,
+   srcaddr := srcaddr,
+   dstaddr := dstaddr
+   },
+   ext_headers := omit,
+   payload := payload
+   }
+
/* template to generate a 'Prefix Information' ICMPv6 option */
template OptionField ts_ICMP6_OptPrefix(OCT16 prefix, INT1 prefix_len) 
:= {
prefixInformation := {
@@ -747,6 +805,18 @@
preferredLifetime := oct2int(''O),
reserved2 := ''O,
prefix := prefix
+   }
+   }
+
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMPv6 ts_ICMPv6_ERQ := {
+   echoRequest := {
+   typeField := 128,
+   code := 0,
+   checksum := ''O,
+

[PATCH] osmo-ttcn3-hacks[master]: ggsn_tests: Add test case to validate packets forwarded vs d...

2018-01-30 Thread Pau Espin Pedrol
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6158

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

ggsn_tests: Add test case to validate packets forwarded vs dropped

New dependency is required: titan.ProtocolModules.ICMP
It tests that ICMP echo packets can be sent successfully (reply is
received or otherwise dest unreachable if routing is not set up
correctly during the test). It also tests some cases in which osmo-ggsn
is required to drop the packets (eg. unknown src ip unrelated to pdp
ctx). It also checks that IPv6 packets are dropped in IPv4 pdp ctx and
viceversa It also checks that IPv6 packets are dropped in IPv4 pdp ctx
and vice versa.

Change-Id: Ib9c6043a6cd3b6622782ec7e7fcd2815101755ba
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/gen_links.sh
M ggsn_tests/regen_makefile.sh
4 files changed, 262 insertions(+), 1 deletion(-)


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

diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index d8994df..bf82057 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -26,9 +26,11 @@
 GGSN_Tests.TC_pdp4_act_deact
 GGSN_Tests.TC_pdp4_act_deact_ipcp
 GGSN_Tests.TC_pdp4_act_deact_pcodns
+GGSN_Tests.TC_pdp4_act_deact_gtpu_access
 
 GGSN_Tests.TC_pdp6_act_deact
 GGSN_Tests.TC_pdp6_act_deact_pcodns
 GGSN_Tests.TC_pdp6_act_deact_icmp6
+GGSN_Tests.TC_pdp6_act_deact_gtpu_access
 
 GGSN_Tests.TC_echo_req_resp
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index f7814db..cf6bd79 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -10,6 +10,7 @@
import from GTPU_Types all;
import from IPCP_Types all;
import from IP_Types all;
+   import from ICMP_Types all;
import from ICMPv6_Types all;
import from Native_Functions all;
 
@@ -734,6 +735,63 @@
/* IPv6 neighbor solicitation fe80::2 -> ff02::1:ff00:2 from 
02:88:b5:1f:25:59 */
const octetstring c_neigh_solicit:= 
'60203afffe82ff020001ff0287009f96fe8201010288b51f2559'O;
 
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMP ts_ICMPv4_ERQ := {
+   echo := {
+   type_field := 8,
+   code := 0,
+   checksum := ''O,
+   identifier := '0345'O,
+   sequence_number := '0001'O,
+   data := ''O
+   }
+   }
+
+   /* template for an ICMPv4 echo reply */
+   template PDU_ICMP tr_ICMPv4_ERP(octetstring data := ''O) := {
+   echo_reply := {
+   type_field := 0,
+   code := 0,
+   checksum := ?,
+   identifier := ?,
+   sequence_number := ?,
+   data := data
+   }
+   }
+
+   /* template for receiving/matching an ICMPv6 Destination Unreachable  */
+   template PDU_ICMP tr_ICMPv4_DU := {
+   destination_unreachable := {
+   type_field := 1,
+   code := ?,
+   checksum := ?,
+   unused := ?,
+   original_ip_msg  := ?
+   }
+   }
+
+   /* template to construct IPv4_packet from input arguments, ready for 
use in f_IPv4_enc() */
+   template IPv4_packet ts_IP4(OCT4 srcaddr, OCT4 dstaddr, LIN1 proto, 
LIN2_BO_LAST tlen, octetstring payload) := {
+   header := {
+   ver := 4,
+   hlen := 5,
+   tos := 0,
+   tlen := tlen,
+   id := 35902,
+   res := '0'B,
+   dfrag := '1'B,
+   mfrag := '0'B,
+   foffset := 0,
+   ttl := 64,
+   proto := proto,
+   cksum := 0,
+   srcaddr := srcaddr,
+   dstaddr := dstaddr
+   },
+   ext_headers := omit,
+   payload := payload
+   }
+
/* template to generate a 'Prefix Information' ICMPv6 option */
template OptionField ts_ICMP6_OptPrefix(OCT16 prefix, INT1 prefix_len) 
:= {
prefixInformation := {
@@ -747,6 +805,18 @@
preferredLifetime := oct2int(''O),
reserved2 := ''O,
prefix := prefix
+   }
+   }
+
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMPv6 ts_ICMPv6_ERQ := {
+   echoRequest := {
+   typeField := 128,
+   code := 0,
+   checksum := ''O,
+

[PATCH] osmo-bsc[master]: abis-rsl: Send imm.ass messages via PCH

2018-01-30 Thread lynxis lazus

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

abis-rsl: Send imm.ass messages via PCH

It is possible to send immidiate assign messages through the
paging channel. This commit adds the required functionality to
the pcu socket interface and to the abis_rsl api

Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5
---
M include/osmocom/bsc/abis_rsl.h
M include/osmocom/bsc/pcuif_proto.h
M src/libbsc/abis_rsl.c
M src/libbsc/pcu_sock.c
4 files changed, 61 insertions(+), 19 deletions(-)


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

diff --git a/include/osmocom/bsc/abis_rsl.h b/include/osmocom/bsc/abis_rsl.h
index b30702f..ae80879 100644
--- a/include/osmocom/bsc/abis_rsl.h
+++ b/include/osmocom/bsc/abis_rsl.h
@@ -60,7 +60,11 @@
 int rsl_relase_request(struct gsm_lchan *lchan, uint8_t link_id);
 
 /* Ericcson vendor specific RSL extensions */
-int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t 
len, uint8_t *val);
+int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val,
+   uint32_t tlli);
+int rsl_ericsson_imm_assign_via_pch_cmd(struct gsm_bts *bts, uint8_t len,
+   uint8_t *val, uint32_t tlli,
+   uint8_t pag_grp);
 
 /* Siemens vendor-specific RSL extensions */
 int rsl_siemens_mrpci(struct gsm_lchan *lchan, struct rsl_mrpci *mrpci);
diff --git a/include/osmocom/bsc/pcuif_proto.h 
b/include/osmocom/bsc/pcuif_proto.h
index eb28d66..0dbb6c2 100644
--- a/include/osmocom/bsc/pcuif_proto.h
+++ b/include/osmocom/bsc/pcuif_proto.h
@@ -23,7 +23,7 @@
 #define PCU_IF_SAPI_PDTCH  0x05/* packet data/control/ccch block */
 #define PCU_IF_SAPI_PRACH  0x06/* packet random access channel */
 #define PCU_IF_SAPI_PTCCH  0x07/* packet TA control channel */
-#define PCU_IF_SAPI_AGCH_DT0x08/* assignment on AGCH but with 
additional TLLI */
+#define PCU_IF_SAPI_AGCH_DT0x08/* assignment on PCH or AGCH but with 
additional TLLI */
 
 /* flags */
 #define PCU_IF_FLAG_ACTIVE (1 << 0)/* BTS is active */
@@ -61,6 +61,7 @@
 struct gsm_pcu_if_data_cnf_dt {
uint8_t sapi;
uint32_ttlli;
+   uint8_t imsi[3];
uint32_tfn;
uint16_tarfcn;
uint8_t trx_nr;
diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index eced0e2..de39f95 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -1095,17 +1095,42 @@
return abis_rsl_sendmsg(msg);
 }
 
-/* Chapter 8.5.6 */
-int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint32_t tlli, uint8_t 
len, uint8_t *val)
+/* Append mobile idenitiy (tlli) to message buffer */
+static void rsl_ericsson_put_mi(struct msgb *msg, uint32_t tlli)
+{
+   /* NOTE: ericsson can handle a reference at the end of the message 
which is used in
+* the confirm message. The confirm message is only sent if the trailer 
is present */
+   msgb_put_u8(msg, RSL_IE_ERIC_MOBILE_ID);
+   msgb_put_u32(msg, tlli);
+}
+
+/* Chapter 8.5.6 (Ericcson vendor specific RSL extension) */
+int rsl_ericsson_imm_assign_cmd(struct gsm_bts *bts, uint8_t len, uint8_t *val,
+   uint32_t tlli)
 {
struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val);
if (!msg)
return 1;
 
-   /* ericsson can handle a reference at the end of the message which is 
used in
-* the confirm message. The confirm message is only sent if the trailer 
is present */
-   msgb_put_u8(msg, RSL_IE_ERIC_MOBILE_ID);
-   msgb_put_u32(msg, tlli);
+   /* Append ericsson propritary mobile identity field */
+   rsl_ericsson_put_mi(msg, tlli);
+
+   return abis_rsl_sendmsg(msg);
+}
+
+/* Chapter 8.5.6 (Ericcson vendor specific RSL extension) */
+int rsl_ericsson_imm_assign_via_pch_cmd(struct gsm_bts *bts, uint8_t len,
+   uint8_t *val, uint32_t tlli,
+   uint8_t pag_grp)
+{
+   struct msgb *msg = rsl_imm_assign_cmd_common(bts, len, val);
+
+   /* Append ericsson propritary paging group field */
+   msgb_put_u8(msg, 0x0e);
+   msgb_put_u8(msg, pag_grp);
+
+   /* Append ericsson propritary mobile identity field */
+   rsl_ericsson_put_mi(msg, tlli);
 
return abis_rsl_sendmsg(msg);
 }
diff --git a/src/libbsc/pcu_sock.c b/src/libbsc/pcu_sock.c
index 9f1c80c..88867af 100644
--- a/src/libbsc/pcu_sock.c
+++ b/src/libbsc/pcu_sock.c
@@ -325,9 +325,9 @@
mi_len = p1->data[0];
mi = p1->data+1;
LOGP(DPCU, LOGL_ERROR, "PCU Sends paging "
-"request type %02x (chan_needed=%02x, mi_len=%u, mi=%s)\n",
+"request type %02x (chan_needed=0x%02x, mi_len=%u, mi=%s, 
paging_group=0x%02x)\n",
 p1->msg_type, chan_needed, mi_len,
-osmo_hexdump_nos

[PATCH] osmo-bsc[master]: pcu_sock: reorganize calculation of paging group

2018-01-30 Thread lynxis lazus

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

pcu_sock: reorganize calculation of paging group

pcu_sock.c:pcu_rx_data_req() needs to calculate the paging group
at two positions, this commit adds a functions for that to avoid
code duplication

Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b
---
M src/libbsc/pcu_sock.c
1 file changed, 23 insertions(+), 19 deletions(-)


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

diff --git a/src/libbsc/pcu_sock.c b/src/libbsc/pcu_sock.c
index 88867af..bfb9c7b 100644
--- a/src/libbsc/pcu_sock.c
+++ b/src/libbsc/pcu_sock.c
@@ -353,11 +353,30 @@
return rc;
 }
 
+/* Helper function for pcu_rx_data_req() to extract paging group info */
+static uint8_t extract_paging_group(struct gsm_bts *bts, uint8_t *data)
+{
+   char imsi_digit_buf[4];
+   uint8_t pag_grp;
+
+   /* the first three bytes are the last three digits of
+* the IMSI, which we need to compute the paging group */
+   imsi_digit_buf[0] = data[0];
+   imsi_digit_buf[1] = data[1];
+   imsi_digit_buf[2] = data[2];
+   imsi_digit_buf[3] = '\0';
+
+   pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
+   str_to_imsi(imsi_digit_buf));
+
+   return pag_grp;
+}
+
+
 static int pcu_rx_data_req(struct gsm_bts *bts, uint8_t msg_type,
struct gsm_pcu_if_data *data_req)
 {
struct msgb *msg;
-   char imsi_digit_buf[4];
uint32_t tlli = -1;
uint8_t pag_grp;
int rc = 0;
@@ -369,15 +388,7 @@
 
switch (data_req->sapi) {
case PCU_IF_SAPI_PCH:
-   /* the first three bytes are the last three digits of
-* the IMSI, which we need to compute the paging group */
-   imsi_digit_buf[0] = data_req->data[0];
-   imsi_digit_buf[1] = data_req->data[1];
-   imsi_digit_buf[2] = data_req->data[2];
-   imsi_digit_buf[3] = '\0';
-   LOGP(DPCU, LOGL_DEBUG, "SAPI PCH imsi %s\n", imsi_digit_buf);
-   pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
-   str_to_imsi(imsi_digit_buf));
+   pag_grp = extract_paging_group(bts,data_req->data);
pcu_rx_rr_paging(bts, pag_grp, data_req->data+3);
break;
case PCU_IF_SAPI_AGCH:
@@ -403,16 +414,9 @@
"invalid/small length %d\n", 
data_req->len);
break;
}
-   tlli = *((uint32_t *)data_req->data);
 
-   /* the first three bytes are the last three digits of
-* the IMSI, which we need to compute the paging group */
-   imsi_digit_buf[0] = data_req->data[4];
-   imsi_digit_buf[1] = data_req->data[5];
-   imsi_digit_buf[2] = data_req->data[6];
-   imsi_digit_buf[3] = '\0';
-   pag_grp = gsm0502_calc_paging_group(&bts->si_common.chan_desc,
-   str_to_imsi(imsi_digit_buf));
+   memcpy(&tlli, data_req->data, sizeof(tlli));
+   pag_grp = extract_paging_group(bts,data_req->data+4);
 
msg = msgb_alloc(data_req->len - 7, "pcu_pch");
if (!msg) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: dexter 


[ABANDON] openbsc[master]: pcu_sock: reorganize calculation of paging group

2018-01-30 Thread lynxis lazus
lynxis lazus has abandoned this change.

Change subject: pcu_sock: reorganize calculation of paging group
..


Abandoned

abondon in favor of the osmo-bsc patch set https://gerrit.osmocom.org/#/c/6204/

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 


[ABANDON] openbsc[master]: abis-rsl: Send imm.ass messages via PCH

2018-01-30 Thread lynxis lazus
lynxis lazus has abandoned this change.

Change subject: abis-rsl: Send imm.ass messages via PCH
..


Abandoned

abandon in favor of the osmo-bsc patch set https://gerrit.osmocom.org/#/c/6203/

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 


osmo-bsc[master]: pcu_sock: reorganize calculation of paging group

2018-01-30 Thread lynxis lazus

Patch Set 1:

original review: https://gerrit.osmocom.org/#/c/2067/1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


osmo-bsc[master]: abis-rsl: Send imm.ass messages via PCH

2018-01-30 Thread lynxis lazus

Patch Set 1:

https://gerrit.osmocom.org/#/c/2066/

missing TODO:
openbsc/include/openbsc/pcuif_proto.h
Line 64:

this changes the layout of the PCU socket interface protocol, and hence should 
be accompaned by a version increment in the pcu interface protocol to ensure 
both sides of the socket have a common understanding.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


osmo-bsc[master]: abis-rsl: Send imm.ass messages via PCH

2018-01-30 Thread lynxis lazus

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6203/1/src/libbsc/abis_rsl.c
File src/libbsc/abis_rsl.c:

Line 1129:  msgb_put_u8(msg, 0x0e);
create a define for this field


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: Yes


osmo-bsc[master]: abis-rsl: Send imm.ass messages via PCH

2018-01-30 Thread lynxis lazus

Patch Set 1: Code-Review-1

PCU protocol needs to be increased.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: ggsn_tests: Add test case to validate packets forwarded vs d...

2018-01-30 Thread Pau Espin Pedrol
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6158

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

ggsn_tests: Add test case to validate packets forwarded vs dropped

New dependency is required: titan.ProtocolModules.ICMP
It tests that ICMP echo packets can be sent successfully (reply is
received or otherwise dest unreachable if routing is not set up
correctly during the test). It also tests some cases in which osmo-ggsn
is required to drop the packets (eg. unknown src ip unrelated to pdp
ctx). It also checks that IPv6 packets are dropped in IPv4 pdp ctx and
viceversa It also checks that IPv6 packets are dropped in IPv4 pdp ctx
and vice versa.

Change-Id: Ib9c6043a6cd3b6622782ec7e7fcd2815101755ba
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/gen_links.sh
M ggsn_tests/regen_makefile.sh
4 files changed, 262 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/58/6158/4

diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index d8994df..bf82057 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -26,9 +26,11 @@
 GGSN_Tests.TC_pdp4_act_deact
 GGSN_Tests.TC_pdp4_act_deact_ipcp
 GGSN_Tests.TC_pdp4_act_deact_pcodns
+GGSN_Tests.TC_pdp4_act_deact_gtpu_access
 
 GGSN_Tests.TC_pdp6_act_deact
 GGSN_Tests.TC_pdp6_act_deact_pcodns
 GGSN_Tests.TC_pdp6_act_deact_icmp6
+GGSN_Tests.TC_pdp6_act_deact_gtpu_access
 
 GGSN_Tests.TC_echo_req_resp
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index f7814db..aa20f25 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -10,6 +10,7 @@
import from GTPU_Types all;
import from IPCP_Types all;
import from IP_Types all;
+   import from ICMP_Types all;
import from ICMPv6_Types all;
import from Native_Functions all;
 
@@ -734,6 +735,63 @@
/* IPv6 neighbor solicitation fe80::2 -> ff02::1:ff00:2 from 
02:88:b5:1f:25:59 */
const octetstring c_neigh_solicit:= 
'60203afffe82ff020001ff0287009f96fe8201010288b51f2559'O;
 
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMP ts_ICMPv4_ERQ := {
+   echo := {
+   type_field := 8,
+   code := 0,
+   checksum := ''O,
+   identifier := '0345'O,
+   sequence_number := '0001'O,
+   data := ''O
+   }
+   }
+
+   /* template for an ICMPv4 echo reply */
+   template PDU_ICMP tr_ICMPv4_ERP(octetstring data := ''O) := {
+   echo_reply := {
+   type_field := 0,
+   code := 0,
+   checksum := ?,
+   identifier := ?,
+   sequence_number := ?,
+   data := data
+   }
+   }
+
+   /* template for receiving/matching an ICMPv6 Destination Unreachable  */
+   template PDU_ICMP tr_ICMPv4_DU := {
+   destination_unreachable := {
+   type_field := 1,
+   code := ?,
+   checksum := ?,
+   unused := ?,
+   original_ip_msg  := ?
+   }
+   }
+
+   /* template to construct IPv4_packet from input arguments, ready for 
use in f_IPv4_enc() */
+   template IPv4_packet ts_IP4(OCT4 srcaddr, OCT4 dstaddr, LIN1 proto, 
LIN2_BO_LAST tlen, octetstring payload) := {
+   header := {
+   ver := 4,
+   hlen := 5,
+   tos := 0,
+   tlen := tlen,
+   id := 35902,
+   res := '0'B,
+   dfrag := '1'B,
+   mfrag := '0'B,
+   foffset := 0,
+   ttl := 64,
+   proto := proto,
+   cksum := 0,
+   srcaddr := srcaddr,
+   dstaddr := dstaddr
+   },
+   ext_headers := omit,
+   payload := payload
+   }
+
/* template to generate a 'Prefix Information' ICMPv6 option */
template OptionField ts_ICMP6_OptPrefix(OCT16 prefix, INT1 prefix_len) 
:= {
prefixInformation := {
@@ -747,6 +805,18 @@
preferredLifetime := oct2int(''O),
reserved2 := ''O,
prefix := prefix
+   }
+   }
+
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMPv6 ts_ICMPv6_ERQ := {
+   echoRequest := {
+   typeField := 128,
+   code := 0,
+   checksum := ''O,
+

[PATCH] osmo-ttcn3-hacks[master]: ggsn_tests: Add test to validate if different pdp ctx can ta...

2018-01-30 Thread Pau Espin Pedrol

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

ggsn_tests: Add test to validate if different pdp ctx can talk each other

It seems due to the current network configuration, pdp v4 ctx can talk
each other while pdp v6 ctx cannot.

Change-Id: I67c04b056cc5c092d357abbb084b7665f59eaf3a
---
M ggsn_tests/GGSN_Tests.cfg
M ggsn_tests/GGSN_Tests.ttcn
2 files changed, 121 insertions(+), 0 deletions(-)


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

diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index bf82057..67fcbd4 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -27,10 +27,12 @@
 GGSN_Tests.TC_pdp4_act_deact_ipcp
 GGSN_Tests.TC_pdp4_act_deact_pcodns
 GGSN_Tests.TC_pdp4_act_deact_gtpu_access
+GGSN_Tests.TC_pdp6_clients_interact
 
 GGSN_Tests.TC_pdp6_act_deact
 GGSN_Tests.TC_pdp6_act_deact_pcodns
 GGSN_Tests.TC_pdp6_act_deact_icmp6
 GGSN_Tests.TC_pdp6_act_deact_gtpu_access
+GGSN_Tests.TC_pdp4_clients_interact
 
 GGSN_Tests.TC_echo_req_resp
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index aa20f25..03437be 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -747,6 +747,18 @@
}
}
 
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMP tr_ICMPv4_ERQ := {
+   echo := {
+   type_field := 8,
+   code := 0,
+   checksum := ?,
+   identifier := ?,
+   sequence_number := ?,
+   data := ?
+   }
+   }
+
/* template for an ICMPv4 echo reply */
template PDU_ICMP tr_ICMPv4_ERP(octetstring data := ''O) := {
echo_reply := {
@@ -910,6 +922,18 @@
}
}
 
+   /* template for an ICMPv6 echo request */
+   template PDU_ICMPv6 tr_ICMPv6_ERQ := {
+   echoRequest := {
+   typeField := 128,
+   code := 0,
+   checksum := ?,
+   identifier := ?,
+   sequenceNr := ?,
+   data := ?
+   }
+   }
+
/* template for receiving/matching an ICMPv6 echo reply */
template PDU_ICMPv6 tr_ICMPv6_ERP(octetstring data := ''O) := {
echoReply := {
@@ -1042,6 +1066,30 @@
T_default.stop;
}
 
+
+   /* Wait to ICMPv4 echo request from GTP */
+   function f_wait_icmp4_echo_request(PdpContext ctx) runs on GT_CT {
+   var Gtp1uUnitdata ud;
+   T_default.start;
+   alt {
+   [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value ud {
+   var octetstring gpdu := 
ud.gtpu.gtpu_IEs.g_PDU_IEs.data;
+   var IPv4_packet ip4 := f_IPv4_dec(gpdu);
+   if (ip4.header.ver != 4) {
+   repeat;
+   }
+   var PDU_ICMP icmp4 := 
f_dec_PDU_ICMP(ip4.payload);
+   if (not match(icmp4, tr_ICMPv4_ERQ)) {
+   repeat;
+   }
+   log("Received echo resquest");
+   }
+   [] GTPU.receive { setverdict(fail); }
+   [] T_default.timeout { setverdict(fail); }
+   }
+   T_default.stop;
+   }
+
/* Wait to ICMPv4 echo reply (or unreachable) from GTP */
function f_wait_icmp4_echo_reply(PdpContext ctx) runs on GT_CT {
var Gtp1uUnitdata ud;
@@ -1055,6 +1103,29 @@
}
var PDU_ICMP icmp4 := 
f_dec_PDU_ICMP(ip4.payload);
if (not match(icmp4, tr_ICMPv4_ERP()) and not 
match(icmp4, tr_ICMPv4_DU)) {
+   repeat;
+   }
+   log("Received echo response");
+   }
+   [] GTPU.receive { setverdict(fail); }
+   [] T_default.timeout { setverdict(fail); }
+   }
+   T_default.stop;
+   }
+
+   /* Wait to ICMPv6 echo request from GTP */
+   function f_wait_icmp6_echo_request(PdpContext ctx) runs on GT_CT {
+   var Gtp1uUnitdata ud;
+   T_default.start;
+   alt {
+   [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> value ud {
+   var octetstring gpdu := 
ud.gtpu.gtpu_IEs.g_PDU_IEs.data;
+   var IPv6_packet ip6 := f_IPv6_dec(gpdu);
+   if (ip6.header.ver != 6 or ip6.header.nexthead 
!= 58) {
+   repeat;
+   

[PATCH] osmo-pcu[master]: TBF: add helpers for assignment type handling

2018-01-30 Thread Max

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

TBF: add helpers for assignment type handling

* add function to set/unset given assignment type
* log assignment type flag changes
* update tests output with additional logs

This enables us to carefully track the TBF assignment type transitions.

Change-Id: I3fe9d52472be8b7f257e8326b2f84e8e7d7bd1f4
Related: OS#1759
---
M src/bts.cpp
M src/tbf.h
M src/tbf_dl.cpp
M tests/tbf/TbfTest.err
4 files changed, 86 insertions(+), 10 deletions(-)


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

diff --git a/src/bts.cpp b/src/bts.cpp
index 1669739..9d913c1 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -759,7 +759,7 @@
} else {
tbf->set_ta(ta);
TBF_SET_STATE(tbf, GPRS_RLCMAC_FLOW);
-   tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_CCCH);
+   TBF_ASS_TYPE_SET(tbf, GPRS_RLCMAC_FLAG_CCCH);
T_START(tbf, T3169, m_bts.t3169, 0, "RACH (new 
UL-TBF)", true);
LOGPTBF(tbf, LOGL_DEBUG, "[UPLINK] START\n");
LOGPTBF(tbf, LOGL_DEBUG, "RX: [PCU <- BTS] RACH "
@@ -1042,7 +1042,7 @@
LOGPTBF(new_tbf, LOGL_INFO,
"The TBF has been confirmed on the PACCH, "
"changed type from CCCH to PACCH\n");
-   new_tbf->state_flags |= (1 << GPRS_RLCMAC_FLAG_PACCH);
+   TBF_ASS_TYPE_SET(new_tbf, GPRS_RLCMAC_FLAG_PACCH);
}
TBF_SET_STATE(new_tbf, GPRS_RLCMAC_FLOW);
/* stop pending assignment timer */
diff --git a/src/tbf.h b/src/tbf.h
index 803ea33..2ed63f9 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -191,6 +191,8 @@
 #define TBF_POLL_SCHED_SET(t) do { t->poll_sched_set(__FILE__, __LINE__); } 
while(0)
 #define TBF_POLL_SCHED_UNSET(t) do { t->poll_sched_unset(__FILE__, __LINE__); 
} while(0)
 #define TBF_SET_ASS_ON(t, fl, chk) do { t->set_assigned_on(fl, chk, __FILE__, 
__LINE__); } while(0)
+#define TBF_ASS_TYPE_SET(t, kind) do { t->ass_type_mod(kind, false, __FILE__, 
__LINE__); } while(0)
+#define TBF_ASS_TYPE_UNSET(t, kind) do { t->ass_type_mod(kind, true, __FILE__, 
__LINE__); } while(0)
 
 struct gprs_rlcmac_tbf {
gprs_rlcmac_tbf(BTS *bts_, gprs_rlcmac_tbf_direction dir);
@@ -213,6 +215,7 @@
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);
+   void ass_type_mod(uint8_t t, bool unset, const char *file, int line);
const char *state_name() const;
 
const char *name() const;
@@ -422,11 +425,57 @@
set_state(GPRS_RLCMAC_ASSIGN, file, line);
if (check_ccch) {
if (!(state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
-   state_flags |= (1 << state_flag);
+   ass_type_mod(state_flag, false, file, line);
} else
state_flags |= (1 << state_flag);
 }
 
+inline void gprs_rlcmac_tbf::ass_type_mod(uint8_t t, bool unset, const char 
*file, int line)
+{
+   const char *ch = "UNKNOWN";
+   switch (t) {
+   case GPRS_RLCMAC_FLAG_CCCH:
+   if (unset) {
+   if (!(state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH)))
+   return;
+   } else {
+   if (state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH))
+   LOGPSRC(DTBF, LOGL_ERROR, file, line,
+   "%s attempted to set ass. type CCCH 
which is already set.\n",
+   tbf_name(this));
+   }
+   ch = "CCCH";
+   break;
+   case GPRS_RLCMAC_FLAG_PACCH:
+   if (unset) {
+   if (!(state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH)))
+   return;
+   } else {
+   if (state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH))
+   LOGPSRC(DTBF, LOGL_ERROR, file, line,
+   "%s attempted to set ass. type PACCH 
which is already set.\n",
+   tbf_name(this));
+   }
+   ch = "PACCH";
+   break;
+   default:
+   LOGPSRC(DTBF, LOGL_ERROR, file, line, "%s attempted to %sset 
unexpected ass. type %d - FIXME!\n",
+   tbf_name(this), unset ? "un" : "", t);
+   return;
+   }
+
+   LOGPSRC(DTBF, LOGL_INFO, file, line, "%s %sset ass. type %s [prev 
CCCH:%u, PACCH:%u]\n",
+   tbf_name(this), unset ? "un" : "", ch,
+   state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH),
+   state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH));
+
+   if (unset) {
+   state_flags &= GPRS_RLCMAC_FLAG_T

[PATCH] osmo-pcu[master]: TBF: show assignment kind in vty

2018-01-30 Thread Max

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

TBF: show assignment kind in vty

Change-Id: Ic4e40d9c141ab7ee3f7c4dceec007dbe16359f93
Related: OS#1759
---
M src/pcu_vty_functions.cpp
1 file changed, 5 insertions(+), 3 deletions(-)


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

diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index eb15aa6..31fffa9 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -49,9 +49,11 @@
tbf->ta(),
tbf->direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL",
tbf->imsi(), VTY_NEWLINE);
-   vty_out(vty, " created=%lu state=%08x 1st_TS=%d 1st_cTS=%d ctrl_TS=%d "
-   "MS_CLASS=%d/%d%s",
-   tbf->created_ts(), tbf->state_flags, tbf->first_ts,
+   vty_out(vty, " created=%lu state=%08x [CCCH:%u, PACCH:%u] 1st_TS=%d 
1st_cTS=%d ctrl_TS=%d MS_CLASS=%d/%d%s",
+   tbf->created_ts(), tbf->state_flags,
+   state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH),
+   state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH),
+   tbf->first_ts,
tbf->first_common_ts, tbf->control_ts,
tbf->ms_class(),
tbf->ms() ? tbf->ms()->egprs_ms_class() : -1,

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

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


[PATCH] osmo-pcu[master]: vty: drop unused function

2018-01-30 Thread Max

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

vty: drop unused function

Change-Id: I01f3773ca6a9b6d4e28ca2f59c944c6d48918dd1
---
M src/pcu_vty.c
M src/pcu_vty_functions.cpp
M src/pcu_vty_functions.h
3 files changed, 1 insertion(+), 7 deletions(-)


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

diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index dff331f..5c3f625 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -265,7 +265,7 @@
}
}
 
-   return pcu_vty_config_write_pcu_ext(vty);
+   return CMD_SUCCESS;
 }
 
 /* per-BTS configuration */
diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index 31fffa9..252c922 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -34,11 +34,6 @@
 #include 
 }
 
-int pcu_vty_config_write_pcu_ext(struct vty *vty)
-{
-   return CMD_SUCCESS;
-}
-
 static void tbf_print_vty_info(struct vty *vty, gprs_rlcmac_tbf *tbf)
 {
gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(tbf);
diff --git a/src/pcu_vty_functions.h b/src/pcu_vty_functions.h
index 35acf64..470df0e 100644
--- a/src/pcu_vty_functions.h
+++ b/src/pcu_vty_functions.h
@@ -27,7 +27,6 @@
 struct vty;
 struct gprs_rlcmac_bts;
 
-int pcu_vty_config_write_pcu_ext(struct vty *vty);
 int pcu_vty_show_tbf_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data);
 int pcu_vty_show_ms_all(struct vty *vty, struct gprs_rlcmac_bts *bts_data);
 int pcu_vty_show_ms_by_tlli(struct vty *vty, struct gprs_rlcmac_bts *bts_data,

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

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


[PATCH] osmo-pcu[master]: TBF: show assignment kind in vty

2018-01-30 Thread Max
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6207

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

TBF: show assignment kind in vty

Change-Id: Ic4e40d9c141ab7ee3f7c4dceec007dbe16359f93
Related: OS#1759
---
M src/pcu_vty_functions.cpp
1 file changed, 5 insertions(+), 3 deletions(-)


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

diff --git a/src/pcu_vty_functions.cpp b/src/pcu_vty_functions.cpp
index eb15aa6..bb341f8 100644
--- a/src/pcu_vty_functions.cpp
+++ b/src/pcu_vty_functions.cpp
@@ -49,9 +49,11 @@
tbf->ta(),
tbf->direction == GPRS_RLCMAC_UL_TBF ? "UL" : "DL",
tbf->imsi(), VTY_NEWLINE);
-   vty_out(vty, " created=%lu state=%08x 1st_TS=%d 1st_cTS=%d ctrl_TS=%d "
-   "MS_CLASS=%d/%d%s",
-   tbf->created_ts(), tbf->state_flags, tbf->first_ts,
+   vty_out(vty, " created=%lu state=%08x [CCCH:%u, PACCH:%u] 1st_TS=%d 
1st_cTS=%d ctrl_TS=%d MS_CLASS=%d/%d%s",
+   tbf->created_ts(), tbf->state_flags,
+   tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_CCCH),
+   tbf->state_flags & (1 << GPRS_RLCMAC_FLAG_PACCH),
+   tbf->first_ts,
tbf->first_common_ts, tbf->control_ts,
tbf->ms_class(),
tbf->ms() ? tbf->ms()->egprs_ms_class() : -1,

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic4e40d9c141ab7ee3f7c4dceec007dbe16359f93
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-sgsn[master]: mandatory depend on libc-ares and libgtp

2018-01-30 Thread lynxis lazus

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

mandatory depend on libc-ares and libgtp

Both library are required to build osmo-sgsn.
The optional dependency was correct when osmo-sgsn
was part of openbsc.

Change-Id: Id608165ae490cb6c84aac1fe70412b2cb2b2587b
---
M configure.ac
M src/gprs/Makefile.am
M tests/Makefile.am
M tests/gtphub/Makefile.am
M tests/oap/Makefile.am
5 files changed, 2 insertions(+), 39 deletions(-)


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

diff --git a/configure.ac b/configure.ac
index ba82eb1..504157b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,21 +60,8 @@
 AC_SUBST(osmo_ac_iu)
 
 
-found_libgtp=yes
-PKG_CHECK_MODULES(LIBGTP, libgtp >= 1.0.0, , found_libgtp=no)
-AM_CONDITIONAL(HAVE_LIBGTP, test "$found_libgtp" = yes)
-AC_SUBST(found_libgtp)
-
-found_libcares=yes
-PKG_CHECK_MODULES([LIBCARES], [libcares], [], [found_libcares=no])
-AM_CONDITIONAL(HAVE_LIBCARES, test "$found_libcares" = yes)
-AC_SUBST(found_libcares)
-
-found_libgtp_and_libcares=no
-if test "$found_libgtp" = "yes" -a "$found_libcares" = "yes"; then
-found_libgtp_and_libcares=yes
-fi
-AC_SUBST(found_libgtp_and_libcares)
+PKG_CHECK_MODULES(LIBGTP, libgtp >= 1.0.0)
+PKG_CHECK_MODULES(LIBCARES, libcares)
 
 dnl checks for header files
 AC_HEADER_STDC
diff --git a/src/gprs/Makefile.am b/src/gprs/Makefile.am
index b0fca6f..4c7f730 100644
--- a/src/gprs/Makefile.am
+++ b/src/gprs/Makefile.am
@@ -36,15 +36,9 @@
 
 bin_PROGRAMS = \
osmo-gbproxy \
-   $(NULL)
-if HAVE_LIBGTP
-if HAVE_LIBCARES
-bin_PROGRAMS += \
osmo-sgsn \
osmo-gtphub \
$(NULL)
-endif
-endif
 
 osmo_gbproxy_SOURCES = \
gb_proxy.c \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3cd8bff..f6a1efc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,15 +1,7 @@
 SUBDIRS = \
gprs \
gbproxy \
-   $(NULL)
-
-if HAVE_LIBGTP
-SUBDIRS += \
gtphub \
-   $(NULL)
-
-if HAVE_LIBCARES
-SUBDIRS += \
sgsn \
oap \
xid \
@@ -17,8 +9,6 @@
slhc \
v42bis \
$(NULL)
-endif
-endif
 
 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
diff --git a/tests/gtphub/Makefile.am b/tests/gtphub/Makefile.am
index f2a6b88..523df61 100644
--- a/tests/gtphub/Makefile.am
+++ b/tests/gtphub/Makefile.am
@@ -16,13 +16,9 @@
gtphub_test.ok \
$(NULL)
 
-if HAVE_LIBGTP
-if HAVE_LIBCARES
 noinst_PROGRAMS = \
gtphub_test \
$(NULL)
-endif
-endif
 
 gtphub_test_SOURCES = \
gtphub_test.c \
diff --git a/tests/oap/Makefile.am b/tests/oap/Makefile.am
index 5f8bbc5..ccc6d8c 100644
--- a/tests/oap/Makefile.am
+++ b/tests/oap/Makefile.am
@@ -15,13 +15,9 @@
oap_client_test.err \
$(NULL)
 
-if HAVE_LIBGTP
-if HAVE_LIBCARES
 noinst_PROGRAMS = \
oap_client_test \
$(NULL)
-endif
-endif
 
 oap_client_test_SOURCES = \
oap_client_test.c \

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id608165ae490cb6c84aac1fe70412b2cb2b2587b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 


[PATCH] osmo-msc[master]: Remove unused code

2018-01-30 Thread Max

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

Remove unused code

The socket.* is unused leftover from pre-split time.

Change-Id: Ibf3b539fcbd7f311caa2291af23b8f18ebc6c2e0
---
M include/osmocom/msc/Makefile.am
D include/osmocom/msc/socket.h
M src/libcommon/Makefile.am
D src/libcommon/socket.c
4 files changed, 0 insertions(+), 127 deletions(-)


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

diff --git a/include/osmocom/msc/Makefile.am b/include/osmocom/msc/Makefile.am
index ec231d0..88305db 100644
--- a/include/osmocom/msc/Makefile.am
+++ b/include/osmocom/msc/Makefile.am
@@ -29,7 +29,6 @@
silent_call.h \
smpp.h \
sms_queue.h \
-   socket.h \
transaction.h \
ussd.h \
vlr.h \
diff --git a/include/osmocom/msc/socket.h b/include/osmocom/msc/socket.h
deleted file mode 100644
index 0fd85f1..000
--- a/include/osmocom/msc/socket.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BSC_SOCKET_H
-#define _BSC_SOCKET_H
-
-#include 
-
-#ifndef IPPROTO_GRE
-#define IPPROTO_GRE 47
-#endif
-
-int make_sock(struct osmo_fd *bfd, int proto,
- uint32_t ip, uint16_t port, int priv_nr,
- int (*cb)(struct osmo_fd *fd, unsigned int what), void *data);
-
-#endif /* _BSC_SOCKET_H */
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 8f70da7..30f37d4 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -26,7 +26,6 @@
gsm_data.c \
gsup_client.c \
oap_client.c \
-   socket.c \
talloc_ctx.c \
gsm_subscriber_base.c \
$(NULL)
diff --git a/src/libcommon/socket.c b/src/libcommon/socket.c
deleted file mode 100644
index 2793bcf..000
--- a/src/libcommon/socket.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* OpenBSC sokcet code, taken from Abis input driver for ip.access */
-
-/* (C) 2009 by Harald Welte 
- * (C) 2010 by Holger Hans Peter Freyther
- * (C) 2010 by On-Waves
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-int make_sock(struct osmo_fd *bfd, int proto,
- uint32_t ip, uint16_t port, int priv_nr,
- int (*cb)(struct osmo_fd *fd, unsigned int what), void *data)
-{
-   struct sockaddr_in addr;
-   int ret, on = 1;
-   int type = SOCK_STREAM;
-
-   switch (proto) {
-   case IPPROTO_TCP:
-   type = SOCK_STREAM;
-   break;
-   case IPPROTO_UDP:
-   type = SOCK_DGRAM;
-   break;
-#ifdef IPPROTO_GRE
-   case IPPROTO_GRE:
-   type = SOCK_RAW;
-   break;
-#endif
-   default:
-   return -EINVAL;
-   }
-
-   bfd->fd = socket(AF_INET, type, proto);
-   bfd->cb = cb;
-   bfd->when = BSC_FD_READ;
-   bfd->data = data;
-   bfd->priv_nr = priv_nr;
-
-   if (bfd->fd < 0) {
-   LOGP(DLINP, LOGL_ERROR, "could not create socket.\n");
-   return -EIO;
-   }
-
-   memset(&addr, 0, sizeof(addr));
-   addr.sin_family = AF_INET;
-   addr.sin_port = htons(port);
-   if (ip != INADDR_ANY)
-   addr.sin_addr.s_addr = htonl(ip);
-   else
-   addr.sin_addr.s_addr = INADDR_ANY;
-
-   setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
-
-   ret = bind(bfd->fd, (struct sockaddr *) &addr, sizeof(addr));
-   if (ret < 0) {
-   LOGP(DLINP, LOGL_ERROR, "could not bind socket %s\n",
-   strerror(errno));
-   close(bfd->fd);
-   return -EIO;
-   }
-
-   if (proto == IPPROTO_TCP) {
-   ret = listen(bfd->fd, 1);
-   if (ret < 0) {
-   perror("listen");
-   close(bfd->fd);
-   return ret;
-   }
-   }
-
-   ret = osmo_fd_register(bfd);
-   if (ret < 0) {
-   perror("register_listen_fd");
-   close(bfd->fd);
-   return ret;
-   }
-   return 0;
-}

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

Gerrit-MessageType: newchang

[PATCH] osmo-msc[master]: Remove unused code

2018-01-30 Thread Max

Remove unused code

The socket.* is unused leftover from pre-split time.

Fixes: CID57645
Change-Id: Ibf3b539fcbd7f311caa2291af23b8f18ebc6c2e0
---
M include/osmocom/msc/Makefile.am
D include/osmocom/msc/socket.h
M src/libcommon/Makefile.am
D src/libcommon/socket.c
4 files changed, 0 insertions(+), 127 deletions(-)


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

diff --git a/include/osmocom/msc/Makefile.am b/include/osmocom/msc/Makefile.am
index ec231d0..88305db 100644
--- a/include/osmocom/msc/Makefile.am
+++ b/include/osmocom/msc/Makefile.am
@@ -29,7 +29,6 @@
silent_call.h \
smpp.h \
sms_queue.h \
-   socket.h \
transaction.h \
ussd.h \
vlr.h \
diff --git a/include/osmocom/msc/socket.h b/include/osmocom/msc/socket.h
deleted file mode 100644
index 0fd85f1..000
--- a/include/osmocom/msc/socket.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BSC_SOCKET_H
-#define _BSC_SOCKET_H
-
-#include 
-
-#ifndef IPPROTO_GRE
-#define IPPROTO_GRE 47
-#endif
-
-int make_sock(struct osmo_fd *bfd, int proto,
- uint32_t ip, uint16_t port, int priv_nr,
- int (*cb)(struct osmo_fd *fd, unsigned int what), void *data);
-
-#endif /* _BSC_SOCKET_H */
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 8f70da7..30f37d4 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -26,7 +26,6 @@
gsm_data.c \
gsup_client.c \
oap_client.c \
-   socket.c \
talloc_ctx.c \
gsm_subscriber_base.c \
$(NULL)
diff --git a/src/libcommon/socket.c b/src/libcommon/socket.c
deleted file mode 100644
index 2793bcf..000
--- a/src/libcommon/socket.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* OpenBSC sokcet code, taken from Abis input driver for ip.access */
-
-/* (C) 2009 by Harald Welte 
- * (C) 2010 by Holger Hans Peter Freyther
- * (C) 2010 by On-Waves
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-int make_sock(struct osmo_fd *bfd, int proto,
- uint32_t ip, uint16_t port, int priv_nr,
- int (*cb)(struct osmo_fd *fd, unsigned int what), void *data)
-{
-   struct sockaddr_in addr;
-   int ret, on = 1;
-   int type = SOCK_STREAM;
-
-   switch (proto) {
-   case IPPROTO_TCP:
-   type = SOCK_STREAM;
-   break;
-   case IPPROTO_UDP:
-   type = SOCK_DGRAM;
-   break;
-#ifdef IPPROTO_GRE
-   case IPPROTO_GRE:
-   type = SOCK_RAW;
-   break;
-#endif
-   default:
-   return -EINVAL;
-   }
-
-   bfd->fd = socket(AF_INET, type, proto);
-   bfd->cb = cb;
-   bfd->when = BSC_FD_READ;
-   bfd->data = data;
-   bfd->priv_nr = priv_nr;
-
-   if (bfd->fd < 0) {
-   LOGP(DLINP, LOGL_ERROR, "could not create socket.\n");
-   return -EIO;
-   }
-
-   memset(&addr, 0, sizeof(addr));
-   addr.sin_family = AF_INET;
-   addr.sin_port = htons(port);
-   if (ip != INADDR_ANY)
-   addr.sin_addr.s_addr = htonl(ip);
-   else
-   addr.sin_addr.s_addr = INADDR_ANY;
-
-   setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
-
-   ret = bind(bfd->fd, (struct sockaddr *) &addr, sizeof(addr));
-   if (ret < 0) {
-   LOGP(DLINP, LOGL_ERROR, "could not bind socket %s\n",
-   strerror(errno));
-   close(bfd->fd);
-   return -EIO;
-   }
-
-   if (proto == IPPROTO_TCP) {
-   ret = listen(bfd->fd, 1);
-   if (ret < 0) {
-   perror("listen");
-   close(bfd->fd);
-   return ret;
-   }
-   }
-
-   ret = osmo_fd_register(bfd);
-   if (ret < 0) {
-   perror("register_listen_fd");
-   close(bfd->fd);
-   return ret;
-   }
-   return 0;
-}

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ibf3b5

[PATCH] osmo-bsc[master]: Make "waiting indicator" of IMMEDIATE ASSIGN REJECT dynamic.

2018-01-30 Thread Stefan Sperling

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

Make "waiting indicator" of IMMEDIATE ASSIGN REJECT dynamic.

The IMMEDIATE ASSIGN REJECT message contains a wait indicator which
tells an MS requesting a channel to wait for a specified amount of
time before trying to request a channel again, i.e. the wait indicator
controls the T3122 timeout value in the MS.

Previously, the wait indicator was fixed to 10 seconds.
This is not sufficient if there are a lot of MS requesting channels
because the MS will retry too soon. Instead of using a fixed value,
maintain a dynamic wait indicator value based on average channel load.

The load (used vs. available channels on a BTS) is sampled once per
second, and once 8 samples have been collected we update a BTS-specific
T3122 wait indicator based on the measured load.

While the wait indicator could go up to 255 seconds, this initial
implementation keeps it in the range from 10 to 128 seconds.

Further experimentation and testing will show whether higher wait
indicator values are desirable, if the sampling rate needs to change,
or if the function mapping the load measurement to a wait indicator
value should change (currently we map the load average linearly into
the range [10, 128] inclusive).

Change-Id: I57e38f6d6ba3b23cc6e1f9520b90261dbb1f1cec
Related: OS#2592
---
M include/osmocom/bsc/chan_alloc.h
M include/osmocom/bsc/gsm_data.h
M include/osmocom/bsc/gsm_data_shared.h
M src/libbsc/abis_rsl.c
M src/libbsc/bsc_init.c
M src/libbsc/bsc_vty.c
M src/libbsc/chan_alloc.c
M src/libbsc/net_init.c
M src/libcommon/gsm_data_shared.c
M tests/channel/Makefile.am
M tests/channel/channel_test.c
11 files changed, 134 insertions(+), 30 deletions(-)


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

diff --git a/include/osmocom/bsc/chan_alloc.h b/include/osmocom/bsc/chan_alloc.h
index 748e9cd..98568a5 100644
--- a/include/osmocom/bsc/chan_alloc.h
+++ b/include/osmocom/bsc/chan_alloc.h
@@ -37,17 +37,13 @@
 /* Release the given lchan */
 int lchan_release(struct gsm_lchan *lchan, int sacch_deact, enum rsl_rel_mode 
release_mode);
 
-struct load_counter {
-   unsigned int total;
-   unsigned int used;
-};
-
 struct pchan_load {
struct load_counter pchan[_GSM_PCHAN_MAX];
 };
 
 void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts);
 void network_chan_load(struct pchan_load *pl, struct gsm_network *net);
+void bts_update_t3122_chan_load(struct gsm_bts *bts);
 
 bool trx_is_usable(const struct gsm_bts_trx *trx);
 bool ts_is_usable(const struct gsm_bts_trx_ts *ts);
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index bdf7cfb..25dee78 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -308,6 +308,9 @@
/* Periodic location update default value */
uint8_t t3212;
 
+   /* Timer for periodic channel load measurements to maintain each BTS's 
T3122. */
+   struct osmo_timer_list t3122_chan_load_timer;
+
struct {
struct mgcp_client_conf *conf;
struct mgcp_client *client;
diff --git a/include/osmocom/bsc/gsm_data_shared.h 
b/include/osmocom/bsc/gsm_data_shared.h
index 86c5ca9..504b42a 100644
--- a/include/osmocom/bsc/gsm_data_shared.h
+++ b/include/osmocom/bsc/gsm_data_shared.h
@@ -573,6 +573,12 @@
double height;
 };
 
+/* Channel load counter */
+struct load_counter {
+   unsigned int total;
+   unsigned int used;
+};
+
 /* One BTS */
 struct gsm_bts {
/* list header in net->bts_list */
@@ -802,6 +808,13 @@
struct rate_ctr_group *bts_ctrs;
 
struct handover_cfg *ho;
+
+   /* BTS-specific overrides for timer values from struct gsm_network. */
+   uint8_t T3122;  /* ASSIGMENT REJECT wait indication */
+
+   /* Periodic channel load measurements are used to maintain T3122. */
+   struct load_counter chan_load_samples[7];
+   int chan_load_samples_idx;
 };
 
 
diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index eced0e2..3282591 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -1776,8 +1776,7 @@
 
 /* Format an IMM ASS REJ according to 04.08 Chapter 9.1.20 */
 static int rsl_send_imm_ass_rej(struct gsm_bts *bts,
-   unsigned int num_req_refs,
-   struct gsm48_req_ref *rqd_refs,
+   struct gsm48_req_ref *rqd_ref,
uint8_t wait_ind)
 {
uint8_t buf[GSM_MACBLOCK_LEN];
@@ -1789,25 +1788,15 @@
iar->msg_type = GSM48_MT_RR_IMM_ASS_REJ;
iar->page_mode = GSM48_PM_SAME;
 
-   memcpy(&iar->req_ref1, &rqd_refs[0], sizeof(iar->req_ref1));
+   /* Set all request references and wait indications to the same value.
+* The BTS will aggregate up to 4 of our ASS REJ messages if possible. 
*/
+   memcpy(&iar->req_ref1, rqd_ref, sizeof(iar->req_ref1));
iar->wait_ind1 = wait_ind;
-
-   if (num_re

[PATCH] osmo-ttcn3-hacks[master]: bsc: Handle wildcard endpoint name in MGCP CRCX

2018-01-30 Thread Harald Welte

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

bsc: Handle wildcard endpoint name in MGCP CRCX

MGCP permits for the CallAgent to send a wildcarded endpoint name,
at which point the MGW itself must allocate an endpoint name and
return it as SpecificEndpointId parameter in the CRCX response.

Change-Id: I704bbe4e11b27e83a6ae6a71aa6a715dc8301f34
---
M bsc/MSC_ConnectionHandler.ttcn
M library/MGCP_Emulation.ttcn
M library/MGCP_Templates.ttcn
3 files changed, 49 insertions(+), 5 deletions(-)


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

diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 55cdb89..b6e6540 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -75,7 +75,7 @@
peer := -
}
 
-   //g_media.mgcp_ep := int2str(i) & "@mgw";
+   g_media.mgcp_ep := "rtpbridge/" & int2str(nr) & "@mgw";
 
for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
g_media.mgcp_conn[i].mime_type := "AMR";
@@ -169,6 +169,16 @@
[] MGCP.receive(tr_CRCX) -> value mgcp_cmd {
var SDP_Message sdp;
var integer cid := f_get_free_mgcp_conn();
+   if (match(mgcp_cmd.line.ep, t_MGCP_EP_wildcard)) {
+   if (cid != 0) {
+   setverdict(fail, "MGCP wildcard EP only works 
in first CRCX");
+   self.stop;
+   }
+   /* we keep the endpoint name allocated during 
MediaState_init */
+   } else {
+   /* Call Agent allocated endpoint, trust/use it always */
+   g_media.mgcp_ep := mgcp_cmd.line.ep;
+   }
if (isvalue(mgcp_cmd.sdp)) {
sdp := mgcp_cmd.sdp;
g_media.mgcp_conn[cid].peer.host := 
sdp.connection.conn_addr.addr;
@@ -181,7 +191,10 @@
mgcp_conn.mime_type & 
"/" &

int2str(mgcp_conn.sample_rate))),
valueof(ts_SDP_ptime(mgcp_conn.ptime)) } ));
-   MGCP.send(ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
mgcp_conn.conn_id, sdp));
+   var template MgcpResponse mgcp_resp;
+   mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
mgcp_conn.conn_id, sdp);
+   f_mgcp_par_append(mgcp_resp.params, 
ts_MgcpParSpecEP(g_media.mgcp_ep));
+   MGCP.send(mgcp_resp);
g_media.mgcp_conn[cid].crcx_seen := true;
repeat;
}
diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index df8e4b4..adcb8b5 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -208,8 +208,12 @@
if (ischosen(msg.command)) {
return msg.command.line.ep;
} else {
-   /* FIXME */
-   return "null@none";
+   var MgcpEndpoint ep;
+   if (f_mgcp_find_param(msg, "Z", ep) == false) {
+   setverdict(fail, "No SpecificEndpointName in MGCP 
response", msg);
+   self.stop;
+   }
+   return ep;
}
 }
 
@@ -273,7 +277,8 @@
} else {
if (cmd.line.verb == "CRCX") {
vc_conn := 
ops.create_cb.apply(cmd, id);
-   if (true /* non-wildcard EP */) 
{
+   if (not match(cmd.line.ep, 
t_MGCP_EP_wildcard)) {
+   /* non-wildcard EP, use 
directly */
f_ep_table_add(vc_conn, 
cmd.line.ep);
} else {
/* add this transaction 
to list of pending transactions */
diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index 5a8d9b1..9e32a34 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -34,6 +34,12 @@
val := hex2str(rid)
};
 
+   /* 3.2.1.3 SpecificEndpointId */
+   template MgcpParameter ts_MgcpParSpecEP(MgcpEndpoint ep) := {
+   code := "Z",
+   val := ep
+   };
+
/* 3.2.2.10: LocalConnectionOptions (codec, packetization, bandwidth, 
ToS, eco, gain, silence, ...) */
template MgcpParameter t_MgcpParLocConnOpt(template charstring lco) := 
{ "L", lco };
 
@@ -326,5 +332,25 @@
sdp := *
}
 
+   function f_mgcp_find_param(MgcpMessage msg, MgcpInfoCode code, out 
charstring ret)
+   return boolean {
+   var MgcpParameterList pars;
+   if (ischosen(msg.command)) {
+  

[MERGED] osmo-ttcn3-hacks[master]: bsc: Handle wildcard endpoint name in MGCP CRCX

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

Change subject: bsc: Handle wildcard endpoint name in MGCP CRCX
..


bsc: Handle wildcard endpoint name in MGCP CRCX

MGCP permits for the CallAgent to send a wildcarded endpoint name,
at which point the MGW itself must allocate an endpoint name and
return it as SpecificEndpointId parameter in the CRCX response.

Change-Id: I704bbe4e11b27e83a6ae6a71aa6a715dc8301f34
---
M bsc/MSC_ConnectionHandler.ttcn
M library/MGCP_Emulation.ttcn
M library/MGCP_Templates.ttcn
3 files changed, 49 insertions(+), 5 deletions(-)

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



diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 55cdb89..b6e6540 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -75,7 +75,7 @@
peer := -
}
 
-   //g_media.mgcp_ep := int2str(i) & "@mgw";
+   g_media.mgcp_ep := "rtpbridge/" & int2str(nr) & "@mgw";
 
for (var integer i:= 0; i < sizeof(g_media.mgcp_conn); i := i+1) {
g_media.mgcp_conn[i].mime_type := "AMR";
@@ -169,6 +169,16 @@
[] MGCP.receive(tr_CRCX) -> value mgcp_cmd {
var SDP_Message sdp;
var integer cid := f_get_free_mgcp_conn();
+   if (match(mgcp_cmd.line.ep, t_MGCP_EP_wildcard)) {
+   if (cid != 0) {
+   setverdict(fail, "MGCP wildcard EP only works 
in first CRCX");
+   self.stop;
+   }
+   /* we keep the endpoint name allocated during 
MediaState_init */
+   } else {
+   /* Call Agent allocated endpoint, trust/use it always */
+   g_media.mgcp_ep := mgcp_cmd.line.ep;
+   }
if (isvalue(mgcp_cmd.sdp)) {
sdp := mgcp_cmd.sdp;
g_media.mgcp_conn[cid].peer.host := 
sdp.connection.conn_addr.addr;
@@ -181,7 +191,10 @@
mgcp_conn.mime_type & 
"/" &

int2str(mgcp_conn.sample_rate))),
valueof(ts_SDP_ptime(mgcp_conn.ptime)) } ));
-   MGCP.send(ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
mgcp_conn.conn_id, sdp));
+   var template MgcpResponse mgcp_resp;
+   mgcp_resp := ts_CRCX_ACK(mgcp_cmd.line.trans_id, 
mgcp_conn.conn_id, sdp);
+   f_mgcp_par_append(mgcp_resp.params, 
ts_MgcpParSpecEP(g_media.mgcp_ep));
+   MGCP.send(mgcp_resp);
g_media.mgcp_conn[cid].crcx_seen := true;
repeat;
}
diff --git a/library/MGCP_Emulation.ttcn b/library/MGCP_Emulation.ttcn
index df8e4b4..adcb8b5 100644
--- a/library/MGCP_Emulation.ttcn
+++ b/library/MGCP_Emulation.ttcn
@@ -208,8 +208,12 @@
if (ischosen(msg.command)) {
return msg.command.line.ep;
} else {
-   /* FIXME */
-   return "null@none";
+   var MgcpEndpoint ep;
+   if (f_mgcp_find_param(msg, "Z", ep) == false) {
+   setverdict(fail, "No SpecificEndpointName in MGCP 
response", msg);
+   self.stop;
+   }
+   return ep;
}
 }
 
@@ -273,7 +277,8 @@
} else {
if (cmd.line.verb == "CRCX") {
vc_conn := 
ops.create_cb.apply(cmd, id);
-   if (true /* non-wildcard EP */) 
{
+   if (not match(cmd.line.ep, 
t_MGCP_EP_wildcard)) {
+   /* non-wildcard EP, use 
directly */
f_ep_table_add(vc_conn, 
cmd.line.ep);
} else {
/* add this transaction 
to list of pending transactions */
diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index 5a8d9b1..9e32a34 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -34,6 +34,12 @@
val := hex2str(rid)
};
 
+   /* 3.2.1.3 SpecificEndpointId */
+   template MgcpParameter ts_MgcpParSpecEP(MgcpEndpoint ep) := {
+   code := "Z",
+   val := ep
+   };
+
/* 3.2.2.10: LocalConnectionOptions (codec, packetization, bandwidth, 
ToS, eco, gain, silence, ...) */
template MgcpParameter t_MgcpParLocConnOpt(template charstring lco) := 
{ "L", lco };
 
@@ -326,5 +332,25 @@
sdp := *
}
 
+   function f_mgcp_find_param(MgcpMessage msg, MgcpInfoCode c

osmo-ttcn3-hacks[master]: bsc: Handle wildcard endpoint name in MGCP CRCX

2018-01-30 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: ggsn_tests: Add test case to validate packets forwarded vs d...

2018-01-30 Thread Harald Welte

Patch Set 4:

(3 comments)

https://gerrit.osmocom.org/#/c/6158/4/ggsn_tests/GGSN_Tests.ttcn
File ggsn_tests/GGSN_Tests.ttcn:

PS4, Line 751: ''O
in a receive template you normally assign a default value of ? or in this case 
maybe even *, to make sure unless something is specified, it will match all 
ICMPv4 echo reply packets, not just those with zero-length data section (like 
in your case).


PS4, Line 914: ''O
same as above


Line 1050:  [] GTPU.receive(tr_GTPU_GPDU(g_peer_u, ?)) -> 
value ud {
the generally mroe elegant solution would be to "stack" a translation port or 
dual-faced ports (I call them *_CodecPort.ttcn) on top of the GTPU port.  This 
port will simply do the encoding/decoding of the payload, so that you can 
directly match on the inner IP header rather than having to manually do this.

TTCN-3 also has some syntactic sugar called "decmatch" which allows you to 
achive what is written here in much less lines of code, but there's no need to 
change it now, this is just a notice in case you end up with this problem again.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib9c6043a6cd3b6622782ec7e7fcd2815101755ba
Gerrit-PatchSet: 4
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-HasComments: Yes


osmo-ttcn3-hacks[master]: ggsn_tests: Add test to validate if different pdp ctx can ta...

2018-01-30 Thread Harald Welte

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6205/1/ggsn_tests/GGSN_Tests.ttcn
File ggsn_tests/GGSN_Tests.ttcn:

Line 1071:  function f_wait_icmp4_echo_request(PdpContext ctx) runs on 
GT_CT {
rather than having these copy+pasted wait-for-... functions, one simple 
approach might be to have an template argument like "f_wait_icmp4(PdpContext 
ctx, template PDU_ICMP expected)"

So the caller would then call "f_wait_icmp4(pdp_ctx, tr_ICMPv4_EQ)" and you 
only have one of those functions for v4 and one for v6, rather than many of 
them that look more or less the same.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I67c04b056cc5c092d357abbb084b7665f59eaf3a
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


osmo-msc[master]: Remove unused code

2018-01-30 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


libosmo-abis[master]: cosmetic: update ipaccess_bts_handle_ccm()

2018-01-30 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] libosmo-abis[master]: cosmetic: update ipaccess_bts_handle_ccm()

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

Change subject: cosmetic: update ipaccess_bts_handle_ccm()
..


cosmetic: update ipaccess_bts_handle_ccm()

* mark internal function parameter as const
* log unit IDs

Change-Id: Ifcf8baf4bf5670efaa8689ca7386597fe2797bda
---
M src/input/ipaccess.c
1 file changed, 3 insertions(+), 2 deletions(-)

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



diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index acb2db0..5eee57e 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -571,7 +571,7 @@
 #define IPA_STRING_MAX 64
 
 static struct msgb *
-ipa_bts_id_resp(struct ipaccess_unit *dev, uint8_t *data, int len, int trx_nr)
+ipa_bts_id_resp(const struct ipaccess_unit *dev, uint8_t *data, int len, int 
trx_nr)
 {
struct msgb *nmsg;
char str[IPA_STRING_MAX];
@@ -704,7 +704,8 @@
if (link->ofd->priv_nr >= E1INP_SIGN_RSL)
trx_nr = link->ofd->priv_nr - E1INP_SIGN_RSL;
 
-   LOGP(DLINP, LOGL_NOTICE, "received ID get\n");
+   LOGP(DLINP, LOGL_NOTICE, "received ID get from 
%u/%u/%u\n",
+dev->site_id, dev->bts_id, dev->trx_id);
rmsg = ipa_bts_id_resp(dev, data + 1, len - 1, trx_nr);
ret = ipa_send(link->ofd->fd, rmsg->data, rmsg->len);
if (ret != rmsg->len) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifcf8baf4bf5670efaa8689ca7386597fe2797bda
Gerrit-PatchSet: 1
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Stefan Sperling 


osmo-ggsn[master]: ggsn.c: cb_tun_ind: log dst addr of packet without pdp ctx

2018-01-30 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ggsn[master]: ggsn.c: cb_tun_ind: Don't drop packets targeting pdp ctx ll ...

2018-01-30 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


libosmocore[master]: GSUP: add helper wrapper for setting IMSI

2018-01-30 Thread Harald Welte

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/6197/1/include/osmocom/gsm/gsup.h
File include/osmocom/gsm/gsup.h:

Line 118: #define OSMO_GSUP_COPY_IMSI(msg, _imsi) osmo_strlcpy((msg)->imsi, 
_imsi, GSM23003_IMSI_MAX_DIGITS + 2)
why not a sizeof((msg)->imsi)?  And why not actually a more generic helper that 
would work for any static array, unrelated to IMSIs or even unerlated to GSUP?  
something like OSMO_STRLCPY_ARRAY(array, source) which would automatically 
expand to an sizeof(array)?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I03d0d3d32a8d572ad573d03c603e14cdc27a3f7b
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


[MERGED] osmo-sgsn[master]: gtphub: check for gsn_addr_from_sockaddr() error

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

Change subject: gtphub: check for gsn_addr_from_sockaddr() error
..


gtphub: check for gsn_addr_from_sockaddr() error

Change-Id: I2d80b5a488e7daa0bc8f57ea304e0e1f10f6c1f5
Fixes: CID182472
---
M src/gprs/gtphub.c
1 file changed, 3 insertions(+), 1 deletion(-)

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



diff --git a/src/gprs/gtphub.c b/src/gprs/gtphub.c
index 2ff1b7c..4ee20cd 100644
--- a/src/gprs/gtphub.c
+++ b/src/gprs/gtphub.c
@@ -2649,7 +2649,9 @@
 {
struct gsn_addr gsna;
uint16_t port;
-   gsn_addr_from_sockaddr(&gsna, &port, addr);
+   if (gsn_addr_from_sockaddr(&gsna, &port, addr) != 0)
+   return NULL;
+
return gtphub_port_find(bind, &gsna, port);
 }
 

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

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


osmo-sgsn[master]: gtphub: check for gsn_addr_from_sockaddr() error

2018-01-30 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-msc[master]: Remove unused code

2018-01-30 Thread Max

Patch Set 2: Verified+1

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

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


[MERGED] osmo-msc[master]: Remove unused code

2018-01-30 Thread Max
Max has submitted this change and it was merged.

Change subject: Remove unused code
..


Remove unused code

The socket.* is unused leftover from pre-split time.

Fixes: CID57645
Change-Id: Ibf3b539fcbd7f311caa2291af23b8f18ebc6c2e0
---
M include/osmocom/msc/Makefile.am
D include/osmocom/msc/socket.h
M src/libcommon/Makefile.am
D src/libcommon/socket.c
4 files changed, 0 insertions(+), 127 deletions(-)

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



diff --git a/include/osmocom/msc/Makefile.am b/include/osmocom/msc/Makefile.am
index ec231d0..88305db 100644
--- a/include/osmocom/msc/Makefile.am
+++ b/include/osmocom/msc/Makefile.am
@@ -29,7 +29,6 @@
silent_call.h \
smpp.h \
sms_queue.h \
-   socket.h \
transaction.h \
ussd.h \
vlr.h \
diff --git a/include/osmocom/msc/socket.h b/include/osmocom/msc/socket.h
deleted file mode 100644
index 0fd85f1..000
--- a/include/osmocom/msc/socket.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _BSC_SOCKET_H
-#define _BSC_SOCKET_H
-
-#include 
-
-#ifndef IPPROTO_GRE
-#define IPPROTO_GRE 47
-#endif
-
-int make_sock(struct osmo_fd *bfd, int proto,
- uint32_t ip, uint16_t port, int priv_nr,
- int (*cb)(struct osmo_fd *fd, unsigned int what), void *data);
-
-#endif /* _BSC_SOCKET_H */
diff --git a/src/libcommon/Makefile.am b/src/libcommon/Makefile.am
index 8f70da7..30f37d4 100644
--- a/src/libcommon/Makefile.am
+++ b/src/libcommon/Makefile.am
@@ -26,7 +26,6 @@
gsm_data.c \
gsup_client.c \
oap_client.c \
-   socket.c \
talloc_ctx.c \
gsm_subscriber_base.c \
$(NULL)
diff --git a/src/libcommon/socket.c b/src/libcommon/socket.c
deleted file mode 100644
index 2793bcf..000
--- a/src/libcommon/socket.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* OpenBSC sokcet code, taken from Abis input driver for ip.access */
-
-/* (C) 2009 by Harald Welte 
- * (C) 2010 by Holger Hans Peter Freyther
- * (C) 2010 by On-Waves
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
- *
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-int make_sock(struct osmo_fd *bfd, int proto,
- uint32_t ip, uint16_t port, int priv_nr,
- int (*cb)(struct osmo_fd *fd, unsigned int what), void *data)
-{
-   struct sockaddr_in addr;
-   int ret, on = 1;
-   int type = SOCK_STREAM;
-
-   switch (proto) {
-   case IPPROTO_TCP:
-   type = SOCK_STREAM;
-   break;
-   case IPPROTO_UDP:
-   type = SOCK_DGRAM;
-   break;
-#ifdef IPPROTO_GRE
-   case IPPROTO_GRE:
-   type = SOCK_RAW;
-   break;
-#endif
-   default:
-   return -EINVAL;
-   }
-
-   bfd->fd = socket(AF_INET, type, proto);
-   bfd->cb = cb;
-   bfd->when = BSC_FD_READ;
-   bfd->data = data;
-   bfd->priv_nr = priv_nr;
-
-   if (bfd->fd < 0) {
-   LOGP(DLINP, LOGL_ERROR, "could not create socket.\n");
-   return -EIO;
-   }
-
-   memset(&addr, 0, sizeof(addr));
-   addr.sin_family = AF_INET;
-   addr.sin_port = htons(port);
-   if (ip != INADDR_ANY)
-   addr.sin_addr.s_addr = htonl(ip);
-   else
-   addr.sin_addr.s_addr = INADDR_ANY;
-
-   setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
-
-   ret = bind(bfd->fd, (struct sockaddr *) &addr, sizeof(addr));
-   if (ret < 0) {
-   LOGP(DLINP, LOGL_ERROR, "could not bind socket %s\n",
-   strerror(errno));
-   close(bfd->fd);
-   return -EIO;
-   }
-
-   if (proto == IPPROTO_TCP) {
-   ret = listen(bfd->fd, 1);
-   if (ret < 0) {
-   perror("listen");
-   close(bfd->fd);
-   return ret;
-   }
-   }
-
-   ret = osmo_fd_register(bfd);
-   if (ret < 0) {
-   perror("register_listen_fd");
-   close(bfd->fd);
-   return ret;
-   }
-   return 0;
-}

-- 
To view,

[PATCH] osmo-ggsn[master]: ggsn.c: cb_tun_ind: log dst addr of packet without pdp ctx

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

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

https://gerrit.osmocom.org/6201

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

ggsn.c: cb_tun_ind: log dst addr of packet without pdp ctx

Change-Id: Ib3a87ec2b2d0014376295028a648750fa3124485
---
M ggsn/ggsn.c
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/01/6201/2

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index c7f6376..fed8f73 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -725,6 +725,7 @@
struct iphdr *iph = (struct iphdr *)pack;
struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
struct ippool_t *pool;
+   char straddr[INET6_ADDRSTRLEN];
 
switch (iph->version) {
case 4:
@@ -755,7 +756,9 @@
DEBUGP(DTUN, "Received packet for APN(%s) from tun %s", apn->cfg.name, 
tun->devname);
 
if (ippool_getip(pool, &ipm, &dst)) {
-   DEBUGPC(DTUN, " with no PDP contex!!\n");
+   DEBUGPC(DTUN, " with no PDP contex! (%s)\n", iph->version == 4 ?
+   inet_ntop(AF_INET, &iph->saddr, straddr, 
sizeof(straddr)) :
+   inet_ntop(AF_INET6, &ip6h->ip6_src, straddr, 
sizeof(straddr)));
return 0;
}
DEBUGPC(DTUN, "\n");

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

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


[PATCH] osmo-ggsn[master]: ggsn.c: cb_tun_ind: Convert ifelse to switch statement

2018-01-30 Thread Pau Espin Pedrol
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/6200

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

ggsn.c: cb_tun_ind: Convert ifelse to switch statement

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


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/00/6200/2

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index de8090b..c7f6376 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -726,13 +726,15 @@
struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
struct ippool_t *pool;
 
-   if (iph->version == 4) {
+   switch (iph->version) {
+   case 4:
if (len < sizeof(*iph) || len < 4*iph->ihl)
return -1;
dst.len = 4;
dst.v4.s_addr = iph->daddr;
pool = apn->v4.pool;
-   } else if (iph->version == 6) {
+   break;
+   case 6:
/* Due to the fact that 3GPP requires an allocation of a
 * /64 prefix to each MS, we must instruct
 * ippool_getip() below to match only the leading /64
@@ -740,7 +742,8 @@
dst.len = 8;
dst.v6 = ip6h->ip6_dst;
pool = apn->v6.pool;
-   } else {
+   break;
+   default:
LOGP(DTUN, LOGL_NOTICE, "non-IPv%u packet received from tun\n", 
iph->version);
return -1;
}

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I4fc97f367ae615cdf0a9501f89419990c2fd4599
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder


[PATCH] osmo-ggsn[master]: ggsn.c: cb_tun_ind: Don't drop packets targeting pdp ctx ll ...

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

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

https://gerrit.osmocom.org/6202

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

ggsn.c: cb_tun_ind: Don't drop packets targeting pdp ctx ll addr

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


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/02/6202/2

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index fed8f73..caf6151 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -726,6 +726,7 @@
struct ip6_hdr *ip6h = (struct ip6_hdr *)pack;
struct ippool_t *pool;
char straddr[INET6_ADDRSTRLEN];
+   uint8_t pref_offset;
 
switch (iph->version) {
case 4:
@@ -739,9 +740,12 @@
/* Due to the fact that 3GPP requires an allocation of a
 * /64 prefix to each MS, we must instruct
 * ippool_getip() below to match only the leading /64
-* prefix, i.e. the first 8 bytes of the address */
+* prefix, i.e. the first 8 bytes of the address. If the ll addr
+* is used, then the match should be done on the trailing 64
+* bits. */
dst.len = 8;
-   dst.v6 = ip6h->ip6_dst;
+   pref_offset = IN6_IS_ADDR_LINKLOCAL(&ip6h->ip6_dst) ? 8 : 0;
+   memcpy(&dst.v6, ((uint8_t*)&ip6h->ip6_dst) + pref_offset, 8);
pool = apn->v6.pool;
break;
default:

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

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


osmo-bsc[master]: Make "waiting indicator" of IMMEDIATE ASSIGN REJECT dynamic.

2018-01-30 Thread Harald Welte

Patch Set 1:

(2 comments)

looks fine to me, besides having the value also listed in "show bts" so one can 
introspect the current value as a system administrator.

It would also make sense to expose the value by other means.  I myself haven't 
used the stasd exporter facilities in libosmocore, but exporting it as a 
"gauge" type sounds like the most logical way. From a quick glance it seems it 
supports the  gauge "|g" type by means of OSMO_STAT_ITEM_NO_UNIT.  The point 
here is that this is a value that you might want to plot on a per-bts basis 
over time.  Could be a follow-up patch.

https://gerrit.osmocom.org/#/c/6211/1/src/libbsc/abis_rsl.c
File src/libbsc/abis_rsl.c:

Line 1791:  /* Set all request references and wait indications to the same 
value.
it might make sense to state explicitly here that the spec requires entries to 
be duplicated if unused.  This is highly unusual and deserves special mention.


https://gerrit.osmocom.org/#/c/6211/1/src/libbsc/net_init.c
File src/libbsc/net_init.c:

Line 79:osmo_timer_setup(&net->t3122_chan_load_timer, 
update_t3122_chan_load_timer, net);
I think it might make sense to have each BTS have its own timer, rather than 
handling all BTSs at once.  Why? Becaus at large number of BTSs, we might 
introduce a load spike at one point in time which normally could be spred more 
evenly.   

But then, ignore that. The computation is not very expensive, so it most likely 
doesn't matter.  And on those systems where it matters (deeply embedded) we 
only have 1-2 BTS anyway.  Maybe add a comment here that if it ever becomes ac 
oncern, each BTS could be staggered.


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

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


osmo-bsc[master]: pcu_sock: reorganize calculation of paging group

2018-01-30 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iee8926d5bc017d912912916e4898e968bf4dd29b
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


osmo-bsc[master]: abis-rsl: Send imm.ass messages via PCH

2018-01-30 Thread Harald Welte

Patch Set 1:

let's clean it up and get merged.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I0a899d9c866ed09dc301694dbbcad304b1ed49e5
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: lynxis lazus 
Gerrit-HasComments: No


osmo-pcu[master]: Simplify TS alloc: split allocation

2018-01-30 Thread Harald Welte

Patch Set 12: Code-Review+2

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

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


osmo-pcu[master]: Simplify TS alloc: split off RX mask computation

2018-01-30 Thread Harald Welte

Patch Set 8: Code-Review+2

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

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


osmo-pcu[master]: Simplify TS alloc: move slot check into functions

2018-01-30 Thread Harald Welte

Patch Set 6: Code-Review+1

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

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


osmo-pcu[master]: Simplify TS alloc: move slot assignment

2018-01-30 Thread Harald Welte

Patch Set 10: Code-Review+2

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

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


osmo-pcu[master]: Simplify TS alloc: separate capacity computation

2018-01-30 Thread Harald Welte

Patch Set 6: Code-Review+2

(1 comment)

https://gerrit.osmocom.org/#/c/3934/6/src/gprs_rlcmac_ts_alloc.cpp
File src/gprs_rlcmac_ts_alloc.cpp:

Line 683:   }
unrelated cosmetic change, but not enough reason to send a separate patch now.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ifd88fc7ff818ea2a041eae61c5d457926a0df0f2
Gerrit-PatchSet: 6
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


osmo-pcu[master]: Simplify TS alloc: split USF/UL allocation

2018-01-30 Thread Harald Welte

Patch Set 7: Code-Review+2

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

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


osmo-pcu[master]: Simplify TS alloc: internalize TRX check

2018-01-30 Thread Harald Welte

Patch Set 20: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I02da2b8ba8c9c8815dae0e39e1fed277ca0df171
Gerrit-PatchSet: 20
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-pcu[master]: TS alloc: print suggested TRX on allocation errors

2018-01-30 Thread Harald Welte

Patch Set 7: Code-Review+2

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

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


osmo-pcu[master]: Simplify TS alloc: improve readability

2018-01-30 Thread Harald Welte

Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/4086/3/src/gprs_rlcmac_ts_alloc.cpp
File src/gprs_rlcmac_ts_alloc.cpp:

Line 651
I don't rally get you removing the debugging code.  I think holger has raised a 
question why it was not helpful or what is your concern herre, but there was - 
AFAIK - no response.  are you confident that you are not removing useful log 
output without having a functionally similarly complete replacement in your new 
code?


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I31600462e48d945bc8b7abf86a3718ac83e1dcbb
Gerrit-PatchSet: 3
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


osmo-pcu[master]: TS alloc: expand tests log

2018-01-30 Thread Harald Welte

Patch Set 20: Code-Review+2

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

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