[PATCH] pysim[master]: fix writing of ICCID for sysmo-usim-sjs1

2017-04-05 Thread dexter
Hello Neels Hofmeyr,

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

https://gerrit.osmocom.org/2175

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

fix writing of ICCID for sysmo-usim-sjs1

The programming procedure for sysmo-usim-sjs1 lacks
writing the ICCID. This commit adds the missing call
to update_binary()

Change-Id: Ief85aa07c562d8d7b2a6dec302d2f485d0b1e577
---
M pySim/cards.py
1 file changed, 7 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/75/2175/3

diff --git a/pySim/cards.py b/pySim/cards.py
index fafc55f..925c5e6 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -434,19 +434,19 @@
 
def program(self, p):
 
+   # authenticate as ADM using default key (written on the card..)
+   if not p['pin_adm']:
+   raise ValueError("Please provide a PIN-ADM as there is 
no default one")
+   self._scc.verify_chv(0x0A, h2b(p['pin_adm']))
 
# select MF
r = self._scc.select_file(['3f00'])
 
+   # write EF.ICCID
+   data, sw = self._scc.update_binary('2fe2', 
enc_iccid(p['iccid']))
+
# select DF_GSM
r = self._scc.select_file(['7f20'])
-
-   # authenticate as ADM using default key (written on the card..)
-   if not p['pin_adm']:
-   raise ValueError("Please provide a PIN-ADM as there is 
no default one")
-
-   self._scc.verify_chv(0x0A, h2b(p['pin_adm']))
-
 
# set Ki in proprietary file
data, sw = self._scc.update_binary('00FF', p['ki'])

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ief85aa07c562d8d7b2a6dec302d2f485d0b1e577
Gerrit-PatchSet: 3
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Neels Hofmeyr 


[ABANDON] pysim[master]: fixup

2017-04-05 Thread dexter
dexter has abandoned this change.

Change subject: fixup
..


Abandoned

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

Gerrit-MessageType: abandon
Gerrit-Change-Id: I32a81a2f1bc0c8f4b4eb41c45c3000f60b2902c3
Gerrit-PatchSet: 1
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Owner: dexter 


[PATCH] osmo-bts[master]: Name systemd service after the software

2017-04-05 Thread Pau Espin Pedrol
Hello Max, Neels Hofmeyr, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/2225

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

Name systemd service after the software

Binary name was changed from sysmobts to osmo-bts but the service file
remained with the old name, which is confusing for newcomers.

Added an alias to the service file for users used to the old naming.

Change-Id: Ie336292c275e7415a1deedab7c3b44966aacc3bf
---
M Makefile.am
R contrib/osmo-bts-sysmo.service
M src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
M src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
4 files changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/25/2225/2

diff --git a/Makefile.am b/Makefile.am
index 9a5e26f..5598c4a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,7 @@
 
 # package the contrib and doc
 EXTRA_DIST = \
-   contrib/dump_docs.py contrib/screenrc-l1fwd contrib/sysmobts.service \
+   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 \
diff --git a/contrib/sysmobts.service b/contrib/osmo-bts-sysmo.service
similarity index 96%
rename from contrib/sysmobts.service
rename to contrib/osmo-bts-sysmo.service
index e07a3db..bbb2bef 100644
--- a/contrib/sysmobts.service
+++ b/contrib/osmo-bts-sysmo.service
@@ -17,3 +17,4 @@
 
 [Install]
 WantedBy=multi-user.target
+Alias=sysmobts.service
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c 
b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
index f01fd14..bdb8000 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_temp.c
@@ -116,7 +116,7 @@
 * and used SIGCHLD/waitpid to pick up the dead processes
 * without invoking shell.
 */
-   system("/bin/systemctl start sysmobts.service");
+   system("/bin/systemctl start osmo-bts-sysmo.service");
}
 }
 
@@ -157,7 +157,7 @@
 * and used SIGCHLD/waitpid to pick up the dead processes
 * without invoking shell.
 */
