[PATCH] osmo-bts[master]: lc-15, sysmo: l1_if: print name on PH-DATA.ind unknwon sapi

2017-07-31 Thread Pau Espin Pedrol

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

lc-15, sysmo: l1_if: print name on PH-DATA.ind unknwon sapi

Change-Id: I007e5f0ce9709026331817e55148749e21d8b015
---
M src/osmo-bts-litecell15/l1_if.c
M src/osmo-bts-sysmo/l1_if.c
2 files changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/97/3397/1

diff --git a/src/osmo-bts-litecell15/l1_if.c b/src/osmo-bts-litecell15/l1_if.c
index cb3efab..a3b9556 100644
--- a/src/osmo-bts-litecell15/l1_if.c
+++ b/src/osmo-bts-litecell15/l1_if.c
@@ -934,8 +934,8 @@
chan_nr = chan_nr_by_sapi(>ts[data_ind->u8Tn], data_ind->sapi,
data_ind->subCh, data_ind->u8Tn, data_ind->u32Fn);
if (!chan_nr) {
-   LOGP(DL1C, LOGL_ERROR, "PH-DATA-INDICATION for unknown sapi "
-   "%d\n", data_ind->sapi);
+   LOGP(DL1C, LOGL_ERROR, "PH-DATA-INDICATION for unknown sapi %s 
(%d)\n",
+get_value_string(lc15bts_l1sapi_names, data_ind->sapi), 
data_ind->sapi);
msgb_free(l1p_msg);
return ENOTSUP;
}
diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index a4bfffb..781900e 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -929,8 +929,8 @@
chan_nr = chan_nr_by_sapi(>ts[data_ind->u8Tn], data_ind->sapi,
data_ind->subCh, data_ind->u8Tn, data_ind->u32Fn);
if (!chan_nr) {
-   LOGP(DL1C, LOGL_ERROR, "PH-DATA-INDICATION for unknown sapi "
-   "%d\n", data_ind->sapi);
+   LOGP(DL1C, LOGL_ERROR, "PH-DATA-INDICATION for unknown sapi %s 
(%d)\n",
+get_value_string(femtobts_l1sapi_names, data_ind->sapi), 
data_ind->sapi);
msgb_free(l1p_msg);
return ENOTSUP;
}

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

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


[MERGED] osmo-gsm-tester[master]: suite: Don't stop cleanup of objects on cleanup exception

2017-07-31 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged.

Change subject: suite: Don't stop cleanup of objects on cleanup exception
..


suite: Don't stop cleanup of objects on cleanup exception

Let's accept that during cleanup time some stuff may not be in a good
state, specially in case of a failure, but let's keep harder to clean
up everything as much as possible.

This should fix an issue in which after a test failure using an esme object,
an smpp connection is kept in a buggy state and never removed/cleaned up, and
makes all tests after it fail too because the conn is triggered at
poll() time:

   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/suite.py",
 line 260, in run_tests
self.objects_cleanup()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/suite.py",
 line 199, in objects_cleanup
obj.cleanup()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py",
 line 345, in cleanup
self.dbus.cleanup()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py",
 line 170, in cleanup
self.set_powered(False)
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py",
 line 304, in set_powered
self.set_bool('Powered', powered)
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py",
 line 295, in set_bool
event_loop.poll()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/event_loop.py",
 line 39, in poll
func()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/esme.py",
 line 78, in poll
self.client.poll()
   File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 321, 
in poll
self.read_once(ignore_error_codes)
   File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 279, 
in read_once
p = self.read_pdu()
   File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 206, 
in read_pdu
raise exceptions.ConnectionError()
 smpplib.exceptions.ConnectionError

Change-Id: Ie7ef9284490f12f5cfd76c35b33b57eefab20eb6
---
M src/osmo_gsm_tester/suite.py
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index c4a9abc..d510b93 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -196,7 +196,10 @@
 def objects_cleanup(self):
 while self.objects_to_clean_up:
 obj = self.objects_to_clean_up.pop()
