gr-gsm[master]: README.md: Turn URLs into hyperlinks (video, mailing list)

2018-01-17 Thread Piotr Krysik

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Iacf7c4b13b0e32ea7761b859f7422ab630c8616f
Gerrit-PatchSet: 2
Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Piotr Krysik 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


gr-gsm[master]: README.md: Change mailing list address to osmocom.org

2018-01-17 Thread Piotr Krysik

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ie7b474138444f0ceea160f74df4b693030ea07a8
Gerrit-PatchSet: 2
Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Piotr Krysik 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[MERGED] gr-gsm[master]: README.md: Change mailing list address to osmocom.org

2018-01-17 Thread Piotr Krysik
Piotr Krysik has submitted this change and it was merged.

Change subject: README.md: Change mailing list address to osmocom.org
..


README.md: Change mailing list address to osmocom.org

Change-Id: Ie7b474138444f0ceea160f74df4b693030ea07a8
---
M README.md
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Piotr Krysik: Looks good to me, approved; Verified
  Harald Welte: Looks good to me, but someone else must approve



diff --git a/README.md b/README.md
index 86ca1e8..983873d 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@
 
 Current gr-gsm project's mailing list address is following:
 
-gr-...@googlegroups.com
+gr-...@lists.osmocom.org
 
 Mailing list is a place for general discussions, questions about the usage and 
installation. In case of problem with installation please try to provide full 
information that will help reproducing it. Minimum information should contain:
 - operating system with version,
@@ -20,9 +20,9 @@
 - version of gnuradio (it can be obtained with: gnuradio-companion --version)
 - error messages (in case of pybombs installation they can be obtained after 
switching it to verbous mode with -v option).
 
-To join the group with any e-mail addres (google account is not required) use 
this link:
+To join the group with any e-mail address, use this link:
 
-https://groups.google.com/forum/#!forum/gr-gsm/join
+https://lists.osmocom.org/mailman/listinfo/gr-gsm
 
 Development
 ===

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie7b474138444f0ceea160f74df4b693030ea07a8
Gerrit-PatchSet: 2
Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Piotr Krysik 
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] gr-gsm[master]: README.md: Turn URLs into hyperlinks (video, mailing list)

2018-01-17 Thread Piotr Krysik
Piotr Krysik has submitted this change and it was merged.

Change subject: README.md: Turn URLs into hyperlinks (video, mailing list)
..


README.md: Turn URLs into hyperlinks (video, mailing list)

Change-Id: Iacf7c4b13b0e32ea7761b859f7422ab630c8616f
---
M README.md
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Piotr Krysik: Looks good to me, approved; Verified
  Vadim Yanitskiy: Looks good to me, but someone else must approve



diff --git a/README.md b/README.md
index 983873d..b31b679 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@
 
 To join the group with any e-mail address, use this link:
 
-https://lists.osmocom.org/mailman/listinfo/gr-gsm
+
 
 Development
 ===
@@ -34,7 +34,7 @@
 ==
 Short presentation of *Airprobe*'like application of *gr-gsm*:
 
-https://www.youtube.com/watch?v=Eofnb7zr8QE
+
 
 Credits
 ===

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iacf7c4b13b0e32ea7761b859f7422ab630c8616f
Gerrit-PatchSet: 2
Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Piotr Krysik 
Gerrit-Reviewer: Vadim Yanitskiy 


gr-gsm[master]: Just a change to be discarded in gerrit

2018-01-17 Thread Piotr Krysik

Patch Set 1: Code-Review-2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice89f3757e9ef672e7b8910f19d5e9512f94ba04
Gerrit-PatchSet: 1
Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Krysik 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Piotr Krysik 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


gr-gsm[master]: I've got the "abandon" button, but the point of this patch w...

2018-01-17 Thread Piotr Krysik

Patch Set 1: Code-Review-2

This was a result of me clicking the "floow up" button instead of "reply". 
Rejecting it then :).

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ieb4ffab11837f6381e88f61e568e523609a34bca
Gerrit-PatchSet: 1
Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Krysik 
Gerrit-Reviewer: Piotr Krysik 
Gerrit-HasComments: No


gr-gsm[master]: Just a change to be discarded in gerrit

2018-01-17 Thread Vadim Yanitskiy

Patch Set 1:

> Patch Set 1: Code-Review-2

Feel free to 'Abandon' this change.
No need to keep it anymore ;)

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice89f3757e9ef672e7b8910f19d5e9512f94ba04
Gerrit-PatchSet: 1
Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Krysik 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Piotr Krysik 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


[ABANDON] gr-gsm[master]: Just a change to be discarded in gerrit

2018-01-17 Thread Piotr Krysik
Piotr Krysik has abandoned this change.

Change subject: Just a change to be discarded in gerrit
..


Abandoned

Rejected it, now lets abandon it :)

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: Ice89f3757e9ef672e7b8910f19d5e9512f94ba04
Gerrit-PatchSet: 1
Gerrit-Project: gr-gsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Krysik 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Piotr Krysik 
Gerrit-Reviewer: Vadim Yanitskiy 


[PATCH] libosmocore[master]: gsm0480: parse all SS info elements in a message

2018-01-17 Thread Vadim Yanitskiy
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/5839

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

gsm0480: parse all SS info elements in a message

Some SS messages (e.g. RELEASE COMPLETE) may contai multiple
IEs (Information Elements). Let's parse them all.

Change-Id: I20cc59c25fdbda176bcf76437174cda829518d60
---
M src/gsm/gsm0480.c
1 file changed, 10 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/39/5839/2

diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index e3856a5..0f30250 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -334,11 +334,15 @@
uint8_t iei;
uint8_t iei_length;
 
+   /* We need at least two bytes */
+   if (len < 2)
+   return 0;
+
iei = ss_ie[0];
iei_length = ss_ie[1];
 
/* If the data does not fit, report an error */
-   if (len - 2 < iei_length)
+   if (iei_length + 2 > len)
return 0;
 
switch (iei) {
@@ -356,6 +360,11 @@
break;
}
 
+   /* A message may contain multiple IEs */
+   if (iei_length + 2 + 2 < len)
+   rc &= parse_ss_info_elements(ss_ie + iei_length + 2,
+   len - iei_length - 2, req);
+
return rc;
 }
 

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I20cc59c25fdbda176bcf76437174cda829518d60
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Jenkins Builder


[PATCH] libosmocore[master]: tests/ussd: fix wrong GSM 04.80 payload length

2018-01-17 Thread Vadim Yanitskiy

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

tests/ussd: fix wrong GSM 04.80 payload length

Previously the same length value was used for both ussd_request
and interrogate_ss payloads, despite they are different.

Change-Id: I90ae7c51b75dcdb9d8ee042af23d127e6db8771d
---
M tests/ussd/ussd_test.c
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/41/5841/1

diff --git a/tests/ussd/ussd_test.c b/tests/ussd/ussd_test.c
index bf6d731..8d88dbb 100644
--- a/tests/ussd/ussd_test.c
+++ b/tests/ussd/ussd_test.c
@@ -120,24 +120,28 @@
 int main(int argc, char **argv)
 {
struct ss_request req;
-   const int size = sizeof(ussd_request);
+   uint16_t size;
int i;
struct msgb *msg;
 
osmo_init_logging(&info);
 
memset(&req, 0, sizeof(req));
-   gsm0480_decode_ss_request((struct gsm48_hdr *) ussd_request, size, 
&req);
+   gsm0480_decode_ss_request((struct gsm48_hdr *) ussd_request,
+   sizeof(ussd_request), &req);
printf("Tested if it still works. Text was: %s\n", req.ussd_text);
 
memset(&req, 0, sizeof(req));
-   gsm0480_decode_ss_request((struct gsm48_hdr *) interrogate_ss, size, 
&req);
+   gsm0480_decode_ss_request((struct gsm48_hdr *) interrogate_ss,
+   sizeof(interrogate_ss), &req);
OSMO_ASSERT(strlen((char *) req.ussd_text) == 0);
OSMO_ASSERT(req.ss_code == 33);
printf("interrogateSS CFU text..'%s' code %d\n", req.ussd_text, 
req.ss_code);
 
printf("Testing parsing a USSD request and truncated versions\n");
 
+   size = sizeof(ussd_request);
+
for (i = size; i > sizeof(struct gsm48_hdr); --i) {
int rc = parse_ussd(&ussd_request[0], i);
printf("Result for len=%d is %d\n", i, rc);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I90ae7c51b75dcdb9d8ee042af23d127e6db8771d
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 


osmo-bts[master]: Remove 11-bit RACH support from 'Known Limitations'

2018-01-17 Thread Max

Patch Set 1: Code-Review-1

> the build is failing

I wasn't referring to compilation. Have you tried to run it with actual phone 
and verified that 11-bit RACH was used? The ticket referred to in README is 
still open. I'd be surprised if adding support to libosmocore would mean that 
it'll be automatically used in osmo-bts.

So if you indeed tested, please share your configs and test setup details in 
OS#1854. We should first close the ticket and than remove it from readme.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I091f4fbd52c29c7d56ca392b8a1b872609829d81
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Alexander Huemer 
Gerrit-Reviewer: Alexander Huemer 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


osmo-bts[master]: Fix test dependencies

2018-01-17 Thread Max

Patch Set 9:

> this alone does not work

Yes, just like --with-litecell15 won't enable LC15 support.

> no longer works on its own?

It does, if headers are placed in default include directory (/usr/include). 
Which is exactly the same behavior as with LC15.

I think we should minimize the difference between BTS variants when it comes to 
./configure

> insist on sane configure option semantics

I think that the proposed change is way more sane: having different semantics 
for similar BTS models is worse than adjusting build once.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I94ea8bad8b410550f72ee6a0408f42f6bd8b6cac
Gerrit-PatchSet: 9
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


osmo-bts[master]: Move sysmobts-calib into osmo-bts-sysmo

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-bts[master]: Move sysmobts-calib into osmo-bts-sysmo

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

Change subject: Move sysmobts-calib into osmo-bts-sysmo
..


Move sysmobts-calib into osmo-bts-sysmo

It's prerequisite for jenkins tests fix after migration to stow. The
sysmobts-calib uses hand-coded Makefile instead of automake which makes
it hard to properly propagate build flags. Also, make it optional to
enable excluding it from certain jenkins tests.

Change-Id: I3b54bfa5ef1d89092f6cf13dc27de10874b31b18
---
M .gitignore
M Makefile.am
M configure.ac
M contrib/jenkins_sysmobts.sh
D contrib/sysmobts-calib/Makefile
M src/osmo-bts-sysmo/Makefile.am
R src/osmo-bts-sysmo/misc/sysmobts-calib.c
R src/osmo-bts-sysmo/misc/sysmobts-layer1.c
R src/osmo-bts-sysmo/misc/sysmobts-layer1.h
9 files changed, 20 insertions(+), 19 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve; Verified
  Neels Hofmeyr: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/.gitignore b/.gitignore
index 2e8c884..1780e1c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,8 +22,7 @@
 core
 core.*
 
-contrib/sysmobts-calib/sysmobts-calib
-
+src/osmo-bts-sysmo/sysmobts-calib
 src/osmo-bts-sysmo/l1fwd-proxy
 src/osmo-bts-sysmo/osmo-bts-sysmo
 src/osmo-bts-sysmo/osmo-bts-sysmo-remote
diff --git a/Makefile.am b/Makefile.am
index 4832c84..dc42574 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -7,10 +7,6 @@
 EXTRA_DIST = \
contrib/dump_docs.py contrib/screenrc-l1fwd 
contrib/osmo-bts-sysmo.service \
contrib/l1fwd.init contrib/screenrc-sysmobts contrib/respawn.sh \
-   contrib/sysmobts.init contrib/sysmobts-calib/Makefile \
-   contrib/sysmobts-calib/sysmobts-calib.c \
-   contrib/sysmobts-calib/sysmobts-layer1.c \
-   contrib/sysmobts-calib/sysmobts-layer1.h \
doc/examples/sysmo/osmo-bts.cfg \
doc/examples/sysmo/sysmobts-mgr.cfg \
doc/examples/virtual/openbsc-virtual.cfg \
diff --git a/configure.ac b/configure.ac
index 89443d0..2181743 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,6 +54,14 @@
 PKG_CHECK_MODULES(LIBOSMOCODING, libosmocoding >= 0.10.0)
 PKG_CHECK_MODULES(ORTP, ortp)
 
+AC_MSG_CHECKING([whether to enable support for sysmobts calibration tool])
+AC_ARG_ENABLE(sysmobts-calib,
+   AC_HELP_STRING([--enable-sysmobts-calib],
+   [enable code for sysmobts calibration tool 
[default=no]]),
+   [enable_sysmobts_calib="yes"],[enable_sysmobts_calib="no"])
+AC_MSG_RESULT([$enable_sysmobts_calib])
+AM_CONDITIONAL(ENABLE_SYSMOBTS_CALIB, test "x$enable_sysmobts_calib" = "xyes")
+
 AC_MSG_CHECKING([whether to enable support for sysmoBTS L1/PHY support])
 AC_ARG_ENABLE(sysmocom-bts,
AC_HELP_STRING([--enable-sysmocom-bts],
diff --git a/contrib/jenkins_sysmobts.sh b/contrib/jenkins_sysmobts.sh
index faeb7c9..852542b 100755
--- a/contrib/jenkins_sysmobts.sh
+++ b/contrib/jenkins_sysmobts.sh
@@ -18,11 +18,11 @@
 
 configure_flags="--enable-sysmocom-bts"
 
-build_bts "osmo-bts-sysmo" "$configure_flags"
-
 # This will not work for the femtobts
 if [ $FIRMWARE_VERSION != "femtobts_v2.7" ]; then
-  $MAKE -C contrib/sysmobts-calib
+configure_flags="$configure_flags --enable-sysmobts-calib"
 fi
 
+build_bts "osmo-bts-sysmo" "$configure_flags"
+
 osmo-clean-workspace.sh
diff --git a/contrib/sysmobts-calib/Makefile b/contrib/sysmobts-calib/Makefile
deleted file mode 100644
index a5d4b99..000
--- a/contrib/sysmobts-calib/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-CFLAGS=`pkg-config --cflags libosmocore` -Wall -Werror
-LIBS=`pkg-config --libs libosmocore libosmogsm`
-
-all: sysmobts-calib
-
-sysmobts-calib: sysmobts-calib.o sysmobts-layer1.o
-   $(CC) $(CPPFLAGS) $(LDFLAGS) -o $@ $^ -lrt $(LIBS)
-
-clean:
-   @rm -f sysmobts-calib *.o
diff --git a/src/osmo-bts-sysmo/Makefile.am b/src/osmo-bts-sysmo/Makefile.am
index c48b77c..6e917e7 100644
--- a/src/osmo-bts-sysmo/Makefile.am
+++ b/src/osmo-bts-sysmo/Makefile.am
@@ -4,6 +4,7 @@
 
 EXTRA_DIST = misc/sysmobts_mgr.h misc/sysmobts_misc.h misc/sysmobts_par.h \
misc/sysmobts_eeprom.h misc/sysmobts_nl.h femtobts.h hw_misc.h \
+   misc/sysmobts-layer1.h \
l1_fwd.h l1_if.h l1_transp.h eeprom.h utils.h oml_router.h
 
 bin_PROGRAMS = osmo-bts-sysmo osmo-bts-sysmo-remote l1fwd-proxy sysmobts-mgr 
sysmobts-util
@@ -20,6 +21,13 @@
 l1fwd_proxy_SOURCES = l1_fwd_main.c l1_transp_hw.c
 l1fwd_proxy_LDADD = $(top_builddir)/src/common/libbts.a $(COMMON_LDADD)
 
+if ENABLE_SYSMOBTS_CALIB
+bin_PROGRAMS = sysmobts-calib
+
+sysmobts_calib_SOURCES = misc/sysmobts-calib.c misc/sysmobts-layer1.c
+sysmobts_calib_LDADD = -lrt $(COMMON_LDADD)
+endif
+
 sysmobts_mgr_SOURCES = \
misc/sysmobts_mgr.c misc/sysmobts_misc.c \
misc/sysmobts_par.c misc/sysmobts_nl.c \
diff --git a/contrib/sysmobts-calib/sysmobts-calib.c 
b/src/osmo-bts-sysmo/misc/sysmobts-calib.c

libosmocore[master]: fsm: fix double llist_del in osmo_fsm_inst_term()

2018-01-17 Thread Harald Welte

Patch Set 1:

llist_del Form an empty list is a safe Operation. So is tzhis a purely cosmetic 
fix orcdid you See any real world issue?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I4b33d508c8a11b72fbf30125088a882894d9e6ac
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmocore[master]: fsm: add function osmo_fsm_inst_set_parent()

2018-01-17 Thread Harald Welte

Patch Set 1:

Lets cxall it change patent, not set

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6d18cbd4ada903cf3720b3ad2a89fc643085beef
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmocore[master]: Log lapd_datalink state on errors

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-bts[master]: Enable optional static builds

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ggsn[master]: Add GTP message names

2018-01-17 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I65eb80db4bcdc6da4d267bef3b907d3f98942a2e
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] libosmocore[master]: Log lapd_datalink state on errors

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

Change subject: Log lapd_datalink state on errors
..


Log lapd_datalink state on errors

It's not very useful to get just the raw pointer address in case of
lapd_datalink receive error. Log it's state in addition.

Change-Id: Ie8c5df262312f886f509113f2707e36811df3bd5
---
M src/gsm/lapd_core.c
1 file changed, 5 insertions(+), 5 deletions(-)

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



diff --git a/src/gsm/lapd_core.c b/src/gsm/lapd_core.c
index 5d87154..a2ff230 100644
--- a/src/gsm/lapd_core.c
+++ b/src/gsm/lapd_core.c
@@ -1505,7 +1505,7 @@
/* G.2.2 Wrong value of the C/R bit */
if (lctx->cr == dl->cr.rem2loc.resp) {
LOGP(DLLAPD, LOGL_ERROR,
-"I frame response not allowed (dl=%p)\n", dl);
+"I frame response not allowed (dl=%p state %s)\n", dl, 
lapd_state_name(dl->state));
msgb_free(msg);
mdl_error(MDL_CAUSE_FRM_UNIMPL, lctx);
return -EINVAL;
@@ -1517,7 +1517,7 @@
 * primitive with cause "I frame with incorrect length"
 * is sent to the mobile management entity. */
LOGP(DLLAPD, LOGL_ERROR,
-"I frame length not allowed (dl=%p)\n", dl);
+"I frame length not allowed (dl=%p state %s)\n", dl, 
lapd_state_name(dl->state));
msgb_free(msg);
mdl_error(MDL_CAUSE_IFRM_INC_LEN, lctx);
return -EIO;
@@ -1529,7 +1529,7 @@
 * mobile management entity. */
if (lctx->more && length < lctx->n201) {
LOGP(DLLAPD, LOGL_ERROR,
-"I frame with M bit too short (dl=%p)\n", dl);
+"I frame with M bit too short (dl=%p state %s)\n", dl, 
lapd_state_name(dl->state));
msgb_free(msg);
mdl_error(MDL_CAUSE_IFRM_INC_MBITS, lctx);
return -EIO;
@@ -1545,7 +1545,7 @@
case LAPD_STATE_SABM_SENT:
case LAPD_STATE_DISC_SENT:
LOGP(DLLAPD, LOGL_NOTICE,
-"I frame ignored in this state (dl=%p)\n", dl);
+"I frame ignored in state %s (dl=%p)\n", 
lapd_state_name(dl->state), dl);
msgb_free(msg);
return 0;
}
@@ -1553,7 +1553,7 @@
/* 5.7.1: N(s) sequence error */
if (ns != dl->v_recv) {
LOGP(DLLAPD, LOGL_NOTICE, "N(S) sequence error: N(S)=%u, "
-"V(R)=%u (dl=%p)\n", ns, dl->v_recv, dl);
+"V(R)=%u (dl=%p state %s)\n", ns, dl->v_recv, dl, 
lapd_state_name(dl->state));
/* discard data */
msgb_free(msg);
if (dl->seq_err_cond != 1) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie8c5df262312f886f509113f2707e36811df3bd5
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[MERGED] osmo-ggsn[master]: Add GTP message names

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