-   system("/bin/systemctl stop sysmobts.service");
+   system("/bin/systemctl stop osmo-bts-sysmo.service");
}
 }
 
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c 
b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
index 3020d90..b49f282 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_mgr_vty.c
@@ -284,7 +284,7 @@
 
 DEFUN(cfg_action_bts_srv_on, cfg_action_bts_srv_on_cmd,
"bts-service-on",
-   "Start the systemd sysmobts.service\n")
+   "Start the systemd osmo-bts-sysmo.service\n")
 {
int *action = vty->index;
*action |= TEMP_ACT_NORM_BTS_SRV_ON;
@@ -293,7 +293,7 @@
 
 DEFUN(cfg_no_action_bts_srv_on, cfg_no_action_bts_srv_on_cmd,
"no bts-service-on",
-   NO_STR "Start the systemd sysmobts.service\n")
+   NO_STR "Start the systemd osmo-bts-sysmo.service\n")
 {
int *action = vty->index;
*action &= ~TEMP_ACT_NORM_BTS_SRV_ON;
@@ -338,7 +338,7 @@
 
 DEFUN(cfg_action_bts_srv_off, cfg_action_bts_srv_off_cmd,
"bts-service-off",
-   "Stop the systemd sysmobts.service\n")
+   "Stop the systemd osmo-bts-sysmo.service\n")
 {
int *action = vty->index;
*action |= TEMP_ACT_BTS_SRV_OFF;
@@ -347,7 +347,7 @@
 
 DEFUN(cfg_no_action_bts_srv_off, cfg_no_action_bts_srv_off_cmd,
"no bts-service-off",
-   NO_STR "Stop the systemd sysmobts.service\n")
+   NO_STR "Stop the systemd osmo-bts-sysmo.service\n")
 {
int *action = vty->index;
*action &= ~TEMP_ACT_BTS_SRV_OFF;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie336292c275e7415a1deedab7c3b44966aacc3bf
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 


osmo-trx[master]: Configuration: Fix const and signedness compile warnings

2017-04-05 Thread Tom Tsou

Patch Set 1: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I701559814b2aee6f84f10e612f128da40f6a51c1
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Tom Tsou 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Tom Tsou 
Gerrit-HasComments: No


[PATCH] libosmocore[master]: gsm0808: make gsm0808_create_reset_ack() accessible

2017-04-05 Thread dexter

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

gsm0808: make gsm0808_create_reset_ack() accessible

The create function to generate the RESET ACKNOWLEDGE
message is not accessible from outside, as it does not
appear in limosmogsm.map. It also has not testcase.

This commit adds gsm0808_create_reset_ack() to the
map file and also adds a testcase.

Change-Id: I82d3411484f82b4a9205d407fa0442244678f183
---
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
3 files changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/29/2229/1

diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index a4e6083..c825dd5 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -141,6 +141,7 @@
 gsm0808_create_layer3;
 gsm0808_create_layer3_aoip;
 gsm0808_create_reset;
+gsm0808_create_reset_ack;
 gsm0808_create_sapi_reject;
 gsm0808_prepend_dtap_header;
 gsm0808_enc_aoip_trasp_addr;
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index a0ff6d5..8304052 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -123,6 +123,18 @@
msgb_free(msg);
 }
 