-obj.cleanup()
+try:
+obj.cleanup()
+except Exception:
+log.log_exn()
 
 def mark_start(self):
 self.start_timestamp = time.time()

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

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


[MERGED] osmo-gsm-tester[master]: esme: Log connection parameters of the SMSC

2017-07-31 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged.

Change subject: esme: Log connection parameters of the SMSC
..


esme: Log connection parameters of the SMSC

Change-Id: Ie4d3019503a68b02ace849defe618bdc74eacbd9
---
M src/osmo_gsm_tester/esme.py
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/esme.py b/src/osmo_gsm_tester/esme.py
index 89eaa39..7063c33 100644
--- a/src/osmo_gsm_tester/esme.py
+++ b/src/osmo_gsm_tester/esme.py
@@ -101,7 +101,7 @@
 self.connected = True
 self.client.bind_transceiver(system_id=self.system_id, 
password=self.password)
 self.bound = True
-self.log('Connected and bound successfully. Starting to listen')
+self.log('Connected and bound successfully to %s (%s:%d). Starting to 
listen.' % (self.system_id, host, port))
 self.start_listening()
 
 def disconnect(self):

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

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


osmo-gsm-tester[master]: esme: Log connection parameters of the SMSC

2017-07-31 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+2

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

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


osmo-gsm-tester[master]: suite: Don't stop cleanup of objects on cleanup exception

2017-07-31 Thread Pau Espin Pedrol

Patch Set 1: Code-Review+2

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

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


[PATCH] osmo-gsm-tester[master]: suite: Don't stop cleanup of objects on cleanup exception

2017-07-31 Thread Pau Espin Pedrol

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

suite: Don't stop cleanup of objects on cleanup exception

Let's accept that during cleanup time some stuff may not be in a good
state, specially in case of a failure, but let's keep harder to clean
up everything as much as possible.

This should fix an issue in which after a test failure using an esme object,
an smpp connection is kept in a buggy state and never removed/cleaned up, and
makes all tests after it fail too because the conn is triggered at
poll() time:

   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/suite.py",
 line 260, in run_tests
self.objects_cleanup()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/suite.py",
 line 199, in objects_cleanup
obj.cleanup()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py",
 line 345, in cleanup
self.dbus.cleanup()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py",
 line 170, in cleanup
self.set_powered(False)
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py",
 line 304, in set_powered
self.set_bool('Powered', powered)
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/ofono_client.py",
 line 295, in set_bool
event_loop.poll()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/event_loop.py",
 line 39, in poll
func()
   File 
"/home/jenkins/workspace/osmo-gsm-tester_run/osmo-gsm-tester/src/osmo_gsm_tester/esme.py",
 line 78, in poll
self.client.poll()
   File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 321, 
in poll
self.read_once(ignore_error_codes)
   File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 279, 
in read_once
p = self.read_pdu()
   File "/usr/local/lib/python3.4/dist-packages/smpplib/client.py", line 206, 
in read_pdu
raise exceptions.ConnectionError()
 smpplib.exceptions.ConnectionError

Change-Id: Ie7ef9284490f12f5cfd76c35b33b57eefab20eb6
---
M src/osmo_gsm_tester/suite.py
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/src/osmo_gsm_tester/suite.py b/src/osmo_gsm_tester/suite.py
index c4a9abc..d510b93 100644
--- a/src/osmo_gsm_tester/suite.py
+++ b/src/osmo_gsm_tester/suite.py
@@ -196,7 +196,10 @@
 def objects_cleanup(self):
 while self.objects_to_clean_up:
 obj = self.objects_to_clean_up.pop()
-obj.cleanup()
+try:
+obj.cleanup()
+except Exception:
+log.log_exn()
 
 def mark_start(self):
 self.start_timestamp = time.time()

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

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


[PATCH] osmo-gsm-tester[master]: esme: Log connection parameters of the SMSC

2017-07-31 Thread Pau Espin Pedrol

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

esme: Log connection parameters of the SMSC

Change-Id: Ie4d3019503a68b02ace849defe618bdc74eacbd9
---
M src/osmo_gsm_tester/esme.py
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/src/osmo_gsm_tester/esme.py b/src/osmo_gsm_tester/esme.py
index 89eaa39..7063c33 100644
--- a/src/osmo_gsm_tester/esme.py
+++ b/src/osmo_gsm_tester/esme.py
@@ -101,7 +101,7 @@
 self.connected = True
 self.client.bind_transceiver(system_id=self.system_id, 
password=self.password)
 self.bound = True
-self.log('Connected and bound successfully. Starting to listen')
+self.log('Connected and bound successfully to %s (%s:%d). Starting to 
listen.' % (self.system_id, host, port))
 self.start_listening()
 
 def disconnect(self):

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

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


libosmocore[master]: l1sap.h: Add ber10k and lqual_cb to ph_tch_param

2017-07-31 Thread Alexander Chemeris

Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/3092/1/include/osmocom/gsm/l1sap.h
File include/osmocom/gsm/l1sap.h:

PS1, Line 88:  
a typo


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If4ae20c22b881e94585dad710f17b9e37f77bf82
Gerrit-PatchSet: 1
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Alexander Chemeris 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: Yes


libosmo-sccp[master]: sccp: fix possible nullpointer deref

2017-07-31 Thread Harald Welte

Patch Set 3: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I1a5dd1ea3167513bf9e7ae153f83e1ae3136c905
Gerrit-PatchSet: 3
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


osmo-iuh[master]: make point codes configurable by SCCP address book

2017-07-31 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


osmo-iuh[master]: apply ctx arg to osmo_ss7_vty_init_asp()

2017-07-31 Thread Harald Welte

Patch Set 2: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idccbdc669d740179153d0a73096745785bd2f5af
Gerrit-PatchSet: 2
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-HasComments: No


osmo-iuh[master]: move openbsc.git's iu.h, iu.c, iu_vty.c here as iu_client

2017-07-31 Thread Harald Welte

Patch Set 4: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Change-Id: I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0
Gerrit-PatchSet: 4
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-HasComments: No


[MERGED] osmo-bts[master]: lc15: Tweak led colors used in service file

2017-07-31 Thread Harald Welte
Harald Welte has submitted this change and it was merged.

Change subject: lc15: Tweak led colors used in service file
..


lc15: Tweak led colors used in service file

service sets led to orange before/while osmo-bts is being started.
osmo-bts-lc15 sets led to green while operating. (unchanged in here)
service sets led to red when osmo-bts stops running.

Change-Id: If351f49d1ead359192d0d80bbc381afd3459c940
---
M contrib/osmo-bts-lc15.service
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/contrib/osmo-bts-lc15.service b/contrib/osmo-bts-lc15.service
index ab7def8..6aa9751 100644
--- a/contrib/osmo-bts-lc15.service
+++ b/contrib/osmo-bts-lc15.service
@@ -3,10 +3,10 @@
 
 [Service]
 Type=simple
-ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/usr0/brightness'
-ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/usr1/brightness'
+ExecStartPre=/bin/sh -c 'echo 1 > /sys/class/leds/usr0/brightness'
+ExecStartPre=/bin/sh -c 'echo 1 > /sys/class/leds/usr1/brightness'
 ExecStart=/usr/bin/osmo-bts-lc15 -t 2 -s -c /etc/osmocom/osmo-bts.cfg -M
-ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/usr0/brightness'
+ExecStopPost=/bin/sh -c 'echo 1 > /sys/class/leds/usr0/brightness'
 ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/usr1/brightness'
 Restart=always
 RestartSec=2

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

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


osmo-bts[master]: lc15: Tweak led colors used in service file

2017-07-31 Thread Harald Welte

Patch Set 1: Code-Review+2

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

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


[PATCH] osmo-iuh[master]: move openbsc.git's iu.h, iu.c, iu_vty.c here as iu_client

2017-07-31 Thread Neels Hofmeyr
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/3187

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

move openbsc.git's iu.h, iu.c, iu_vty.c here as iu_client

To help split openbsc.git to separate MSC and SGSN repositories, place the
common Iu interface related code here in libosmo-ranap. Also apply various
improvements while moving (from intermittent code review).

The code depends on libosmo-ranap tightly. One reason to want this separate
from libosmo-ranap could be that it uses libosmo-sigtran, accepting an sccp
instance. However, including in libosmo-ranap is the simplest way to go. The
osmo-iuh build depends on libosmo-sigtran anyway because of OsmoHNBGW, and all
current users of libosmo-ranap also naturally link libosmo-sigtran already.

Apply prefix ranap_iu_ and RANAP_IU_ to allow smooth transition from the
openbsc.git iu_ to the libranap ranap_iu_ implementations.

Prune unneeded #include statements.

Instead of sccp_addr, store an rnc pointer in the ue_conn_ctx. To facilitate,
also:
- Move iu_rnc struct to iu_client.h (as ranap_iu_rnc).
- Instead of sccp_addr, pass rnc to ue_conn_ctx_alloc().
- Pass a local struct new_ue_conn_ctx containing the sccp_addr and conn_id up
  the RANAP handling stack in case of an InitialUE message.
- Separate the InitialUE message handling from cn_ranap_handle_co(), by moving
  to new and separate cn_ranap_handle_co_initial(), so we can still pass a
  looked-up ue_conn_ctx to all other cn_ranap_handle_co() code paths.
- Allocate the ue_conn_ctx only in ranap_handle_co_initial_ue(), not as early
  as before.
Note that we are not actually ever using the rnc pointer now present in
ue_conn_ctx. It could be used for more concise paging, to first page only the
RNC where we last saw the subscriber. So far we page all matching LAC/RACs.

Tweak error logging: use __func__ instead of writing the function names as
string constants.

In iu_client_vty.c:
- Move the asn.1 debug commands from logging over to the iu node. They are not
  specific to the logging target. They could qualify for an entirely separate
  'asn1' root node, but for simplicity place under 'iu'.
- Add the 'asn1' commands to ranap_iu_vty_config_write(), so far missing.
- remove the legacy "net." from a VTY error message, it is not known which name
  the parent node of 'iu' has.

Depends: libosmo-sccp I85b46269dbe7909e52873ace3f720f6292a4516c,
 libosmo-sccp Ie1aedd7894acd69ddc887cd65a8a0df4b38c
Change-Id: I6a3f7ad15be03fb94689b4af6ccfa828c25f45c0
---
M include/osmocom/ranap/Makefile.am
A include/osmocom/ranap/iu_client.h
M src/Makefile.am
A src/iu_client.c
A src/iu_client_vty.c
5 files changed, 999 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/87/3187/4

diff --git a/include/osmocom/ranap/Makefile.am 
b/include/osmocom/ranap/Makefile.am
index 0f83e03..1606928 100644
--- a/include/osmocom/ranap/Makefile.am
+++ b/include/osmocom/ranap/Makefile.am
@@ -12,6 +12,7 @@
ranap_common_cn.h \
ranap_msg_factory.h \
iu_helpers.h \
+   iu_client.h \
RANAP_AccuracyFulfilmentIndicator.h \
RANAP_AllocationOrRetentionPriority.h \
RANAP_AlternativeRABConfigurationRequest.h \
diff --git a/include/osmocom/ranap/iu_client.h 
b/include/osmocom/ranap/iu_client.h
new file mode 100644
index 000..873b2d2
--- /dev/null
+++ b/include/osmocom/ranap/iu_client.h
@@ -0,0 +1,74 @@
+#pragma once
+
+#include 
+
+#include 
+#include 
+#include 
+
+struct msgb;
+struct osmo_auth_vector;
+
+struct RANAP_RAB_SetupOrModifiedItemIEs_s;
+struct RANAP_Cause;
+
+struct ranap_iu_rnc;
+
+/* Debugging switches from asn1c and osmo-iuh */
+extern int asn_debug;
+extern int asn1_xer_print;
+
+enum ranap_nsap_addr_enc {
+   RANAP_NSAP_ADDR_ENC_X213,
+   RANAP_NSAP_ADDR_ENC_V4RAW,
+};
+
+struct ranap_ue_conn_ctx {
+   struct llist_head list;
+   struct ranap_iu_rnc *rnc;
+   uint32_t conn_id;
+   int integrity_active;
+   struct gprs_ra_id ra_id;
+   enum ranap_nsap_addr_enc rab_assign_addr_enc;
+};
+
+enum ranap_iu_event_type {
+   RANAP_IU_EVENT_RAB_ASSIGN,
+   RANAP_IU_EVENT_SECURITY_MODE_COMPLETE,
+   RANAP_IU_EVENT_IU_RELEASE, /* An actual Iu Release message was received 
*/
+   RANAP_IU_EVENT_LINK_INVALIDATED, /* A SUA link was lost or closed down 
*/
+};
+
+extern const struct value_string ranap_iu_event_type_names[];
+static inline const char *ranap_iu_event_type_str(enum ranap_iu_event_type e)
+{
+   return get_value_string(ranap_iu_event_type_names, e);
+}
+
+/* Implementations of iu_recv_cb_t shall find the ranap_ue_conn_ctx in 
msg->dst. */
+typedef int (* ranap_iu_recv_cb_t )(struct msgb *msg, struct gprs_ra_id *ra_id,
+   uint16_t *sai);
+
+typedef int (* ranap_iu_event_cb_t )(struct ranap_ue_conn_ctx *ue_ctx,
+enum ranap_iu_event_type type, void *data);
+

[PATCH] osmo-iuh[master]: make point codes configurable by SCCP address book

2017-07-31 Thread Neels Hofmeyr

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

make point codes configurable by SCCP address book

In the vty config, use the SCCP address book to configure the local and remote
SCCP addresses. Add VTY commands to set the remote SCCP addresses by name,
derive the ss7 instance from these addresses:

  cs7 instance 1
   point-code 0.23.0
   sccp-address msc
point-code 0.0.1
   sccp-address sgsn
point-code 0.0.2
  hnbgw
   iucs
remote-addr msc
   iups
remote-addr sgsn

Enforce that both IuCS and IuPS use the same ss7 instance. In the future, we
may add the feature to use two separate instances.

Depends: libosmo-sccp I75c67d289693f1c2a049ac61cf2b2097d6e5687d,
 Ie1aedd7894acd69ddc887cd65a8a0df4b38c,
 I85b46269dbe7909e52873ace3f720f6292a4516c

Change-Id: I33a7ba11eb7c2d9a5dc74d10fb0cf04bf664477b
---
M include/osmocom/iuh/hnbgw.h
M include/osmocom/iuh/hnbgw_cn.h
M src/hnbgw.c
M src/hnbgw_cn.c
M src/hnbgw_rua.c
M src/hnbgw_vty.c
6 files changed, 118 insertions(+), 98 deletions(-)


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

diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index db22d97..58bdab4 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -116,10 +116,8 @@
/*! The UDP port where we receive multiplexed CS user
 * plane traffic from HNBs */
uint16_t iuh_cs_mux_port;
-   const char *iucs_remote_ip;
-   uint16_t iucs_remote_port;
-   const char *iups_remote_ip;
-   uint16_t iups_remote_port;
+   const char *iucs_remote_addr_name;
+   const char *iups_remote_addr_name;
uint16_t rnc_id;
bool hnbap_allow_tmsi;
} config;
@@ -134,11 +132,11 @@
 
/* currently active CN links for CS and PS */
struct {
-   struct osmo_sccp_instance *instance;
+   struct osmo_sccp_instance *client;
struct hnbgw_cnlink *cnlink;
struct osmo_sccp_addr local_addr;
-   struct osmo_sccp_addr remote_addr_cs;
-   struct osmo_sccp_addr remote_addr_ps;
+   struct osmo_sccp_addr iucs_remote_addr;
+   struct osmo_sccp_addr iups_remote_addr;
} sccp;
 };
 