Change subject: Add GTP message names
..


Add GTP message names

Change-Id: I65eb80db4bcdc6da4d267bef3b907d3f98942a2e
---
M gtp/gtp.c
M gtp/gtp.h
2 files changed, 51 insertions(+), 0 deletions(-)

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



diff --git a/gtp/gtp.c b/gtp/gtp.c
index b36e0c6..0d6d896 100644
--- a/gtp/gtp.c
+++ b/gtp/gtp.c
@@ -86,6 +86,51 @@
return VERSION;
 }
 
+const struct value_string gtp_type_names[] = {
+   { GTP_ECHO_REQ,"Echo Request" },
+   { GTP_ECHO_RSP,"Echo Response" },
+   { GTP_NOT_SUPPORTED,   "Version Not Supported" },
+   { GTP_ALIVE_REQ,   "Node Alive Request" },
+   { GTP_ALIVE_RSP,   "Node Alive Response" },
+   { GTP_REDIR_REQ,   "Redirection Request" },
+   { GTP_REDIR_RSP,   "Redirection Response" },
+   { GTP_CREATE_PDP_REQ,  "Create PDP Context Request" },
+   { GTP_CREATE_PDP_RSP,  "Create PDP Context Response" },
+   { GTP_UPDATE_PDP_REQ,  "Update PDP Context Request" },
+   { GTP_UPDATE_PDP_RSP,  "Update PDP Context Response" },
+   { GTP_DELETE_PDP_REQ,  "Delete PDP Context Request" },
+   { GTP_DELETE_PDP_RSP,  "Delete PDP Context Response" },
+   { GTP_ERROR,   "Error Indication" },
+   { GTP_PDU_NOT_REQ, "PDU Notification Request" },
+   { GTP_PDU_NOT_RSP, "PDU Notification Response" },
+   { GTP_PDU_NOT_REJ_REQ, "PDU Notification Reject Request" },
+   { GTP_PDU_NOT_REJ_RSP, "PDU Notification Reject Response" },
+   { GTP_SUPP_EXT_HEADER, "Supported Extension Headers Notification" },
+   { GTP_SND_ROUTE_REQ,   "Send Routeing Information for GPRS Request" },
+   { GTP_SND_ROUTE_RSP,   "Send Routeing Information for GPRS Response" },
+   { GTP_FAILURE_REQ, "Failure Report Request" },
+   { GTP_FAILURE_RSP, "Failure Report Response" },
+   { GTP_MS_PRESENT_REQ,  "Note MS GPRS Present Request" },
+   { GTP_MS_PRESENT_RSP,  "Note MS GPRS Present Response" },
+   { GTP_IDEN_REQ,"Identification Request" },
+   { GTP_IDEN_RSP,"Identification Response" },
+   { GTP_SGSN_CONTEXT_REQ,"SGSN Context Request" },
+   { GTP_SGSN_CONTEXT_RSP,"SGSN Context Response" },
+   { GTP_SGSN_CONTEXT_ACK,"SGSN Context Acknowledge" },
+   { GTP_FWD_RELOC_REQ,   "Forward Relocation Request" },
+   { GTP_FWD_RELOC_RSP,   "Forward Relocation Response" },
+   { GTP_FWD_RELOC_COMPL, "Forward Relocation Complete" },
+   { GTP_RELOC_CANCEL_REQ,"Relocation Cancel Request" },
+   { GTP_RELOC_CANCEL_RSP,"Relocation Cancel Response" },
+   { GTP_FWD_SRNS,"Forward SRNS Context" },
+   { GTP_FWD_RELOC_ACK,   "Forward Relocation Complete Acknowledge" },
+   { GTP_FWD_SRNS_ACK,"Forward SRNS Context Acknowledge" },
+   { GTP_DATA_TRAN_REQ,   "Data Record Transfer Request" },
+   { GTP_DATA_TRAN_RSP,   "Data Record Transfer Response" },
+   { GTP_GPDU,"G-PDU" },
+   { 0, NULL }
+};
+
 /* gtp_new */
 /* gtp_free */
 
diff --git a/gtp/gtp.h b/gtp/gtp.h
index d189ded..8f8e293 100644
--- a/gtp/gtp.h
+++ b/gtp/gtp.h
@@ -12,6 +12,8 @@
 #ifndef _GTP_H
 #define _GTP_H
 
+#include 
+
 #define GTP_MODE_GGSN 1
 #define GTP_MODE_SGSN 2
 
@@ -85,6 +87,10 @@
 /* 242-254 For future use. */
 #define GTP_GPDU255/* G-PDU */
 
+extern const struct value_string gtp_type_names[];
+static inline const char *gtp_type_name(uint8_t val)
+{ return get_value_string(gtp_type_names, val); }
+
 /* GTP information element cause codes from 29.060 v3.9.0 7.7 */
 /**/
 #define GTPCAUSE_REQ_IMSI   0  /* Request IMSI */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I65eb80db4bcdc6da4d267bef3b907d3f98942a2e
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


osmo-bts[master]: Fix test dependencies

2018-01-17 Thread Harald Welte

Patch Set 9:

I leave it up to neels. We shouldn't break existing semantics

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I94ea8bad8b410550f72ee6a0408f42f6bd8b6cac
Gerrit-PatchSet: 9
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: neels 
Gerrit-HasComments: No


osmo-bsc[master]: Split paging cases in bssmap_handle_paging() off into helper...

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

Very nice

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

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


osmo-trx[master]: tests: convolve: Disable due to difference in output in diff...

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2320309bc8c1c20e2de6ef2e0f17472c68de80cb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: ttsou 
Gerrit-HasComments: No


[MERGED] osmo-trx[master]: tests: convolve: Disable due to difference in output in diff...

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

Change subject: tests: convolve: Disable due to difference in output in 
different archs
..


tests: convolve: Disable due to difference in output in different archs

Let's disable this test in order to have passing jenkins jobs until we
find a better way to properly test this for different architectures.

Change-Id: I2320309bc8c1c20e2de6ef2e0f17472c68de80cb
---
M tests/testsuite.at
1 file changed, 2 insertions(+), 2 deletions(-)

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

Objections:
  Alexander Chemeris: I would prefer this is not merged as is



diff --git a/tests/testsuite.at b/tests/testsuite.at
index ca979e5..f84225e 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -46,8 +46,8 @@
 
 AT_SETUP([convolve_test])
 AT_KEYWORDS([convolve_test])
-# Disabled for ARM builds as it gives different output than x86, see  OS#2826
-AT_SKIP_IF(! uname -m | grep x86)
+# Different results for i686, x86_64 and ARM. see  OS#2826, OS#2828, and 
https://lists.osmocom.org/pipermail/openbsc/2018-January/011655.html
+AT_SKIP_IF(true)
 cat $abs_srcdir/Transceiver52M/convolve_test.ok > expout
 AT_CHECK([$abs_top_builddir/tests/Transceiver52M/convolve_test], [], [expout], 
[])
 AT_CLEANUP

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2320309bc8c1c20e2de6ef2e0f17472c68de80cb
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: ttsou 


osmo-bsc[master]: handover_decision: log HO causes more accurately

2018-01-17 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib0a0787ac8b877ac63455d72886389b546e7a337
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


[MERGED] osmo-bsc[master]: handover_decision: log HO causes more accurately

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

Change subject: handover_decision: log HO causes more accurately
..


handover_decision: log HO causes more accurately

Tweaked-by: nhofm...@sysmocom.de
Change-Id: Ib0a0787ac8b877ac63455d72886389b546e7a337
---
M src/libbsc/handover_decision.c
1 file changed, 15 insertions(+), 5 deletions(-)

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