+static void test_create_reset_ack()
+{
+   static const uint8_t res[] = { 0x00, 0x01, 0x31 };
+   struct msgb *msg;
+
+   printf("Testing creating Reset Ack\n");
+   msg = gsm0808_create_reset_ack();
+   VERIFY(msg, res, ARRAY_SIZE(res));
+   msgb_free(msg);
+}
+
+
 static void test_create_clear_command()
 {
static const uint8_t res[] = { 0x20, 0x04, 0x01, 0x23 };
@@ -828,6 +840,7 @@
test_create_layer3();
test_create_layer3_aoip();
test_create_reset();
+   test_create_reset_ack();
test_create_clear_command();
test_create_clear_complete();
test_create_cipher();
diff --git a/tests/gsm0808/gsm0808_test.ok b/tests/gsm0808/gsm0808_test.ok
index 52af134..e101d65 100644
--- a/tests/gsm0808/gsm0808_test.ok
+++ b/tests/gsm0808/gsm0808_test.ok
@@ -2,6 +2,7 @@
 Testing creating Layer3
 Testing creating Layer3 (AoIP)
 Testing creating Reset
+Testing creating Reset Ack
 Testing creating Clear Command
 Testing creating Clear Complete
 Testing creating Chipher Mode Command

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I82d3411484f82b4a9205d407fa0442244678f183
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: dexter 


[MERGED] osmo-iuh[master]: asn1tostruct.py: specify python version in shebang

2017-04-05 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged.

Change subject: asn1tostruct.py: specify python version in shebang
..


asn1tostruct.py: specify python version in shebang

The script is expected to be run using python 2.x, but nowadays some
distros are already using python 3 as default, which will fail to run
this script.

This change fixes compilation in my Archlinux box.

Change-Id: I6eb95351538a64f2b23d638824972818591b1b66
---
M asn1/utils/asn1tostruct.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/asn1/utils/asn1tostruct.py b/asn1/utils/asn1tostruct.py
index 1a2d95f..8364c27 100755
--- a/asn1/utils/asn1tostruct.py
+++ b/asn1/utils/asn1tostruct.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import re, os, sys, string
 import datetime

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I6eb95351538a64f2b23d638824972818591b1b66
Gerrit-PatchSet: 1
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


osmo-iuh[master]: asn1tostruct.py: specify python version in shebang

2017-04-05 Thread Neels Hofmeyr

Patch Set 1: Code-Review+2

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

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


[PATCH] openbsc[master]: abis: log known ACKs and unknown messages

2017-04-05 Thread Max
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/2227

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

abis: log known ACKs and unknown messages

Log expected ACK messages and unhandled messages to aid in
troubleshooting.

Change-Id: Id3afaaa76e24f63076ae0e6fd2322e4a7fa29b45
Related: OS#1614
---
M openbsc/src/libbsc/abis_nm.c
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/27/2227/3

diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index 33a23a2..20e8e60 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -694,7 +694,20 @@
case NM_MT_BS11_LMT_SESSION:
ret = abis_nm_rx_lmt_event(mb);
break;
+   case NM_MT_OPSTART_ACK:
+   abis_nm_debugp_foh(DNM, foh);
+   DEBUGP(DNM, "Opstart ACK\n");
+   break;
+   case NM_MT_SET_CHAN_ATTR_ACK:
+   abis_nm_debugp_foh(DNM, foh);
+   DEBUGP(DNM, "Set Channel Attributes ACK\n");
+   break;
+   case NM_MT_SET_RADIO_ATTR_ACK:
+   abis_nm_debugp_foh(DNM, foh);
+   DEBUGP(DNM, "Set Radio Carrier Attributes ACK\n");
+   break;
case NM_MT_CONN_MDROP_LINK_ACK:
+   abis_nm_debugp_foh(DNM, foh);
DEBUGP(DNM, "CONN MDROP LINK ACK\n");
break;
case NM_MT_IPACC_RESTART_ACK:
@@ -705,6 +718,10 @@
break;
case NM_MT_SET_BTS_ATTR_ACK:
break;
+   default:
+   abis_nm_debugp_foh(DNM, foh);
+   LOGP(DNM, LOGL_ERROR, "Unhandled message %s\n",
+get_value_string(abis_nm_msgtype_names, mt));
}
 
abis_nm_queue_send_next(bts);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id3afaaa76e24f63076ae0e6fd2322e4a7fa29b45
Gerrit-PatchSet: 3
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


openbsc[master]: abis: log known ACKs and unknown messages

2017-04-05 Thread Harald Welte

Patch Set 2: Code-Review-2

(1 comment)

https://gerrit.osmocom.org/#/c/2227/2/openbsc/src/libbsc/abis_nm.c
File openbsc/src/libbsc/abis_nm.c:

Line 700:  btstype2str(bts->type));
The BTS type is not useful here (it is static configuratoin for one given BTS 
number).  The MO class + instance is the important information.  Was it TS0 on 
TRX1 that sent us th emessage?  Opstart messages are not sent "by a bts" but by 
one specific managed objcet identified by the MO header.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Id3afaaa76e24f63076ae0e6fd2322e4a7fa29b45
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


libosmo-sccp[master]: Add new 'osmo_ss7' SS7 core code with M3UA, ASP/AS FSM, ...