diff --git a/include/osmocom/iuh/hnbgw_cn.h b/include/osmocom/iuh/hnbgw_cn.h
index 93123f2..2e61d82 100644
--- a/include/osmocom/iuh/hnbgw_cn.h
+++ b/include/osmocom/iuh/hnbgw_cn.h
@@ -2,5 +2,4 @@
 
 #include 
 
-int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t 
stp_port,
- const char *local_ip, uint32_t local_pc);
+int hnbgw_cnlink_init(struct hnb_gw *gw, const char *stp_host, uint16_t 
stp_port, const char *local_ip);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 5d9f87b..409110f 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -79,14 +79,6 @@
gw->config.iuh_local_ip = talloc_strdup(gw, HNBGW_LOCAL_IP_DEFAULT);
gw->config.iuh_local_port = IUH_DEFAULT_SCTP_PORT;
 
-   gw->config.iucs_remote_ip = talloc_strdup(gw,
-   HNBGW_IUCS_REMOTE_IP_DEFAULT);
-   gw->config.iucs_remote_port = M3UA_PORT;
-
-   gw->config.iups_remote_ip = talloc_strdup(gw,
-   HNBGW_IUPS_REMOTE_IP_DEFAULT);
-   gw->config.iups_remote_port = M3UA_PORT;
-
gw->next_ue_ctx_id = 23;
INIT_LLIST_HEAD(>hnb_list);
INIT_LLIST_HEAD(>ue_list);
@@ -465,6 +457,7 @@
vty_info.copyright = osmo_hnbgw_copyright;
vty_init(_info);
 