diff --git a/src/libbsc/handover_decision.c b/src/libbsc/handover_decision.c
index c637e25..3bca05f 100644
--- a/src/libbsc/handover_decision.c
+++ b/src/libbsc/handover_decision.c
@@ -230,7 +230,7 @@
rc = handover_to_arfcn_bsic(mr->lchan, best_cell->arfcn, 
best_cell->bsic);
switch (rc) {
case 0:
-   LOGPC(DHO, LOGL_INFO, "Starting handover\n");
+   LOGPC(DHO, LOGL_INFO, "Starting handover: meas report number %d 
\n", mr->nr);
break;
case -ENOSPC:
LOGPC(DHO, LOGL_INFO, "No channel available\n");
@@ -278,20 +278,30 @@
 
/* Interference HO */
if (rxlev2dbm(av_rxlev) > -85 &&
-   meas_rep_n_out_of_m_be(mr->lchan, dqual, 3, 4, 5))
+   meas_rep_n_out_of_m_be(mr->lchan, dqual, 3, 4, 5)) {
+   LOGPC(DHO, LOGL_INFO, "HO cause: Interference HO av_rxlev=%d 
dBm\n",
+ rxlev2dbm(av_rxlev));
return attempt_handover(mr);
+   }
 
/* Bad Quality */
-   if (meas_rep_n_out_of_m_be(mr->lchan, dqual, 3, 4, 5))
+   if (meas_rep_n_out_of_m_be(mr->lchan, dqual, 3, 4, 5)) {
+   LOGPC(DHO, LOGL_INFO, "HO cause: Bad Quality av_rxlev=%d 
dBm\n", rxlev2dbm(av_rxlev));
return attempt_handover(mr);
+   }
 
/* Low Level */
-   if (rxlev2dbm(av_rxlev) <= -110)
+   if (rxlev2dbm(av_rxlev) <= -110) {
+   LOGPC(DHO, LOGL_INFO, "HO cause: Low Level av_rxlev=%d dBm\n", 
rxlev2dbm(av_rxlev));
return attempt_handover(mr);
+   }
 
/* Distance */
-   if (mr->ms_l1.ta > net->handover.max_distance)
+   if (mr->ms_l1.ta > net->handover.max_distance) {
+   LOGPC(DHO, LOGL_INFO, "HO cause: Distance av_rxlev=%d dBm 
ta=%u\n",
+ rxlev2dbm(av_rxlev), mr->ms_l1.ta);
return attempt_handover(mr);
+   }
 
/* Power Budget AKA Better Cell */
if ((mr->nr % net->handover.pwr_interval) == net->handover.pwr_interval 
- 1)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0a0787ac8b877ac63455d72886389b546e7a337
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-bsc[master]: handover_decision: Fix condition for power budget handover a...

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

Change subject: handover_decision: Fix condition for power budget handover 
attempt
..


handover_decision: Fix condition for power budget handover attempt

Handover attempt for power budget case should be performed every N SACCH frames,
where N = Power Budget Interval.
First measurement report with mr->nr = 0 was used for the first handover attempt
in this case, which is not correct, because first usable report should have
mr->nr = net->handover.pwr_interval-1.
Moreover using the first measurement report with mr->nr = 0 for handover attempt
could lead to unnecessary handover, because usually av_rxlev for first 
measurement report
from MS is worse than for following reports.

Change-Id: If7f54a4cb179eaa9e5eb147b9477633ac618e69e
---
M src/libbsc/handover_decision.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/libbsc/handover_decision.c b/src/libbsc/handover_decision.c
index 09c7eaa..c637e25 100644
--- a/src/libbsc/handover_decision.c
+++ b/src/libbsc/handover_decision.c
@@ -294,7 +294,7 @@
return attempt_handover(mr);
 
/* Power Budget AKA Better Cell */
-   if ((mr->nr % net->handover.pwr_interval) == 0)
+   if ((mr->nr % net->handover.pwr_interval) == net->handover.pwr_interval 
- 1)
return attempt_handover(mr);
 
return 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If7f54a4cb179eaa9e5eb147b9477633ac618e69e
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: logging: add ability to log the log-level with API and vty

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


libosmocore[master]: logging: color the log level

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-bsc[master]: Split paging cases in bssmap_handle_paging() off into helper...

2018-01-17 Thread Stefan Sperling
Stefan Sperling has submitted this change and it was merged.

Change subject: Split paging cases in bssmap_handle_paging() off into helper 
functions.
..


Split paging cases in bssmap_handle_paging() off into helper functions.

This is mostly no-op code refactoring which makes it easier to maintain the
code for each paging case and reduces the scope of several local variables.

Also, ensure that paging failures where no matching BTS was found are logged
consistently in all cases. The log level changes from ERROR to NOTICE since
this is not necessarily a fatal condition.

Change-Id: If8fdf425145791f4904a70e295bdc3c7d0f4d5f6
---
M src/osmo-bsc/osmo_bsc_bssap.c
1 file changed, 186 insertions(+), 130 deletions(-)

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



diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 1894561..799cb46 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -273,6 +273,179 @@
return gsm48_decode_lai(&lai, mcc, mnc, lac) != 0 ? -1 : 0;
 }
 
+static void
+page_all_bts(struct bsc_msc_data *msc, uint32_t tmsi, const char *mi_string, 
uint8_t chan_needed)
+{
+   struct gsm_bts *bts;
+   llist_for_each_entry(bts, &msc->network->bts_list, list) {
+   /* ignore errors from page_subscriber(); try all BTS */
+   page_subscriber(msc, bts, tmsi, GSM_LAC_RESERVED_ALL_BTS, 
mi_string, chan_needed);
+   }
+}
+
+static void
+page_cgi(struct bsc_msc_data *msc, const uint8_t *data, uint8_t data_length, 
size_t remain,
+uint32_t tmsi, const char *mi_string, uint8_t chan_needed)
+{
+   uint16_t ci;
+   int i = 0;
+   while (remain >= sizeof(struct gsm48_loc_area_id) + sizeof(ci)) {
+   uint16_t mcc, mnc, lac, *ci_be;
+   size_t lai_offset = 1 + i * (sizeof(struct gsm48_loc_area_id) + 
sizeof(ci));
+   if (decode_lai(&data[lai_offset], &mcc, &mnc, &lac) != 0) {
+   LOGP(DMSC, LOGL_ERROR, "Paging IMSI %s: Invalid LAI in 
Cell Identifier List "
+"for BSS (0x%x), paging entire BSS anyway (%s)\n",
+mi_string, CELL_IDENT_BSS, osmo_hexdump(data, 
data_length));
+   page_all_bts(msc, tmsi, mi_string, chan_needed);
+   return;
+   }
+   ci_be = (uint16_t *)(&data[lai_offset + sizeof(struct 
gsm48_loc_area_id)]);
+   ci = osmo_load16be(ci_be);
+   if (mcc == msc->network->country_code && mnc == 
msc->network->network_code) {
+   int paged = 0;
+   struct gsm_bts *bts;
+   llist_for_each_entry(bts, &msc->network->bts_list, 
list) {
+   if (bts->location_area_code != lac)
+   continue;
+   if (bts->cell_identity != ci)
+   continue;
+   /* ignore errors from page_subscriber(); keep 
trying other BTS */
+   page_subscriber(msc, bts, tmsi, lac, mi_string, 
chan_needed);
+   paged = 1;
+   }
+   if (!paged) {
+   LOGP(DMSC, LOGL_NOTICE, "Paging IMSI %s: BTS 
with LAC %d and CI %d not found\n",
+mi_string, lac, ci);
+   }
+   } else {
+   LOGP(DMSC, LOGL_DEBUG, "Paging IMSI %s: MCC/MNC in Cell 
Identifier List "
+"(%d/%d) do not match our network (%d/%d)\n", 
mi_string, mcc, mnc,
+msc->network->country_code, 
msc->network->network_code);
+   }
+   remain -= sizeof(struct gsm48_loc_area_id) + sizeof(ci);
+   i++;
+   }
+}
+
+static void
+page_lac_and_ci(struct bsc_msc_data *msc, const uint8_t *data, size_t remain,
+uint32_t tmsi, const char *mi_string, uint8_t chan_needed)
+{
+   uint16_t *lacp_be, *ci_be;
+   lacp_be = (uint16_t *)(&data[1]);
+   ci_be = (uint16_t *)(&data[3]);
+   while (remain >= sizeof(*lacp_be) + sizeof(*ci_be)) {
+   uint16_t lac = osmo_load16be(lacp_be);
+   uint16_t ci = osmo_load16be(ci_be);
+   int paged = 0;
+   struct gsm_bts *bts;
+   llist_for_each_entry(bts, &msc->network->bts_list, list) {
+   if (bts->location_area_code != lac)
+   continue;
+   if (bts->cell_identity != ci)
+   continue;
+   /* ignore errors from page_subscriber(); keep trying 
other BTS */
+   page_subscriber(msc, bts, tmsi, lac, mi_string, 
chan_needed);
+   

libosmocore[master]: gsm0480: skip length check for 'RELEASE COMPLETE' message

2018-01-17 Thread Harald Welte

Patch Set 8: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I63b7f8ce403169a9dbdbdb031db16693de2196d6
Gerrit-PatchSet: 8
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


libosmocore[master]: gsm0480: fix USSD OCTET STRING length confusion

2018-01-17 Thread Harald Welte

Patch Set 6: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6dead74f9ecea079752ff2400cdaf7c30187784e
Gerrit-PatchSet: 6
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


libosmocore[master]: gsm0480: clean up the parse_process_uss_req() code

2018-01-17 Thread Harald Welte

Patch Set 9: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88
Gerrit-PatchSet: 9
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmocore[master]: gsm0480: handle GSM0480_CTYPE_RETURN_RESULT

2018-01-17 Thread Harald Welte

Patch Set 9: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf
Gerrit-PatchSet: 9
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F

2018-01-17 Thread Harald Welte

Patch Set 9: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
Gerrit-PatchSet: 9
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


libosmocore[master]: gsm0480: add specification reference to SS message type

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


libosmocore[master]: gsm0480: move SS request length check to parse_ss()

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


libosmocore[master]: gsm0480: pass exact GSM 04.80 payload length to parse_ss()

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


libosmocore[master]: gsm0480: correct parse_ss_info_elements() declaration

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


libosmocore[master]: gsm0480: refactor gsm0480_decode_ss_request

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


libosmocore[master]: gsm0480: parse all SS info elements in a message

2018-01-17 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] libosmocore[master]: gsm0480: parse optional IEs for RELEASE COMPLETE message

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

Change subject: gsm0480: parse optional IEs for RELEASE COMPLETE message
..


gsm0480: parse optional IEs for RELEASE COMPLETE message

According to GSM 04.80 section 2.5 "Release complete", a message
of the mentioned type may contain optional IEs, such as Cause
and Facility. Let's parse them.

Change-Id: Ib8fc1f6bae472b0b264b6158f372b6cce255b222
---
M src/gsm/gsm0480.c
1 file changed, 5 insertions(+), 1 deletion(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 0f30250..0072812 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -295,7 +295,11 @@
switch (msg_type) {
case GSM0480_MTYPE_RELEASE_COMPLETE:
LOGP(0, LOGL_DEBUG, "SS Release Complete\n");
-   /* could also parse out the optional Cause/Facility data */
+
+   /* Parse optional Cause and/or Facility data */
+   if (len >= 2)
+   rc &= parse_ss_info_elements(&hdr->data[0], len, req);
+
req->ussd_text[0] = 0xFF;
break;
case GSM0480_MTYPE_REGISTER:

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

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


[MERGED] libosmocore[master]: gsm0480: parse all SS info elements in a message

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

Change subject: gsm0480: parse all SS info elements in a message
..


gsm0480: parse all SS info elements in a message

Some SS messages (e.g. RELEASE COMPLETE) may contai multiple
IEs (Information Elements). Let's parse them all.

Change-Id: I20cc59c25fdbda176bcf76437174cda829518d60
---
M src/gsm/gsm0480.c
1 file changed, 10 insertions(+), 1 deletion(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index e3856a5..0f30250 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -334,11 +334,15 @@
uint8_t iei;
uint8_t iei_length;
 
+   /* We need at least two bytes */
+   if (len < 2)
+   return 0;
+
iei = ss_ie[0];
iei_length = ss_ie[1];
 
/* If the data does not fit, report an error */
-   if (len - 2 < iei_length)
+   if (iei_length + 2 > len)
return 0;
 
switch (iei) {
@@ -356,6 +360,11 @@
break;
}
 
+   /* A message may contain multiple IEs */
+   if (iei_length + 2 + 2 < len)
+   rc &= parse_ss_info_elements(ss_ie + iei_length + 2,
+   len - iei_length - 2, req);
+
return rc;
 }
 

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

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


libosmocore[master]: tests/ussd: fix wrong GSM 04.80 payload length

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] libosmocore[master]: gsm0480: add specification reference to SS message type

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

Change subject: gsm0480: add specification reference to SS message type
..


gsm0480: add specification reference to SS message type

Change-Id: Iff0210e995053e270939a774db33f55b22545204
---
M src/gsm/gsm0480.c
1 file changed, 1 insertion(+), 0 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 328a8c0..8319b19 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -285,6 +285,7 @@
int rc = 1;
uint8_t msg_type = hdr->msg_type & 0x3F;  /* message-type - section 3.4 
*/
 
+   /* Table 2.1: Messages for call independent SS control */
switch (msg_type) {
case GSM0480_MTYPE_RELEASE_COMPLETE:
LOGP(0, LOGL_DEBUG, "SS Release Complete\n");

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

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


[MERGED] libosmocore[master]: gsm0480: clean up the parse_process_uss_req() code

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

Change subject: gsm0480: clean up the parse_process_uss_req() code
..


gsm0480: clean up the parse_process_uss_req() code

This change reduces the degree of code nesting...

Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88
---
M src/gsm/gsm0480.c
1 file changed, 20 insertions(+), 19 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index dcf487a..11c66e9 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -439,33 +439,34 @@
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
 struct ss_request *req)
 {
-   int rc = 0;
-   int num_chars;
+   uint8_t num_chars;
uint8_t dcs;
-
 
/* we need at least that much */
if (length < 8)
return 0;
 
+   if (uss_req_data[0] != GSM_0480_SEQUENCE_TAG)
+   return 0;
 
-   if (uss_req_data[0] == GSM_0480_SEQUENCE_TAG) {
-   if (uss_req_data[2] == ASN1_OCTET_STRING_TAG) {
-   dcs = uss_req_data[4];
-   if ((dcs == 0x0F) &&
-   (uss_req_data[5] == ASN1_OCTET_STRING_TAG)) {
-   num_chars = (uss_req_data[6] * 8) / 7;
-   /* Prevent a mobile-originated buffer-overrun! 
*/
-   if (num_chars > GSM0480_USSD_7BIT_STRING_LEN)
-   num_chars = 
GSM0480_USSD_7BIT_STRING_LEN;
-   gsm_7bit_decode_n_ussd((char *)req->ussd_text,
-   sizeof(req->ussd_text),
-   &(uss_req_data[7]), 
num_chars);
-   rc = 1;
-   }
-   }
+   /* Both 2th and 5th should be equal to ASN1_OCTET_STRING_TAG */
+   if ((uss_req_data[2] & uss_req_data[5]) != ASN1_OCTET_STRING_TAG)
+   return 0;
+
+   dcs = uss_req_data[4];
+   if (dcs == 0x0F) {
+   num_chars = (uss_req_data[6] * 8) / 7;
+   /* Prevent a mobile-originated buffer-overrun! */
+   if (num_chars > GSM0480_USSD_7BIT_STRING_LEN)
+   num_chars = GSM0480_USSD_7BIT_STRING_LEN;
+
+   gsm_7bit_decode_n_ussd((char *)req->ussd_text,
+   sizeof(req->ussd_text), &(uss_req_data[7]), num_chars);
+
+   return 1;
}
-   return rc;
+
+   return 0;
 }
 
 /* Parse the parameters of a Interrogate/Activate/DeactivateSS Request */

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88
Gerrit-PatchSet: 10
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: gsm0480: parse optional IEs for RELEASE COMPLETE message

2018-01-17 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] libosmocore[master]: gsm0480: pass exact GSM 04.80 payload length to parse_ss()

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

Change subject: gsm0480: pass exact GSM 04.80 payload length to parse_ss()
..


gsm0480: pass exact GSM 04.80 payload length to parse_ss()

Change-Id: I9608d4ad16d7581320615c140beaac36628c31a4
---
M src/gsm/gsm0480.c
1 file changed, 4 insertions(+), 4 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 8319b19..75388b9 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -232,7 +232,7 @@
req->transaction_id = hdr->proto_discr & 0x70;
 
ss.transaction_id = req->transaction_id;
-   rc = parse_ss(hdr, len, &ss);
+   rc = parse_ss(hdr, len - sizeof(*hdr), &ss);
 
/* convert from ss_request to legacy ussd_request */
req->transaction_id = ss.transaction_id;
@@ -271,7 +271,7 @@
 
if (gsm48_hdr_pdisc(hdr) == GSM48_PDISC_NC_SS) {
req->transaction_id = hdr->proto_discr & 0x70;
-   rc = parse_ss(hdr, len, req);
+   rc = parse_ss(hdr, len - sizeof(*hdr), req);
}
 
if (!rc)
@@ -293,10 +293,10 @@
req->ussd_text[0] = 0xFF;
break;
case GSM0480_MTYPE_REGISTER:
-   rc &= parse_ss_info_elements(&hdr->data[0], len - sizeof(*hdr), 
req);
+   rc &= parse_ss_info_elements(&hdr->data[0], len, req);
break;
case GSM0480_MTYPE_FACILITY:
-   rc &= parse_ss_facility(&hdr->data[0], len - sizeof(*hdr), req);
+   rc &= parse_ss_facility(&hdr->data[0], len, req);
break;
default:
LOGP(0, LOGL_DEBUG, "Unknown GSM 04.80 message-type field 
0x%02x\n",

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

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


[MERGED] libosmocore[master]: gsm0480: handle GSM0480_CTYPE_RETURN_RESULT

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

Change subject: gsm0480: handle GSM0480_CTYPE_RETURN_RESULT
..


gsm0480: handle GSM0480_CTYPE_RETURN_RESULT

Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf
---
M src/gsm/gsm0480.c
1 file changed, 82 insertions(+), 0 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 17657c7..fdec3d2 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -204,6 +204,10 @@
 struct ss_request *req);
 static int parse_ss_invoke(const uint8_t *invoke_data, uint16_t length,
struct ss_request *req);
+static int parse_ss_return_result(const uint8_t *rr_data, uint16_t length,
+ struct ss_request *req);
+static int parse_process_uss_data(const uint8_t *uss_req_data, uint16_t length,
+ struct ss_request *req);
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
struct ss_request *req);
 static int parse_ss_for_bs_req(const uint8_t *ss_req_data,
@@ -372,6 +376,9 @@
  req);
break;
case GSM0480_CTYPE_RETURN_RESULT:
+   rc &= parse_ss_return_result(facility_ie+2,
+component_length,
+req);
break;
case GSM0480_CTYPE_RETURN_ERROR:
break;
@@ -451,6 +458,81 @@
return rc;
 }
 
+/* Parse a Return Result component - see table 3.4 */
+static int parse_ss_return_result(const uint8_t *rr_data, uint16_t length,
+ struct ss_request *req)
+{
+   uint8_t operation_code;
+   uint8_t offset;
+
+   if (length < 3)
+   return 0;
+
+   /* Mandatory part */
+   if (rr_data[0] != GSM0480_COMPIDTAG_INVOKE_ID) {
+   LOGP(0, LOGL_DEBUG, "Unexpected GSM 04.80 Component-ID tag "
+"0x%02x (expecting Invoke ID tag)\n", rr_data[0]);
+   return 0;
+   }
+
+   offset = rr_data[1] + 2;
+   req->invoke_id = rr_data[2];
+
+   if (offset >= length)
+   return 0;
+
+   if (rr_data[offset] != GSM_0480_SEQUENCE_TAG)
+   return 0;
+
+   if (offset + 2 > length)
+   return 0;
+
+   offset += 2;
+   operation_code = rr_data[offset + 2];
+   req->opcode = operation_code;
+
+   switch (operation_code) {
+   case GSM0480_OP_CODE_USS_NOTIFY:
+   case GSM0480_OP_CODE_USS_REQUEST:
+   case GSM0480_OP_CODE_PROCESS_USS_REQ:
+   return parse_process_uss_req(rr_data + offset + 3,
+   length - offset - 3, req);
+   case GSM0480_OP_CODE_PROCESS_USS_DATA:
+   return parse_process_uss_data(rr_data + offset + 3,
+   length - offset - 3, req);
+   default:
+   LOGP(0, LOGL_DEBUG, "GSM 04.80 operation code 0x%02x "
+   "is not yet handled\n", operation_code);
+   return 0;
+   }
+
+   return 1;
+}
+
+static int parse_process_uss_data(const uint8_t *uss_req_data, uint16_t length,
+ struct ss_request *req)
+{
+   uint8_t num_chars;
+
+   /* we need at least that much */
+   if (length < 3)
+   return 0;
+
+   if (uss_req_data[0] != ASN1_IA5_STRING_TAG)
+   return 0;
+
+   num_chars = uss_req_data[1];
+   if (num_chars > length - 2)
+   return 0;
+
+   if (num_chars > GSM0480_USSD_OCTET_STRING_LEN)
+   num_chars = GSM0480_USSD_OCTET_STRING_LEN;
+
+   memcpy(req->ussd_text, uss_req_data + 2, num_chars);
+
+   return 1;
+}
+
 /* Parse the parameters of a Process UnstructuredSS Request */
 static int parse_process_uss_req(const uint8_t *uss_req_data, uint16_t length,
 struct ss_request *req)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf
Gerrit-PatchSet: 10
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmocore[master]: gsm0480: skip length check for 'RELEASE COMPLETE' message

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

Change subject: gsm0480: skip length check for 'RELEASE COMPLETE' message
..


gsm0480: skip length check for 'RELEASE COMPLETE' message

According to GSM 04.80 Section 2.5 'Release complete' Table 2.5,
the 'RELEASE COMPLETE' message payload is optional, so let's drop
the length check in gsm0480_decode_ss_request() for this type.

Change-Id: I63b7f8ce403169a9dbdbdb031db16693de2196d6
---
M src/gsm/gsm0480.c
1 file changed, 10 insertions(+), 3 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 71470e5..d7c2978 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -249,11 +249,18 @@
 int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
struct ss_request *req)
 {
+   uint8_t msg_type = hdr->msg_type & 0x3F;
int rc = 0;
 
-   if (len < sizeof(*hdr) + 2) {
-   LOGP(0, LOGL_DEBUG, "SS Request is too short.\n");
-   return 0;
+   /**
+* GSM 04.80 Section 2.5 'Release complete' Table 2.5
+* payload is optional for 'RELEASE COMPLETE' message
+*/
+   if (msg_type != GSM0480_MTYPE_RELEASE_COMPLETE) {
+   if (len < sizeof(*hdr) + 2) {
+   LOGP(0, LOGL_DEBUG, "SS Request is too short.\n");
+   return 0;
+   }
}
 
if (gsm48_hdr_pdisc(hdr) == GSM48_PDISC_NC_SS) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I63b7f8ce403169a9dbdbdb031db16693de2196d6
Gerrit-PatchSet: 9
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 


[MERGED] libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F

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

Change subject: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
..


gsm0480: handle UnstructuredSS Request with DSC != 0x0F

According to GSM 04.08, 4.4.2 "ASN.1 data types":
the USSD-DataCodingScheme shall indicate use of
the default alphabet using the 0x0F value.

Previously, the UnstructuredSS Request messages with not
default alphabet were not being handled. Let's fix this.

Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
---
M src/gsm/gsm0480.c
1 file changed, 20 insertions(+), 0 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 11c66e9..b0b28e4 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -453,9 +453,18 @@
if ((uss_req_data[2] & uss_req_data[5]) != ASN1_OCTET_STRING_TAG)
return 0;
 
+   /* Get DCS (Data Coding Scheme) */
dcs = uss_req_data[4];
+
+   /**
+* According to GSM 04.08, 4.4.2 "ASN.1 data types":
+* the USSD-DataCodingScheme shall indicate use of
+* the default alphabet using the 0x0F value.
+*/
if (dcs == 0x0F) {
+   /* Calculate the amount of 7-bit characters */
num_chars = (uss_req_data[6] * 8) / 7;
+
/* Prevent a mobile-originated buffer-overrun! */
if (num_chars > GSM0480_USSD_7BIT_STRING_LEN)
num_chars = GSM0480_USSD_7BIT_STRING_LEN;
@@ -464,6 +473,17 @@
sizeof(req->ussd_text), &(uss_req_data[7]), num_chars);
 
return 1;
+   } else {
+   /* Get the amount of 8-bit characters */
+   num_chars = uss_req_data[6];
+
+   /* Prevent a mobile-originated buffer-overrun! */
+   if (num_chars > GSM0480_USSD_OCTET_STRING_LEN)
+   num_chars = GSM0480_USSD_OCTET_STRING_LEN;
+
+   memcpy(req->ussd_text, &(uss_req_data[7]), num_chars);
+
+   return 1;
}
 
return 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788
Gerrit-PatchSet: 10
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmocore[master]: tests/ussd: fix wrong GSM 04.80 payload length

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

Change subject: tests/ussd: fix wrong GSM 04.80 payload length
..


tests/ussd: fix wrong GSM 04.80 payload length

Previously the same length value was used for both ussd_request
and interrogate_ss payloads, despite they are different.

Change-Id: I90ae7c51b75dcdb9d8ee042af23d127e6db8771d
---
M tests/ussd/ussd_test.c
1 file changed, 7 insertions(+), 3 deletions(-)

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



diff --git a/tests/ussd/ussd_test.c b/tests/ussd/ussd_test.c
index bf6d731..8d88dbb 100644
--- a/tests/ussd/ussd_test.c
+++ b/tests/ussd/ussd_test.c
@@ -120,24 +120,28 @@
 int main(int argc, char **argv)
 {
struct ss_request req;
-   const int size = sizeof(ussd_request);
+   uint16_t size;
int i;
struct msgb *msg;
 
osmo_init_logging(&info);
 
memset(&req, 0, sizeof(req));
-   gsm0480_decode_ss_request((struct gsm48_hdr *) ussd_request, size, 
&req);
+   gsm0480_decode_ss_request((struct gsm48_hdr *) ussd_request,
+   sizeof(ussd_request), &req);
printf("Tested if it still works. Text was: %s\n", req.ussd_text);
 
memset(&req, 0, sizeof(req));
-   gsm0480_decode_ss_request((struct gsm48_hdr *) interrogate_ss, size, 
&req);
+   gsm0480_decode_ss_request((struct gsm48_hdr *) interrogate_ss,
+   sizeof(interrogate_ss), &req);
OSMO_ASSERT(strlen((char *) req.ussd_text) == 0);
OSMO_ASSERT(req.ss_code == 33);
printf("interrogateSS CFU text..'%s' code %d\n", req.ussd_text, 
req.ss_code);
 
printf("Testing parsing a USSD request and truncated versions\n");
 
+   size = sizeof(ussd_request);
+
for (i = size; i > sizeof(struct gsm48_hdr); --i) {
int rc = parse_ussd(&ussd_request[0], i);
printf("Result for len=%d is %d\n", i, rc);

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

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


[MERGED] libosmocore[master]: gsm0480: refactor gsm0480_decode_ss_request

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

Change subject: gsm0480: refactor gsm0480_decode_ss_request
..


gsm0480: refactor gsm0480_decode_ss_request

Change-Id: Iba734db97ab516f8fce816c4e4225b97b93619f1
---
M src/gsm/gsm0480.c
1 file changed, 14 insertions(+), 7 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 25f97a2..ca00999 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -255,17 +255,24 @@
 int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
struct ss_request *req)
 {
-   int rc = 0;
+   uint8_t pdisc;
 
-   if (gsm48_hdr_pdisc(hdr) == GSM48_PDISC_NC_SS) {
-   req->transaction_id = hdr->proto_discr & 0x70;
-   rc = parse_ss(hdr, len - sizeof(*hdr), req);
+   /**
+* Check Protocol Discriminator
+* see TS GSM 04.07 and GSM 04.80
+*/
+   pdisc = gsm48_hdr_pdisc(hdr);
+   if (pdisc != GSM48_PDISC_NC_SS) {
+   LOGP(0, LOGL_ERROR, "Dropping message with "
+   "unsupported pdisc=%02x\n", pdisc);
+   return 0;
}
 
-   if (!rc)
-   LOGP(0, LOGL_DEBUG, "Error occurred while parsing received 
SS!\n");
+   /* GSM 04.80 3.3 Transaction Identifier */
+   req->transaction_id = hdr->proto_discr & 0x70;
 
-   return rc;
+   /* Parse SS request */
+   return parse_ss(hdr, len - sizeof(*hdr), req);
 }
 
 static int parse_ss(const struct gsm48_hdr *hdr, uint16_t len, struct 
ss_request *req)

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

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


[MERGED] libosmocore[master]: gsm0480: correct parse_ss_info_elements() declaration

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

Change subject: gsm0480: correct parse_ss_info_elements() declaration
..


gsm0480: correct parse_ss_info_elements() declaration

Change-Id: I64df293188908c7eb10a61941db76656340d3a8e
---
M src/gsm/gsm0480.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index ca00999..e3856a5 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -198,7 +198,7 @@
uint16_t len, struct ss_request *req);
 static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
 struct ss_request *req);
-static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len,
+static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len,
  struct ss_request *req);
 static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
 struct ss_request *req);

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

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


[MERGED] libosmocore[master]: gsm0480: handle GSM0480_OP_CODE_PROCESS_USS_DATA

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

Change subject: gsm0480: handle GSM0480_OP_CODE_PROCESS_USS_DATA
..


gsm0480: handle GSM0480_OP_CODE_PROCESS_USS_DATA

Change-Id: I470290c2b544555e53cedd849b1d6a961db7b5a4
---
M src/gsm/gsm0480.c
1 file changed, 5 insertions(+), 0 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 4d87974..328a8c0 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -437,6 +437,11 @@
   length - offset - 3,
   req);