2017-04-05 Thread Harald Welte

Patch Set 2: Code-Review+2

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

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


libosmocore[master]: gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQST

2017-04-05 Thread Harald Welte

Patch Set 6: Code-Review+2

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

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


osmo-bts[master]: Name systemd service after the software

2017-04-05 Thread Max

Patch Set 1:

I wonder if it's worth it to merge common parts with 
debian/osmo-bts-trx.service?

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

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


[PATCH] openbsc[master]: abis: log known ACKs and unknown messages

2017-04-05 Thread Max
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/2227

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

abis: log known ACKs and unknown messages

Log expected ACK messages and unhandled messages to aid in
troubleshooting.

Change-Id: Id3afaaa76e24f63076ae0e6fd2322e4a7fa29b45
Related: OS#1614
---
M openbsc/src/libbsc/abis_nm.c
1 file changed, 22 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/27/2227/2

diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c
index 33a23a2..ff0a70b 100644
--- a/openbsc/src/libbsc/abis_nm.c
+++ b/openbsc/src/libbsc/abis_nm.c
@@ -694,8 +694,25 @@
case NM_MT_BS11_LMT_SESSION:
ret = abis_nm_rx_lmt_event(mb);
break;
+   case NM_MT_OPSTART_ACK:
+   abis_nm_debugp_foh(DNM, foh);
+   DEBUGP(DNM, "Opstart acked by BTS %u type %s\n", bts->nr,
+  btstype2str(bts->type));
+   break;
+   case NM_MT_SET_CHAN_ATTR_ACK:
+   abis_nm_debugp_foh(DNM, foh);
+   DEBUGP(DNM, "Set Channel Attributes acked by BTS %u type %s\n",
+  bts->nr, btstype2str(bts->type));
+   break;
+   case NM_MT_SET_RADIO_ATTR_ACK:
+   abis_nm_debugp_foh(DNM, foh);
+   DEBUGP(DNM, "Set Radio Carrier Attributes acked by BTS %u type 
%s\n",
+  bts->nr, btstype2str(bts->type));
+   break;
case NM_MT_CONN_MDROP_LINK_ACK:
-   DEBUGP(DNM, "CONN MDROP LINK ACK\n");
+   abis_nm_debugp_foh(DNM, foh);
+   DEBUGP(DNM, "CONN MDROP LINK acked by BTS %u type %s\n",
+  bts->nr, btstype2str(bts->type));
break;
case NM_MT_IPACC_RESTART_ACK:
osmo_signal_dispatch(SS_NM, S_NM_IPACC_RESTART_ACK, NULL);
@@ -705,6 +722,10 @@
break;
case NM_MT_SET_BTS_ATTR_ACK:
break;
+   default:
+   LOGP(DNM, LOGL_ERROR, "Unhandled message %s from BTS type %s\n",
+get_value_string(abis_nm_msgtype_names, mt),
+btstype2str(bts->type));
}
 
abis_nm_queue_send_next(bts);

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id3afaaa76e24f63076ae0e6fd2322e4a7fa29b45
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder


[PATCH] libosmocore[master]: gsm0808: Add create functions for CIPHER MODE COMMAND

2017-04-05 Thread dexter
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/2182

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

gsm0808: Add create functions for CIPHER MODE COMMAND

gsm0808.h/c lacks functionality to generate CIPHER MODE COMMAND messages. These
messages are required if the code is used in an MSC implementation.

This commit adds a gsm0808_create_cipher() function, that generates an A/AoiP
CIPHER MODE COMMAND message.

Change-Id: I8eb1c357860c3e740b0f5d17e1c256bc87920958
---
M include/osmocom/gsm/gsm0808.h
M src/gsm/gsm0808.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
5 files changed, 78 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/82/2182/5

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index fd73376..9738a55 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -35,6 +35,8 @@
 struct msgb *gsm0808_create_reset_ack(void);
 struct msgb *gsm0808_create_clear_command(uint8_t reason);
 struct msgb *gsm0808_create_clear_complete(void);
+struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei,
+  const uint8_t *cipher_response_mode);
 struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t 
alg_id);
 struct msgb *gsm0808_create_cipher_reject(uint8_t cause);
 struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t 
cm2_len,
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index b8ab79b..c952a9f 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -131,6 +131,39 @@
return msg;
 }
 
+struct msgb *gsm0808_create_cipher(const struct gsm0808_encrypt_info *ei,
+  const uint8_t *cipher_response_mode)
+{
+   /* See also: 3GPP TS 48.008 3.2.1.30 CIPHER MODE COMMAND */
+   struct msgb *msg;
+
+   /* Mandatory emelent! */
+   OSMO_ASSERT(ei);
+
+   msg =
+   msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM,
+   "cipher-mode-command");
+   if (!msg)
+   return NULL;
+
+   /* Message Type 3.2.2.1 */
+   msgb_v_put(msg, BSS_MAP_MSG_CIPHER_MODE_CMD);
+
+   /* Encryption Information 3.2.2.10 */
+   gsm0808_enc_encrypt_info(msg, ei);
+
+   /* Cipher Response Mode 3.2.2.34 */
+   if (cipher_response_mode)
+   msgb_tv_put(msg, GSM0808_IE_CIPHER_RESPONSE_MODE,
+   *cipher_response_mode);
+
+   /* pre-pend the header */
+   msg->l3h =
+   msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
+
+   return msg;
+}
+
 struct msgb *gsm0808_create_cipher_complete(struct msgb *layer3, uint8_t 
alg_id)
 {
struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, 
BSSMAP_MSG_HEADROOM,
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index cf0a7fe..786bf08 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -128,6 +128,7 @@
 gsm0808_create_ass_compl;
 gsm0808_create_assignment_failure;
 gsm0808_create_ass_fail;
+gsm0808_create_cipher;
 gsm0808_create_cipher_complete;
 gsm0808_create_cipher_reject;
 gsm0808_create_classmark_update;
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index af457b4..f33e0bd 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -144,6 +144,46 @@
msgb_free(msg);
 }
 
+static void test_create_cipher()
+{
+   static const uint8_t res[] =
+   { 0x00, 0x0c, 0x53, 0x0a, 0x09, 0x03, 0xaa,
+ 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x23, 0x42 };
+   static const uint8_t res2[] =
+   { 0x00, 0x0e, 0x53, 0x0a, 0x09, 0x03, 0xaa,
+ 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x23, 0x42,
+ GSM0808_IE_CIPHER_RESPONSE_MODE, 0x01 };
+   struct msgb *msg;
+   struct gsm0808_encrypt_info ei;
+   uint8_t include_imeisv;
+
+   memset(, 0, sizeof(ei));
+   ei.perm_algo[0] = GSM0808_ALG_ID_A5_0;
+   ei.perm_algo[1] = GSM0808_ALG_ID_A5_1;
+   ei.perm_algo_len = 2;
+   ei.key[0] = 0xaa;
+   ei.key[1] = 0xbb;
+   ei.key[2] = 0xcc;
+   ei.key[3] = 0xdd;
+   ei.key[4] = 0xee;
+   ei.key[5] = 0xff;
+   ei.key[6] = 0x23;
+   ei.key[7] = 0x42;
+   ei.key_len = 8;
+   include_imeisv = 1;
+
+   printf("Testing creating Chipher Mode Command\n");
+   msg = gsm0808_create_cipher(, NULL);
+   OSMO_ASSERT(msg);
+   VERIFY(msg, res, ARRAY_SIZE(res));
+   msgb_free(msg);
+
+   msg = gsm0808_create_cipher(, _imeisv);
+   OSMO_ASSERT(msg);
+   VERIFY(msg, res2, ARRAY_SIZE(res2));
+   msgb_free(msg);
+}
+
 static void test_create_cipher_complete()
 {
static const uint8_t res1[] = {
@@ -700,6 +740,7 @@
test_create_reset();
test_create_clear_command();
test_create_clear_complete();
+   

[PATCH] libosmocore[master]: gsm0808: Add AoIP specific elements to gsm0808_create_... fu...

2017-04-05 Thread dexter
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/2178

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

gsm0808: Add AoIP specific elements to gsm0808_create_... functions

the classic A implementation in libosmocore lacks support for AoIP
message elements. This patch adds support for AoIP by adding a set
of new gsm0808_create_..., which support the missing AoIP message
elements

Change-Id: I77f866abec1822d19871052f3c647ad782785b34
---
M include/osmocom/gsm/gsm0808.h
M src/gsm/gsm0808.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
5 files changed, 195 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/2178/5

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index a7e102c..fd73376 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -20,10 +20,17 @@
 #pragma once
 
 #include "tlv.h"
+#include 
+#include 
 
 struct msgb;
 
-struct msgb *gsm0808_create_layer3(struct msgb *msg, uint16_t netcode, 
uint16_t countrycode, int lac, uint16_t ci);
+struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc,
+  uint16_t cc, int lac, uint16_t _ci);
+struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc,
+   uint16_t cc, int lac, uint16_t _ci,
+   const struct gsm0808_speech_codec_list
+   *scl);
 struct msgb *gsm0808_create_reset(void);
 struct msgb *gsm0808_create_reset_ack(void);
 struct msgb *gsm0808_create_clear_command(uint8_t reason);
@@ -33,9 +40,19 @@
 struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t 
cm2_len,
 const uint8_t *cm3, uint8_t 
cm3_len);
 struct msgb *gsm0808_create_sapi_reject(uint8_t link_id);
+struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
+ uint8_t encr_alg_id, uint8_t speech_mode,
+ const struct sockaddr_storage *ss,
+ const struct gsm0808_speech_codec *sc,
+ const struct gsm0808_speech_codec_list
+ *scl);
 struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
-uint8_t chosen_channel, 
uint8_t encr_alg_id,
+uint8_t chosen_channel,
+uint8_t encr_alg_id,
 uint8_t speech_mode);
+struct msgb *gsm0808_create_ass_fail(uint8_t cause, const uint8_t *rr_cause,
+const struct gsm0808_speech_codec_list
+*scl);
 struct msgb *gsm0808_create_assignment_failure(uint8_t cause, uint8_t 
*rr_cause);
 struct msgb *gsm0808_create_clear_rqst(uint8_t cause);
 
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index de80006..b8ab79b 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -19,6 +19,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
@@ -27,7 +28,10 @@
 #define BSSMAP_MSG_SIZE 512
 #define BSSMAP_MSG_HEADROOM 128
 
-struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc, uint16_t 
cc, int lac, uint16_t _ci)
+struct msgb *gsm0808_create_layer3_aoip(const struct msgb *msg_l3, uint16_t nc,
+   uint16_t cc, int lac, uint16_t _ci,
+   const struct gsm0808_speech_codec_list
+   *scl)
 {
struct msgb* msg;
struct {
@@ -55,10 +59,20 @@
msgb_tlv_put(msg, GSM0808_IE_LAYER_3_INFORMATION,
 msgb_l3len(msg_l3), msg_l3->l3h);
 
+   /* AoIP: add Codec List (BSS Supported) 3.2.2.103 */
+   if (scl)
+   gsm0808_enc_speech_codec_list(msg, scl);
+
/* push the bssmap header */
msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, 
msgb_length(msg));
 
return msg;
+}
+
+struct msgb *gsm0808_create_layer3(struct msgb *msg_l3, uint16_t nc,
+  uint16_t cc, int lac, uint16_t _ci)
+{
+   return gsm0808_create_layer3_aoip(msg_l3, nc, cc, lac, _ci, NULL);
 }
 
 struct msgb *gsm0808_create_reset(void)
@@ -191,9 +205,12 @@
return msg;
 }
 
-struct msgb *gsm0808_create_assignment_completed(uint8_t rr_cause,
-uint8_t chosen_channel, 
uint8_t encr_alg_id,
-uint8_t speech_mode)
+struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
+ uint8_t encr_alg_id, uint8_t speech_mode,
+ 

[PATCH] libosmocore[master]: gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQST

2017-04-05 Thread dexter
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/2184

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

gsm0808: Add create functions for BSS_MAP_MSG_ASSIGMENT_RQST

gsm0808.h/c lacks functionality to generate BSS_MAP_MSG_ASSIGMENT_RQST messages.
These messages are required if the code is used in an MSC implementation.