+   osmo_ss7_vty_init_asp();
hnbgw_vty_init(g_hnb_gw, tall_hnb_ctx);
logging_vty_add_cmds(_log_info);
 
@@ -501,23 +494,12 @@
 
ranap_set_log_area(DRANAP);
 
-   OSMO_ASSERT(g_hnb_gw->config.iucs_remote_ip);
rc = hnbgw_cnlink_init(g_hnb_gw,
-  g_hnb_gw->config.iucs_remote_ip,
-  g_hnb_gw->config.iucs_remote_port,
-  "127.0.0.5" /* FIXME: configurable */,
-  23 /* FIXME: configurable */);
+  "127.0.0.1", M3UA_PORT, "127.0.0.5" /* FIXME: 
configurable */);
if (rc < 0) {
LOGP(DMAIN, LOGL_ERROR, "Failed to initialize SCCP link to 
CN\n");
exit(1);
}
-
-   osmo_sccp_make_addr_pc_ssn(_hnb_gw->sccp.remote_addr_cs,
-  1 /* FIXME: configurable */,
-  OSMO_SCCP_SSN_RANAP);
-   osmo_sccp_make_addr_pc_ssn(_hnb_gw->sccp.remote_addr_ps,
-  2 /* FIXME: configurable */,
-  OSMO_SCCP_SSN_RANAP);
 
OSMO_ASSERT(g_hnb_gw->config.iuh_local_ip);
LOGP(DMAIN, LOGL_NOTICE, "Listening for Iuh at %s %d\n",
diff --git a/src/hnbgw_cn.c b/src/hnbgw_cn.c
index e967260..4bd6506 100644

[PATCH] libosmo-sccp[master]: sccp: fix possible nullpointer deref

2017-07-31 Thread dexter
Hello Neels Hofmeyr, Jenkins Builder,

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

https://gerrit.osmocom.org/3354

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

sccp: fix possible nullpointer deref

check input parameters local_ip and remote_ip of the function
osmo_sccp_simple_client_on_ss7_id() before using them with
talloc_strdup()

Change-Id: I1a5dd1ea3167513bf9e7ae153f83e1ae3136c905
---
M src/sccp_user.c
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/54/3354/3

diff --git a/src/sccp_user.c b/src/sccp_user.c
index c9443a2..89a0320 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -331,8 +331,10 @@
goto out_rt;
asp_created = true;
 
-   asp->cfg.local.host = talloc_strdup(asp, local_ip);
-   asp->cfg.remote.host = talloc_strdup(asp, remote_ip);
+   local_ip ? asp->cfg.local.host =
+   talloc_strdup(asp, local_ip) : NULL;
+   remote_ip ? asp->cfg.remote.host =
+   talloc_strdup(asp, remote_ip) : NULL;
 
osmo_ss7_as_add_asp(as, asp->cfg.name);
}

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I1a5dd1ea3167513bf9e7ae153f83e1ae3136c905
Gerrit-PatchSet: 3
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr 


[PATCH] libosmo-sccp[master]: sccp: derive local address from given sccp instance

2017-07-31 Thread dexter
Hello Neels Hofmeyr, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/3330

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

sccp: derive local address from given sccp instance

The most important parts of an SCCP address are the routing
indicator and the pointcode. The latter one is always available
via the SS7 instance, so a basic local address can be derived
from there.

Add function osmo_sccp_local_addr_by_instance() to derive a basic
local SCCP address from a given SCCP instance

Change-Id: I371dc9132871aad3d8321ea13cf9fd69d76eff8f
---
M include/osmocom/sigtran/sccp_sap.h
M src/sccp_user.c
2 files changed, 26 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/30/3330/3

diff --git a/include/osmocom/sigtran/sccp_sap.h 
b/include/osmocom/sigtran/sccp_sap.h
index 24d64d9..732df2a 100644
--- a/include/osmocom/sigtran/sccp_sap.h
+++ b/include/osmocom/sigtran/sccp_sap.h
@@ -253,3 +253,7 @@
   const char *name);
 
 const char *osmo_sccp_name_by_addr(const struct osmo_sccp_addr *addr);