break;
+   case GSM0480_OP_CODE_PROCESS_USS_DATA:
+   rc = parse_process_uss_data(invoke_data + offset + 3,
+   length - offset - 3,
+   req);
+   break;
case GSM0480_OP_CODE_ACTIVATE_SS:
case GSM0480_OP_CODE_DEACTIVATE_SS:
case GSM0480_OP_CODE_INTERROGATE_SS:

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I470290c2b544555e53cedd849b1d6a961db7b5a4
Gerrit-PatchSet: 10
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder


[ABANDON] osmo-ttcn3-hacks[master]: GPRS/Gb: use generic linker

2018-01-17 Thread Harald Welte
Harald Welte has abandoned this change.

Change subject: GPRS/Gb: use generic linker
..


Abandoned

TPD files are the TITAN standard way of handling this properly

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: I713b8dffe298e3e878a4760a82f1ad0d42e0aacf
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 


osmo-ttcn3-hacks[master]: Add generic link functions

2018-01-17 Thread Harald Welte

Patch Set 3: Code-Review-2

as indicated, the proper solution is to use .tpd XML files as documented in the 
TITAN reference manual.  However, I think we have more urgent things than to 
improve the build system at this point.

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

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


[ABANDON] osmo-ttcn3-hacks[master]: Add generic link functions

2018-01-17 Thread Harald Welte
Harald Welte has abandoned this change.

Change subject: Add generic link functions
..


Abandoned

TPD files are the TITAN standard way of handling this properly

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: I2aaab05ebe19e5f18c03806069197be0e1304a0b
Gerrit-PatchSet: 3
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 


[MERGED] libosmocore[master]: gsm0480: fix USSD OCTET STRING length confusion

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

Change subject: gsm0480: fix USSD OCTET STRING length confusion
..


gsm0480: fix USSD OCTET STRING length confusion

According to the GSM 04.80 (version 5.0.0) specification Annex A
"Expanded ASN.1 Module "SS-Protocol", the maximum size of a USSD
OCTET STRING is 160 bytes.

Thus according to ETSI TS 123 038 (version 10.0.0) specification
6.1.2.3 "USSD packing of 7 bit characters", in 160 octets, it's
possible to pack (160 * 8) / 7 = 182.8, that is 182 characters.
The remaining 6 bits are set to zero.

This change defines both mentioned values:

  - GSM0480_USSD_OCTET_STRING_LEN  160
  - GSM0480_USSD_7BIT_STRING_LEN   182

keeping the old MAX_LEN_USSD_STRING 'as is' due to compatibility
reasons. Now the new value is used for ss_request structure, while
old one is still used for deprecated ussd_request structure.

Change-Id: I6dead74f9ecea079752ff2400cdaf7c30187784e
---
M include/osmocom/gsm/gsm0480.h
M src/gsm/gsm0480.c
2 files changed, 24 insertions(+), 4 deletions(-)

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



diff --git a/include/osmocom/gsm/gsm0480.h b/include/osmocom/gsm/gsm0480.h
index 672ffe5..0dfd868 100644
--- a/include/osmocom/gsm/gsm0480.h
+++ b/include/osmocom/gsm/gsm0480.h
@@ -7,7 +7,27 @@
 #include 
 #include 
 
-#define MAX_LEN_USSD_STRING31
+/**
+ * According to the GSM 04.80 (version 5.0.0) specification Annex A
+ * "Expanded ASN.1 Module "SS-Protocol", the maximum size of a USSD
+ * OCTET STRING field is 160 bytes.
+ */
+#define GSM0480_USSD_OCTET_STRING_LEN  160
+
+/**
+ * Thus according to ETSI TS 123 038 (version 10.0.0) specification
+ * 6.1.2.3 "USSD packing of 7 bit characters", in 160 octets, it's
+ * possible to pack (160 * 8) / 7 = 182.8, that is 182 characters.
+ * The remaining 6 bits are set to zero.
+ */
+#define GSM0480_USSD_7BIT_STRING_LEN   182
+
+/**
+ * DEPRECATED: this definition doesn't follow any specification,
+ * so we only keep it for compatibility reasons. It's strongly
+ * recommended to use correct definitions above.
+ */
+#define MAX_LEN_USSD_STRING31
 
 /* deprecated */
 struct ussd_request {
@@ -23,7 +43,7 @@
 struct ss_request {
uint8_t opcode;
uint8_t ss_code;
-   uint8_t ussd_text[MAX_LEN_USSD_STRING + 1];
+   uint8_t ussd_text[GSM0480_USSD_OCTET_STRING_LEN];
uint8_t transaction_id;
uint8_t invoke_id;
 };
diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index d7c2978..dcf487a 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -456,8 +456,8 @@
(uss_req_data[5] == ASN1_OCTET_STRING_TAG)) {
num_chars = (uss_req_data[6] * 8) / 7;
/* Prevent a mobile-originated buffer-overrun! 
*/
-   if (num_chars > MAX_LEN_USSD_STRING)
-   num_chars = MAX_LEN_USSD_STRING;
+   if (num_chars > GSM0480_USSD_7BIT_STRING_LEN)
+   num_chars = 
GSM0480_USSD_7BIT_STRING_LEN;
gsm_7bit_decode_n_ussd((char *)req->ussd_text,
sizeof(req->ussd_text),
&(uss_req_data[7]), 
num_chars);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6dead74f9ecea079752ff2400cdaf7c30187784e
Gerrit-PatchSet: 7
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Vadim Yanitskiy 


[MERGED] libosmocore[master]: gsm0480: parse GSM0480_MTYPE_FACILITY separately

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

Change subject: gsm0480: parse GSM0480_MTYPE_FACILITY separately
..


gsm0480: parse GSM0480_MTYPE_FACILITY separately

Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
---
M src/gsm/gsm0480.c
1 file changed, 17 insertions(+), 1 deletion(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index b0b28e4..17657c7 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -196,6 +196,8 @@
 /* Forward declarations */
 static int parse_ss(const struct gsm48_hdr *hdr,
uint16_t len, struct ss_request *req);
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+struct ss_request *req);
 static int parse_ss_info_elements(const uint8_t *ussd_ie, uint16_t len,
  struct ss_request *req);
 static int parse_facility_ie(const uint8_t *facility_ie, uint16_t length,
@@ -286,8 +288,10 @@
req->ussd_text[0] = 0xFF;
break;
case GSM0480_MTYPE_REGISTER:
-   case GSM0480_MTYPE_FACILITY:
rc &= parse_ss_info_elements(&hdr->data[0], len - sizeof(*hdr), 
req);
+   break;
+   case GSM0480_MTYPE_FACILITY:
+   rc &= parse_ss_facility(&hdr->data[0], len - sizeof(*hdr), req);
break;
default:
LOGP(0, LOGL_DEBUG, "Unknown GSM 04.80 message-type field 
0x%02x\n",
@@ -299,6 +303,18 @@
return rc;
 }
 
+static int parse_ss_facility(const uint8_t *ss_facility, uint16_t len,
+struct ss_request *req)
+{
+   uint8_t facility_length;
+
+   facility_length = ss_facility[0];
+   if (len - 1 < facility_length)
+   return 0;
+
+   return parse_facility_ie(ss_facility + 1, facility_length, req);
+}
+
 static int parse_ss_info_elements(const uint8_t *ss_ie, uint16_t len,
  struct ss_request *req)
 {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa
Gerrit-PatchSet: 10
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmocore[master]: gsm0480: move SS request length check to parse_ss()

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

Change subject: gsm0480: move SS request length check to parse_ss()
..


gsm0480: move SS request length check to parse_ss()

Change-Id: I8e7ce5bd97f3a8731924264c92afb9a7183937dc
---
M src/gsm/gsm0480.c
1 file changed, 11 insertions(+), 12 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index 75388b9..25f97a2 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -255,19 +255,7 @@
 int gsm0480_decode_ss_request(const struct gsm48_hdr *hdr, uint16_t len,
struct ss_request *req)
 {
-   uint8_t msg_type = hdr->msg_type & 0x3F;
int rc = 0;
-
-   /**
-* GSM 04.80 Section 2.5 'Release complete' Table 2.5
-* payload is optional for 'RELEASE COMPLETE' message
-*/
-   if (msg_type != GSM0480_MTYPE_RELEASE_COMPLETE) {
-   if (len < sizeof(*hdr) + 2) {
-   LOGP(0, LOGL_DEBUG, "SS Request is too short.\n");
-   return 0;
-   }
-   }
 
if (gsm48_hdr_pdisc(hdr) == GSM48_PDISC_NC_SS) {
req->transaction_id = hdr->proto_discr & 0x70;
@@ -285,6 +273,17 @@
int rc = 1;
uint8_t msg_type = hdr->msg_type & 0x3F;  /* message-type - section 3.4 
*/
 
+   /**
+* GSM 04.80 Section 2.5 'Release complete' Table 2.5
+* payload is optional for 'RELEASE COMPLETE' message
+*/
+   if (msg_type != GSM0480_MTYPE_RELEASE_COMPLETE) {
+   if (len < 2) {
+   LOGP(0, LOGL_DEBUG, "SS Request is too short.\n");
+   return 0;
+   }
+   }
+
/* Table 2.1: Messages for call independent SS control */
switch (msg_type) {
case GSM0480_MTYPE_RELEASE_COMPLETE:

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

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


[MERGED] libosmocore[master]: gsm0480: handle USS_NOTIFY and USS_REQUEST with PROCESS_USS_REQ

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

Change subject: gsm0480: handle USS_NOTIFY and USS_REQUEST with PROCESS_USS_REQ
..


gsm0480: handle USS_NOTIFY and USS_REQUEST with PROCESS_USS_REQ

Change-Id: If7cc6a966dfc17d37e22338ecc1f239f908a9f2e
---
M src/gsm/gsm0480.c
1 file changed, 2 insertions(+), 0 deletions(-)

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



diff --git a/src/gsm/gsm0480.c b/src/gsm/gsm0480.c
index fdec3d2..4d87974 100644
--- a/src/gsm/gsm0480.c
+++ b/src/gsm/gsm0480.c
@@ -430,6 +430,8 @@
uint8_t operation_code = invoke_data[offset+2];
req->opcode = operation_code;
switch (operation_code) {
+   case GSM0480_OP_CODE_USS_NOTIFY:
+   case GSM0480_OP_CODE_USS_REQUEST:
case GSM0480_OP_CODE_PROCESS_USS_REQ:
rc = parse_process_uss_req(invoke_data + offset + 3,
   length - offset - 3,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If7cc6a966dfc17d37e22338ecc1f239f908a9f2e
Gerrit-PatchSet: 10
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder


libosmocore[master]: gsm0480: expose the gsm0480_parse_ss_facility_ie()

2018-01-17 Thread Vadim Yanitskiy

Patch Set 9: Code-Review-1

I am not sure if we really need this change.
Alexander?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I35d3360f36c48eb1295610ab96ff264c45af77eb
Gerrit-PatchSet: 9
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Ivan Kluchnikov 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-HasComments: No


osmo-pcu[master]: Rewrite EGPRS Packet Uplink Assignment

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-pcu[master]: Rewrite Packet Uplink Assignment

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[MERGED] osmo-pcu[master]: Rewrite Packet Uplink Assignment

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

Change subject: Rewrite Packet Uplink Assignment
..


Rewrite Packet Uplink Assignment

Use bitvec_set_*() directly without external write pointer tracking to
simplify the code. This is part of IA Rest Octets (3GPP TS 44.018
§10.5.2.16) which is the last part of the message so it should not
interfere with the rest of encoding functions.

The tests are adjusted accordingly.

Change-Id: I44db2eeea7448ff67e688ae716487bc6dbfc96a3
Related: OS#1526
---
M src/encoding.cpp
M tests/tbf/TbfTest.err
2 files changed, 63 insertions(+), 63 deletions(-)

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



diff --git a/src/encoding.cpp b/src/encoding.cpp
index 279bbfe..e96894f 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -230,50 +230,51 @@
return 0;
 }
 
-static int write_ia_rest_uplink(
-   gprs_rlcmac_ul_tbf *tbf,
-   bitvec * dest, unsigned& wp,
-   uint8_t usf, uint32_t fn,
-   uint8_t alpha, uint8_t gamma, int8_t ta_idx)
+/* 3GPP TS 44.018 §10.5.2.16 IA Rest Octets ::= Packet Uplink Assignment */
+static inline int write_ia_rest_uplink(const gprs_rlcmac_ul_tbf *tbf, bitvec * 
dest,
+  uint8_t usf, uint32_t fn, uint8_t alpha, 
uint8_t gamma, int8_t ta_idx)
 {
-   OSMO_ASSERT(!tbf || !tbf->is_egprs_enabled());
+   int rc;
 
-   // GMS 04.08 10.5.2.37b 10.5.2.16
-   bitvec_write_field(dest, &wp, 3, 2);// "HH"
-   bitvec_write_field(dest, &wp, 0, 2);// "0" Packet Uplink Assignment
-   if (tbf == NULL) {
-   bitvec_write_field(dest, &wp, 0, 1);// Block Allocation : 
Single Block Allocation
-   if (alpha) {
-   bitvec_write_field(dest, &wp,0x1,1);   // ALPHA = 
present
-   bitvec_write_field(dest, &wp,alpha,4);   // ALPHA = 
present
-   } else
-   bitvec_write_field(dest, &wp,0x0,1);   // ALPHA = not 
present
-   bitvec_write_field(dest, &wp,gamma,5);   // GAMMA power control 
parameter
-   write_tai(dest, wp, ta_idx);
-   bitvec_write_field(dest, &wp, 1, 1);// 
TBF_STARTING_TIME_FLAG
-   bitvec_write_field(dest, &wp,(fn / (26 * 51)) % 32,5); // T1'
-   bitvec_write_field(dest, &wp,fn % 51,6);   // T3
-   bitvec_write_field(dest, &wp,fn % 26,5);   // T2
+   set_H(dest); set_H(dest);
+   set_0(dest); set_0(dest); /* 00 Packet Uplink Assignment */
+
+   if (tbf) {
+   set_1(dest); /* Multi Block Allocation */
+
+   rc = write_tfi_usf(dest, tbf, usf);
+   check(rc);
+
+   /* 3GPP TS 44.060 Table 11.2.28.2 Channel Coding Indicator */
+   rc = bitvec_set_u64(dest, tbf->current_cs().to_num() - 1, 2, 
false); /* CHANNEL_CODING_COMMAND */
+   check(rc);
+
+   rc = bitvec_set_bit(dest, (bit_value)tbf->tlli());  
 /* TLLI_BLOCK_CHANNEL_CODING */
+   check(rc);
+
+   rc = write_alpha_gamma(dest, alpha, gamma);
+   check(rc);
+
+   set_0(dest); /* No TIMING_ADVANCE_INDEX */
+   set_0(dest); /* No TBF_STARTING_TIME */
} else {
-   bitvec_write_field(dest, &wp, 1, 1);// Block Allocation : 
Not Single Block Allocation
-   bitvec_write_field(dest, &wp, tbf->tfi(), 5);  // 
TFI_ASSIGNMENT Temporary Flow Identity
-   bitvec_write_field(dest, &wp, 0, 1);// POLLING
-   bitvec_write_field(dest, &wp, 0, 1);// ALLOCATION_TYPE: 
dynamic
-   bitvec_write_field(dest, &wp, usf, 3);// USF
-   bitvec_write_field(dest, &wp, 0, 1);// USF_GRANULARITY
-   bitvec_write_field(dest, &wp, 0, 1);   // "0" power control: 
Not Present
-   bitvec_write_field(dest, &wp, tbf->current_cs().to_num()-1, 2); 
   // CHANNEL_CODING_COMMAND
-   bitvec_write_field(dest, &wp, 1, 1);// 
TLLI_BLOCK_CHANNEL_CODING
-   if (alpha) {
-   bitvec_write_field(dest, &wp,0x1,1);   // ALPHA = 
present
-   bitvec_write_field(dest, &wp,alpha,4);   // ALPHA
-   } else
-   bitvec_write_field(dest, &wp,0x0,1);   // ALPHA = not 
present
-   bitvec_write_field(dest, &wp,gamma,5);   // GAMMA power control 
parameter
-   /* note: there is no choise for TAI and no starting time */
-   bitvec_write_field(dest, &wp, 0, 1);   // switch 
TIMING_ADVANCE_INDEX = off
-   bitvec_write_field(dest, &wp, 0, 1);// 
TBF_STARTING_TIME_FLAG
+   set_0(dest); /* Single Block Allocation */
+   rc = write_alpha_gamma(dest, alpha, gamma);
+   check(rc);
+
+   /* A 'Timing Ad

[MERGED] osmo-pcu[master]: Rewrite Packet Downlink Assignment

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

Change subject: Rewrite Packet Downlink Assignment
..


Rewrite Packet Downlink Assignment

Use bitvec_set_*() directly without external write pointer tracking to
simplify the code. This is part of IA Rest Octets (3GPP TS 44.018
§10.5.2.16) which is the last part of the message so it should not
interfere with the rest of encoding functions.

The tests are adjusted accordingly.

Change-Id: I52ec9b07413daabba8cd5f1fba5c7b3af6a33389
Related: OS#1526
---
M src/encoding.cpp
M tests/tbf/TbfTest.err
2 files changed, 108 insertions(+), 83 deletions(-)

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



diff --git a/src/encoding.cpp b/src/encoding.cpp
index 7b711b8..279bbfe 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -44,6 +44,21 @@
 #define set_H(bv) set_x(bv, H)
 
 /* { 0 | 1 < TIMING_ADVANCE_INDEX : bit (4) > } */
+static inline int write_ta_index(bitvec *dest, int8_t tai)
+{
+   int rc;
+
+   if (tai < 0) /* No TIMING_ADVANCE_INDEX: */
+   set_0(dest);
+
+   /* TIMING_ADVANCE_INDEX: */
+   set_1(dest);
+   rc = bitvec_set_u64(dest, tai, 4, false);
+   check(rc);
+
+   return 0;
+}
+
 static inline bool write_tai(bitvec *dest, unsigned& wp, int8_t tai)
 {
if (tai < 0) { /* No TIMING_ADVANCE_INDEX: */
@@ -159,52 +174,58 @@
return 0;
 }
 
-static int write_ia_rest_downlink(
-   gprs_rlcmac_dl_tbf *tbf,
-   bitvec * dest, unsigned& wp,
-   uint8_t polling, bool ta_valid, uint32_t fn,
-   uint8_t alpha, uint8_t gamma, int8_t ta_idx)
+/* 3GPP TS 44.018 §10.5.2.16 IA Rest Octets ::= Packet Downlink Assignment */
+static inline int write_ia_rest_downlink(const gprs_rlcmac_dl_tbf *tbf, bitvec 
*dest,
+bool polling, bool ta_valid, uint32_t 
fn,
+uint8_t alpha, uint8_t gamma, int8_t 
ta_idx)
 {
-   if (!tbf) {
-   LOGP(DRLCMACDL, LOGL_ERROR,
-   "Cannot encode DL IMMEDIATE ASSIGNMENT without TBF\n");
-   return -EINVAL;
-   }
-   // GSM 04.08 10.5.2.16 IA Rest Octets
-   bitvec_write_field(dest, &wp, 3, 2);   // "HH"
-   bitvec_write_field(dest, &wp, 1, 2);   // "01" Packet Downlink 
Assignment
-   bitvec_write_field(dest, &wp,tbf->tlli(),32); // TLLI
-   bitvec_write_field(dest, &wp,0x1,1);   // switch TFI   : on
-   bitvec_write_field(dest, &wp,tbf->tfi(),5);   // TFI
-   bitvec_write_field(dest, &wp,0x0,1);   // RLC acknowledged mode
-   if (alpha) {
-   bitvec_write_field(dest, &wp,0x1,1);   // ALPHA = present
-   bitvec_write_field(dest, &wp,alpha,4);   // ALPHA
-   } else {
-   bitvec_write_field(dest, &wp,0x0,1);   // ALPHA = not present
-   }
-   bitvec_write_field(dest, &wp,gamma,5);   // GAMMA power control 
parameter
-   bitvec_write_field(dest, &wp,polling,1);   // Polling Bit
-   bitvec_write_field(dest, &wp, ta_valid, 1); // N. B: NOT related to TAI!
-   write_tai(dest, wp, ta_idx);
+   int rc;
+
+   set_H(dest); set_H(dest);
+   set_0(dest); set_1(dest); /* 00 Packet Downlink Assignment */
+
+   rc = bitvec_set_u64(dest, tbf->tlli(), 32, false); /* TLLI */
+   check(rc);
+
+   set_1(dest);
+   rc = bitvec_set_u64(dest, tbf->tfi(), 5, false);   /* TFI_ASSIGNMENT */
+   check(rc);
+
+   /* RLC acknowledged mode */
+   set_0(dest); /* RLC_MODE */
+
+   rc = write_alpha_gamma(dest, alpha, gamma);/* ALPHA and GAMMA */
+   check(rc);
+
+   rc = bitvec_set_bit(dest, (bit_value)polling); /* POLLING */
+   check(rc);
+
+   /* N. B: NOT related to TAI! */
+   rc = bitvec_set_bit(dest, (bit_value)ta_valid); /* TA_VALID */
+   check(rc);
+
+   rc = write_ta_index(dest, ta_idx);
+   check(rc);
+
if (polling) {
-   bitvec_write_field(dest, &wp,0x1,1);   // TBF Starting TIME 
present
-   bitvec_write_field(dest, &wp,(fn / (26 * 51)) % 32,5); // T1'
-   bitvec_write_field(dest, &wp,fn % 51,6);   // T3
-   bitvec_write_field(dest, &wp,fn % 26,5);   // T2
-   } else {
-   bitvec_write_field(dest, &wp,0x0,1);   // TBF Starting TIME 
present
-   }
-   bitvec_write_field(dest, &wp,0x0,1);   // P0 not present
-   //  bitvec_write_field(dest, &wp,0x1,1);   // P0 not present
-   //  bitvec_write_field(dest, &wp,,0xb,4);
+   set_1(dest);
+   rc = write_tbf_start_time(dest, fn);/* TBF_STARTING_TIME */
+   check(rc);
+   } else
+   set_0(dest); /* No TBF_STARTING_TIME */
+
+   set_0(dest); /* No P0 nor PR_MODE */
+
if (tbf->is_egprs_enabled()) {
-   /* see

[MERGED] osmo-pcu[master]: Use Timing Advance Index in UL assignments

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

Change subject: Use Timing Advance Index in UL assignments
..


Use Timing Advance Index in UL assignments

Write TAI (if available) when generating Rest Octets for UL
Assignment. This should not affect actual PCU behavior because TAI is
not yet supported by upper layers but we have to adjust corresponding
tests anyway.

Change-Id: I8b17be78a46c0bc17516b7c90f35aa4768010ae4
---
M src/encoding.cpp
M tests/tbf/TbfTest.err
2 files changed, 22 insertions(+), 18 deletions(-)

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



diff --git a/src/encoding.cpp b/src/encoding.cpp
index e96894f..39cbe24 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -255,7 +255,9 @@
rc = write_alpha_gamma(dest, alpha, gamma);
check(rc);
 
-   set_0(dest); /* No TIMING_ADVANCE_INDEX */
+   rc = write_ta_index(dest, ta_idx);
+   check(rc);
+
set_0(dest); /* No TBF_STARTING_TIME */
} else {
set_0(dest); /* Single Block Allocation */
@@ -317,7 +319,9 @@
rc = write_alpha_gamma(dest, alpha, gamma); /* 
ALPHA and GAMMA */
check(rc);
 
-   set_0(dest);/* 
No TIMING_ADVANCE_INDEX */
+   rc = write_ta_index(dest, ta_idx);
+   check(rc);
+
set_0(dest);/* 
No TBF_STARTING_TIME */
bitvec_set_bit(dest, L);/* 
No Additions for Rel-7 */
} else {
diff --git a/tests/tbf/TbfTest.err b/tests/tbf/TbfTest.err
index b37d31e..da2c2dd 100644
--- a/tests/tbf/TbfTest.err
+++ b/tests/tbf/TbfTest.err
@@ -1561,7 +1561,7 @@
 TBF(TFI=0 TLLI=0x DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 
ra=0x03, Fn=2654167  (17,25,9)
 TBF(TFI=0 TLLI=0x DIR=UL STATE=FLOW) TX: START Immediate Assignment 
Uplink (AGCH)
  - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=0 USF=0
-Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 
0f 00 00 03 8b 29 07 00 c8 00 00 0b 2b 2b 2b 2b 2b 2b 2b 
+Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 
0f 00 00 03 8b 29 07 00 c8 00 00 1f 2b 2b 2b 2b 2b 2b 2b 
 Got RLC block, coding scheme: CS-1, length: 23 (23))
   UL data: 00 01 01 f1 22 33 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 
 Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184
@@ -2195,7 +2195,7 @@
 TBF(TFI=0 TLLI=0x DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 
ra=0x03, Fn=2654275  (17,31,13)
 TBF(TFI=0 TLLI=0x DIR=UL STATE=FLOW) TX: START Immediate Assignment 
Uplink (AGCH)
  - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=0 USF=0
-Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 
0f 00 00 03 8b ed 07 00 c8 00 00 0b 2b 2b 2b 2b 2b 2b 2b 
+Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 
0f 00 00 03 8b ed 07 00 c8 00 00 1f 2b 2b 2b 2b 2b 2b 2b 
 Got RLC block, coding scheme: CS-1, length: 23 (23))
   UL data: 00 01 01 f1 22 33 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
00 
 Got CS-1 RLC block: R=0, SI=0, TFI=0, CPS=0, RSB=0, rc=184
@@ -6871,7 +6871,7 @@
 TBF(TFI=0 TLLI=0x DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 
ra=0x78, Fn=2654167  (17,25,9)
 TBF(TFI=0 TLLI=0x DIR=UL STATE=FLOW) TX: START Immediate Assignment 
Uplink (AGCH)
  - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=0 USF=0
-Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 
0f 00 00 78 8b 29 07 00 c8 00 60 0b 2b 2b 2b 2b 2b 2b 2b 
+Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 
0f 00 00 78 8b 29 07 00 c8 00 60 1f 2b 2b 2b 2b 2b 2b 2b 
 MS requests UL TBF on RACH, so we provide one: ra=0x79 Fn=2654167 qta=31 
is_11bit=0:
 ** UL-TBF starts here **
 Allocating UL TBF: MS_CLASS=0/0
@@ -6896,7 +6896,7 @@
 TBF(TFI=1 TLLI=0x DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 
ra=0x79, Fn=2654167  (17,25,9)
 TBF(TFI=1 TLLI=0x DIR=UL STATE=FLOW) TX: START Immediate Assignment 
Uplink (AGCH)
  - TRX=0 (0) TS=7 TA=7 TSC=0 TFI=1 USF=1
-Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 
0f 00 00 79 8b 29 07 00 c8 42 60 0b 2b 2b 2b 2b 2b 2b 2b 
+Sending data request: trx=0 ts=0 sapi=2 arfcn=0 fn=0 block=0 data=2d 06 3f 10 
0f 00 00 79 8b 29 07 00 c8 42 60 1f 2b 2b 2b 2b 2b 2b 2b 
 MS requests UL TBF on RACH, so we provide one: ra=0x7a Fn=2654167 qta=31 
is_11bit=0:
 ** UL-TBF starts here **
 Allocating UL TBF: MS_CLASS=0/0
@@ -6921,7 +6921,7 @@
 TBF(TFI=2 TLLI=0x DIR=UL STATE=FLOW) RX: [PCU <- BTS] RACH qbit-ta=31 
ra=0x7a, Fn=2654167  (17,25,9)
 TBF(TFI=2 TLLI=0x DIR=UL STATE=FLOW) TX: START Immediate Assignment

[MERGED] osmo-pcu[master]: Rewrite EGPRS Packet Uplink Assignment

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

Change subject: Rewrite EGPRS Packet Uplink Assignment
..


Rewrite EGPRS Packet Uplink Assignment

Use bitvec_set_*() directly without external write pointer tracking to
simplify the code. This is part of IA Rest Octets (3GPP TS 44.018
§10.5.2.16) which is the last part of the message so it should not
interfere with the rest of encoding functions.

Reusable fragments are split into static helpers.

Change-Id: I2139fb347b3290621bbc3f6a031f7f213d372e65
Related: OS#1526
---
M src/encoding.cpp
1 file changed, 117 insertions(+), 55 deletions(-)

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



diff --git a/src/encoding.cpp b/src/encoding.cpp
index b2da1e8..7b711b8 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -36,6 +36,13 @@
 #include 
 #include 
 
+#define check(rc) { if (rc < 0) return rc; }
+#define set_x(bv, x) { if (bitvec_set_bit(bv, x) < 0) return -EOWNERDEAD; }
+#define set_0(bv) set_x(bv, ZERO)
+#define set_1(bv) set_x(bv, ONE)
+#define set_L(bv) set_x(bv, L)
+#define set_H(bv) set_x(bv, H)
+
 /* { 0 | 1 < TIMING_ADVANCE_INDEX : bit (4) > } */
 static inline bool write_tai(bitvec *dest, unsigned& wp, int8_t tai)
 {
@@ -86,6 +93,70 @@
write_ta(dest, wp, ta);
if (write_tai(dest, wp, tai)) /* TIMING_ADVANCE_TIMESLOT_NUMBER: */
bitvec_write_field(dest, &wp, ts, 3);
+}
+
+/* 3GPP TS 44.018 § 10.5.2.16:
+   { 0 | 1 < ALPHA : bit (4) > }
+   < GAMMA : bit (5) >
+*/
+static inline int write_alpha_gamma(bitvec *dest, uint8_t alpha, uint8_t gamma)
+{
+   int rc;
+
+   if (alpha) {
+   set_1(dest);
+   rc = bitvec_set_u64(dest, alpha, 4, false); /* ALPHA */
+   check(rc);
+   } else
+   set_0(dest);/* No ALPHA */
+
+   rc = bitvec_set_u64(dest, gamma, 5, false); /* GAMMA */
+   check(rc);
+
+   return 0;
+}
+
+/* TBF_STARTING_TIME -- same as 3GPP TS 44.018 §10.5.2.38 Starting Time 
without tag: */
+static inline int write_tbf_start_time(bitvec *dest, uint32_t fn)
+{
+   int rc;
+
+   /* Set values according to 3GPP TS 44.018 Table 10.5.2.38.1 */
+   rc = bitvec_set_u64(dest, (fn / (26 * 51)) % 32, 5, false); /* T1' */
+   check(rc);
+   rc = bitvec_set_u64(dest, fn % 51, 6, false);   /* T3  */
+   check(rc);
+   rc = bitvec_set_u64(dest, fn % 26, 5, false);   /* T2  */
+
+   return rc;
+}
+
+/* 3GPP TS 44.018 § 10.5.2.16:
+   < TFI_ASSIGNMENT : bit (5) >
+   < POLLING : bit >
+   0 -- The value '1' was allocated in an earlier version of the protocol and 
shall not be used.
+   < USF: bit (3) >
+   < USF_GRANULARITY : bit >
+   { 0 | 1 < P0 : bit (4) > < PR_MODE : bit (1) > }
+*/
+static inline int write_tfi_usf(bitvec *dest, const gprs_rlcmac_ul_tbf *tbf, 
uint8_t usf)
+{
+   int rc;
+
+   rc = bitvec_set_u64(dest, tbf->tfi(), 5, false); /* TFI_ASSIGNMENT */
+   check(rc);
+
+   set_0(dest); /* POLLING -- no action is required from MS */
+
+   set_0(dest); /* '1' was allocated in an earlier spec version and shall 
not be used */
+
+   rc = bitvec_set_u64(dest, usf, 3, false); /* USF */
+   check(rc);
+   set_0(dest); /* USF_GRANULARITY -- the mobile station shall transmit 
one RLC/MAC block */
+
+   set_0(dest); /* No P0 nor PR_MODE */
+
+   return 0;
 }
 
 static int write_ia_rest_downlink(
@@ -185,68 +256,60 @@
return 0;
 }
 
-static int write_ia_rest_egprs_uplink(
-   gprs_rlcmac_ul_tbf *tbf,
-   bitvec * dest, unsigned& wp,
-   uint8_t usf, uint32_t fn,
-   uint8_t alpha, uint8_t gamma, int8_t ta_idx,
-   enum ph_burst_type burst_type, uint16_t ra)
+/* 3GPP TS 44.018 §10.5.2.16 IA Rest Octets ::= EGPRS Packet Uplink Assignment 
*/
+static inline int write_ia_rest_egprs_uplink(const gprs_rlcmac_ul_tbf *tbf, 
bitvec *dest,
+uint8_t usf, uint32_t fn,
+uint8_t alpha, uint8_t gamma, 
int8_t ta_idx,
+enum ph_burst_type burst_type, 
uint16_t ra)
 {
-   uint8_t extended_ra = 0;
+   int rc;
 
-   extended_ra = (ra & 0x1F);
+   set_L(dest); set_H(dest);
+   set_0(dest); set_0(dest); /* 00 EGPRS Packet Uplink Assignment */
 
-   bitvec_write_field(dest, &wp, 1, 2);/* LH */
-   bitvec_write_field(dest, &wp, 0, 2);/* 0 EGPRS Uplink Assignment */
-   bitvec_write_field(dest, &wp, extended_ra, 5);/* Extended RA */
-   bitvec_write_field(dest, &wp, 0, 1);/* Access technology Request */
+   rc = bitvec_set_u64(dest, ra & 0x1F, 5, false); /* Extended RA */
+   check(rc);
 
-   if (tbf == NULL) {
+   set_0(dest);/* No Access 
Technologies Request */
 
-  

osmo-pcu[master]: Rewrite Packet Downlink Assignment

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-ttcn3-hacks[master]: Add "SourceInfoFormat := Single; " to all test configs

2018-01-17 Thread Harald Welte

Patch Set 3: Code-Review+2

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

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


[MERGED] osmo-ttcn3-hacks[master]: Add "SourceInfoFormat := Single; " to all test configs

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

Change subject: Add "SourceInfoFormat := Single;" to all test configs
..


Add "SourceInfoFormat := Single;" to all test configs

This will make sure that all log files will contain information about
the .ttcn source file name and line number that has caused the log,
which is extremely useful during debugging.

Change-Id: Id6785757f20279ba84b34747f878baf67d065b20
---
M bsc-nat/IPA_Test.cfg
M bsc/BSC_Tests.cfg
M ggsn_tests/GGSN_Tests.cfg
M gprs_gb/Test.cfg
M mgw/MGCP_Test.cfg
M selftest/Selftest.cfg
M sysinfo/Test.cfg
7 files changed, 7 insertions(+), 0 deletions(-)

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



diff --git a/bsc-nat/IPA_Test.cfg b/bsc-nat/IPA_Test.cfg
index 3a34102..617e349 100644
--- a/bsc-nat/IPA_Test.cfg
+++ b/bsc-nat/IPA_Test.cfg
@@ -1,4 +1,5 @@
 [LOGGING]
+SourceInfoFormat := Single;
 #FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
 #ConsoleMask := ERROR | WARNING | TESTCASE | TTCN_MATCHING | DEBUG_ENCDEC
 FileMask := LOG_ALL | TTCN_MATCHING;
diff --git a/bsc/BSC_Tests.cfg b/bsc/BSC_Tests.cfg
index 5fd3203..fcb1055 100644
--- a/bsc/BSC_Tests.cfg
+++ b/bsc/BSC_Tests.cfg
@@ -1,4 +1,5 @@
 [LOGGING]
+SourceInfoFormat := Single;
 #FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
 #ConsoleMask := ERROR | WARNING | TESTCASE | TTCN_MATCHING | DEBUG_ENCDEC
 #FileMask := LOG_ALL | TTCN_MATCHING;
diff --git a/ggsn_tests/GGSN_Tests.cfg b/ggsn_tests/GGSN_Tests.cfg
index a7f4681..e97578c 100644
--- a/ggsn_tests/GGSN_Tests.cfg
+++ b/ggsn_tests/GGSN_Tests.cfg
@@ -1,4 +1,5 @@
 [LOGGING]
+SourceInfoFormat := Single;
 ConsoleMask := DEBUG | LOG_ALL | MATCHING | DEBUG_TESTPORT
 
 LoggerPlugins := { JUnitLogger := "libjunitlogger2" }
diff --git a/gprs_gb/Test.cfg b/gprs_gb/Test.cfg
index 2155628..2f11dfb 100644
--- a/gprs_gb/Test.cfg
+++ b/gprs_gb/Test.cfg
@@ -1,4 +1,5 @@
 [LOGGING]
+SourceInfoFormat := Single;
 #*.FileMask := LOG_ALL
 ConsoleMask := ERROR | WARNING | TESTCASE | TIMEROP_START | DEBUG_ENCDEC
 
diff --git a/mgw/MGCP_Test.cfg b/mgw/MGCP_Test.cfg
index 75989fe..00e3d7c 100644
--- a/mgw/MGCP_Test.cfg
+++ b/mgw/MGCP_Test.cfg
@@ -1,4 +1,5 @@
 [LOGGING]
+SourceInfoFormat := Single;
 #FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
 #ConsoleMask := ERROR | WARNING | TESTCASE | TTCN_MATCHING | DEBUG_ENCDEC
 FileMask := LOG_ALL | TTCN_MATCHING;
diff --git a/selftest/Selftest.cfg b/selftest/Selftest.cfg
index 1eed017..ffa0edb 100644
--- a/selftest/Selftest.cfg
+++ b/selftest/Selftest.cfg
@@ -1,4 +1,5 @@
 [LOGGING]
+SourceInfoFormat := Single;
 #FileMask := LOG_ALL | TTCN_DEBUG | TTCN_MATCHING | DEBUG_ENCDEC;
 #ConsoleMask := ERROR | WARNING | TESTCASE | TTCN_MATCHING | DEBUG_ENCDEC
 #FileMask := LOG_ALL | TTCN_MATCHING;
diff --git a/sysinfo/Test.cfg b/sysinfo/Test.cfg
index 16e0dd6..56696f4 100644
--- a/sysinfo/Test.cfg
+++ b/sysinfo/Test.cfg
@@ -1,4 +1,5 @@
 [LOGGING]
+SourceInfoFormat := Single;
 
 [MODULE_PARAMETERS]
 

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

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


libosmocore[master]: logging: separate the '<000b>' subsys from filename logging

2018-01-17 Thread Harald Welte

Patch Set 1:

> I would gladly separate the hex category out to its own logging
 > config api, the only reason why I'm continuing to tie it with the
 > filename is backwards compat. If you agree that we completely untie
 > it from the filename (and that changing the logging API behavior is
 > acceptable) I'll change the patches.

I'm not sure why we would change the behavoir?  If we just add a new function 
which can disable the printing of th ehex category prefix, and make sure that 
the start-up default is "enabled", how are we breaking compatibility?

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

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


libosmocore[master]: NS: use monotonic clock

2018-01-17 Thread Max

Patch Set 5:

Those are 2 different things:
1) osmo_gettimeofday() used inside libosmocore for elapsed time computations in 
osmo_timers_*()
2) osmo_gettimeofday() used externally for elapsed time computations

Those are pretty-much independent. The main difference is that corresponding 
"struct timeval" is internal parameter in 1) and managed by caller in 2). 
Because of that moving to monotonic time in 1) won't help with 2) - we still 
have to go and manually change it. Similarly, moving 2) to monotonic time won't 
affect 1) at all.

This patch series address case 2) only. The 1) is more intrusive because it's 
also used to mock time in tests.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib6949601a80747f0de1a05e0790a1bace209efbf
Gerrit-PatchSet: 5
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


[MERGED] libosmocore[master]: logging: add ability to log the log-level with API and vty

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

Change subject: logging: add ability to log the log-level with API and vty
..


logging: add ability to log the log-level with API and vty

Log the log level string after the category name, if enabled.

The default behavior remains unchanged.

Change-Id: Ie6be365cfa6aeabdf115bff19bac198440c9adf1
---
M include/osmocom/core/logging.h
M src/logging.c
M src/vty/logging_vty.c
3 files changed, 42 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 922cbf6..1e809d0 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -298,6 +298,9 @@
void (*raw_output)(struct log_target *target, int subsys,
   unsigned int level, const char *file, int line,
   int cont, const char *format, va_list ap);
+
+   /* Should the log level be printed? */
+   bool print_level;
 };
 
 /* use the above macros */
@@ -320,6 +323,7 @@
 void log_set_print_timestamp(struct log_target *target, int);
 void log_set_print_filename(struct log_target *target, int);
 void log_set_print_category(struct log_target *target, int);
+void log_set_print_level(struct log_target *target, int);
 void log_set_log_level(struct log_target *target, int log_level);
 void log_parse_category_mask(struct log_target *target, const char* mask);
 const char* log_category_name(int subsys);
diff --git a/src/logging.c b/src/logging.c
index e4f3e87..80fc7d2 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -353,6 +353,12 @@
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
}
+   if (target->print_level) {
+   ret = snprintf(buf + offset, rem, "%s ", 
log_level_str(level));
+   if (ret < 0)
+   goto err;
+   OSMO_SNPRINTF_RET(ret, rem, offset, len);
+   }
if (target->print_filename) {
ret = snprintf(buf + offset, rem, "<%4.4x> %s:%d ",
subsys, file, line);
@@ -608,6 +614,17 @@
target->print_category = print_category;
 }
 
+/*! Enable or disable printing of the log level name.
+ *  \param[in] target Log target to be affected
+ *  \param[in] print_catname Enable (1) or disable (0) filenames
+ *
+ *  Print the log level name in front of every log message.
+ */
+void log_set_print_level(struct log_target *target, int print_level)
+{
+   target->print_level = (bool)print_level;
+}
+
 /*! Set the global log level for a given log target
  *  \param[in] target Log target to be affected
  *  \param[in] log_level New global log level
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index dc457ff..5914822 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -203,6 +203,23 @@
return CMD_SUCCESS;
 }
 
+DEFUN(logging_prnt_level,
+  logging_prnt_level_cmd,
+  "logging print level (0|1)",
+  LOGGING_STR "Log output settings\n"
+  "Configure log message\n"
+  "Don't prefix each log message\n"
+  "Prefix each log message with the log level name\n")
+{
+   struct log_target *tgt = osmo_log_vty2tgt(vty);
+
+   if (!tgt)
+   return CMD_WARNING;
+
+   log_set_print_level(tgt, atoi(argv[0]));
+   return CMD_SUCCESS;
+}
+
 DEFUN(logging_level,
   logging_level_cmd,
   NULL, /* cmdstr is dynamically set in logging_vty_add_cmds(). */
@@ -734,6 +751,8 @@
else
vty_out(vty, "  logging timestamp %u%s",
tgt->print_timestamp ? 1 : 0, VTY_NEWLINE);
+   if (tgt->print_level)
+   vty_out(vty, "  logging print level 1%s", VTY_NEWLINE);
 
/* stupid old osmo logging API uses uppercase strings... */
osmo_str2lower(level_lower, log_level_str(tgt->loglevel));
@@ -783,6 +802,7 @@
install_element_ve(&logging_prnt_timestamp_cmd);
install_element_ve(&logging_prnt_ext_timestamp_cmd);
install_element_ve(&logging_prnt_cat_cmd);
+   install_element_ve(&logging_prnt_level_cmd);
install_element_ve(&logging_set_category_mask_cmd);
install_element_ve(&logging_set_category_mask_old_cmd);
 
@@ -799,6 +819,7 @@
install_element(CFG_LOG_NODE, &logging_prnt_timestamp_cmd);
install_element(CFG_LOG_NODE, &logging_prnt_ext_timestamp_cmd);
install_element(CFG_LOG_NODE, &logging_prnt_cat_cmd);
+   install_element(CFG_LOG_NODE, &logging_prnt_level_cmd);
install_element(CFG_LOG_NODE, &logging_level_cmd);
 
install_element(CONFIG_NODE, &cfg_log_stderr_cmd);

-- 
To view, visit https://gerrit.osmocom.org/5809
To unsubscribe, visit https://gerrit.osmocom.or

[MERGED] libosmocore[master]: logging: color the log category according to level

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

Change subject: logging: color the log category according to level
..


logging: color the log category according to level

When log_set_use_color() is enabled, color the log category string according to
the log level. The log line before and after the log category is printed in the
category's configured color.

ERROR and FATAL are red, NOTICE is yellow, INFO is green and DEBUG is blue.

The default behavior remains unchanged; If color is enabled, the category
string will now always be colored in the log level color, not the log category
color, and will stand out from the rest of the line.

Change-Id: I84f886ac880e9056a666bbb231ae06cbaaf65f44
---
M src/logging.c
1 file changed, 5 insertions(+), 1 deletion(-)

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



diff --git a/src/logging.c b/src/logging.c
index c01294c..a6aa7eb 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -366,7 +366,11 @@
OSMO_SNPRINTF_RET(ret, rem, offset, len);
}
if (target->print_category) {
-   ret = snprintf(buf + offset, rem, "%s ", 
log_category_name(subsys));
+   ret = snprintf(buf + offset, rem, "%s%s%s%s ",
+  target->use_color ? level_color(level) : 
"",
+  log_category_name(subsys),
+  target->use_color ? "\033[0;m" : "",
+  c_subsys ? c_subsys : "");
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I84f886ac880e9056a666bbb231ae06cbaaf65f44
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-mgw[master]: cosmetic: mgcp_network: typo in log

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

Change subject: cosmetic: mgcp_network: typo in log
..


cosmetic: mgcp_network: typo in log

Change-Id: Ia7675e52fe1082d21bd68dcf54fe34c0f0326f11
---
M src/libosmo-mgcp/mgcp_network.c
1 file changed, 1 insertion(+), 1 deletion(-)

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



diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index bd6bec9..6cecbb0 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -905,7 +905,7 @@
*proto = fd == &conn->end.rtp ? MGCP_PROTO_RTP : MGCP_PROTO_RTCP;
 
LOGP(DRTP, LOGL_DEBUG, "endpoint:0x%x ", ENDPOINT_NUMBER(endp));
-   LOGPC(DRTP, LOGL_DEBUG, "receiveing from %s %s %d\n",
+   LOGPC(DRTP, LOGL_DEBUG, "receiving from %s %s %d\n",
  conn->conn->name, inet_ntoa(addr->sin_addr),
  ntohs(addr->sin_port));
LOGP(DRTP, LOGL_DEBUG, "endpoint:0x%x conn:%s\n", ENDPOINT_NUMBER(endp),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia7675e52fe1082d21bd68dcf54fe34c0f0326f11
Gerrit-PatchSet: 2
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmocore[master]: logging: color the log level

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

Change subject: logging: color the log level
..


logging: color the log level

When log_set_use_color() is enabled, color the log level string according to
the log level. The log line before and after the log level is printed in the
category's color.

ERROR and FATAL are red, NOTICE is yellow, INFO is green and DEBUG is blue.

The default behavior remains unchanged.

Change-Id: If2e52ae9ab83e538e04321c338e3fdffb2c7f9d3
---
M src/logging.c
1 file changed, 26 insertions(+), 4 deletions(-)

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



diff --git a/src/logging.c b/src/logging.c
index 80fc7d2..c01294c 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -298,6 +298,23 @@
return NULL;
 }
 
+static const struct value_string level_colors[] = {
+   { LOGL_DEBUG, "\033[1;34m" },
+   { LOGL_INFO, "\033[1;32m" },
+   { LOGL_NOTICE, "\033[1;33m" },
+   { LOGL_ERROR, "\033[1;31m" },
+   { LOGL_FATAL, "\033[1;31m" },
+   { 0, NULL }
+};
+
+static const char *level_color(int level)
+{
+   const char *c = get_value_string_or_null(level_colors, level);
+   if (!c)
+   return get_value_string(level_colors, LOGL_FATAL);
+   return c;
+}
+
 const char* log_category_name(int subsys)
 {
if (subsys < osmo_log_info->num_cat)
@@ -312,12 +329,13 @@
 {
char buf[4096];
int ret, len = 0, offset = 0, rem = sizeof(buf);
+   const char *c_subsys = NULL;
 
/* are we using color */
if (target->use_color) {
-   const char *c = color(subsys);
-   if (c) {
-   ret = snprintf(buf + offset, rem, "%s", c);
+   c_subsys = color(subsys);
+   if (c_subsys) {
+   ret = snprintf(buf + offset, rem, c_subsys);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
@@ -354,7 +372,11 @@
OSMO_SNPRINTF_RET(ret, rem, offset, len);
}
if (target->print_level) {
-   ret = snprintf(buf + offset, rem, "%s ", 
log_level_str(level));
+   ret = snprintf(buf + offset, rem, "%s%s%s%s ",
+  target->use_color ? level_color(level) : 
"",
+  log_level_str(level),
+  target->use_color ? "\033[0;m" : "",
+  c_subsys ? c_subsys : "");
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If2e52ae9ab83e538e04321c338e3fdffb2c7f9d3
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[MERGED] osmo-pcu[master]: Allow specifying sysmocom headers explicitly

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

Change subject: Allow specifying sysmocom headers explicitly
..


Allow specifying sysmocom headers explicitly

The headers for LC1.5 are specified explicitly. Add corresponding option
to specify sysmoBTS headers location and use it in jenkins build. While
at it, unify header fixup code with the one used in OsmoBTS.

Change-Id: I5248e8b389fd240b4d5a0bcf6c954d6115262462
---
M configure.ac
M contrib/jenkins.sh
M src/Makefile.am
3 files changed, 15 insertions(+), 6 deletions(-)

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



diff --git a/configure.ac b/configure.ac
index 56e2057..3706b6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,8 +65,19 @@
AC_HELP_STRING([--enable-sysmocom-dsp],
[enable code for sysmocom DSP [default=no]]),
[enable_sysmocom_dsp="$enableval"],[enable_sysmocom_dsp="no"])
+AC_ARG_WITH([sysmobts], [AS_HELP_STRING([--with-sysmobts=INCLUDE_DIR], 
[Location of the sysmobts API header files])],
+
[sysmobts_incdir="$withval"],[sysmobts_incdir="$incdir"])
+AC_SUBST([SYSMOBTS_INCDIR], $sysmobts_incdir)
 AC_MSG_RESULT([$enable_sysmocom_dsp])
 AM_CONDITIONAL(ENABLE_SYSMODSP, test "x$enable_sysmocom_dsp" = "xyes")
+if test "$enable_sysmocom_bts" = "yes"; then
+   oldCPPFLAGS=$CPPFLAGS
+   CPPFLAGS="$CPPFLAGS -I$SYSMOBTS_INCDIR -I$srcdir/include 
$LIBOSMOCORE_CFLAGS"
+   AC_CHECK_HEADER([sysmocom/femtobts/superfemto.h],[],
+   [AC_MSG_ERROR([sysmocom/femtobts/superfemto.h can not 
be found in $sysmobts_incdir])],
+   [#include ])
+   CPPFLAGS=$oldCPPFLAGS
+fi
 
 AC_MSG_CHECKING([whether to enable direct PHY access for PDCH of NuRAN 
Wireless Litecell 1.5 BTS])
 AC_ARG_ENABLE(lc15bts-phy,
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index b7cfc3d..af25c69 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -26,15 +26,13 @@
 # Collect configure options for osmo-pcu
 PCU_CONFIG=""
 if [ "$with_dsp" = sysmo ]; then
-  PCU_CONFIG="$PCU_CONFIG --enable-sysmocom-dsp"
+  PCU_CONFIG="$PCU_CONFIG --enable-sysmocom-dsp --with-sysmobts=$inst/include/"
 
   # For direct sysmo DSP access, provide the SysmoBTS Layer 1 API
   cd "$deps"
   osmo-layer1-headers.sh sysmo
-  cd layer1-headers
-  api_incl="$inst/include/sysmocom/femtobts/"
-  mkdir -p "$api_incl"
-  cp include/*.h "$api_incl"
+  mkdir -p "$inst/include/sysmocom/femtobts"
+  ln -s $deps/layer1-headers/include/* "$inst/include/sysmocom/femtobts/"
   cd "$base"
 
 elif [ "$with_dsp" = lc15 ]; then
diff --git a/src/Makefile.am b/src/Makefile.am
index a6e98e5..7d2a62e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -103,7 +103,7 @@
 osmo_pcu_SOURCES = pcu_main.cpp
 
 if ENABLE_SYSMODSP
-AM_CPPFLAGS += -I$(srcdir)/osmo-bts-sysmo
+AM_CPPFLAGS += -I$(srcdir)/osmo-bts-sysmo -I$(SYSMOBTS_INCDIR)
 
 EXTRA_DIST = \
osmo-bts-sysmo/sysmo_l1_if.c \

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5248e8b389fd240b4d5a0bcf6c954d6115262462
Gerrit-PatchSet: 8
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 


osmo-pcu[master]: Allow specifying sysmocom headers explicitly

2018-01-17 Thread Harald Welte

Patch Set 7: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5248e8b389fd240b4d5a0bcf6c954d6115262462
Gerrit-PatchSet: 7
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


gapk[master]: Merge branch 'fixeria/lib'

2018-01-17 Thread Harald Welte

Patch Set 1:

@tnt: any feedbackk on this patch series?

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3c6d4a9d326ee49153e4ad83823d094831c112da
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


gapk[master]: Merge branch 'fixeria/lib'

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+1

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3c6d4a9d326ee49153e4ad83823d094831c112da
Gerrit-PatchSet: 1
Gerrit-Project: gapk
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: tnt 
Gerrit-HasComments: No


libosmocore[master]: logging: allow to log only the basename of each source

2018-01-17 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-sgsn[master]: Use gsm48_encode_ra() for RAI encoding

2018-01-17 Thread Max

Patch Set 2:

Indeed, this was not tested against actual gbproxy. The change is rather 
cosmetic: explicit struct type used instead of void * but this can wait until 
we have more elaborate test infrastructure for gbproxy.

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

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


[PATCH] osmo-ttcn3-hacks[master]: BSSMAP_Emulation: Initialize ExpectTable before use

2018-01-17 Thread daniel

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

BSSMAP_Emulation: Initialize ExpectTable before use

The assignment_fr_* tests now go through to the point where the BSC
sends a CRCX to the mgw.

Change-Id: Ic5a128861ae7b1a4cf8158e43c59c52ebd2a20ba
---
M library/BSSMAP_Emulation.ttcn
1 file changed, 7 insertions(+), 0 deletions(-)


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

diff --git a/library/BSSMAP_Emulation.ttcn b/library/BSSMAP_Emulation.ttcn
index 153fb86..8475d55 100644
--- a/library/BSSMAP_Emulation.ttcn
+++ b/library/BSSMAP_Emulation.ttcn
@@ -297,6 +297,7 @@
 
g_bssmap_id := id;
f_conn_table_init();
+   f_expect_table_init();
 
while (true) {
var BSSAP_N_UNITDATA_ind ud_ind;
@@ -518,5 +519,11 @@
setverdict(fail, "No space left in ExpectTable");
 }
 
+private function f_expect_table_init()
+runs on BSSMAP_Emulation_CT {
+   for (var integer i := 0; i < sizeof(ExpectTable); i := i+1) {
+   ExpectTable[i].l3_payload := omit;
+   }
+}
 
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic5a128861ae7b1a4cf8158e43c59c52ebd2a20ba
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: daniel 


[PATCH] osmo-ttcn3-hacks[master]: RSL_Emulation: Initialize the ConnectionTable

2018-01-17 Thread daniel

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

RSL_Emulation: Initialize the ConnectionTable

By default all the elements in the conn table seem to be considered
.
f_cid_create() manages to set ra, ra_fn and comp_ref in the
ConnectionData element, but checking for
ispresent(ConnectionTable[i].ra) still returns false while
log(ConnectionTable[i].ra) returns 23. Setting every optional element to
omit as f_cid_clear() does before using the connection table seems to
solve this issue.

The assignment_fr_* tests now continue after receiving the Immediate
Assignment, but still fail after receiving the CM Service Request.

Change-Id: I24205425c5b6ae5b8a0f6288ba89ea5a1dc4669d
---
M library/RSL_Emulation.ttcn
1 file changed, 5 insertions(+), 0 deletions(-)


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

diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index 7c5a168..2c33dfe 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -214,6 +214,11 @@
var integer cid;
var integer i;
 
+   /* Initialize the ConnectionTable */
+   for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
+   f_cid_clear(i);
+   }
+
while (true) {
alt {
[] IPA_PT.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24205425c5b6ae5b8a0f6288ba89ea5a1dc4669d
Gerrit-PatchSet: 1
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: daniel 


osmo-ttcn3-hacks[master]: RSL_Emulation: Initialize the ConnectionTable

2018-01-17 Thread daniel

Patch Set 1: Code-Review-1

I'll make the init routine here a function as well

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

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


osmo-bts[master]: Remove 11-bit RACH support from 'Known Limitations'

2018-01-17 Thread Alexander Huemer

Patch Set 1:

> I wasn't referring to compilation. Have you tried to run it with
 > actual phone and verified that 11-bit RACH was used? The ticket
 > referred to in README is still open. I'd be surprised if adding
 > support to libosmocore would mean that it'll be automatically used
 > in osmo-bts.
 > 
 > So if you indeed tested, please share your configs and test setup
 > details in OS#1854. We should first close the ticket and than
 > remove it from readme.

Yes you are right. I drew the wrong conclusion.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I091f4fbd52c29c7d56ca392b8a1b872609829d81
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Alexander Huemer 
Gerrit-Reviewer: Alexander Huemer 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


osmo-bts[master]: Remove 11-bit RACH support from 'Known Limitations'

2018-01-17 Thread Max

Patch Set 1:

Ok, let's keep in this in gerrit until OS#1854 is resolved and than we can 
merge this. Updating readme is easily overlooked so thanks for sending this.

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I091f4fbd52c29c7d56ca392b8a1b872609829d81
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Alexander Huemer 
Gerrit-Reviewer: Alexander Huemer 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: No


[PATCH] osmo-ttcn3-hacks[master]: RSL_Emulation: Initialize the ConnectionTable

2018-01-17 Thread daniel
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/5842

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

RSL_Emulation: Initialize the ConnectionTable

By default all the elements in the conn table seem to be considered
.
f_cid_create() manages to set ra, ra_fn and comp_ref in the
ConnectionData element, but checking for
ispresent(ConnectionTable[i].ra) still returns false while
log(ConnectionTable[i].ra) returns 23. Setting every optional element to
omit as f_cid_clear() does before using the connection table seems to
solve this issue.

The assignment_fr_* tests now continue after receiving the Immediate
Assignment, but still fail after receiving the CM Service Request.

Change-Id: I24205425c5b6ae5b8a0f6288ba89ea5a1dc4669d
---
M library/RSL_Emulation.ttcn
1 file changed, 11 insertions(+), 0 deletions(-)


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

diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index 7c5a168..a19e627 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -214,6 +214,8 @@
var integer cid;
var integer i;
 
+   f_conn_table_init();
+
while (true) {
alt {
[] IPA_PT.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) {
@@ -315,5 +317,14 @@
}
 }
 
+private function f_conn_table_init()
+runs on RSL_Emulation_CT {
+   var integer i;
+
+   /* Initialize the ConnectionTable */
+   for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
+   f_cid_clear(i);
+   }
+}
 
 }

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I24205425c5b6ae5b8a0f6288ba89ea5a1dc4669d
Gerrit-PatchSet: 2
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Owner: daniel 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 


[PATCH] libosmocore[master]: tests: fix LDADD: link libosmovty from current build

2018-01-17 Thread Neels Hofmeyr

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

tests: fix LDADD: link libosmovty from current build

Do not link against the system-wide installed libosmovty during build. Instead,
use the locally built one: add libosmovty.la to LDADD explicitly.

It might be more accurate to add this linking only to those tests that really
require it, but on the one hand ctrl_test (which raises an error) doesn't even
seem to use libosmovty, and on the other hand I don't want to spend time
analysing each and every test for which libs it links now. I am being lazy and
find it sufficient that the tests still work after linking libosmovty to all of
them.

I got:

  /usr/local/lib/libosmovty.so.4: undefined reference to 
`log_set_print_basename'
  collect2: error: ld returned 1 exit status
  Makefile:964: recipe for target 'ctrl/ctrl_test' failed

because a system installation of libosmovty was from a branch with a new symbol
expected present in libosmocore.la (log_set_print_basename), followed by a
build of current master which lacks that symbol.

Change-Id: Id084e6e6efd25cd62b1bd7a4fc7c5985c39130c6
---
M tests/Makefile.am
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/44/5844/1

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 877a302..4eeb471 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,9 @@
 AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include
 AM_CFLAGS = -Wall $(TALLOC_CFLAGS)
 AM_LDFLAGS =
-LDADD = $(top_builddir)/src/libosmocore.la $(TALLOC_LIBS)
+LDADD = $(top_builddir)/src/libosmocore.la \
+   $(top_builddir)/src/vty/libosmovty.la \
+   $(TALLOC_LIBS)
 
 check_PROGRAMS = timer/timer_test sms/sms_test ussd/ussd_test  \
  smscb/smscb_test bits/bitrev_test a5/a5_test  \
@@ -146,7 +148,7 @@
 strrb_strrb_test_SOURCES = strrb/strrb_test.c
 
 vty_vty_test_SOURCES = vty/vty_test.c
-vty_vty_test_LDADD = $(LDADD) $(top_builddir)/src/vty/libosmovty.la
+vty_vty_test_LDADD = $(LDADD)
 
 sim_sim_test_SOURCES = sim/sim_test.c
 sim_sim_test_LDADD = $(LDADD) $(top_builddir)/src/sim/libosmosim.la \

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id084e6e6efd25cd62b1bd7a4fc7c5985c39130c6
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] libosmocore[master]: fix -Werror build: logging.c: always use literal with snprintf

2018-01-17 Thread Neels Hofmeyr

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

fix -Werror build: logging.c: always use literal with snprintf

A recent commit added an snprintf that passes a pointer to a literal directly
to snprintf. Since passing pointers to printf formats is a vulnerability in
case user supplied data may be passed in the format, modern compilers warn
against that, which breaks our -Werror builds. Even though this is just a
pointer to a literal, it needs to be an actual literal to make compilers happy.

Use printf("%s", c) instead of printf(c).

Note that our current build slave's gcc does not enforce that yet, while newer
compilers do.

Change-Id: Ifa4eb8a9fab66dcd987986065351b4a06421f1ec
---
M src/logging.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/5845/1

diff --git a/src/logging.c b/src/logging.c
index a6aa7eb..9b37bf5 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -335,7 +335,7 @@
if (target->use_color) {
c_subsys = color(subsys);
if (c_subsys) {
-   ret = snprintf(buf + offset, rem, c_subsys);
+   ret = snprintf(buf + offset, rem, "%s", c_subsys);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifa4eb8a9fab66dcd987986065351b4a06421f1ec
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 


[PATCH] libosmocore[master]: fix -Werror build: logging.c: always use literal with snprintf

2018-01-17 Thread Neels Hofmeyr

fix -Werror build: logging.c: always use literal with snprintf

A recent commit added an snprintf that passes a pointer to a literal directly
to snprintf. Since passing pointers to printf formats is a vulnerability in
case user supplied data may be passed in the format, modern compilers warn
against that, which breaks our -Werror builds. Even though this is just a
pointer to a literal, it needs to be an actual literal to make compilers happy.

Use printf("%s", c) instead of printf(c).

Note that our current build slave's gcc does not enforce that yet, while newer
compilers do.

  logging.c:338:4: warning: format not a string literal and no format arguments 
[-Wformat-security]
   ret = snprintf(buf + offset, rem, c_subsys);

Change-Id: Ifa4eb8a9fab66dcd987986065351b4a06421f1ec
---
M src/logging.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/45/5845/2

diff --git a/src/logging.c b/src/logging.c
index a6aa7eb..9b37bf5 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -335,7 +335,7 @@
if (target->use_color) {
c_subsys = color(subsys);
if (c_subsys) {
-   ret = snprintf(buf + offset, rem, c_subsys);
+   ret = snprintf(buf + offset, rem, "%s", c_subsys);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ifa4eb8a9fab66dcd987986065351b4a06421f1ec
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder


[MERGED] libosmocore[master]: fix -Werror build: logging.c: always use literal with snprintf

2018-01-17 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged.

Change subject: fix -Werror build: logging.c: always use literal with snprintf
..


fix -Werror build: logging.c: always use literal with snprintf

A recent commit added an snprintf that passes a pointer to a literal directly
to snprintf. Since passing pointers to printf formats is a vulnerability in
case user supplied data may be passed in the format, modern compilers warn
against that, which breaks our -Werror builds. Even though this is just a
pointer to a literal, it needs to be an actual literal to make compilers happy.

Use printf("%s", c) instead of printf(c).

Note that our current build slave's gcc does not enforce that yet, while newer
compilers do.

  logging.c:338:4: warning: format not a string literal and no format arguments 
[-Wformat-security]
   ret = snprintf(buf + offset, rem, c_subsys);

Change-Id: Ifa4eb8a9fab66dcd987986065351b4a06421f1ec
---
M src/logging.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved; Verified



diff --git a/src/logging.c b/src/logging.c
index a6aa7eb..9b37bf5 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -335,7 +335,7 @@
if (target->use_color) {
c_subsys = color(subsys);
if (c_subsys) {
-   ret = snprintf(buf + offset, rem, c_subsys);
+   ret = snprintf(buf + offset, rem, "%s", c_subsys);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifa4eb8a9fab66dcd987986065351b4a06421f1ec
Gerrit-PatchSet: 2
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


libosmocore[master]: fix -Werror build: logging.c: always use literal with snprintf

2018-01-17 Thread Neels Hofmeyr

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

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

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


libosmocore[master]: tests: fix LDADD: link libosmovty from current build

2018-01-17 Thread Max

Patch Set 1: Code-Review-1

(2 comments)

https://gerrit.osmocom.org/#/c/5844/1/tests/Makefile.am
File tests/Makefile.am:

Line 5: $(top_builddir)/src/vty/libosmovty.la \
Seems like unrelated cosmetic change, but we shouldn't consider it merge 
blocker.


Line 151: vty_vty_test_LDADD = $(LDADD)
That's unnecessary: LDADD is used by default so you can just remove the line 
entirely.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id084e6e6efd25cd62b1bd7a4fc7c5985c39130c6
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-HasComments: Yes


osmo-ttcn3-hacks[master]: RSL_Emulation: Initialize the ConnectionTable

2018-01-17 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


[MERGED] osmo-ttcn3-hacks[master]: RSL_Emulation: Initialize the ConnectionTable

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

Change subject: RSL_Emulation: Initialize the ConnectionTable
..


RSL_Emulation: Initialize the ConnectionTable

By default all the elements in the conn table seem to be considered
.
f_cid_create() manages to set ra, ra_fn and comp_ref in the
ConnectionData element, but checking for
ispresent(ConnectionTable[i].ra) still returns false while
log(ConnectionTable[i].ra) returns 23. Setting every optional element to
omit as f_cid_clear() does before using the connection table seems to
solve this issue.

The assignment_fr_* tests now continue after receiving the Immediate
Assignment, but still fail after receiving the CM Service Request.

Change-Id: I24205425c5b6ae5b8a0f6288ba89ea5a1dc4669d
---
M library/RSL_Emulation.ttcn
1 file changed, 11 insertions(+), 0 deletions(-)

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



diff --git a/library/RSL_Emulation.ttcn b/library/RSL_Emulation.ttcn
index 7c5a168..a19e627 100644
--- a/library/RSL_Emulation.ttcn
+++ b/library/RSL_Emulation.ttcn
@@ -214,6 +214,8 @@
var integer cid;
var integer i;
 
+   f_conn_table_init();
+
while (true) {
alt {
[] IPA_PT.receive(ASP_IPA_Event:{up_down := ASP_IPA_EVENT_UP}) {
@@ -315,5 +317,14 @@
}
 }
 
+private function f_conn_table_init()
+runs on RSL_Emulation_CT {
+   var integer i;
+
+   /* Initialize the ConnectionTable */
+   for (i := 0; i < sizeof(ConnectionTable); i := i+1) {
+   f_cid_clear(i);
+   }
+}
 
 }

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

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


osmo-ttcn3-hacks[master]: BSSMAP_Emulation: Initialize ExpectTable before use

2018-01-17 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


  1   2   >