This commit adds a gsm0808_create_assignment() function, that generates an
A/AoiP BSS_MAP_MSG_PAGING message.

Change-Id: I4d1d455a1e1cf95407e23ded7b7defbcf2dd6ff0
---
M include/osmocom/gsm/gsm0808.h
M src/gsm/gsm0808.c
M src/gsm/libosmogsm.map
M tests/gsm0808/gsm0808_test.c
M tests/gsm0808/gsm0808_test.ok
5 files changed, 113 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/2184/6

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index 990fd74..a9f610a 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -42,6 +42,11 @@
 struct msgb *gsm0808_create_classmark_update(const uint8_t *cm2, uint8_t 
cm2_len,
 const uint8_t *cm3, uint8_t 
cm3_len);
 struct msgb *gsm0808_create_sapi_reject(uint8_t link_id);
+struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
+   const uint16_t *cic,
+   const struct sockaddr_storage *ss,
+   const struct gsm0808_speech_codec_list *scl,
+   const uint32_t *ci);
 struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
  uint8_t encr_alg_id, uint8_t speech_mode,
  const struct sockaddr_storage *ss,
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 2721a1b..be58939 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -238,6 +238,62 @@
return msg;
 }
 
+struct msgb *gsm0808_create_ass(const struct gsm0808_channel_type *ct,
+   const uint16_t *cic,
+   const struct sockaddr_storage *ss,
+   const struct gsm0808_speech_codec_list *scl,
+   const uint32_t *ci)
+{
+   /* See also: 3GPP TS 48.008 3.2.1.1 ASSIGNMENT REQUEST */
+   struct msgb *msg;
+   uint16_t cic_sw;
+   uint32_t ci_sw;
+
+   /* Mandatory emelent! */
+   OSMO_ASSERT(ct);
+
+   msg =
+   msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM,
+   "bssmap: ass req");
+   if (!msg)
+   return NULL;
+
+   /* Message Type 3.2.2.1 */
+   msgb_v_put(msg, BSS_MAP_MSG_ASSIGMENT_RQST);
+
+   /* Channel Type 3.2.2.11 */
+   gsm0808_enc_channel_type(msg, ct);
+
+   /* Circuit Identity Code 3.2.2.2  */
+   if (cic) {
+   cic_sw = htons(*cic);
+   msgb_tv_fixed_put(msg, GSM0808_IE_CIRCUIT_IDENTITY_CODE,
+ sizeof(cic_sw), (uint8_t *) & cic_sw);
+   }
+
+   /* AoIP: AoIP Transport Layer Address (MGW) 3.2.2.102 */
+   if (ss) {
+   gsm0808_enc_aoip_trasp_addr(msg, ss);
+   }
+
+   /* AoIP: Codec List (MSC Preferred) 3.2.2.103 */
+   if (scl)
+   gsm0808_enc_speech_codec_list(msg, scl);
+
+   /* AoIP: Call Identifier 3.2.2.105 */
+   if (ci) {
+   ci_sw = htonl(*ci);
+   msgb_tv_fixed_put(msg, GSM0808_IE_CALL_ID, sizeof(ci_sw),
+ (uint8_t *) & ci_sw);
+   }
+
+   /* push the bssmap header */
+   msg->l3h =
+   msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, msgb_length(msg));
+
+   return msg;
+}
+
 struct msgb *gsm0808_create_ass_compl(uint8_t rr_cause, uint8_t chosen_channel,
  uint8_t encr_alg_id, uint8_t speech_mode,
  const struct sockaddr_storage *ss,
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index ec23418..a4e6083 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -124,6 +124,7 @@
 gsm0808_att_tlvdef;
 gsm0808_bssap_name;
 gsm0808_bssmap_name;
+gsm0808_create_ass;
 gsm0808_create_assignment_completed;
 gsm0808_create_ass_compl;
 gsm0808_create_assignment_failure;
diff --git a/tests/gsm0808/gsm0808_test.c b/tests/gsm0808/gsm0808_test.c
index b0dad7d..a0ff6d5 100644
--- a/tests/gsm0808/gsm0808_test.c
+++ b/tests/gsm0808/gsm0808_test.c
@@ -262,6 +262,55 @@
msgb_free(msg);
 }
 
+static void test_create_ass()
+{
+   static const uint8_t res1[] =
+   { 0x00, 0x0a, 0x01, 0x0b, 0x04, 0x01, 0x0b, 0xa1, 0x25, 0x01, 0x00,
+ 0x04 };
+   static const uint8_t res2[] =
+   { 0x00, 0x20, 0x01, 0x0b, 0x04, 0x01, 0x0b, 0xa1, 0x25, 0x01, 0x00,
+ 0x04, GSM0808_IE_AOIP_TRASP_ADDR, 0x06, 0xc0, 0xa8, 0x64, 0x17,
+ 

[MERGED] osmo-gsm-manuals[master]: gb.adoc: Add info to NS-over-UDP example

2017-04-05 Thread daniel
daniel has submitted this change and it was merged.

Change subject: gb.adoc: Add info to NS-over-UDP example
..


gb.adoc: Add info to NS-over-UDP example

Change-Id: I5b6d2fb284336614da28e0d1b01c7e8c26725f81
---
M common/chapters/gb.adoc
1 file changed, 3 insertions(+), 0 deletions(-)

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



diff --git a/common/chapters/gb.adoc b/common/chapters/gb.adoc
index 199ef2c..6a6f65c 100644
--- a/common/chapters/gb.adoc
+++ b/common/chapters/gb.adoc
@@ -20,6 +20,9 @@
 OsmoSGSN(config-ns)# encapsulation udp local-ip 127.0.0.1 <1>
 OsmoSGSN(config-ns)# encapsulation udp local-port 23000 <2>
 
+The example above configures a libosmogb based application to listen for
+incoming connections from PCUs on the specified address and port.
+
 <1> Set the local side IP address for NS-over-UDP
 <2> Set the local side UDP port number for NS-over-UDP. 23000 is the default
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5b6d2fb284336614da28e0d1b01c7e8c26725f81
Gerrit-PatchSet: 1
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max 
Gerrit-Reviewer: daniel 


[PATCH] osmo-iuh[master]: asn1tostruct.py: specify python version in shebang

2017-04-05 Thread Pau Espin Pedrol

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

asn1tostruct.py: specify python version in shebang

The script is expected to be run using python 2.x, but nowadays some
distros are already using python 3 as default, which will fail to run
this script.

This change fixes compilation in my Archlinux box.

Change-Id: I6eb95351538a64f2b23d638824972818591b1b66
---
M asn1/utils/asn1tostruct.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/asn1/utils/asn1tostruct.py b/asn1/utils/asn1tostruct.py
index 1a2d95f..8364c27 100755
--- a/asn1/utils/asn1tostruct.py
+++ b/asn1/utils/asn1tostruct.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
 
 import re, os, sys, string
 import datetime

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

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


[MERGED] openbsc[master]: python: fix Null logger

2017-04-05 Thread Max
Max has submitted this change and it was merged.

Change subject: python: fix Null logger
..


python: fix Null logger

Change-Id: Ie120273eabbc670e9f19ba365508688a810a2773
Related: SYS#3028
---
M openbsc/contrib/twisted_ipa.py
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/openbsc/contrib/twisted_ipa.py b/openbsc/contrib/twisted_ipa.py
index c143852..e6d7b1a 100755
--- a/openbsc/contrib/twisted_ipa.py
+++ b/openbsc/contrib/twisted_ipa.py
@@ -22,7 +22,7 @@
  */
 """
 
-__version__ = "0.5" # bump this on every non-trivial change
+__version__ = "0.6" # bump this on every non-trivial change
 
 from ipa import Ctrl, IPA
 from twisted.internet.protocol import ReconnectingClientFactory
@@ -318,8 +318,8 @@
 self.log = log
 else:
 self.log = logging.getLogger('IPAFactory')
-log.setLevel(logging.CRITICAL)
-log.addHandler(logging.NullHandler)
+self.log.setLevel(logging.CRITICAL)
+self.log.addHandler(logging.NullHandler)
 
 def clientConnectionFailed(self, connector, reason):
 """

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie120273eabbc670e9f19ba365508688a810a2773
Gerrit-PatchSet: 3
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Max 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max