+
+void osmo_sccp_local_addr_by_instance(struct osmo_sccp_addr *dest_addr,
+ const struct osmo_sccp_instance *inst,
+ uint32_t ssn);
diff --git a/src/sccp_user.c b/src/sccp_user.c
index c9443a2..acd5ee1 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -22,6 +22,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
@@ -30,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "sccp_internal.h"
 #include "xua_internal.h"
@@ -231,6 +233,26 @@
talloc_free(inst);
 }
 
+/*! \brief derive a basic local SCCP-Address from a given SCCP instance.
+ *  \param[out] dest_addr pointer to output address memory
+ *  \param[in] inst SCCP instance
+ *  \param[in] ssn Subsystem Number */
+void osmo_sccp_local_addr_by_instance(struct osmo_sccp_addr *dest_addr,
+ const struct osmo_sccp_instance *inst,
+ uint32_t ssn)
+{
+   struct osmo_ss7_instance *ss7;
+
+   OSMO_ASSERT(dest_addr);
+   OSMO_ASSERT(inst);
+   ss7 = inst->ss7;
+   OSMO_ASSERT(ss7);
+
+   *dest_addr = (struct osmo_sccp_addr){};
+
+   osmo_sccp_make_addr_pc_ssn(dest_addr, ss7->cfg.primary_pc, ssn);
+}
+
 /***
  * Convenience function for CLIENT
  ***/

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I371dc9132871aad3d8321ea13cf9fd69d76eff8f
Gerrit-PatchSet: 3
Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Owner: dexter 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr