Change in osmo-hlr[master]: hlr.c: forward GSUP messages between clients

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13006 )

Change subject: hlr.c: forward GSUP messages between clients
..


Patch Set 11:

argh, @osmith, I think I undid some of your modifications by pushing another 
patch set.

My apologies, but I'm infinitely way past my time, can I burden you with 
resurrecting the parts I destroyed, while keeping the parts I might have fixed? 
thanks!


--
To view, visit https://gerrit.osmocom.org/13006
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
Gerrit-Change-Number: 13006
Gerrit-PatchSet: 11
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: osmith 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 12 Apr 2019 05:12:08 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-hlr[master]: use new OSMO_IMSI_BUF_SIZE

2019-04-11 Thread Neels Hofmeyr
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/13589

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

Change subject: use new OSMO_IMSI_BUF_SIZE
..

use new OSMO_IMSI_BUF_SIZE

Depends: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770 (libosmocore)
Change-Id: I8e8fa221e97303df3c6cce96b25d31a53f67b939
---
M src/hlr_ussd.c
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/89/13589/2
--
To view, visit https://gerrit.osmocom.org/13589
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8e8fa221e97303df3c6cce96b25d31a53f67b939
Gerrit-Change-Number: 13589
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-hlr[master]: hlr.c: forward GSUP messages between clients

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded a new patch set (#11) to the change originally 
created by osmith. ( https://gerrit.osmocom.org/13006 )

Change subject: hlr.c: forward GSUP messages between clients
..

hlr.c: forward GSUP messages between clients

Allow clients to forward any GSUP message between clients. Determine the
sender and receiver from the new {source,dest}_name{,_len} IEs. Reject
messages with a forged source name.

This will be used for the inter-MSC handover.

Depends: Ic00b0601eacff6d72927cea51767801142ee75db (libosmocore.git)
Related: OS#3793
Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
---
M src/hlr.c
1 file changed, 82 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/06/13006/11
--
To view, visit https://gerrit.osmocom.org/13006
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
Gerrit-Change-Number: 13006
Gerrit-PatchSet: 11
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: osmith 
Gerrit-CC: Vadim Yanitskiy 


Change in osmo-hlr[master]: GSUP routing: use Message Class IE

2019-04-11 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13588

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

Change subject: GSUP routing: use Message Class IE
..

GSUP routing: use Message Class IE

Include the GSUP Class from original message in routing error responses.
Add the Message Class to GSUP router logging.

Depends: Ic397a9f2c4a7224e47cab944c72e75ca5592efef (libosmocore)
Change-Id: I8dc3967d9372d63e9d57ca2608dd3316edb234a4
---
M src/hlr.c
1 file changed, 17 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/88/13588/2
--
To view, visit https://gerrit.osmocom.org/13588
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8dc3967d9372d63e9d57ca2608dd3316edb234a4
Gerrit-Change-Number: 13588
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Vadim Yanitskiy 


Change in osmo-ttcn3-hacks[master]: msc: f_tc_sgsap_mt_sms_and_reject: shorter delay

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has abandoned this change. ( https://gerrit.osmocom.org/13615 )

Change subject: msc: f_tc_sgsap_mt_sms_and_reject: shorter delay
..


Abandoned
--
To view, visit https://gerrit.osmocom.org/13615
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: I4b2a588bcd20a4c04162997b9fe357dbe37178e9
Gerrit-Change-Number: 13615
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ttcn3-hacks[master]: msc: mo and mt voice call tests: add lots of missing parts

2019-04-11 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13616

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

Change subject: msc: mo and mt voice call tests: add lots of missing parts
..

msc: mo and mt voice call tests: add lots of missing parts

Both f_mo_call_establish() and f_mt_call_establish() were testing barely half a
voice call setup.  For example, f_mo_call_establish() used to be satisfied with
just two CRCX, but no actual RTP connections being made.

Add numerous MNCC and MGCP messages more closely resembling an actual call.

The main reason is to achieve a state that passes both current osmo-msc master
as well as the upcoming inter-MSC Handover refactoring.

Add log markers to f_*_call_*(): often when a test halts, it is not at all
clear why. With these log markers it is saner to figure out what has happened
and what hasn't.

Change-Id: I162985045bb5e129977a3a797b656e30220990df
---
M library/L3_Templates.ttcn
M library/MGCP_Templates.ttcn
M library/MNCC_Types.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
5 files changed, 200 insertions(+), 42 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/16/13616/4
--
To view, visit https://gerrit.osmocom.org/13616
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I162985045bb5e129977a3a797b656e30220990df
Gerrit-Change-Number: 13616
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ttcn3-hacks[master]: msc: f_call_hangup: ignore MDCX

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has abandoned this change. ( https://gerrit.osmocom.org/13168 )

Change subject: msc: f_call_hangup: ignore MDCX
..


Abandoned
--
To view, visit https://gerrit.osmocom.org/13168
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: I768f16288617aade6a4d6548129e6f9e0b1d4d33
Gerrit-Change-Number: 13168
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Harald Welte 


Change in osmo-ttcn3-hacks[master]: msc: f_call_hangup: ignore MDCX

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13168 )

Change subject: msc: f_call_hangup: ignore MDCX
..


Patch Set 1:

actually it was removed completely.


--
To view, visit https://gerrit.osmocom.org/13168
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I768f16288617aade6a4d6548129e6f9e0b1d4d33
Gerrit-Change-Number: 13168
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Fri, 12 Apr 2019 05:04:43 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: msc: f_call_hangup: ignore MDCX

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13168 )

Change subject: msc: f_call_hangup: ignore MDCX
..


Patch Set 1:

sorry, forgot about this one for a while.
It is now absorbed in the the commit named "msc: mo and mt voice call tests: 
add lots of missing parts" by fixing call establishment in general. There 
shouldn't be stray MDCX left now.

I162985045bb5e129977a3a797b656e30220990df


--
To view, visit https://gerrit.osmocom.org/13168
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I768f16288617aade6a4d6548129e6f9e0b1d4d33
Gerrit-Change-Number: 13168
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Fri, 12 Apr 2019 04:50:55 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP: add inter-MSC handover related msgs and IEs

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/12860 )

Change subject: GSUP: add inter-MSC handover related msgs and IEs
..


Set Ready For Review


--
To view, visit https://gerrit.osmocom.org/12860
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic00b0601eacff6d72927cea51767801142ee75db
Gerrit-Change-Number: 12860
Gerrit-PatchSet: 9
Gerrit-Owner: osmith 
Gerrit-Reviewer: Daniel Willmann 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Fri, 12 Apr 2019 04:47:28 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmocore[master]: add identifier sanitation for setting FSM instance ids

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13574 )

Change subject: add identifier sanitation for setting FSM instance ids
..

add identifier sanitation for setting FSM instance ids

We often compose FSM instance IDs from context information, for example placing
an MSISDN string or IP:port information in the FSM instance id, using
osmo_fsm_inst_update_id_f(). This fails if any characters are contained that
don't pass osmo_identifier_valid(). Hence it is the task of the caller to make
sure only characters allowed in an FSM id are applied.

Provide API to trivially allow this by replacing illegal chars:
- osmo_identifier_sanitize_buf(), with access to the same set of illegal
  characters defined in utils.c,
- osmo_fsm_inst_update_id_f_sanitize() implicitly replaces non-identifier
  chars.

This makes it easy to add strings like '192.168.0.1:2342' or '+4987654321' to
an FSM instance id, without adding string mangling to each place that sets an
id; e.g. replacing with '-' to yield '192-168-0-1:2342' or '-4987654321'.

Change-Id: Ia40a6f3b2243c95fe428a080b938e11d8ab771a7
---
M include/osmocom/core/fsm.h
M include/osmocom/core/utils.h
M src/fsm.c
M src/utils.c
4 files changed, 53 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h
index c9e1e0c..41d01a5 100644
--- a/include/osmocom/core/fsm.h
+++ b/include/osmocom/core/fsm.h
@@ -220,6 +220,7 @@

 int osmo_fsm_inst_update_id(struct osmo_fsm_inst *fi, const char *id);
 int osmo_fsm_inst_update_id_f(struct osmo_fsm_inst *fi, const char *fmt, ...);
+int osmo_fsm_inst_update_id_f_sanitize(struct osmo_fsm_inst *fi, char 
replace_with, const char *fmt, ...);

 const char *osmo_fsm_event_name(struct osmo_fsm *fsm, uint32_t event);
 const char *osmo_fsm_inst_name(struct osmo_fsm_inst *fi);
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index 08735fd..f27359c 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -140,6 +140,7 @@

 bool osmo_identifier_valid(const char *str);
 bool osmo_separated_identifiers_valid(const char *str, const char *sep_chars);
+void osmo_identifier_sanitize_buf(char *str, const char *sep_chars, char 
replace_with);

 const char *osmo_escape_str(const char *str, int len);
 char *osmo_escape_str_buf2(char *buf, size_t bufsize, const char *str, int 
in_len);
diff --git a/src/fsm.c b/src/fsm.c
index b6912c6..c32767b 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -364,6 +364,35 @@
return 0;
 }

+/*! Change id of the FSM instance using a string format, and ensuring a valid 
id.
+ * Replace any characters that are not permitted as FSM identifier with 
replace_with.
+ * \param[in] fi FSM instance.
+ * \param[in] replace_with Character to use instead of non-permitted FSM id 
characters.
+ * Make sure to choose a legal character, e.g. '-'.
+ * \param[in] fmt format string to compose new ID.
+ * \param[in] ... variable argument list for format string.
+ * \returns 0 if the ID was updated, otherwise -EINVAL.
+ */
+int osmo_fsm_inst_update_id_f_sanitize(struct osmo_fsm_inst *fi, char 
replace_with, const char *fmt, ...)
+{
+   char *id = NULL;
+   va_list ap;
+   int rc;
+
+   if (!fmt)
+   return osmo_fsm_inst_update_id(fi, NULL);
+
+   va_start(ap, fmt);
+   id = talloc_vasprintf(fi, fmt, ap);
+   va_end(ap);
+
+   osmo_identifier_sanitize_buf(id, NULL, replace_with);
+
+   rc = osmo_fsm_inst_update_id(fi, id);
+   talloc_free(id);
+   return rc;
+}
+
 /*! allocate a new instance of a specified FSM
  *  \param[in] fsm Descriptor of the FSM
  *  \param[in] ctx talloc context from which to allocate memory
diff --git a/src/utils.c b/src/utils.c
index 6116d3a..896e917 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -553,6 +553,8 @@
return true;
 }

+static const char osmo_identifier_illegal_chars[] = "., 
{}[]()<>|~\\^`'\"?=;/+*&%$#!";
+
 /*! Determine if a given identifier is valid, i.e. doesn't contain illegal 
chars
  *  \param[in] str String to validate
  *  \param[in] sep_chars Permitted separation characters between identifiers.
@@ -561,7 +563,6 @@
 bool osmo_separated_identifiers_valid(const char *str, const char *sep_chars)
 {
/* characters that are illegal in names */
-   static const char illegal_chars[] = "., {}[]()<>|~\\^`'\"?=;/+*&%$#!";
unsigned int i;
size_t len;

@@ -578,7 +579,7 @@
if (!isprint((int)str[i]))
return false;
/* check for some explicit reserved control characters */
-   if (strchr(illegal_chars, str[i]))
+   if (strchr(osmo_identifier_illegal_chars, str[i]))
return false;
}

@@ -594,6 +595,25 @@
return 

Change in libosmocore[master]: add osmo_{escape, quote}_str_buf2() for standard args ordering

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13573 )

Change subject: add osmo_{escape,quote}_str_buf2() for standard args ordering
..

add osmo_{escape,quote}_str_buf2() for standard args ordering

To be able to append an escaped or quoted string using
OSMO_STRBUF_APPEND_NOLEN(), the function signature must have the buf and len as
first args, like most other *_buf() functions.

Add osmo_escape_str_buf2() and osmo_quote_str_buf2() to match this signature.

A recent patch [1] has changed the return value of osmo_escape_str_buf() to
char*, removing the const. However, the functions may return const strings,
hence re-add the const. The new signatures always return the non-const buffer.

To avoid code duplication, implement osmo_quote_str_buf() and
osmo_escape_str_buf() by calling the new functions.

I decided to allow slight changes to the behavior for current osmo_escape_str()
and osmo_escape_str_buf(), because impact on callers is minimal:

(1) The new implementation uses OSMO_STRBUF_*, and in consequence
osmo_quote_str() no longer prints an ending double quote after truncated
strings; Before, a truncated output was, sic:
  "this string is trunca"
and now this becomes, sic:
  "this string is truncat
I decided to not keep the old behavior because it is questionable to begin
with. It looks like the string actually ended at the truncation boundary
instead of the reason being not enough space in the output buffer.

(2) The new osmo_escape_str_buf2() function obviously cannot pass-thru an
unchanged char* if no escaping was needed. Sacrifice this tiny optimization
feature to avoid code duplication:
- it is an unnoticeable optimization,
- the caller anyway always passes a string buffer,
- the feature caused handling strings and buffers differently depending on
  their content (i.e. code that usually writes out strings in full length
  "suddenly" truncates because a non-printable character is contained, etc.)
I considered adding a skip_if_unescaped flag to the osmo_quote_str_buf2()
function signature, but in the end decided that the API clutter is not worth
having for all the above reasons.

Adjust tests to accomodate above changes.

[1] 4a62eda225ab7f3c9556990c81a6fc5e19b5eec8
Ibf85f79e93244f53b2684ff6f1095c5b41203e05

Change-Id: Id748b906b0083b1f1887f2be7a53cae705a8a9ae
---
M TODO-RELEASE
M include/osmocom/core/utils.h
M src/utils.c
M tests/utils/utils_test.c
M tests/utils/utils_test.ok
5 files changed, 117 insertions(+), 49 deletions(-)

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



diff --git a/TODO-RELEASE b/TODO-RELEASE
index 5ddc57a..7c81e32 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -11,3 +11,11 @@
 libosmogb  gprs_nsvc   Adding sig_weight and data_weight 
members for IP-SNS support
 libosmogb  various new symbols Adding functions related to IP-SNS 
support
 libosmocoreosmo_fsm_inst   Add flag proc.terminating (ABI change)
+libosmocoreosmo_escape_str(),  These now always copy to the buffer 
instead of returning the
+   osmo_escape_str_buf() unchanged input string when no chars 
needed escaping, hence
+ returned strings might now also be 
truncated even if all chars were printable.
+libosmocoreosmo_escape_str_buf2()  New function signature similar to 
snprintf(), for use with OSMO_STRBUF_APPEND().
+libosmocoreosmo_quote_str(),   On string truncation, these used to 
print a closing quote '"' after the
+   osmo_quote_str_buf()  truncated string. This is no longer 
the case. e.g. a string 'truncated' in a
+ 9-char buffer used to print 
'"trunca"\0', which now becomes '"truncat\0'.
+libosmocoreosmo_quote_str_buf2()   New function signature similar to 
snprintf(), for use with OSMO_STRBUF_APPEND().
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index f13c1e4..08735fd 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -142,12 +142,16 @@
 bool osmo_separated_identifiers_valid(const char *str, const char *sep_chars);

 const char *osmo_escape_str(const char *str, int len);
-char *osmo_escape_str_buf(const char *str, int in_len, char *buf, size_t 
bufsize);
+char *osmo_escape_str_buf2(char *buf, size_t bufsize, const char *str, int 
in_len);
+const char *osmo_escape_str_buf(const char *str, int in_len, char *buf, size_t 
bufsize);
 char *osmo_escape_str_c(const void *ctx, const char *str, int in_len);
 const char *osmo_quote_str(const char *str, int in_len);
-char *osmo_quote_str_buf(const char *str, int in_len, char *buf, size_t 
bufsize);
+char *osmo_quote_str_buf2(char *buf, size_t bufsize, const char *str, int 
in_len);
+const char *osmo_quote_str_buf(const char *str, int in_len, char *buf, size_t 
bufsize);
 char 

Change in libosmocore[master]: add osmo_{escape, quote}_str_buf2() for standard args ordering

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13573 )

Change subject: add osmo_{escape,quote}_str_buf2() for standard args ordering
..


Patch Set 4: Code-Review+2

re-apply previous +2 after trivial merge conflict fix


--
To view, visit https://gerrit.osmocom.org/13573
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id748b906b0083b1f1887f2be7a53cae705a8a9ae
Gerrit-Change-Number: 13573
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Fri, 12 Apr 2019 04:45:28 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in libosmocore[master]: tweak OSMO_STRBUF_APPEND(), add OSMO_STRBUF_APPEND_NOLEN()

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13594 )

Change subject: tweak OSMO_STRBUF_APPEND(), add OSMO_STRBUF_APPEND_NOLEN()
..

tweak OSMO_STRBUF_APPEND(), add OSMO_STRBUF_APPEND_NOLEN()

In OSMO_STRBUF_APPEND, use local variable names that are less likely to shadow
other local variables: prefix with _sb_.

In OSMO_STRBUF_APPEND, add a check to add to .pos only if it is not NULL.

Add OSMO_STRBUF_APPEND_NOLEN(), which works for function signatures that don't
return a length. This is useful for any osmo_*_buf() string writing functions,
so that these write directly to the strbuf.

Change-Id: I108cadf72deb3a3bcab9a07e50572d9da1ab0359
---
M include/osmocom/core/utils.h
M tests/utils/utils_test.c
M tests/utils/utils_test.ok
3 files changed, 53 insertions(+), 7 deletions(-)

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



diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index 474e36c..f13c1e4 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -205,14 +205,14 @@
 #define OSMO_STRBUF_APPEND(STRBUF, func, args...) do { \
if (!(STRBUF).pos) \
(STRBUF).pos = (STRBUF).buf; \
-   size_t remain = (STRBUF).buf ? (STRBUF).len - ((STRBUF).pos - 
(STRBUF).buf) : 0; \
-   int l = func((STRBUF).pos, remain, ##args); \
-   if (l < 0 || l > remain) \
+   size_t _sb_remain = (STRBUF).buf ? (STRBUF).len - ((STRBUF).pos 
- (STRBUF).buf) : 0; \
+   int _sb_l = func((STRBUF).pos, _sb_remain, ##args); \
+   if (_sb_l < 0 || _sb_l > _sb_remain) \
(STRBUF).pos = (STRBUF).buf + (STRBUF).len; \
-   else \
-   (STRBUF).pos += l; \
-   if (l > 0) \
-   (STRBUF).chars_needed += l; \
+   else if ((STRBUF).pos) \
+   (STRBUF).pos += _sb_l; \
+   if (_sb_l > 0) \
+   (STRBUF).chars_needed += _sb_l; \
} while(0)

 /*! Shortcut for OSMO_STRBUF_APPEND() invocation using snprintf().
@@ -237,6 +237,29 @@
 #define OSMO_STRBUF_PRINTF(STRBUF, fmt, args...) \
OSMO_STRBUF_APPEND(STRBUF, snprintf, fmt, ##args)

+/*! Like OSMO_STRBUF_APPEND(), but for function signatures that return the 
char* buffer instead of a length.
+ * When using this function, the final STRBUF.chars_needed may not reflect the 
actual number of characters needed, since
+ * that number cannot be obtained from this kind of function signature.
+ * \param[inout] STRBUF  A struct osmo_strbuf instance.
+ * \param[in] func  A function with a signature of char *func(char *dst, 
size_t dst_len [, args]) where
+ *  the returned string is always written to dst.
+ * \param[in] args  Arguments passed to func, if any.
+ */
+#define OSMO_STRBUF_APPEND_NOLEN(STRBUF, func, args...) do { \
+   if (!(STRBUF).pos) \
+   (STRBUF).pos = (STRBUF).buf; \
+   size_t _sb_remain = (STRBUF).buf ? (STRBUF).len - ((STRBUF).pos 
- (STRBUF).buf) : 0; \
+   if (_sb_remain) { \
+   func((STRBUF).pos, _sb_remain, ##args); \
+   } \
+   size_t _sb_l = (STRBUF).pos ? strnlen((STRBUF).pos, _sb_remain) 
: 0; \
+   if (_sb_l > _sb_remain) \
+   (STRBUF).pos = (STRBUF).buf + (STRBUF).len; \
+   else if ((STRBUF).pos) \
+   (STRBUF).pos += _sb_l; \
+   (STRBUF).chars_needed += _sb_l; \
+   } while(0)
+
 bool osmo_str_startswith(const char *str, const char *startswith_str);

 /*! @} */
diff --git a/tests/utils/utils_test.c b/tests/utils/utils_test.c
index 211b4d1..223f67d 100644
--- a/tests/utils/utils_test.c
+++ b/tests/utils/utils_test.c
@@ -1014,6 +1014,23 @@
printf("(need %d chars, had size=63) %s\n", rc, buf);
 }

+void strbuf_test_nolen()
+{
+   char buf[20];
+   struct osmo_strbuf sb = { .buf = buf, .len = sizeof(buf) };
+   uint8_t ubits[] = {0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0};
+   printf("\n%s\n", __func__);
+
+   OSMO_STRBUF_APPEND_NOLEN(sb, osmo_ubit_dump_buf, ubits, sizeof(ubits));
+   printf("%zu: %s (need=%zu)\n", sb.len, buf, sb.chars_needed);
+   OSMO_STRBUF_APPEND_NOLEN(sb, osmo_ubit_dump_buf, ubits, sizeof(ubits));
+   printf("more: %s (need=%zu)\n", buf, sb.chars_needed);
+
+   sb = (struct osmo_strbuf){ .buf = buf, .len = 10 };
+   OSMO_STRBUF_APPEND_NOLEN(sb, osmo_ubit_dump_buf, ubits, sizeof(ubits));
+   printf("%zu: %s (need=%zu)\n", sb.len, buf, sb.chars_needed);
+}
+
 static void startswith_test_str(const char *str, const char *startswith_str, 
bool expect_rc)
 {
bool rc = osmo_str_startswith(str, startswith_str);
@@ -1059,6 +1076,7 @@

Change in osmo-msc[master]: large refactoring: support inter-BSC and inter-MSC Handover

2019-04-11 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13137

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

Change subject: large refactoring: support inter-BSC and inter-MSC Handover
..

large refactoring: support inter-BSC and inter-MSC Handover

3GPP TS 49.008 '4.3 Roles of MSC-A, MSC-I and MSC-T' defines distinct roles:
- MSC-A is responsible for managing subscribers,
- MSC-I is the gateway to the RAN.
- MSC-T is a second transitory gateway to another RAN during Handover.

After inter-MSC Handover, the MSC-I is handled by a remote MSC instance, while
the original MSC-A retains the responsibility of subscriber management.

MSC-T exists in this patch but is not yet used, since Handover is only prepared
for, not yet implemented.

Facilitate Inter-MSC and inter-BSC Handover by the same internal split of MSC
roles.

Compared to inter-MSC Handover, mere inter-BSC has the obvious simplifications:
- all of MSC-A, MSC-I and MSC-T roles will be served by the same osmo-msc
  instance,
- messages between MSC-A and MSC-{I,T} don't need to be routed via E-interface
  (GSUP),
- no call routing between MSC-A and -I via MNCC necessary.

This is the largest code bomb I have submitted, ever. Out of principle, I
apologize to everyone trying to read this as a whole. Unfortunately, I see no
sense in trying to split this patch into smaller bits. It would be a huge
amount of work to introduce these changes in separate chunks, especially if
each should in turn be useful and pass all test suites. So, unfortunately, we
are stuck with this code bomb.

The following are some details and rationale for this rather huge refactoring:

* separate MSC subscriber management from ran_conn

struct ran_conn is reduced from the pivotal subscriber management entity it has
been so far to a mere storage for an SCCP connection ID and an MSC subscriber
reference.

The new pivotal subscriber management entity is struct msc_a -- struct msub
lists the msc_a, msc_i, msc_t roles, the vast majority of code paths however
use msc_a, since MSC-A is where all the interesting stuff happens.

Before handover, msc_i is an FSM implementation that encodes to the local
ran_conn. After inter-MSC Handover, msc_i is a compatible but different FSM
implementation that instead forwards via/from GSUP. Same goes for the msc_a
struct: if osmo-msc is the MSC-I "RAN proxy" for a remote MSC-A role, the
msc_a->fi is an FSM implementation that merely forwards via/from GSUP.

* New SCCP implementation for RAN access

To be able to forward BSSAP and RANAP messages via the GSUP interface, the
individual message layers need to be cleanly separated. The IuCS implementation
used until now (iu_client from libosmo-ranap) did not provide this level of
separation, and needed a complete rewrite. It was trivial to implement this in
such a way that both BSSAP and RANAP can be handled by the same SCCP code,
hence the new SCCP-RAN layer also replaces BSSAP handling.

sccp_ran.h: struct sccp_ran_inst provides an abstract handler for incoming RAN
connections. A set of callback functions provides implementation specific
details.

* RAN Abstraction (BSSAP vs. RANAP)

The common SCCP implementation did set the theme for the remaining refactoring:
make all other MSC code paths entirely RAN-implementation-agnostic.

ran_infra.c provides data structures that list RAN implementation specifics,
from logging to NAS de-/encoding to SCCP callbacks and timers. A ran_infra
pointer hence allows complete abstraction of RAN implementations:

- managing connected RAN peers (BSC, RNC) in ran_peer.c,
- classifying and de-/encoding NAS PDUs,
- recording connected LACs and cell IDs and sending out Paging requests to
  matching RAN peers.

* RAN RESET now also for RANAP

ran_peer.c absorbs the reset_fsm from a_reset.c; in consequence, RANAP also
supports proper RESET semantics now. Hence osmo-hnbgw now also needs to provide
proper RESET handling, which it so far duly ignores. (TODO)

* NAS de-/encoding abstraction

The NAS abstraction mentioned above serves not only to separate RANAP and BSSAP
implementations transparently, but also to be able to optionally handle NAS on
distinct levels. Before Handover, all NAS is handled by the MSC-A role.
However, after an inter-MSC Handover, a standalone MSC-I will need to decode
NAS PDUs, at least in order to manage Assignment of RTP streams between BSS/RNC
and MNCC call forwarding.

nas.h provides a common API with abstraction for:

- receiving NAS events from RAN, i.e. passing NAS decode from the BSC/RNC and
  MS/UE: struct nas_dec_msg represents NAS messages decoded from either BSSMAP
  or RANAP;
- sending NAS events: nas_enc_msg is the counterpart to compose NAS messages
  that should be encoded to either BSSMAP or RANAP and passed down to the
  BSC/RNC and MS/UE.

The RAN-specific implementations are completely contained by nas_a.c and
nas_iu.c.

In particular, 

Change in libosmo-sccp[master]: add caller-owns-msgb variant osmo_sccp_user_sap_down_nofree()

2019-04-11 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13277

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

Change subject: add caller-owns-msgb variant osmo_sccp_user_sap_down_nofree()
..

add caller-owns-msgb variant osmo_sccp_user_sap_down_nofree()

Add osmo_sccp_user_sap_down_nofree(), which is identical to
osmo_sccp_user_sap_down(), but doesn't imply a msgb_free().

To implement that, sccp_sclc_user_sap_down_nofree() with the same msgb
semantics is required.

Rationale:

Avoiding msgb leaks is easiest if the caller retains ownership of the msgb.
Take this hypothetical chain where leaks are obviously avoided:

  void send()
  {
msg = msgb_alloc();
dispatch(msg);
msgb_free(msg);
  }

  void dispatch(msg)
  {
osmo_fsm_inst_dispatch(fi, msg);
  }

  void fi_on_event(fi, data)
  {
if (socket_is_ok)
socket_write((struct msgb*)data);
  }

  void socket_write(msgb)
  {
if (!ok1)
return;
if (ok2) {
if (!ok3)
return;
write(sock, msg->data);
}
  }

However, if the caller passes ownership down to the msgb consumer, things
become nightmarishly complex:

  void send()
  {
msg = msgb_alloc();
rc = dispatch(msg);
/* dispatching event failed? */
if (rc)
msgb_free(msg);
  }

  int dispatch(msg)
  {
if (osmo_fsm_inst_dispatch(fi, msg))
return -1;
if (something_else())
return -1; // <-- double free!
  }

  void fi_on_event(fi, data)
  {
if (socket_is_ok) {
socket_write((struct msgb*)data);
else
/* socket didn't consume? */
msgb_free(data);
  }

  int socket_write(msgb)
  {
if (!ok1)
return -1; // <-- leak!
if (ok2) {
if (!ok3)
goto out;
write(sock, msg->data);
}
  out:
msgb_free(msg);
return -2;
  }

If any link in this call chain fails to be aware of the importance to return a
failed RC or to free a msgb if the chain is broken, or to not return a failed
RC if the msgb is consumed, we have a hidden msgb leak or double free.

This is the case with osmo_sccp_user_sap_down(). In new osmo-msc, passing data
through various FSM instances, there is high potential for leak/double-free
bugs. A very large brain is required to track down every msgb path.

osmo_sccp_user_sap_down_nofree() makes this problem trivial to solve even for
humans.

Change-Id: Ic818efa78b90f727e1a94c18b60d9a306644f340
---
M include/osmocom/sigtran/sccp_sap.h
M src/sccp_internal.h
M src/sccp_sclc.c
M src/sccp_scoc.c
4 files changed, 38 insertions(+), 23 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/77/13277/2
--
To view, visit https://gerrit.osmocom.org/13277
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic818efa78b90f727e1a94c18b60d9a306644f340
Gerrit-Change-Number: 13277
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Harald Welte 


Change in osmo-ttcn3-hacks[master]: msc: mo and mt voice call tests: add lots of missing parts

2019-04-11 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13616

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

Change subject: msc: mo and mt voice call tests: add lots of missing parts
..

msc: mo and mt voice call tests: add lots of missing parts

Both f_mo_call_establish() and f_mt_call_establish() were testing barely half a
voice call setup.  For example, f_mo_call_establish() used to be satisfied with
just two CRCX, but no actual RTP connections being made.

Add numerous MNCC and MGCP messages more closely resembling an actual call.

The main reason is to achieve a state that passes both current osmo-msc master
as well as the upcoming inter-MSC Handover refactoring.

Add log markers to f_*_call_*(): often when a test halts, it is not at all
clear why. With these log markers it is saner to figure out what has happened
and what hasn't.

Change-Id: I162985045bb5e129977a3a797b656e30220990df
---
M library/L3_Templates.ttcn
M library/MGCP_Templates.ttcn
M library/MNCC_Types.ttcn
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
5 files changed, 208 insertions(+), 42 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/16/13616/3
--
To view, visit https://gerrit.osmocom.org/13616
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I162985045bb5e129977a3a797b656e30220990df
Gerrit-Change-Number: 13616
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ttcn3-hacks[master]: msc: f_tc_sgsap_mt_sms_and_reject: expect SMPP messages (REALLY?)

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has abandoned this change. ( https://gerrit.osmocom.org/13614 )

Change subject: msc: f_tc_sgsap_mt_sms_and_reject: expect SMPP messages 
(REALLY?)
..


Abandoned
--
To view, visit https://gerrit.osmocom.org/13614
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: I894ca2bba2743e7102e0e60a12a407c99a224769
Gerrit-Change-Number: 13614
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ttcn3-hacks[master]: msc: clear the failed SMS when a test is done

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13613 )

Change subject: msc: clear the failed SMS when a test is done
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13613
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4ff05187131e93f5bc58dc7ea44546f770e5b4c1
Gerrit-Change-Number: 13613
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Fri, 12 Apr 2019 03:55:20 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: msc: expect only one Paging on failed MT SMS

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13192 )

Change subject: msc: expect only one Paging on failed MT SMS
..

msc: expect only one Paging on failed MT SMS

An MSC might decide to repeatedly retry Paging if it failed the first time, but
osmo-msc currently has no such mechanism. Instead, it so far had a bug that
retriggered a failed Paging from a start in a situation where there are SMS
pending for only one subscriber, and sending the SMS fails. osmo-msc patch
I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49 changes this behavior to accept a
Paging failure and not launch the same SMS again numerous times.

Adjust the tests to this new behavior.

Depends: I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49 (osmo-msc)
Change-Id: I7dce12942a65eaaf97f78ca69401c7f93faacb9e
---
M msc/MSC_Tests.ttcn
1 file changed, 4 insertions(+), 31 deletions(-)

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



diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 8aa6199..df088bc 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -2044,7 +2044,6 @@
 private function f_tc_lu_and_mt_sms_paging_and_nothing(charstring id, 
BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
var SmsParameters spars := valueof(t_SmsPars);
var OCT4 tmsi;
-   var integer page_count := 0;
f_init_handler(pars, 150.0);

/* Perform location update */
@@ -2060,21 +2059,8 @@

f_vty_sms_send(hex2str(pars.imsi), "2342", "Hello SMS");

-   /* Expect the MSC to page exactly 10 times before giving up */
-   alt {
-   [] BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi))
-   {
-   page_count := page_count + 1;
-
-   if (page_count < 10) {
-   repeat;
-   }
-   }
-   [] BSSAP.receive {
-   setverdict(fail, "unexpected BSSAP message received");
-   self.stop;
-   }
-   }
+   /* Expect the MSC to page exactly once */
+   BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi)) { };

/* Wait some time to make sure the MSC is not delivering any further
 * paging messages or anything else that could be unexpected. */
@@ -4423,21 +4409,8 @@
/* Trigger SMS via VTY */
f_vty_sms_send_conn_hdlr(hex2str(pars.imsi), "2342", "Hello SMS");

-   /* Expect the MSC/VLR to page exactly 10 times before giving up */
-   alt {
-   [] SGsAP.receive(exp_pag_req)
-   {
-   page_count := page_count + 1;
-
-   if (page_count < 10) {
-   repeat;
-   }
-   }
-   [] SGsAP.receive {
-   setverdict(fail, "unexpected SGsAP message received");
-   self.stop;
-   }
-   }
+   /* Expect the MSC/VLR to page exactly once */
+   SGsAP.receive(exp_pag_req);

/* Wait some time to make sure the MSC is not delivering any further
 * paging messages or anything else that could be unexpected. */

--
To view, visit https://gerrit.osmocom.org/13192
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7dce12942a65eaaf97f78ca69401c7f93faacb9e
Gerrit-Change-Number: 13192
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 


Change in osmo-ttcn3-hacks[master]: msc: clear the failed SMS when a test is done

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13613 )

Change subject: msc: clear the failed SMS when a test is done
..

msc: clear the failed SMS when a test is done

If an MT SMS is triggered and not handled in the test, it is so far left behind
when the test ends. That causes Paging to retrigger for that SMS at any later
point during subsequent test runs, causing stray bogus test failures.

Actually remove the SMS from the SMS database and the queue with a new VTY
command: The vty command to clear failed SMS from the db is added in osmo-msc
I637cbd7adc075a192f49752b38779391472ff06d

Depends: I637cbd7adc075a192f49752b38779391472ff06d (osmo-msc)
Change-Id: I4ff05187131e93f5bc58dc7ea44546f770e5b4c1
---
M msc/MSC_Tests.ttcn
1 file changed, 13 insertions(+), 6 deletions(-)

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



diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 13d1ddb..8aa6199 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1994,6 +1994,13 @@
f_vty_transceive(MSCVTY, "subscriber imsi "&" sms sender msisdn 
"&" send ");
 }

+/* Remove still pending SMS */
+private function f_vty_sms_clear(charstring imsi)
+runs on BSC_ConnHdlr {
+   f_vty_transceive(MSCVTY, "subscriber imsi " & imsi & " sms delete-all");
+   f_vty_transceive(MSCVTY, "sms-queue clear");
+}
+
 /* LU followed by MT SMS */
 private function f_tc_lu_and_mt_sms(charstring id, BSC_ConnHdlrPars pars) runs 
on BSC_ConnHdlr {
var SmsParameters spars := valueof(t_SmsPars);
@@ -2088,6 +2095,8 @@
}
}

+   f_vty_sms_clear(hex2str(g_pars.imsi));
+
setverdict(pass);
 }
 testcase TC_lu_and_mt_sms_paging_and_nothing() runs on MTC_CT {
@@ -4456,8 +4465,8 @@
 * MSC/VLR would re-try to deliver the test SMS trigered above and
 * so the screening would fail. */

-   /* Expire the subscriber now to avoid that the MSC will try the SMS
-* delivery at some later point. */
+   f_vty_sms_clear(hex2str(g_pars.imsi));
+
f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " 
expire");

setverdict(pass);
@@ -4514,16 +4523,14 @@
}
}

+   f_vty_sms_clear(hex2str(g_pars.imsi));
+
/* A rejected paging with IMSI_unknown (see above) should always send
 * the SGs association to NULL. */
f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & 
".state", "SGs-NULL");

f_sgsap_bssmap_screening();

-   /* Expire the subscriber now to avoid that the MSC will try the SMS
-* delivery at some later point. */
-   f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " 
expire");
-
setverdict(pass);
 }
 testcase TC_sgsap_mt_sms_and_reject() runs on MTC_CT {

--
To view, visit https://gerrit.osmocom.org/13613
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4ff05187131e93f5bc58dc7ea44546f770e5b4c1
Gerrit-Change-Number: 13613
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 


Change in osmo-ttcn3-hacks[master]: msc: expect only one Paging on failed MT SMS

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13192 )

Change subject: msc: expect only one Paging on failed MT SMS
..


Patch Set 3: Code-Review+2

I just merged an osmo-msc change that will probably cause puzzling 
ttcn3-msc-test failures. I realized this corresponding fix isn't reviewed yet 
-- but before I send everyone off on tagents trying to figure out what is 
wrong, I'll rather merge this change now. I am still open to adjusting this 
patch nevertheless!


--
To view, visit https://gerrit.osmocom.org/13192
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I7dce12942a65eaaf97f78ca69401c7f93faacb9e
Gerrit-Change-Number: 13192
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Fri, 12 Apr 2019 03:54:51 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: msc: clear the failed SMS when a test is done

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13613 )

Change subject: msc: clear the failed SMS when a test is done
..


Patch Set 1:

I just merged an osmo-msc change that will probably cause puzzling 
ttcn3-msc-test failures. I realized this corresponding fix isn't reviewed yet 
-- but before I send everyone off on tagents trying to figure out what is 
wrong, I'll rather merge this change now. I am still open to adjusting this 
patch nevertheless!


--
To view, visit https://gerrit.osmocom.org/13613
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4ff05187131e93f5bc58dc7ea44546f770e5b4c1
Gerrit-Change-Number: 13613
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Fri, 12 Apr 2019 03:55:15 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-msc[master]: vlr_subscr: use osmo_use_count

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13136 )

Change subject: vlr_subscr: use osmo_use_count
..

vlr_subscr: use osmo_use_count

Depends: Ife31e6798b4e728a23913179e346552a7dd338c0 (libosmocore)
Change-Id: Ib06d030e8464abe415ff597d462ed40eeddef475
---
M include/osmocom/msc/db.h
M include/osmocom/msc/ran_conn.h
M include/osmocom/msc/sms_queue.h
M include/osmocom/msc/vlr.h
M include/osmocom/msc/vlr_sgs.h
M src/libmsc/ctrl_commands.c
M src/libmsc/db.c
M src/libmsc/gsm_04_08.c
M src/libmsc/gsm_04_08_cc.c
M src/libmsc/gsm_04_11.c
M src/libmsc/gsm_subscriber.c
M src/libmsc/msc_vty.c
M src/libmsc/ran_conn.c
M src/libmsc/sgs_iface.c
M src/libmsc/smpp_openbsc.c
M src/libmsc/sms_queue.c
M src/libmsc/transaction.c
M src/libvlr/vlr.c
M src/libvlr/vlr_access_req_fsm.c
M src/libvlr/vlr_lu_fsm.c
M src/libvlr/vlr_sgs.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.err
M tests/msc_vlr/msc_vlr_test_call.c
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_test_gsm_authen.c
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_gsm_ciph.c
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.c
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.c
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
M tests/msc_vlr/msc_vlr_test_no_authen.c
M tests/msc_vlr/msc_vlr_test_no_authen.err
M tests/msc_vlr/msc_vlr_test_reject_concurrency.c
M tests/msc_vlr/msc_vlr_test_reject_concurrency.err
M tests/msc_vlr/msc_vlr_test_rest.c
M tests/msc_vlr/msc_vlr_test_rest.err
M tests/msc_vlr/msc_vlr_test_ss.c
M tests/msc_vlr/msc_vlr_test_ss.err
M tests/msc_vlr/msc_vlr_test_umts_authen.c
M tests/msc_vlr/msc_vlr_test_umts_authen.err
M tests/sms_queue/sms_queue_test.c
45 files changed, 2,350 insertions(+), 2,287 deletions(-)

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




--
To view, visit https://gerrit.osmocom.org/13136
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib06d030e8464abe415ff597d462ed40eeddef475
Gerrit-Change-Number: 13136
Gerrit-PatchSet: 5
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Max 


Change in osmo-msc[master]: enable osmo_fsm_term_safely(), apply logging changes

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13592 )

Change subject: enable osmo_fsm_term_safely(), apply logging changes
..

enable osmo_fsm_term_safely(), apply logging changes

Start using osmo_fsm_term_safely(true), the recently added feature of
libosmocore's fsm.c. Deallocates in slightly changed order and with slightly
modified logging. Adjust test expectations.

Depends: I8eda67540a1cd91beb7856b9fcd0a3143b18 (libosmocore)
Change-Id: I195a719d9ec1f6764ee5a361244f59f0144dc253
---
M src/osmo-msc/msc_main.c
M tests/msc_vlr/msc_vlr_test_authen_reuse.err
M tests/msc_vlr/msc_vlr_test_call.err
M tests/msc_vlr/msc_vlr_test_gsm_authen.err
M tests/msc_vlr/msc_vlr_test_gsm_ciph.err
M tests/msc_vlr/msc_vlr_test_hlr_reject.err
M tests/msc_vlr/msc_vlr_test_hlr_timeout.err
M tests/msc_vlr/msc_vlr_test_ms_timeout.err
M tests/msc_vlr/msc_vlr_test_no_authen.err
M tests/msc_vlr/msc_vlr_test_reject_concurrency.err
M tests/msc_vlr/msc_vlr_test_rest.err
M tests/msc_vlr/msc_vlr_test_ss.err
M tests/msc_vlr/msc_vlr_test_umts_authen.err
M tests/msc_vlr/msc_vlr_tests.c
14 files changed, 627 insertions(+), 1,140 deletions(-)

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




--
To view, visit https://gerrit.osmocom.org/13592
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I195a719d9ec1f6764ee5a361244f59f0144dc253
Gerrit-Change-Number: 13592
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 


Change in osmo-msc[master]: gsm_04_08_cc: improve logging for CC trans

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13593 )

Change subject: gsm_04_08_cc: improve logging for CC trans
..

gsm_04_08_cc: improve logging for CC trans

Pass trans around more functions as log context.
Add missing "rx" logging for two cases.

Change-Id: If79f724a2faca70023271398c618cfe490fb294e
---
M src/libmsc/gsm_04_08_cc.c
1 file changed, 12 insertions(+), 9 deletions(-)

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



diff --git a/src/libmsc/gsm_04_08_cc.c b/src/libmsc/gsm_04_08_cc.c
index 4475d05..62b5d12 100644
--- a/src/libmsc/gsm_04_08_cc.c
+++ b/src/libmsc/gsm_04_08_cc.c
@@ -1601,7 +1601,7 @@
return mncc_recvmsg(trans->net, trans, MNCC_USERINFO_IND, );
 }

-static void mncc_recv_rtp(struct gsm_network *net, uint32_t callref,
+static void mncc_recv_rtp(struct gsm_network *net, struct gsm_trans *trans, 
uint32_t callref,
int cmd, uint32_t addr, uint16_t port, uint32_t payload_type,
uint32_t payload_msg_type)
 {
@@ -1617,7 +1617,7 @@
rtp->port = port;
rtp->payload_type = payload_type;
rtp->payload_msg_type = payload_msg_type;
-   mncc_recvmsg(net, NULL, cmd, (struct gsm_mncc *)data);
+   mncc_recvmsg(net, trans, cmd, (struct gsm_mncc *)data);
 }

 static void mncc_recv_rtp_sock(struct gsm_network *net, struct gsm_trans 
*trans, int cmd)
@@ -1652,16 +1652,16 @@
 * lchan->abis_ip.rtp_payload */
uint32_t payload_type = 0;

-   return mncc_recv_rtp(net, trans->callref, cmd,
+   return mncc_recv_rtp(net, trans, trans->callref, cmd,
addr,
port,
payload_type,
msg_type);
 }

-static void mncc_recv_rtp_err(struct gsm_network *net, uint32_t callref, int 
cmd)
+static void mncc_recv_rtp_err(struct gsm_network *net, struct gsm_trans 
*trans, uint32_t callref, int cmd)
 {
-   return mncc_recv_rtp(net, callref, cmd, 0, 0, 0, 0);
+   return mncc_recv_rtp(net, trans, callref, cmd, 0, 0, 0, 0);
 }

 static int tch_rtp_create(struct gsm_network *net, uint32_t callref)
@@ -1672,15 +1672,16 @@
trans = trans_find_by_callref(net, callref);
if (!trans) {
LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "RTP create for 
non-existing trans\n");
-   mncc_recv_rtp_err(net, callref, MNCC_RTP_CREATE);
+   mncc_recv_rtp_err(net, trans, callref, MNCC_RTP_CREATE);
return -EIO;
}
log_set_context(LOG_CTX_VLR_SUBSCR, trans->vsub);
if (!trans->conn) {
LOG_TRANS_CAT(trans, DMNCC, LOGL_NOTICE, "RTP create for trans 
without conn\n");
-   mncc_recv_rtp_err(net, callref, MNCC_RTP_CREATE);
+   mncc_recv_rtp_err(net, trans, callref, MNCC_RTP_CREATE);
return 0;
}
+   LOG_TRANS_CAT(trans, DMNCC, LOGL_DEBUG, "rx %s\n", 
get_mncc_name(MNCC_RTP_CREATE));

/* When we call msc_mgcp_call_assignment() we will trigger, depending
 * on the RAN type the call assignment on the A or Iu interface.
@@ -1733,16 +1734,18 @@
trans = trans_find_by_callref(net, rtp->callref);
if (!trans) {
LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "RTP connect for 
non-existing trans\n");
-   mncc_recv_rtp_err(net, rtp->callref, MNCC_RTP_CONNECT);
+   mncc_recv_rtp_err(net, trans, rtp->callref, MNCC_RTP_CONNECT);
return -EIO;
}
log_set_context(LOG_CTX_VLR_SUBSCR, trans->vsub);
if (!trans->conn) {
LOG_TRANS_CAT(trans, DMNCC, LOGL_ERROR, "RTP connect for trans 
without conn\n");
-   mncc_recv_rtp_err(net, rtp->callref, MNCC_RTP_CONNECT);
+   mncc_recv_rtp_err(net, trans, rtp->callref, MNCC_RTP_CONNECT);
return 0;
}

+   LOG_TRANS_CAT(trans, DMNCC, LOGL_DEBUG, "rx %s\n", 
get_mncc_name(MNCC_RTP_CONNECT));
+
addr.s_addr = osmo_htonl(rtp->ip);
return msc_mgcp_call_complete(trans, rtp->port, inet_ntoa(addr));
 }

--
To view, visit https://gerrit.osmocom.org/13593
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If79f724a2faca70023271398c618cfe490fb294e
Gerrit-Change-Number: 13593
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 


Change in osmo-msc[master]: sms queue: avoid repeated Paging for a failed SMS

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13173 )

Change subject: sms queue: avoid repeated Paging for a failed SMS
..

sms queue: avoid repeated Paging for a failed SMS

So far, sms_pending_failed() starts a new sms_queue_trigger() run. The
intention behind that might have been to fill up the queue when sending SMS has
failed, but the practical effect is actually bad:

As current ttcn3-msc-test runs show, a failed MT SMS gets triggered multiple
times in short succession, i.e. osmo-msc repeatedly sends Paging Requests for
the same subscriber.

This special case happens actually only when there are few SMS still in the DB
to be delivered. In the TTCN3 test, there is exactly one MT SMS for one
subscriber, and retriggering the queue brings up the same SMS every time.

See f_tc_lu_and_mt_sms_paging_and_nothing() and f_tc_sgsap_mt_sms_and_nothing()
which say:
"/* Expect the MSC to page exactly 10 times before giving up */"

This is bad because an MSC should send a Paging Request exactly once. Retrying
failed Paging is clearly the task of the BSC, not the MSC. The remaining code
around Paging correctly follows this paradigm, but this retrigger doesn't.

Do not immediately trigger the SMS queue on a failed MT SMS. Instead, leave it
up to the periodical SMS queue trigger to decide.

This patch will cause the MT SMS tests in ttcn3-msc-tests to fail, because the
test expectations are bogus. The patch fixing the test run is listed 'Related'
below.

Related: I7dce12942a65eaaf97f78ca69401c7f93faacb9e (osmo-ttcn3-hacks)
Change-Id: I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49
---
M src/libmsc/sms_queue.c
1 file changed, 0 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Neels Hofmeyr: Looks good to me, approved
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Keith Whyte: Looks good to me, but someone else must approve



diff --git a/src/libmsc/sms_queue.c b/src/libmsc/sms_queue.c
index afd878f..4de30ad 100644
--- a/src/libmsc/sms_queue.c
+++ b/src/libmsc/sms_queue.c
@@ -161,7 +161,6 @@

sms_pending_free(pending);
smsq->pending -= 1;
-   sms_queue_trigger(smsq);
 }

 /*

--
To view, visit https://gerrit.osmocom.org/13173
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49
Gerrit-Change-Number: 13173
Gerrit-PatchSet: 5
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Keith Whyte 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmo-msc[master]: sms queue: avoid repeated Paging for a failed SMS

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13173 )

Change subject: sms queue: avoid repeated Paging for a failed SMS
..


Patch Set 5: Code-Review+2

applying +1+1 == +2


--
To view, visit https://gerrit.osmocom.org/13173
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49
Gerrit-Change-Number: 13173
Gerrit-PatchSet: 5
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Keith Whyte 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Fri, 12 Apr 2019 03:52:30 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-bsc[master]: lchan activation: add explicit encryption info to activation

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13582 )

Change subject: lchan activation: add explicit encryption info to activation
..

lchan activation: add explicit encryption info to activation

For intra-BSC handover, the previous encryption is copied from the old lchan,
which of course is not available during inter-BSC handover.  Hence the lchan
activation info needs to include an explicit encryption information, and we
must not rely on the presence of the previous lchan to copy encryption
information from.

Add struct lchan_activate_info.encr to allow passing encryption info through
lchan_activate() without requiring a previous struct gsm_lchan to be present.

Instead of copying from the old lchan, always copy encryption info to
lchan_activate_info, and during activation, just before sending the Channel
Activation, copy the lchan_activate_info.encr to the new lchan.

This prepares for upcoming I5b269f50bd2092516bfdf87746196983d3ac49d1 which
obtains the encryption information from an intra-BSC-incoming Handover Request
message.

Related: OS#3842
Related: I5b269f50bd2092516bfdf87746196983d3ac49d1
Change-Id: Ib3d259a5711add65ab7298bfa3977855a17a1642
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/assignment_fsm.c
M src/osmo-bsc/handover_fsm.c
M src/osmo-bsc/lchan_fsm.c
4 files changed, 10 insertions(+), 10 deletions(-)

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



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 47ca5e8..ba28a6b 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -528,6 +528,7 @@
/* This always is for a specific lchan, so its lchan->type indicates 
full or half rate.
 * When a dyn TS was selected, the lchan->type has been set to the 
desired rate. */
enum gsm48_chan_mode chan_mode;
+   struct gsm_encr encr;
/* AMR config */
uint16_t s15_s0;
bool requires_voice_stream;
diff --git a/src/osmo-bsc/assignment_fsm.c b/src/osmo-bsc/assignment_fsm.c
index c17b555..9c0c400 100644
--- a/src/osmo-bsc/assignment_fsm.c
+++ b/src/osmo-bsc/assignment_fsm.c
@@ -484,6 +484,7 @@
.activ_for = FOR_ASSIGNMENT,
.for_conn = conn,
.chan_mode = conn->lchan->ch_mode_rate.chan_mode,
+   .encr = conn->lchan->encr,
.s15_s0 = conn->lchan->ch_mode_rate.s15_s0,
.requires_voice_stream = conn->assignment.requires_voice_stream,
.msc_assigned_cic = req->msc_assigned_cic,
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index a3d25d6..9c86b70 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -358,6 +358,7 @@
.activ_for = FOR_HANDOVER,
.for_conn = conn,
.chan_mode = conn->lchan->tch_mode,
+   .encr = conn->lchan->encr,
.requires_voice_stream = conn->lchan->mgw_endpoint_ci_bts ? 
true : false,
.msc_assigned_cic = conn->ho.inter_bsc_in.msc_assigned_cic,
.re_use_mgw_endpoint_from_lchan = conn->lchan,
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 2b7dc97..7af2ea0 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -518,14 +518,6 @@

lchan->conn = info->for_conn;

-   if (old_lchan)
-   lchan->encr = old_lchan->encr;
-   else {
-   lchan->encr = (struct gsm_encr){
-   .alg_id = RSL_ENC_ALG_A5(0),/* no encryption */
-   };
-   }
-
/* If there is a previous lchan, and the new lchan is on the same cell 
as previous one,
 * take over power and TA values. Otherwise, use max power and zero TA. 
*/
if (old_lchan && old_lchan->ts->trx->bts == bts) {
@@ -585,14 +577,17 @@
use_mgwep_ci = lchan_use_mgw_endpoint_ci_bts(lchan);

LOG_LCHAN(lchan, LOGL_INFO,
- "Activation requested: %s voice=%s MGW-ci=%s type=%s 
tch-mode=%s\n",
+ "Activation requested: %s voice=%s MGW-ci=%s type=%s 
tch-mode=%s encr-alg=A5/%u ck=%s\n",
  lchan_activate_mode_name(lchan->activate.info.activ_for),
  lchan->activate.info.requires_voice_stream ? "yes" : "no",
  lchan->activate.info.requires_voice_stream ?
(use_mgwep_ci ? mgwep_ci_name(use_mgwep_ci) : "new")
: "none",
  gsm_lchant_name(lchan->type),
- gsm48_chan_mode_name(lchan->tch_mode));
+ gsm48_chan_mode_name(lchan->tch_mode),
+ (lchan->activate.info.encr.alg_id ? : 1)-1,
+ lchan->activate.info.encr.key_len ? 
osmo_hexdump_nospc(lchan->activate.info.encr.key,
+ 

Change in osmo-msc[master]: add LOG_TRANS, proper context for all transactions

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13139 )

Change subject: add LOG_TRANS, proper context for all transactions
..


Patch Set 5:

This change is ready for review.


--
To view, visit https://gerrit.osmocom.org/13139
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I2e60964d7a3c06d051debd1c707051a0eb3101ba
Gerrit-Change-Number: 13139
Gerrit-PatchSet: 5
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Fri, 12 Apr 2019 03:51:59 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-bsc[master]: fix inter-BSC-HO-incoming for AoIP (1/2)

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13584 )

Change subject: fix inter-BSC-HO-incoming for AoIP (1/2)
..

fix inter-BSC-HO-incoming for AoIP (1/2)

Move the HO_ST_WAIT_MGW_ENDPOINT_TO_MSC state up to right after the lchan is
done establishing. For AoIP, the local RTP address towards the MSC already
needs to be known before the Handover Request Acknowledge is sent, so the AoIP
Transport Layer Address IE can be included. This patch only modifies the
handover FSM, a subsequent patch adds the IE.

Change-Id: I4a5acdb2d4a0b947cc0c62067a67be88a3d467ff
---
M include/osmocom/bsc/handover_fsm.h
M src/osmo-bsc/handover_fsm.c
2 files changed, 106 insertions(+), 85 deletions(-)

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



diff --git a/include/osmocom/bsc/handover_fsm.h 
b/include/osmocom/bsc/handover_fsm.h
index 4db0890..7c2145e 100644
--- a/include/osmocom/bsc/handover_fsm.h
+++ b/include/osmocom/bsc/handover_fsm.h
@@ -28,10 +28,10 @@
HO_ST_NOT_STARTED,

HO_ST_WAIT_LCHAN_ACTIVE,
+   HO_ST_WAIT_MGW_ENDPOINT_TO_MSC,
HO_ST_WAIT_RR_HO_DETECT,
HO_ST_WAIT_RR_HO_COMPLETE,
HO_ST_WAIT_LCHAN_ESTABLISHED,
-   HO_ST_WAIT_MGW_ENDPOINT_TO_MSC,

/* The inter-BSC Outgoing Handover FSM has completely separate states, 
but since it makes sense for it
 * to also live in conn->ho.fi, it should share the same event enum. 
From there it is merely
@@ -46,11 +46,11 @@
HO_EV_LCHAN_ACTIVE,
HO_EV_LCHAN_ESTABLISHED,
HO_EV_LCHAN_ERROR,
+   HO_EV_MSC_MGW_OK,
+   HO_EV_MSC_MGW_FAIL,
HO_EV_RR_HO_DETECT,
HO_EV_RR_HO_COMPLETE,
HO_EV_RR_HO_FAIL,
-   HO_EV_MSC_MGW_OK,
-   HO_EV_MSC_MGW_FAIL,
HO_EV_CONN_RELEASING,

HO_OUT_EV_BSSMAP_HO_COMMAND,
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index 421c32e..3b5a660 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -161,10 +161,10 @@

 static const struct state_timeout ho_fsm_timeouts[32] = {
[HO_ST_WAIT_LCHAN_ACTIVE] = { .T = 23042 },
+   [HO_ST_WAIT_MGW_ENDPOINT_TO_MSC] = { .T = 23042 },
[HO_ST_WAIT_RR_HO_DETECT] = { .T = 23042 },
[HO_ST_WAIT_RR_HO_COMPLETE] = { .T = 23042 },
[HO_ST_WAIT_LCHAN_ESTABLISHED] = { .T = 23042 },
-   [HO_ST_WAIT_MGW_ENDPOINT_TO_MSC] = { .T = 23042 },
[HO_OUT_ST_WAIT_HO_COMMAND] = { .T = 7 },
[HO_OUT_ST_WAIT_CLEAR] = { .T = 8 },
 };
@@ -876,10 +876,24 @@
 static void ho_fsm_wait_lchan_active(struct osmo_fsm_inst *fi, uint32_t event, 
void *data)
 {
struct gsm_subscriber_connection *conn = ho_fi_conn(fi);
+   struct handover *ho = >ho;
switch (event) {

case HO_EV_LCHAN_ACTIVE:
-   ho_fsm_state_chg(HO_ST_WAIT_RR_HO_DETECT);
+   /* - If the lchan is voiceless, no need to even think about the 
MGW.
+* - If this is an intra-BSC Handover, we already have an RTP 
stream towards the MSC and aren't
+*   touching it.
+* - If we're on SCCPlite, the MSC manages the MGW endpoint, 
all we do is the BTS side CI, so we can
+*   skip the part that would CRCX towards the MSC.
+* So create an MSC side endpoint CI only if a voice lchan is 
established for an incoming inter-BSC
+* handover on AoIP. Otherwise go on to send a Handover Command 
and wait for the Detect.
+*/
+   if (ho->new_lchan->activate.info.requires_voice_stream
+   && (ho->scope & HO_INTER_BSC_IN)
+   && gscon_is_aoip(conn))
+   ho_fsm_state_chg(HO_ST_WAIT_MGW_ENDPOINT_TO_MSC);
+   else
+   ho_fsm_state_chg(HO_ST_WAIT_RR_HO_DETECT);
return;

case HO_EV_LCHAN_ERROR:
@@ -892,6 +906,76 @@
}
 }

+/* Only for voice, only for inter-BSC Handover into this BSC, and only for 
AoIP:
+ *
+ * Establish the MGW endpoint CI that points towards the MSC. This needs to 
happen after the lchan (lchan_rtp_fsm) has
+ * created an MGW endpoint with the first CRCX, so that an endpoint is 
available, and before sending the Handover
+ * Request Acknowledge, so that the RTP address and port established towards 
the MSC can be included in the Handover
+ * Request Acknowledge message.
+ * (For SCCPlite, the MSC manages the CN side endpoint CI itself, and we don't 
need to send any RTP address in the
+ * Handover Request Acknowledge.)
+ *
+ * Actually, it should be possible to kick this off even above in 
handover_start_inter_bsc_in(), to do the CRCX towards
+ * the MSC at the same time as establishing the lchan. The 
gscon_ensure_mgw_endpoint() doesn't care which one of
+ * lchan_rtp_fsm or handover_start_inter_bsc_in() calls it first. The benefit 
would be that 

Change in osmo-bsc[master]: Handover Request: also parse Chosen Algorithm IE, pass to lchan activ...

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13583 )

Change subject: Handover Request: also parse Chosen Algorithm IE, pass to lchan 
activation
..

Handover Request: also parse Chosen Algorithm IE, pass to lchan activation

During inter-BSC-incoming, the MSC sends the chosen encryption algorithm in the
Handover Request message. Actually parse this Chosen Encryption Algorithm IE.

Place the chosen algorithm and the CK into lchan_activate_info->encr so that
the new lchan will use the same ciphering on this new BSS as it did on the old
BSS.

Change-Id: I5b269f50bd2092516bfdf87746196983d3ac49d1
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/handover_fsm.c
2 files changed, 33 insertions(+), 0 deletions(-)

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



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index ba28a6b..131a53e 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -179,6 +179,10 @@
struct gsm0808_speech_codec_list scl;
struct gsm0808_encrypt_info ei;
struct gsm_classmark classmark;
+   /* chosen_encr_alg reflects the encoded value as in 
RSL_ENC_ALG_A5(a5_numer):
+* chosen_encr_alg == 1 means A5/0 i.e. no encryption, chosen_encr_alg 
== 4 means A5/3.
+* chosen_encr_alg == 0 means no such IE was present. */
+   uint8_t chosen_encr_alg;
struct gsm0808_cell_id cell_id_serving;
char cell_id_serving_name[64];
struct gsm0808_cell_id cell_id_target;
diff --git a/src/osmo-bsc/handover_fsm.c b/src/osmo-bsc/handover_fsm.c
index 9c86b70..421c32e 100644
--- a/src/osmo-bsc/handover_fsm.c
+++ b/src/osmo-bsc/handover_fsm.c
@@ -432,6 +432,17 @@
   "Missing mandatory IE: 3GPP mandates either Classmark 
Information 1 or 2"
   " in BSSMAP Handover Request, but neither are present. 
Will continue without.\n");

+   if ((e = TLVP_GET(tp, GSM0808_IE_CHOSEN_ENCR_ALG))) {
+   req->chosen_encr_alg = e->val[0];
+   if (req->chosen_encr_alg < 1 || req->chosen_encr_alg > 8)
+   LOG_HO(conn, LOGL_ERROR, "Chosen Encryption Algorithm 
(Serving) is invalid: %u\n",
+  req->chosen_encr_alg);
+   }
+
+   LOG_HO(conn, LOGL_DEBUG, "Handover Request encryption info: 
chosen=A5/%u key=%s\n",
+  (req->chosen_encr_alg ? : 1) - 1, req->ei.key_len?
+  osmo_hexdump_nospc(req->ei.key, req->ei.key_len) : "none");
+
if (TLVP_PRESENT(tp, GSM0808_IE_AOIP_TRASP_ADDR)) {
int rc;
unsigned int u;
@@ -611,6 +622,24 @@
.msc_assigned_cic = req->msc_assigned_cic,
};

+   if (req->chosen_encr_alg) {
+   info.encr.alg_id = req->chosen_encr_alg;
+   if (info.encr.alg_id > 1 && !req->ei.key_len) {
+   ho_fail(HO_RESULT_ERROR, "Chosen Encryption Algorithm 
(Serving) reflects A5/%u"
+   " but there is no key (Encryption 
Information)", info.encr.alg_id - 1);
+   return;
+   }
+   }
+
+   if (req->ei.key_len) {
+   if (req->ei.key_len > sizeof(info.encr.key)) {
+   ho_fail(HO_RESULT_ERROR, "Encryption Information IE key 
length is too large: %u\n",
+   req->ei.key_len);
+   }
+   memcpy(info.encr.key, req->ei.key, req->ei.key_len);
+   info.encr.key_len = req->ei.key_len;
+   }
+
lchan_activate(ho->new_lchan, );
 }


--
To view, visit https://gerrit.osmocom.org/13583
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5b269f50bd2092516bfdf87746196983d3ac49d1
Gerrit-Change-Number: 13583
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 


Change in osmo-ttcn3-hacks[master]: msc: f_tc_sgsap_mt_sms_and_reject: shorter delay

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13615


Change subject: msc: f_tc_sgsap_mt_sms_and_reject: shorter delay
..

msc: f_tc_sgsap_mt_sms_and_reject: shorter delay

Change-Id: I4b2a588bcd20a4c04162997b9fe357dbe37178e9
---
M msc/MSC_Tests.ttcn
1 file changed, 1 insertion(+), 1 deletion(-)



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

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index d91e8b1..24428f1 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -4481,7 +4481,7 @@
/* The MSC/VLR should no longer try to page once the paging has been
 * rejected. Wait some time and check if there are no unexpected
 * messages on the SGs interface. */
-   timer T := 20.0;
+   timer T := 3.0;
T.start
alt {
[] SGsAP.receive(exp_pag_req)

--
To view, visit https://gerrit.osmocom.org/13615
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b2a588bcd20a4c04162997b9fe357dbe37178e9
Gerrit-Change-Number: 13615
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-ttcn3-hacks[master]: msc: clear the failed SMS when a test is done

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13613


Change subject: msc: clear the failed SMS when a test is done
..

msc: clear the failed SMS when a test is done

If an MT SMS is triggered and not handled in the test, it is so far left behind
when the test ends. That causes Paging to retrigger for that SMS at any later
point during subsequent test runs, causing stray bogus test failures.

Actually remove the SMS from the SMS database and the queue with a new VTY
command: The vty command to clear failed SMS from the db is added in osmo-msc
I637cbd7adc075a192f49752b38779391472ff06d

Depends: I637cbd7adc075a192f49752b38779391472ff06d (osmo-msc)
Change-Id: I4ff05187131e93f5bc58dc7ea44546f770e5b4c1
---
M msc/MSC_Tests.ttcn
1 file changed, 13 insertions(+), 6 deletions(-)



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

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 13d1ddb..8aa6199 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -1994,6 +1994,13 @@
f_vty_transceive(MSCVTY, "subscriber imsi "&" sms sender msisdn 
"&" send ");
 }

+/* Remove still pending SMS */
+private function f_vty_sms_clear(charstring imsi)
+runs on BSC_ConnHdlr {
+   f_vty_transceive(MSCVTY, "subscriber imsi " & imsi & " sms delete-all");
+   f_vty_transceive(MSCVTY, "sms-queue clear");
+}
+
 /* LU followed by MT SMS */
 private function f_tc_lu_and_mt_sms(charstring id, BSC_ConnHdlrPars pars) runs 
on BSC_ConnHdlr {
var SmsParameters spars := valueof(t_SmsPars);
@@ -2088,6 +2095,8 @@
}
}

+   f_vty_sms_clear(hex2str(g_pars.imsi));
+
setverdict(pass);
 }
 testcase TC_lu_and_mt_sms_paging_and_nothing() runs on MTC_CT {
@@ -4456,8 +4465,8 @@
 * MSC/VLR would re-try to deliver the test SMS trigered above and
 * so the screening would fail. */

-   /* Expire the subscriber now to avoid that the MSC will try the SMS
-* delivery at some later point. */
+   f_vty_sms_clear(hex2str(g_pars.imsi));
+
f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " 
expire");

setverdict(pass);
@@ -4514,16 +4523,14 @@
}
}

+   f_vty_sms_clear(hex2str(g_pars.imsi));
+
/* A rejected paging with IMSI_unknown (see above) should always send
 * the SGs association to NULL. */
f_ctrl_get_exp(IPA_CTRL, "fsm.SGs-UE.id.imsi:" & hex2str(g_pars.imsi) & 
".state", "SGs-NULL");

f_sgsap_bssmap_screening();

-   /* Expire the subscriber now to avoid that the MSC will try the SMS
-* delivery at some later point. */
-   f_vty_transceive(MSCVTY, "subscriber imsi " & hex2str(g_pars.imsi) & " 
expire");
-
setverdict(pass);
 }
 testcase TC_sgsap_mt_sms_and_reject() runs on MTC_CT {

--
To view, visit https://gerrit.osmocom.org/13613
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ff05187131e93f5bc58dc7ea44546f770e5b4c1
Gerrit-Change-Number: 13613
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-ttcn3-hacks[master]: msc: mo and mt voice call tests: add lots of missing parts

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13616


Change subject: msc: mo and mt voice call tests: add lots of missing parts
..

msc: mo and mt voice call tests: add lots of missing parts

Both f_mo_call_establish() and f_mt_call_establish() were testing barely half a
voice call setup.  For example, f_mo_call_establish() used to be satisfied with
just two CRCX, but no actual RTP connections being made.

Add numerous MNCC and MGCP messages more closely resembling an actual call.

The main reason is to achieve a state that passes both current osmo-msc master
as well as the upcoming inter-MSC Handover refactoring.

Add log markers to f_*_call_*(): often when a test halts, it is not at all
clear why. With these log markers it is saner to figure out what has happened
and what hasn't.

Change-Id: I162985045bb5e129977a3a797b656e30220990df
---
M library/MGCP_Templates.ttcn
M library/MNCC_Types.ttcn
M msc/BSC_ConnectionHandler.ttcn
3 files changed, 185 insertions(+), 37 deletions(-)



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

diff --git a/library/MGCP_Templates.ttcn b/library/MGCP_Templates.ttcn
index f720553..506100f 100644
--- a/library/MGCP_Templates.ttcn
+++ b/library/MGCP_Templates.ttcn
@@ -286,6 +286,22 @@
}
}

+   function f_mgcp_contains_par(MgcpMessage msg, MgcpInfoCode code) return 
boolean {
+   var MgcpParameterList pars;
+   if (ischosen(msg.command)) {
+   pars := msg.command.params;
+   } else {
+   pars := msg.response.params;
+   }
+   for (var integer i := 0; i < lengthof(pars); i := i + 1) {
+   var MgcpParameter par := pars[i];
+   if (par.code == code) {
+   return true;
+   }
+   }
+   return false;
+   }
+
function f_mgcp_extract_par(MgcpMessage msg, MgcpInfoCode code) return 
charstring {
var MgcpParameterList pars;
if (ischosen(msg.command)) {
@@ -317,6 +333,13 @@
return f_mgcp_extract_par(msg, code);
}

+   function f_MgcpCmd_contains_par(MgcpCommand cmd, MgcpInfoCode code) 
return boolean {
+   var MgcpMessage msg := {
+   command := cmd
+   }
+   return f_mgcp_contains_par(msg, code);
+   }
+
function f_MgcpResp_extract_conn_id(MgcpResponse resp) return 
MgcpConnectionId {
return str2hex(f_MgcpResp_extract_par(resp, "I"));
}
diff --git a/library/MNCC_Types.ttcn b/library/MNCC_Types.ttcn
index a3714b1..f5028d2 100644
--- a/library/MNCC_Types.ttcn
+++ b/library/MNCC_Types.ttcn
@@ -1874,14 +1874,17 @@
 template MNCC_PDU ts_MNCC_RTP_CREATE(uint32_t call_id) := 
ts_MNCC_SIMPLE_RTP(MNCC_RTP_CREATE, call_id);

 /* MSC -> MNCC: RTP_CREATE.rsp; acknowledge creation of RTP (stating MSC side 
IP/Port) */
-template MNCC_PDU tr_MNCC_RTP_CREATE(template uint32_t call_id := ?) := {
+template MNCC_PDU tr_MNCC_RTP_CREATE(template uint32_t call_id := ?,
+template uint32_t ip := ?,
+template uint32_t rtp_port := ?,
+template uint32_t payload_type := ?) := {
msg_type := MNCC_RTP_CREATE,
u := {
rtp := {
callref := call_id,
-   ip := ?,
-   rtp_port := ?,
-   payload_type := ?,
+   ip := ip,
+   rtp_port := rtp_port,
+   payload_type := payload_type,
payload_msg_type := ?
}
}
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index 8e5c5f2..833c31f 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -479,12 +479,15 @@

f_establish_fully(EST_TYPE_PAG_RESP);

+   log("f_mt_call_complete 1");
+
/* MS <- MSC: Expect CC SETUP */
BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_CC_SETUP(cpars.transaction_id, 
*, cpars.called_party)));

/* MS -> MSC: ALERTING */
BSSAP.send(ts_PDU_DTAP_MO(ts_ML3_MO_CC_ALERTING(cpars.transaction_id)));
MNCC.receive(tr_MNCC_ALERT_ind(cpars.mncc_callref));
+   log("f_mt_call_complete 2");

/* Create MGCP expect */
f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
@@ -493,6 +496,7 @@

/* First MGCP CRCX (for BSS/RAN side) */
MGCP.receive(tr_CRCX) -> value mgcp_cmd {
+   log("f_mt_call_complete 3");
cpars.mgcp_call_id := f_MgcpCmd_extract_call_id(mgcp_cmd);

/* When the endpoint contains a wildcard we keep the endpoint
@@ -521,6 +525,7 

Change in osmo-ttcn3-hacks[master]: msc: f_tc_sgsap_mt_sms_and_reject: expect SMPP messages (REALLY?)

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13614


Change subject: msc: f_tc_sgsap_mt_sms_and_reject: expect SMPP messages 
(REALLY?)
..

msc: f_tc_sgsap_mt_sms_and_reject: expect SMPP messages (REALLY?)

Change-Id: I894ca2bba2743e7102e0e60a12a407c99a224769
---
M msc/MSC_Tests.ttcn
1 file changed, 2 insertions(+), 0 deletions(-)



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

diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index df088bc..d91e8b1 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -4469,6 +4469,8 @@
var template LocationAreaId exp_lai := 
ts_SGsAP_IE_Lai(valueof(ts_SGsAP_LAI('901'H, '70'H, 2342)));
exp_pag_req.sGsAP_PAGING_REQUEST.locationAreaId := exp_lai;

+   f_create_smpp_expect(hex2str(spars.tp.da.tP_DA_NoPad.tP_DAValue));
+
/* Trigger SMS via VTY */
f_vty_sms_send_conn_hdlr(hex2str(pars.imsi), "2342", "Hello SMS");


--
To view, visit https://gerrit.osmocom.org/13614
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I894ca2bba2743e7102e0e60a12a407c99a224769
Gerrit-Change-Number: 13614
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in osmo-ttcn3-hacks[master]: msc: expect only one Paging on failed MT SMS

2019-04-11 Thread Neels Hofmeyr
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/13192

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

Change subject: msc: expect only one Paging on failed MT SMS
..

msc: expect only one Paging on failed MT SMS

An MSC might decide to repeatedly retry Paging if it failed the first time, but
osmo-msc currently has no such mechanism. Instead, it so far had a bug that
retriggered a failed Paging from a start in a situation where there are SMS
pending for only one subscriber, and sending the SMS fails. osmo-msc patch
I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49 changes this behavior to accept a
Paging failure and not launch the same SMS again numerous times.

Adjust the tests to this new behavior.

Depends: I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49 (osmo-msc)
Change-Id: I7dce12942a65eaaf97f78ca69401c7f93faacb9e
---
M msc/MSC_Tests.ttcn
1 file changed, 4 insertions(+), 31 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/92/13192/3
--
To view, visit https://gerrit.osmocom.org/13192
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I7dce12942a65eaaf97f78ca69401c7f93faacb9e
Gerrit-Change-Number: 13192
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 


Change in osmo-msc[master]: GSUP: include terminating nul in inter-MSC source/destination name

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13612


Change subject: GSUP: include terminating nul in inter-MSC source/destination 
name
..

GSUP: include terminating nul in inter-MSC source/destination name

Before, I was testing with osmo-hlr patch
I01a45900e14d41bcd338f50ad85d9fabf2c61405 applied, but that patch is currently
in an abandoned state.

This is the counterpart implemented in osmo-msc: always include the terminating
nul char in the "blob" that is the MSC IPA name.

The dualities in the formats of routing between MSCs is whether to handle it as
a char*, or as a uint8_t* with explicit len (a blob).

In the VTY config to indicate target MSCs for inter-MSC handover, we have
strings. We currently even completely lack a way of configuring any blob-like
data as a VTY config item.

In osmo-hlr, the IPA names used for routing are currently received as a char*
which *includes* the terminating nul char. So in osmo-msc, if we also always
include the nul char, it works.

Instead, we could just send the char* part without the nul char, and apply
above mentioned osmo-hlr patch. That patch would magically match a name that
lacks a nul with a name that includes one. I think it is better to agree on one
format on the GSUP wire now, instead of making assumptions in osmo-hlr on the
format of the source/target names for routing. This format, from the way GSUP
so far transmits the IPA SERNO tag when a client attaches to osmo-hlr, happens
to include the terminating nul char.

Change-Id: I9ca8c9eef104519ed1ea46e2fef46dcdc0d554eb
---
M src/libmsc/e_link.c
1 file changed, 14 insertions(+), 7 deletions(-)



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

diff --git a/src/libmsc/e_link.c b/src/libmsc/e_link.c
index c0ebbf6..1ec3647 100644
--- a/src/libmsc/e_link.c
+++ b/src/libmsc/e_link.c
@@ -69,6 +69,7 @@
 {
struct e_link *e;
struct msc_role_common *c = msc_role->priv;
+   size_t use_len;

/* use msub as talloc parent, so we can move an e_link from msc_t to 
msc_i when it is established. */
e = talloc_zero(c->msub, struct e_link);
@@ -79,12 +80,18 @@
.gcm = gcm,
};

-   /* Expecting all code paths to print the remote name according to 
remote_name_len. To be paranoid, place a nul
-* character after the end. */
-   e->remote_name = talloc_size(e, remote_name_len + 1);
+   /* FIXME: this is a braindamaged duality of char* and blob, which we 
can't seem to get rid of easily.
+* See also osmo-hlr change I01a45900e14d41bcd338f50ad85d9fabf2c61405 
which resolved this on the
+* osmo-hlr side, but was abandoned. Not sure which way is the right 
solution. */
+   /* To be able to include a terminating NUL character when sending the 
IPA name, append one if there is none yet.
+* Current osmo-hlr needs the terminating NUL to be included. */
+   use_len = remote_name_len;
+   if (remote_name[use_len-1] != '\0')
+   use_len++;
+   e->remote_name = talloc_size(e, use_len);
memcpy(e->remote_name, remote_name, remote_name_len);
-   e->remote_name[remote_name_len] = '\0';
-   e->remote_name_len = remote_name_len;
+   e->remote_name[use_len-1] = '\0';
+   e->remote_name_len = use_len;

e_link_assign(e, msc_role);
return e;
@@ -125,9 +132,9 @@
*gsup_msg = (struct osmo_gsup_message){
.message_class = OSMO_GSUP_MESSAGE_CLASS_INTER_MSC,
.source_name = (const uint8_t*)local_msc_name,
-   .source_name_len = strlen(local_msc_name),
+   .source_name_len = strlen(local_msc_name)+1, /* include 
terminating nul */
.destination_name = (const uint8_t*)e->remote_name,
-   .destination_name_len = e->remote_name_len,
+   .destination_name_len = e->remote_name_len, /* the nul here is 
also included, from e_link_alloc() */
};

if (vsub)

--
To view, visit https://gerrit.osmocom.org/13612
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9ca8c9eef104519ed1ea46e2fef46dcdc0d554eb
Gerrit-Change-Number: 13612
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Build failure of network:osmocom:nightly/libosmo-netif in xUbuntu_17.10/x86_64

2019-04-11 Thread OBS Notification
Visit 
https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/libosmo-netif/xUbuntu_17.10/x86_64

Package network:osmocom:nightly/libosmo-netif failed to build in 
xUbuntu_17.10/x86_64

Check out the package for editing:
  osc checkout network:osmocom:nightly libosmo-netif

Last lines of build log:
[  115s] +non-reconnecting test step 0 [client OK, server OK], FD reg 1
[  115s] --- expout 2019-04-12 02:50:55.77600 +
[  115s] +++ /usr/src/packages/BUILD/tests/testsuite.dir/at-groups/1/stdout 
2019-04-12 02:51:04.79600 +
[  115s] @@ -44,8 +44,6 @@
[  115s]  [OK|OK] Server's read_cb_srv(): received 29(29) bytes: 44 6f 68 2c 20 
72 65 73 70 6f 6e 64 69 6e 67 20 74 6f 20 73 65 72 76 65 72 20 3a 2d 44 
[  115s]  [OK|OK] Server's read_cb_srv(): sent 11 bytes message: 72 65 61 64 5f 
63 62 5f 73 72 76 
[  115s]  [OK|OK] Server's read_cb_srv(): force client disconnect on subsequent 
call
[  115s] -[OK] Client's read_cb_cli(): callback triggered
[  115s] -[OK] Client's read_cb_cli(): 0-byte read, auto-reconnect will be 
triggered if enabled
[  115s]  non-reconnecting test complete.
[  115s]  
[  115s]  Stream tests completed
[  115s] 1. testsuite.at:4: 1. stream_test (testsuite.at:4): FAILED 
(testsuite.at:8)
[  115s] debian/rules:27: recipe for target 'override_dh_auto_test' failed
[  115s] make[1]: *** [override_dh_auto_test] Error 1
[  115s] make[1]: Leaving directory '/usr/src/packages/BUILD'
[  115s] debian/rules:13: recipe for target 'build' failed
[  115s] make: *** [build] Error 2
[  115s] dpkg-buildpackage: error: debian/rules build gave error exit status 2
[  115s] 
[  115s] lamb01 failed "build libosmo-netif_0.4.0.25.e380.dsc" at Fri Apr 12 
02:51:06 UTC 2019.
[  115s] 
[  115s] ### VM INTERACTION START ###
[  118s] [  107.016730] sysrq: SysRq : Power Off
[  118s] [  107.023688] reboot: Power down
[  118s] ### VM INTERACTION END ###
[  118s] 
[  118s] lamb01 failed "build libosmo-netif_0.4.0.25.e380.dsc" at Fri Apr 12 
02:51:09 UTC 2019.
[  118s] 

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


Change in osmo-msc[master]: large refactoring: support inter-BSC and inter-MSC Handover

2019-04-11 Thread Neels Hofmeyr
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13137

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

Change subject: large refactoring: support inter-BSC and inter-MSC Handover
..

large refactoring: support inter-BSC and inter-MSC Handover

3GPP TS 49.008 '4.3 Roles of MSC-A, MSC-I and MSC-T' defines distinct roles:
- MSC-A is responsible for managing subscribers,
- MSC-I is the gateway to the RAN.
- MSC-T is a second transitory gateway to another RAN during Handover.

After inter-MSC Handover, the MSC-I is handled by a remote MSC instance, while
the original MSC-A retains the responsibility of subscriber management.

MSC-T exists in this patch but is not yet used, since Handover is only prepared
for, not yet implemented.

Facilitate Inter-MSC and inter-BSC Handover by the same internal split of MSC
roles.

Compared to inter-MSC Handover, mere inter-BSC has the obvious simplifications:
- all of MSC-A, MSC-I and MSC-T roles will be served by the same osmo-msc
  instance,
- messages between MSC-A and MSC-{I,T} don't need to be routed via E-interface
  (GSUP),
- no call routing between MSC-A and -I via MNCC necessary.

This is the largest code bomb I have submitted, ever. Out of principle, I
apologize to everyone trying to read this as a whole. Unfortunately, I see no
sense in trying to split this patch into smaller bits. It would be a huge
amount of work to introduce these changes in separate chunks, especially if
each should in turn be useful and pass all test suites. So, unfortunately, we
are stuck with this code bomb.

The following are some details and rationale for this rather huge refactoring:

* separate MSC subscriber management from ran_conn

struct ran_conn is reduced from the pivotal subscriber management entity it has
been so far to a mere storage for an SCCP connection ID and an MSC subscriber
reference.

The new pivotal subscriber management entity is struct msc_a -- struct msub
lists the msc_a, msc_i, msc_t roles, the vast majority of code paths however
use msc_a, since MSC-A is where all the interesting stuff happens.

Before handover, msc_i is an FSM implementation that encodes to the local
ran_conn. After inter-MSC Handover, msc_i is a compatible but different FSM
implementation that instead forwards via/from GSUP. Same goes for the msc_a
struct: if osmo-msc is the MSC-I "RAN proxy" for a remote MSC-A role, the
msc_a->fi is an FSM implementation that merely forwards via/from GSUP.

* New SCCP implementation for RAN access

To be able to forward BSSAP and RANAP messages via the GSUP interface, the
individual message layers need to be cleanly separated. The IuCS implementation
used until now (iu_client from libosmo-ranap) did not provide this level of
separation, and needed a complete rewrite. It was trivial to implement this in
such a way that both BSSAP and RANAP can be handled by the same SCCP code,
hence the new SCCP-RAN layer also replaces BSSAP handling.

sccp_ran.h: struct sccp_ran_inst provides an abstract handler for incoming RAN
connections. A set of callback functions provides implementation specific
details.

* RAN Abstraction (BSSAP vs. RANAP)

The common SCCP implementation did set the theme for the remaining refactoring:
make all other MSC code paths entirely RAN-implementation-agnostic.

ran_infra.c provides data structures that list RAN implementation specifics,
from logging to NAS de-/encoding to SCCP callbacks and timers. A ran_infra
pointer hence allows complete abstraction of RAN implementations:

- managing connected RAN peers (BSC, RNC) in ran_peer.c,
- classifying and de-/encoding NAS PDUs,
- recording connected LACs and cell IDs and sending out Paging requests to
  matching RAN peers.

* RAN RESET now also for RANAP

ran_peer.c absorbs the reset_fsm from a_reset.c; in consequence, RANAP also
supports proper RESET semantics now. Hence osmo-hnbgw now also needs to provide
proper RESET handling, which it so far duly ignores. (TODO)

* NAS de-/encoding abstraction

The NAS abstraction mentioned above serves not only to separate RANAP and BSSAP
implementations transparently, but also to be able to optionally handle NAS on
distinct levels. Before Handover, all NAS is handled by the MSC-A role.
However, after an inter-MSC Handover, a standalone MSC-I will need to decode
NAS PDUs, at least in order to manage Assignment of RTP streams between BSS/RNC
and MNCC call forwarding.

nas.h provides a common API with abstraction for:

- receiving NAS events from RAN, i.e. passing NAS decode from the BSC/RNC and
  MS/UE: struct nas_dec_msg represents NAS messages decoded from either BSSMAP
  or RANAP;
- sending NAS events: nas_enc_msg is the counterpart to compose NAS messages
  that should be encoded to either BSSMAP or RANAP and passed down to the
  BSC/RNC and MS/UE.

The RAN-specific implementations are completely contained by nas_a.c and
nas_iu.c.

In particular, 

Change in osmo-msc[master]: sms queue: avoid repeated Paging for a failed SMS

2019-04-11 Thread Neels Hofmeyr
Hello Vadim Yanitskiy, Keith Whyte, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/13173

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

Change subject: sms queue: avoid repeated Paging for a failed SMS
..

sms queue: avoid repeated Paging for a failed SMS

So far, sms_pending_failed() starts a new sms_queue_trigger() run. The
intention behind that might have been to fill up the queue when sending SMS has
failed, but the practical effect is actually bad:

As current ttcn3-msc-test runs show, a failed MT SMS gets triggered multiple
times in short succession, i.e. osmo-msc repeatedly sends Paging Requests for
the same subscriber.

This special case happens actually only when there are few SMS still in the DB
to be delivered. In the TTCN3 test, there is exactly one MT SMS for one
subscriber, and retriggering the queue brings up the same SMS every time.

See f_tc_lu_and_mt_sms_paging_and_nothing() and f_tc_sgsap_mt_sms_and_nothing()
which say:
"/* Expect the MSC to page exactly 10 times before giving up */"

This is bad because an MSC should send a Paging Request exactly once. Retrying
failed Paging is clearly the task of the BSC, not the MSC. The remaining code
around Paging correctly follows this paradigm, but this retrigger doesn't.

Do not immediately trigger the SMS queue on a failed MT SMS. Instead, leave it
up to the periodical SMS queue trigger to decide.

This patch will cause the MT SMS tests in ttcn3-msc-tests to fail, because the
test expectations are bogus. The patch fixing the test run is listed 'Related'
below.

Related: I7dce12942a65eaaf97f78ca69401c7f93faacb9e (osmo-ttcn3-hacks)
Change-Id: I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49
---
M src/libmsc/sms_queue.c
1 file changed, 0 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/73/13173/5
--
To view, visit https://gerrit.osmocom.org/13173
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I24bf9f1c1167efe1080ae4cf47ed2ef0bd981e49
Gerrit-Change-Number: 13173
Gerrit-PatchSet: 5
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Keith Whyte 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmo-msc[master]: rename bscconfig.h to config.h, cleanup

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13138 )

Change subject: rename bscconfig.h to config.h, cleanup
..


Patch Set 4:

This change is ready for review.


--
To view, visit https://gerrit.osmocom.org/13138
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id4f683be1f36f0630c83da54e02868aae847aeec
Gerrit-Change-Number: 13138
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-CC: Max 
Gerrit-Comment-Date: Fri, 12 Apr 2019 02:27:12 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-msc[master]: large refactoring: support inter-BSC and inter-MSC Handover

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13137 )

Change subject: large refactoring: support inter-BSC and inter-MSC Handover
..


Patch Set 4:

This change is ready for review.


--
To view, visit https://gerrit.osmocom.org/13137
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I27e4988e0371808b512c757d2b52ada1615067bd
Gerrit-Change-Number: 13137
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Fri, 12 Apr 2019 02:27:17 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in libosmocore[master]: add OSMO_IMSI_BUF_SIZE

2019-04-11 Thread Neels Hofmeyr
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/13575

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

Change subject: add OSMO_IMSI_BUF_SIZE
..

add OSMO_IMSI_BUF_SIZE

Various places in our code base figure out how many chars they need to safely
store an IMSI. An IMSI can have a checksum digit, which is not reflected by
GSM23003_IMSI_MAX_DIGITS. And we usually need a terminating \0.

Instead of having a magic +2 repeated every so often, rather define
OSMO_IMSI_BUF_SIZE to contain both checksum digit and nul char, and have the
explanatory comment with it here in libosmocore.

Change-Id: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770
---
M include/osmocom/gsm/gsup.h
M include/osmocom/gsm/protocol/gsm_23_003.h
2 files changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/13575/4
--
To view, visit https://gerrit.osmocom.org/13575
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770
Gerrit-Change-Number: 13575
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Pau Espin Pedrol 
Gerrit-CC: Vadim Yanitskiy 


Change in libosmocore[master]: add gsm0808_create_common_id()

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13611


Change subject: add gsm0808_create_common_id()
..

add gsm0808_create_common_id()

Change-Id: Id055df109cf67754854641ce6486523027f4d801
---
M include/osmocom/gsm/gsm0808.h
M src/gsm/gsm0808.c
2 files changed, 28 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/11/13611/1

diff --git a/include/osmocom/gsm/gsm0808.h b/include/osmocom/gsm/gsm0808.h
index a4e63a9..5f3a628 100644
--- a/include/osmocom/gsm/gsm0808.h
+++ b/include/osmocom/gsm/gsm0808.h
@@ -301,6 +301,8 @@
 struct msgb *gsm0808_create_dtap(struct msgb *msg, uint8_t link_id);
 void gsm0808_prepend_dtap_header(struct msgb *msg, uint8_t link_id);

+struct msgb *gsm0808_create_common_id(const char *imsi);
+
 const struct tlv_definition *gsm0808_att_tlvdef(void);

 /*! Parse BSSAP TLV structure using \ref tlv_parse */
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 3c77c77..ad320da 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -1258,6 +1258,32 @@
return msg;
 }

+/*! Crate BSSMAP Common ID message.
+ * \param[in] imsi  Subscriber's IMSI to send in the Common ID message.
+ * \return allocated msgb with BSSMAP Common ID message.
+ */
+struct msgb *gsm0808_create_common_id(const char *imsi)
+{
+   uint8_t mid_buf[GSM48_MI_SIZE + 2];
+   int mid_len;
+   struct msgb *msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, 
BSSMAP_MSG_HEADROOM, "CommonID");
+   if (!msg)
+   return NULL;
+   OSMO_ASSERT(strlen(imsi) <= GSM48_MI_SIZE);
+
+   /* Message Type, 3.2.2.1 */
+   msgb_v_put(msg, BSS_MAP_MSG_COMMON_ID);
+
+   /* mandatory IMSI 3.2.2.6 */
+   mid_len = gsm48_generate_mid_from_imsi(mid_buf, imsi);
+   msgb_tlv_put(msg, GSM0808_IE_IMSI, mid_len - 2, mid_buf + 2);
+
+   /* prepend header with final length */
+   msg->l3h = msgb_tv_push(msg, BSSAP_MSG_BSS_MANAGEMENT, 
msgb_length(msg));
+
+   return msg;
+}
+
 /* As per 3GPP TS 48.008 version 11.7.0 Release 11 */
 static const struct tlv_definition bss_att_tlvdef = {
.def = {

-- 
To view, visit https://gerrit.osmocom.org/13611
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

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


Change in libosmocore[master]: add gsm0808_create_common_id()

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has abandoned this change. ( https://gerrit.osmocom.org/13611 )

Change subject: add gsm0808_create_common_id()
..


Abandoned

accidental push
-- 
To view, visit https://gerrit.osmocom.org/13611
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: Id055df109cf67754854641ce6486523027f4d801
Gerrit-Change-Number: 13611
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in libosmocore[master]: contrib/voicecall-shark

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has abandoned this change. ( https://gerrit.osmocom.org/13610 )

Change subject: contrib/voicecall-shark
..


Abandoned

accidental push
--
To view, visit https://gerrit.osmocom.org/13610
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: abandon
Gerrit-Change-Id: Ia3cdefe16b9e929d2836ca837db6f6107f7ed9eb
Gerrit-Change-Number: 13610
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 


Change in libosmocore[master]: GSUP: add Message Class IE

2019-04-11 Thread Neels Hofmeyr
Hello Vadim Yanitskiy, Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/13576

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

Change subject: GSUP: add Message Class IE
..

GSUP: add Message Class IE

osmo-msc and osmo-hlr have distinct subsystems handling incoming GSUP messages.
So far we decide entirely by message type which code path should handle a GSUP
message. Thus no GSUP message type may be re-used across subsystems.

If we add a GSUP message to indicate a routing error, it would have to be a
distinct message type for subscriber management, another one for SMS, another
one for USSD...

To allow introducing common message types, introduce a GSUP Message Class IE.

In the presence of this IE, GSUP handlers can trivially direct a received
message to the right code path. If it is missing, handlers can fall back to the
previous switch(message_type) method.

Change-Id: Ic397a9f2c4a7224e47cab944c72e75ca5592efef
---
M include/osmocom/gsm/gsup.h
M src/gsm/gsup.c
M src/gsm/libosmogsm.map
M tests/gsup/gsup_test.c
M tests/gsup/gsup_test.err
5 files changed, 47 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/76/13576/4
--
To view, visit https://gerrit.osmocom.org/13576
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ic397a9f2c4a7224e47cab944c72e75ca5592efef
Gerrit-Change-Number: 13576
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 


Change in libosmocore[master]: contrib/voicecall-shark

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/13610


Change subject: contrib/voicecall-shark
..

contrib/voicecall-shark

Change-Id: Ia3cdefe16b9e929d2836ca837db6f6107f7ed9eb
---
A contrib/voicecall-shark
1 file changed, 669 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/10/13610/1

diff --git a/contrib/voicecall-shark b/contrib/voicecall-shark
new file mode 100755
index 000..54600d0
--- /dev/null
+++ b/contrib/voicecall-shark
@@ -0,0 +1,669 @@
+#!/usr/bin/env python3
+
+doc = '''voicecall-shark: get grips on voice call MGCP and RTP'''
+
+import pyshark
+import pprint
+
+verbose = False
+
+def vprint(*args):
+   if not verbose:
+   return
+   print(*args)
+
+def error(*args):
+   raise Exception(''.join(*args))
+
+def pget(p, *field, ifnone=None):
+   tokens = ('.'.join(field)).split('.')
+   if p is None or len(tokens) < 1:
+   return ifnone
+   first = tokens[0]
+   if not hasattr(p, first):
+   return ifnone
+   p_field = getattr(p, first)
+   if p_field is None:
+   return ifnone
+   if len(tokens) > 1:
+   return pget(p_field, *tokens[1:])
+   return p_field
+
+
+class LogEntry:
+   def __init__(s, p, message, obj):
+   s.p = p
+   s.message = message
+   s.obj = obj
+
+
+class HasLog:
+   def __init__(s, parent=None):
+   s.log_entries = []
+   s.parents = []
+   s.children = []
+   if parent is not None:
+   s.log_parent(parent)
+
+   def log_child(s, child):
+   s.children.append(child)
+   child.parents.append(s)
+
+   def log_parent(s, parent):
+   parent.log_child(s)
+
+   def log(s, p, message):
+   s.log_entries.append(LogEntry(p, message, s))
+
+class Domino(HasLog):
+   def __init__(s, left, right, *refs):
+   s.left = left
+   s.right = right
+   s.refs = list(refs)
+   s.reversed = [ False ] * len(s.refs)
+
+   def absorb(s, domino):
+   s.refs.extend(domino.refs)
+   s.reversed.extend(domino.reversed)
+
+   def reverse(s):
+   x = s.left
+   s.left = s.right
+   s.right = x
+   s.reversed = list(map(lambda x: not x, s.reversed))
+
+   def matches(s, label):
+   if s.left == label:
+   return -1
+   if s.right == label:
+   return 1
+   return 0
+
+   def __str__(s):
+   return s.str('[','|',']')
+
+   def __repr__(s):
+   return str(s)
+
+   def str(s, left='[', mid='|', right=']', reverse=False):
+   if reverse:
+   return '%s%s%s%s%s' % (left, s.right, mid, s.left, 
right)
+   else:
+   return '%s%s%s%s%s' % (left, s.left, mid, s.right, 
right)
+
+   def __eq__(s, other):
+   o = other.str()
+   return s.str() == o or s.str(reverse=True) == o
+
+class Dominoes(HasLog):
+   def __init__(s, *pieces):
+   s.pieces = list(pieces)
+
+   def has(s, piece):
+   for p in s.pieces:
+   if p is piece:
+   return True
+   return False
+
+   def add(s, piece):
+   if s.has(piece):
+   return
+   s.pieces.append(piece)
+
+   def find_piece(s, label, in_list=None):
+   if in_list is None:
+   in_list = s.pieces
+   for piece in in_list:
+   if piece.matches(label):
+   return piece
+   return None
+
+   def find_match(s, for_piece, in_list=None):
+   if in_list is None:
+   in_list = s.pieces
+   match = s.find_piece(for_piece.left, in_list)
+   if not match:
+   match = s.find_piece(for_piece.right, in_list)
+   return match
+
+   def dedup(loose_pieces):
+   pieces = []
+   loose_pieces = list(loose_pieces)
+   while loose_pieces:
+   l = loose_pieces.pop(0)
+   for p in pieces:
+   if l == p:
+   p.absorb(l)
+   l = None
+   break
+
+   if l:
+   pieces.append(l)
+   return pieces
+
+   def arrange(loose_pieces):
+   if not loose_pieces:
+   return []
+   pieces_remain = 

Change in libosmocore[master]: add osmo_{escape, quote}_str_buf2() for standard args ordering

2019-04-11 Thread Neels Hofmeyr
Hello Harald Welte, Jenkins Builder,

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

https://gerrit.osmocom.org/13573

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

Change subject: add osmo_{escape,quote}_str_buf2() for standard args ordering
..

add osmo_{escape,quote}_str_buf2() for standard args ordering

To be able to append an escaped or quoted string using
OSMO_STRBUF_APPEND_NOLEN(), the function signature must have the buf and len as
first args, like most other *_buf() functions.

Add osmo_escape_str_buf2() and osmo_quote_str_buf2() to match this signature.

A recent patch [1] has changed the return value of osmo_escape_str_buf() to
char*, removing the const. However, the functions may return const strings,
hence re-add the const. The new signatures always return the non-const buffer.

To avoid code duplication, implement osmo_quote_str_buf() and
osmo_escape_str_buf() by calling the new functions.

I decided to allow slight changes to the behavior for current osmo_escape_str()
and osmo_escape_str_buf(), because impact on callers is minimal:

(1) The new implementation uses OSMO_STRBUF_*, and in consequence
osmo_quote_str() no longer prints an ending double quote after truncated
strings; Before, a truncated output was, sic:
  "this string is trunca"
and now this becomes, sic:
  "this string is truncat
I decided to not keep the old behavior because it is questionable to begin
with. It looks like the string actually ended at the truncation boundary
instead of the reason being not enough space in the output buffer.

(2) The new osmo_escape_str_buf2() function obviously cannot pass-thru an
unchanged char* if no escaping was needed. Sacrifice this tiny optimization
feature to avoid code duplication:
- it is an unnoticeable optimization,
- the caller anyway always passes a string buffer,
- the feature caused handling strings and buffers differently depending on
  their content (i.e. code that usually writes out strings in full length
  "suddenly" truncates because a non-printable character is contained, etc.)
I considered adding a skip_if_unescaped flag to the osmo_quote_str_buf2()
function signature, but in the end decided that the API clutter is not worth
having for all the above reasons.

Adjust tests to accomodate above changes.

[1] 4a62eda225ab7f3c9556990c81a6fc5e19b5eec8
Ibf85f79e93244f53b2684ff6f1095c5b41203e05

Change-Id: Id748b906b0083b1f1887f2be7a53cae705a8a9ae
---
M TODO-RELEASE
M include/osmocom/core/utils.h
M src/utils.c
M tests/utils/utils_test.c
M tests/utils/utils_test.ok
5 files changed, 117 insertions(+), 49 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/73/13573/4
--
To view, visit https://gerrit.osmocom.org/13573
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id748b906b0083b1f1887f2be7a53cae705a8a9ae
Gerrit-Change-Number: 13573
Gerrit-PatchSet: 4
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 


Change in libosmocore[master]: add gsm0808_create_handover_request_ack2 to add AoIP RTP addr

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13259 )

Change subject: add gsm0808_create_handover_request_ack2 to add AoIP RTP addr
..


Patch Set 9:

(1 comment)

https://gerrit.osmocom.org/#/c/13259/9//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/#/c/13259/9//COMMIT_MSG@15
PS9, Line 15: the
: gsm0808.c actually also gets built on embedded systems that lack 
arpa/inet.h
: (for me indicated by the ARM build job on jenkins)
> we can simply not compile 08.08 related functions in the "embedded" case. […]
Yes, I actually did try quite a few things, and in the end decided it's not 
worth it to waste my time on.
Originally I wanted to use a struct sockaddr as a member in struct 
gsm0808_handover_*.
In the meantime I have befriended the idea of passing pointers in those 
structs, so not that urgent.

The core problem was that I cannot use struct sockaddr as a non-opaque struct 
in the header file.
Even though on embedded, the .c file isn't built, the header file is still 
included!
And in the .h file one obviously cannot use '#if (!EMBEDDED)', because in 
/usr/include there is no config.h.

It's not a big deal for me anymore,
but in general the include / compile semantics for gsm0808.h are unsorted/wrong.



--
To view, visit https://gerrit.osmocom.org/13259
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia71542ea37d4fd2c9fb9b40357db7aeb111ec576
Gerrit-Change-Number: 13259
Gerrit-PatchSet: 9
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Comment-Date: Fri, 12 Apr 2019 00:08:30 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP: add Class IE

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13576 )

Change subject: GSUP: add Class IE
..


Patch Set 3:

(2 comments)

https://gerrit.osmocom.org/#/c/13576/3/src/gsm/gsup.c
File src/gsm/gsup.c:

https://gerrit.osmocom.org/#/c/13576/3/src/gsm/gsup.c@481
PS3, Line 481: osmo_decode_big_endian
> It's just one byte, no need for osmo_decode_big_endian() here.
was just copying code I saw elsewhere; you are right though, I think I copied 
uint32_t code without noticing.


https://gerrit.osmocom.org/#/c/13576/3/src/gsm/gsup.c@739
PS3, Line 739: {}
> Common style: { 0, NULL }
I always use {}, and have been doing that all over the place.



--
To view, visit https://gerrit.osmocom.org/13576
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic397a9f2c4a7224e47cab944c72e75ca5592efef
Gerrit-Change-Number: 13576
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 23:33:52 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP: add Class IE

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13576 )

Change subject: GSUP: add Class IE
..


Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/13576/3/include/osmocom/gsm/gsup.h
File include/osmocom/gsm/gsup.h:

https://gerrit.osmocom.org/#/c/13576/3/include/osmocom/gsm/gsup.h@309
PS3, Line 309:  enum osmo_gsup_classclass;
Actually in this case I notice that the word 'class' alone is a keyword in C++, 
so it was in fact a poor choice for a variable / member name. So ... might have 
to format-patch-sed-git-am again 

This here would have been a saner place to argue against the name than above :P

I wish I had stayed firm with just using "Kind" instead, what's the use of 
changing synonyms for synonyms.



--
To view, visit https://gerrit.osmocom.org/13576
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic397a9f2c4a7224e47cab944c72e75ca5592efef
Gerrit-Change-Number: 13576
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 23:30:27 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in libosmocore[master]: GSUP: add Class IE

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13576 )

Change subject: GSUP: add Class IE
..


Patch Set 3:

(2 comments)

I appreciate the review, but in this case...

https://gerrit.osmocom.org/#/c/13576/3/include/osmocom/gsm/gsup.h
File include/osmocom/gsm/gsup.h:

https://gerrit.osmocom.org/#/c/13576/3/include/osmocom/gsm/gsup.h@71
PS3, Line 71: OSMO_GSUP_CLASS_IE
> Looking at this IE, the reader may ask: class of what? […]
It is actually rather absurd, in the face of HUGE GIGANTIC patches waiting for 
review, we are seriously nitpicking about "Kind" vs "Class" vs "Message Class". 
This is Bikeshed at its best, if I may say so myself ;)

"Message Class" is saying exactly the same thing but with more words; what part 
of GSUP is not a Message?

I already once edited all those patches from "KIND" to "CLASS", here, in 
osmo-hlr and osmo-msc, across entire branch histories; with git format-patch, 
sed and git am, taking great care to not accidentally modify other sentences 
containing the word "kind" in unrelated contexts. IMHO that's no sane way to 
spend my time.


https://gerrit.osmocom.org/#/c/13576/3/include/osmocom/gsm/gsup.h@241
PS3, Line 241: OSMO_GSUP_CLASS_ARRAYSIZE
> Which array? […]
Please see the comment just above it. It explicitly serves as size for an 
array, hence it is called ARRAYSIZE.

The other may be an End Marker, which it actually isn't: it never is actually 
used as a marker anywhere. The only place it is used is gsup_test.c for a 
validity check.

Apologies, but I'd rather not adopt a bad name choice if you don't force me.



--
To view, visit https://gerrit.osmocom.org/13576
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ic397a9f2c4a7224e47cab944c72e75ca5592efef
Gerrit-Change-Number: 13576
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 23:24:10 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in libosmocore[master]: add OSMO_IMSI_SIZE

2019-04-11 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/13575 )

Change subject: add OSMO_IMSI_SIZE
..


Patch Set 3:

interesting, I see "size" as synonymous with "buf_size". Even more generally 
appropriate, next guy prefers ARRAY_SIZE or ALLOC_SIZE or DUMP_SIZE or 
CACHE_SIZE..., all just comes down to size. I don't mind changing the name, 
though it does add more work to adjust other patches for a pretty moot change...


--
To view, visit https://gerrit.osmocom.org/13575
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770
Gerrit-Change-Number: 13575
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-CC: Pau Espin Pedrol 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 23:04:24 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13609 )

Change subject: ggsn: More logging from PCO handling (e.g. in case of 
malconfiguration)
..


Patch Set 3: Code-Review+2

(1 comment)

https://gerrit.osmocom.org/#/c/13609/3/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13609/3/ggsn/ggsn.c@570
PS3, Line 570:  if (!peer_v4) {
Wondering why IPCP is only used in ipv4...



--
To view, visit https://gerrit.osmocom.org/13609
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e
Gerrit-Change-Number: 13609
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 20:01:23 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-ggsn[master]: ggsn: Add minimalistic PAP support

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13608 )

Change subject: ggsn: Add minimalistic PAP support
..


Patch Set 3: Code-Review-1

(7 comments)

-1 because it should be ntohs.

https://gerrit.osmocom.org/#/c/13608/3//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/#/c/13608/3//COMMIT_MSG@12
PS3, Line 12: all, without actually checking any credentials database.
So the MS is expected to send inside PAP the values you configure your APN 
with? (the User+Password fields in the APN menu of android phones).


https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c@511
PS3, Line 511: "Welcome to OsmoGGSN"
> btw, I think this will be an easy way to figure out remotely if somebody is 
> using OsmoGGSN or not: S […]
If it was AGPL then it'd be funny answering that in osmo-sgsn with a message 
"go free you code!" and a copy of the license ;)


https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c@518
PS3, Line 518:  unsigned int pap_welcome_len = strlen(pap_welcome);
"ARRAY_SIZE(pap_welcome) -1" would make sense too :)


https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c@519
PS3, Line 519:  uint8_t pap_out_size = sizeof(struct pap_element) + 1 + 
pap_welcome_len;
Is that +1 for the NULL chat of pap_welcome? please add comment (and add +1 to 
the end).


https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c@520
PS3, Line 520:  struct pap_element *pap_out = alloca(pap_out_size);
nice, didn't know about alloca()


https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c@526
PS3, Line 526:  if (htons(pap_in->len) > pco_in->length)
is htons() fine alignment-access wise?
And actually it should be ntohs.


https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c@531
PS3, Line 531:  peer_id_len = pap_in->data[0];
I think you are not covering case sizeof(*pap_in) == ntohs(pap_in->len), that 
is, pap_in->data is empty. In that case you shoul avoid accessing pap_in->data 
and returning broken.



--
To view, visit https://gerrit.osmocom.org/13608
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I81875f30f9f1497199253497f84718510747f731
Gerrit-Change-Number: 13608
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 19:57:42 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-ggsn[master]: ggsn.c: Refactor PCO processing during PDP activation

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13606 )

Change subject: ggsn.c: Refactor PCO processing during PDP activation
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c@606
PS1, Line 606:   cur + sizeof(struct pco_element) <= pco->v + pco->l;
> I know that I can eliminate the local stack variable that way. […]
Ok, I actually prefer ther other way but fine :)



--
To view, visit https://gerrit.osmocom.org/13606
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4a7d09279b6b259e2b95f1f51159b16838b2d94c
Gerrit-Change-Number: 13606
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 19:29:35 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ttcn3-hacks[master]: ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13564 )

Change subject: ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()
..


Patch Set 5: Code-Review+1

(2 comments)

https://gerrit.osmocom.org/#/c/13564/5/ggsn_tests/GGSN_Tests.ttcn
File ggsn_tests/GGSN_Tests.ttcn:

https://gerrit.osmocom.org/#/c/13564/5/ggsn_tests/GGSN_Tests.ttcn@943
PS5, Line 943:  setverdict(fail, "PAP isn't an AuthenticateAck: 
", pap);
so iiuc this means some code is needed in osmo-ggsn which answers this and 
basically allows everybody no matter the PAP credentials provided (as if PAP 
was not used, as until now).


https://gerrit.osmocom.org/#/c/13564/5/library/GTP_Templates.ttcn
File library/GTP_Templates.ttcn:

https://gerrit.osmocom.org/#/c/13564/5/library/GTP_Templates.ttcn@466
PS5, Line 466:  protoIDContents := 
'013c035338323700bc1c08087c1508083e0079150808fd060100'O
lol. Some description/comment here would be welcome.



--
To view, visit https://gerrit.osmocom.org/13564
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie89d984ed9e26fbbb2e4914bdb8623446d462a4c
Gerrit-Change-Number: 13564
Gerrit-PatchSet: 5
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 19:26:23 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: library: Add PAP_Types for PPP Authentication Protocol (RFC 1334)

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13607 )

Change subject: library: Add PAP_Types for PPP Authentication Protocol (RFC 
1334)
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13607
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I31cb766bb701b8107df5de978d2b0b085977045a
Gerrit-Change-Number: 13607
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 19:18:14 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: ggsn: Verify that there are no duplicate PCO protocolIDs

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13563 )

Change subject: ggsn: Verify that there are no duplicate PCO protocolIDs
..


Patch Set 3: Code-Review+1

(1 comment)

https://gerrit.osmocom.org/#/c/13563/3/ggsn_tests/GGSN_Tests.ttcn
File ggsn_tests/GGSN_Tests.ttcn:

https://gerrit.osmocom.org/#/c/13563/3/ggsn_tests/GGSN_Tests.ttcn@773
PS3, Line 773:  f_PCO_ensure_no_duplicates(ctx.pco_neg);
What about adding this kind of check inside f_pdp_ctx_act so we don't need to 
put it in every test?

To take into account cases like TC_pdp4_act_deact_with_separate_dns(), I'd 
actually modify f_PCO_ensure_no_duplicates() to count number of duplicates sent 
in request and making sure we answer each of them, so req.count(prot_type) == 
resp.count(prot_type), for each prot_type.



--
To view, visit https://gerrit.osmocom.org/13563
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I9d439dab1696196cd125f4d7113b426f1711a405
Gerrit-Change-Number: 13563
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 19:14:14 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()

2019-04-11 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13564

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

Change subject: ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()
..

ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()

This test case reproduces a real-world PCO capture including a broken
PAP AuthenticationReq.  It triggers some weird behavior in OsmoGGSN
1.3.0 where it would send duplicate IPCP repsonses and no PAP response.

Change-Id: Ie89d984ed9e26fbbb2e4914bdb8623446d462a4c
Related: OS#3914
---
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/gen_links.sh
M library/GTP_Templates.ttcn
3 files changed, 46 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/64/13564/5
--
To view, visit https://gerrit.osmocom.org/13564
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie89d984ed9e26fbbb2e4914bdb8623446d462a4c
Gerrit-Change-Number: 13564
Gerrit-PatchSet: 5
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-gsm-manuals[master]: Add debian packaging for osmo-gsm-manuals-dev

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13599 )

Change subject: Add debian packaging for osmo-gsm-manuals-dev
..


Patch Set 2:

(2 comments)

https://gerrit.osmocom.org/#/c/13599/2/debian/copyright
File debian/copyright:

https://gerrit.osmocom.org/#/c/13599/2/debian/copyright@10
PS2, Line 10: Copyright: 2019 Oliver Smith 
afaik the copyright of those files is not yours, but from sysmocom.

Copyright: 2019 sysmocom s.m.f.c. GmbH 


https://gerrit.osmocom.org/#/c/13599/2/debian/copyright@13
PS2, Line 13: License: GPL-3.0+
Repeated line (l11)?



--
To view, visit https://gerrit.osmocom.org/13599
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I7edb5093e5b58eb3b0f7af2376476db4026db735
Gerrit-Change-Number: 13599
Gerrit-PatchSet: 2
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:43:13 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-gsm-manuals[master]: Makefile.am: proper noarch pkgconfig install dir

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13598 )

Change subject: Makefile.am: proper noarch pkgconfig install dir
..


Patch Set 1: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/13598
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I63bc8ab6d2845751079f40383d2aa92c709ce2fe
Gerrit-Change-Number: 13598
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:43:25 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ggsn[master]: ggsn: Add minimalistic PAP support

2019-04-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13608 )

Change subject: ggsn: Add minimalistic PAP support
..


Patch Set 3:

(1 comment)

https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13608/3/ggsn/ggsn.c@511
PS3, Line 511: "Welcome to OsmoGGSN"
btw, I think this will be an easy way to figure out remotely if somebody is 
using OsmoGGSN or not: Simply send PAP in the PDP CTX ACT REQ and the message 
in the response will tell you ;)



--
To view, visit https://gerrit.osmocom.org/13608
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I81875f30f9f1497199253497f84718510747f731
Gerrit-Change-Number: 13608
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:42:27 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn.c: Refactor PCO processing during PDP activation

2019-04-11 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13606

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

Change subject: ggsn.c: Refactor PCO processing during PDP activation
..

ggsn.c: Refactor PCO processing during PDP activation

The existing PCO processing is implemented in a rather convoluted
way.  We scan the list of PCO elements several times for different
PCO protocols.  Let's change to a straight-forward model where we
simply do one iteration over the list of PCO elements and generate
responses step by step.

Change-Id: I4a7d09279b6b259e2b95f1f51159b16838b2d94c
---
M ggsn/ggsn.c
1 file changed, 95 insertions(+), 85 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/06/13606/3
--
To view, visit https://gerrit.osmocom.org/13606
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I4a7d09279b6b259e2b95f1f51159b16838b2d94c
Gerrit-Change-Number: 13606
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 


Change in osmo-ggsn[master]: ggsn.c: Refactor PCO processing during PDP activation

2019-04-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13606 )

Change subject: ggsn.c: Refactor PCO processing during PDP activation
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c@606
PS1, Line 606:   cur + sizeof(struct pco_element) <= pco->v + pco->l;
> You actually need to cast to uint8_t* during the sum in last line most 
> probably
I know that I can eliminate the local stack variable that way.  However, I 
think it's more readable - and one doesn't have to have several in-line "const 
uint8_t *" typecasts to make the additions work.



--
To view, visit https://gerrit.osmocom.org/13606
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4a7d09279b6b259e2b95f1f51159b16838b2d94c
Gerrit-Change-Number: 13606
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:39:44 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn: Add minimalistic PAP support

2019-04-11 Thread Harald Welte
Harald Welte has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/13608 )

Change subject: ggsn: Add minimalistic PAP support
..

ggsn: Add minimalistic PAP support

Some modems are configured to use PAP as an additional authentication
mechanism beyond the GSM authentication that's part of GMM.  Let's
handle such PAP authentication requests by simply acknowledging them
all, without actually checking any credentials database.

This is the most sane thing we can do for now, without adding external
requirements / interfaces like radius servers or the like.

Closes: OS#3914
Change-Id: I81875f30f9f1497199253497f84718510747f731
---
M ggsn/ggsn.c
1 file changed, 63 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/08/13608/2
--
To view, visit https://gerrit.osmocom.org/13608
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I81875f30f9f1497199253497f84718510747f731
Gerrit-Change-Number: 13608
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte 


Change in osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)

2019-04-11 Thread Harald Welte
Harald Welte has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/13609 )

Change subject: ggsn: More logging from PCO handling (e.g. in case of 
malconfiguration)
..

ggsn: More logging from PCO handling (e.g. in case of malconfiguration)

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


  git pull ssh://gerrit.osmocom.org:29418/osmo-ggsn refs/changes/09/13609/2
--
To view, visit https://gerrit.osmocom.org/13609
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e
Gerrit-Change-Number: 13609
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte 


Change in osmo-gsm-manuals[master]: Makefile.common.inc: add {, un}install targets

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13597 )

Change subject: Makefile.common.inc: add {,un}install targets
..


Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/#/c/13597/1/build/Makefile.common.inc
File build/Makefile.common.inc:

https://gerrit.osmocom.org/#/c/13597/1/build/Makefile.common.inc@34
PS1, Line 34:   if [ "$(OSMO_GSM_MANUALS_NO_INSTALL)" != "1" ]; then \
According to configure.ac in osmo-bsc, default is not building manuals, so I 
think this should also be "don't install by default", that is: var must be set 
explicitly to 1 to have pdf installed. Otherwise please provide some reasoning 
why is it enabled by default.

>From osmo-bsc.git/configure.ac:
# Generate manuals
AC_ARG_ENABLE(manuals,
[AS_HELP_STRING(
[--enable-manuals],
[Generate manual PDFs [default=no]],
)],


https://gerrit.osmocom.org/#/c/13597/1/build/Makefile.common.inc@36
PS1, Line 36: Dm6
Probably better using /share/doc/osmo-gsm-manuals/. since we use for instance 
/usr/share/doc/osmo-bsc/ for osmo-bsc (unless of course you know how to easily 
pass by "osmo-bsc" from main Makefile to this one).



--
To view, visit https://gerrit.osmocom.org/13597
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I66f33172fa410681acbaef4592e9405627948705
Gerrit-Change-Number: 13597
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:30:50 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn: More logging from PCO handling (e.g. in case of malconfiguration)

2019-04-11 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13609


Change subject: ggsn: More logging from PCO handling (e.g. in case of 
malconfiguration)
..

ggsn: More logging from PCO handling (e.g. in case of malconfiguration)

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



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

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index d079efe..45026fe 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -567,15 +567,19 @@
ptrdiff_t consumed;
size_t remain;

-   if (!peer_v4)
+   if (!peer_v4) {
+   LOGPPDP(LOGL_ERROR, pdp, "IPCP but no IPv4 type ?!?\n");
return;
+   }

ipcp = pco_elem->data;
consumed = (ipcp - >pco_req.v[0]);
remain = sizeof(pdp->pco_req.v) - consumed;
ipcp_len = osmo_load16be(ipcp + 2); /* 1=code + 1=id */
-   if (remain < 0 || remain < ipcp_len)
+   if (remain < 0 || remain < ipcp_len) {
+   LOGPPDP(LOGL_ERROR, pdp, "Malformed IPCP, ignoring\n");
return;
+   }

/* Three byte T16L header */
msgb_put_u16(resp, 0x8021); /* IPCP */
@@ -608,6 +612,7 @@
 const struct apn_ctx *apn, struct 
pdp_t *pdp)
 {
unsigned int i;
+   const uint8_t *tail = resp->tail;

for (i = 0; i < ARRAY_SIZE(apn->v6.cfg.dns); i++) {
const struct in46_addr *i46a = >v6.cfg.dns[i];
@@ -615,12 +620,15 @@
continue;
msgb_t16lv_put(resp, PCO_P_DNS_IPv6_ADDR, i46a->len, 
i46a->v6.s6_addr);
}
+   if (resp->tail == tail)
+   LOGPPDP(LOGL_NOTICE, pdp, "MS requested IPv6 DNS, but APN has 
none configured\n");
 }

 static void process_pco_element_dns_ipv4(const struct pco_element *pco_elem, 
struct msgb *resp,
 const struct apn_ctx *apn, struct 
pdp_t *pdp)
 {
unsigned int i;
+   const uint8_t *tail = resp->tail;

for (i = 0; i < ARRAY_SIZE(apn->v4.cfg.dns); i++) {
const struct in46_addr *i46a = >v4.cfg.dns[i];
@@ -628,12 +636,17 @@
continue;
msgb_t16lv_put(resp, PCO_P_DNS_IPv4_ADDR, i46a->len, (uint8_t 
*)>v4);
}
+   if (resp->tail == tail)
+   LOGPPDP(LOGL_NOTICE, pdp, "MS requested IPv4 DNS, but APN has 
none configured\n");
 }

 static void process_pco_element(const struct pco_element *pco_elem, struct 
msgb *resp,
const struct apn_ctx *apn, struct pdp_t *pdp)
 {
-   switch (ntohs(pco_elem->protocol_id)) {
+   uint16_t protocol_id = ntohs(pco_elem->protocol_id);
+
+   LOGPPDP(LOGL_DEBUG, pdp, "PCO Protocol 0x%04x\n", protocol_id);
+   switch (protocol_id) {
case PCO_P_PAP:
process_pco_element_pap(pco_elem, resp, apn, pdp);
break;
@@ -647,6 +660,8 @@
process_pco_element_dns_ipv4(pco_elem, resp, apn, pdp);
break;
default:
+   LOGPPDP(LOGL_INFO, pdp, "Unknown/Unimplemented PCO Protocol 
0x%04x: %s\n",
+   protocol_id, osmo_hexdump_nospc(pco_elem->data, 
pco_elem->length));
break;
}
 }

--
To view, visit https://gerrit.osmocom.org/13609
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I38c2c4178ff4fd795f54638adec63166b1c0838e
Gerrit-Change-Number: 13609
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 


Change in osmo-ggsn[master]: ggsn: Add minimalistic PAP support

2019-04-11 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13608


Change subject: ggsn: Add minimalistic PAP support
..

ggsn: Add minimalistic PAP support

Some modems are configured to use PAP as an additional authentication
mechanism beyond the GSM authentication that's part of GMM.  Let's
handle such PAP authentication requests by simply acknowledging them
all, without actually checking any credentials database.

This is the most sane thing we can do for now, without adding external
requirements / interfaces like radius servers or the like.

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



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

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index f46436f..d079efe 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -1,7 +1,7 @@
 /*
  * OsmoGGSN - Gateway GPRS Support Node
  * Copyright (C) 2002, 2003, 2004 Mondru AB.
- * Copyright (C) 2017 by Harald Welte 
+ * Copyright (C) 2017-2019 by Harald Welte 
  *
  * The contents of this file may be used under the terms of the GNU
  * General Public License Version 2, provided that the above copyright
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -494,6 +495,64 @@
return NULL;
 }

+struct pap_element {
+   uint8_t code;
+   uint8_t id;
+   uint16_t len; /* length including header */
+   uint8_t data[0];
+} __attribute__((packed));
+
+enum pap_code {
+   PAP_CODE_AUTH_REQ = 1,
+   PAP_CODE_AUTH_ACK = 2,
+   PAP_CODE_AUTH_NAK = 3,
+};
+
+static const char *pap_welcome = "Welcome to OsmoGGSN";
+
+/* Handle PAP protocol according to RFC 1334 */
+static void process_pco_element_pap(const struct pco_element *pco_in, struct 
msgb *resp,
+   const struct apn_ctx *apn, struct pdp_t 
*pdp)
+{
+   const struct pap_element *pap_in = (const struct pap_element *) 
pco_in->data;
+   unsigned int pap_welcome_len = strlen(pap_welcome);
+   uint8_t pap_out_size = sizeof(struct pap_element) + 1 + pap_welcome_len;
+   struct pap_element *pap_out = alloca(pap_out_size);
+   uint8_t peer_id_len;
+   const uint8_t *peer_id;
+
+   if (sizeof(*pap_in) > pco_in->length)
+   goto ret_broken;
+   if (htons(pap_in->len) > pco_in->length)
+   goto ret_broken;
+
+   switch (pap_in->code) {
+   case PAP_CODE_AUTH_REQ:
+   peer_id_len = pap_in->data[0];
+   peer_id = _in->data[1];
+   LOGPPDP(LOGL_DEBUG, pdp, "PCO PAP PeerId = %s, ACKing\n",
+   osmo_quote_str((const char *)peer_id, peer_id_len));
+   /* Password-Length + Password following here, but we don't care 
*/
+   pap_out->code = PAP_CODE_AUTH_ACK;
+   pap_out->id = pap_in->id;
+   pap_out->len = htons(pap_out_size);
+   pap_out->data[0] = pap_welcome_len;
+   memcpy(pap_out->data+1, pap_welcome, pap_welcome_len);
+   msgb_t16lv_put(resp, PCO_P_PAP, pap_out_size, (uint8_t *) 
pap_out);
+   break;
+   case PAP_CODE_AUTH_ACK:
+   case PAP_CODE_AUTH_NAK:
+   default:
+   LOGPPDP(LOGL_NOTICE, pdp, "Unsupported PAP PCO Code %u, 
ignoring\n", pap_in->code);
+   break;
+   }
+   return;
+
+ret_broken:
+   LOGPPDP(LOGL_NOTICE, pdp, "Invalid PAP PCO Length: %s, ignoring\n",
+   osmo_hexdump_nospc((const uint8_t *)pco_in, pco_in->length));
+}
+
 static void process_pco_element_ipcp(const struct pco_element *pco_elem, 
struct msgb *resp,
 const struct apn_ctx *apn, struct pdp_t 
*pdp)
 {
@@ -575,6 +634,9 @@
const struct apn_ctx *apn, struct pdp_t *pdp)
 {
switch (ntohs(pco_elem->protocol_id)) {
+   case PCO_P_PAP:
+   process_pco_element_pap(pco_elem, resp, apn, pdp);
+   break;
case PCO_P_IPCP:
process_pco_element_ipcp(pco_elem, resp, apn, pdp);
break;

--
To view, visit https://gerrit.osmocom.org/13608
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I81875f30f9f1497199253497f84718510747f731
Gerrit-Change-Number: 13608
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 


Change in osmo-ttcn3-hacks[master]: library: Add PAP_Types for PPP Authentication Protocol (RFC 1334)

2019-04-11 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13607


Change subject: library: Add PAP_Types for PPP Authentication Protocol (RFC 
1334)
..

library: Add PAP_Types for PPP Authentication Protocol (RFC 1334)

Change-Id: I31cb766bb701b8107df5de978d2b0b085977045a
---
A library/PAP_Types.ttcn
1 file changed, 90 insertions(+), 0 deletions(-)



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

diff --git a/library/PAP_Types.ttcn b/library/PAP_Types.ttcn
new file mode 100644
index 000..4e3f14f
--- /dev/null
+++ b/library/PAP_Types.ttcn
@@ -0,0 +1,90 @@
+module PAP_Types {
+
+/* (C) 2019 by Harald Welte 
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ */
+
+import from Osmocom_Types all;
+
+/* RFC1334 */
+type enumerated PapCode {
+   PAP_AuthenticateReq ('01'O),
+   PAP_AuthenticateAck ('02'O),
+   PAP_AuthenticateNak ('03'O)
+} with { variant "FIELDLENGTH(8)" };
+
+type record PapPacket {
+   PapCode code,
+   uint8_t identifier,
+   uint16_tlen,
+   PapPayloadUnion payload
+} with {
+   variant (len) "LENGTHTO(code,identifier,len,payload)"
+   variant (payload) "CROSSTAG( req, code = PAP_AuthenticateReq;
+ack, code = PAP_AuthenticateAck;
+nak, code = PAP_AuthenticateNak)"
+};
+
+type union PapPayloadUnion {
+   PapAuthReq  req,
+   PapAuthResp ack,
+   PapAuthResp nak
+};
+
+type record PapAuthReq {
+   uint8_t peer_id_len,
+   octetstring peer_id,
+   uint8_t passwd_len,
+   octetstring passwd
+} with {
+   variant (peer_id_len) "LENGTHTO(peer_id)"
+   variant (passwd_len) "LENGTHTO(passwd)"
+};
+
+type record PapAuthResp {
+   uint8_t msg_len,
+   charstring  msg
+} with { variant (msg_len) "LENGTHTO(msg)" };
+
+external function enc_PapPacket(in PapPacket inp) return octetstring
+with { extension "prototype(convert)" extension "encode(RAW)" };
+
+external function dec_PapPacket(in octetstring inp) return PapPacket
+with { extension "prototype(convert)" extension "decode(RAW)" };
+
+
+template (value) PapPacket ts_PAP(template (value) PapCode code, template 
(value) uint8_t identifier,
+ template (value) PapPayloadUnion payload) := {
+   code := code,
+   identifier := identifier,
+   len := 0, /* overwritten */
+   payload := payload
+}
+template PapPacket tr_PAP(template PapCode code, template uint8_t identifier, 
template PapPayloadUnion payload) := {
+   code := code,
+   identifier := identifier,
+   len := ?,
+   payload := payload
+}
+
+template (value) PapPacket ts_PAP_AuthReq(uint8_t identifier := 0, octetstring 
peer_id, octetstring passwd) :=
+   ts_PAP(PAP_AuthenticateReq, identifier,
+   { req := { peer_id_len := 0, peer_id := peer_id,
+  passwd_len := 0, passwd := passwd } });
+template PapPacket tr_PAP_AuthReq(template uint8_t identifier := ?, 
octetstring peer_id, octetstring passwd) :=
+   tr_PAP(PAP_AuthenticateReq, identifier,
+   { req := { peer_id_len := ?, peer_id := peer_id,
+  passwd_len := ?, passwd := passwd } });
+template (value) PapPacket ts_PAP_AuthAck(uint8_t identifier := 0, charstring 
msg) :=
+   ts_PAP(PAP_AuthenticateAck, identifier, { ack := { msg_len := 0, msg := 
msg } });
+template PapPacket tr_PAP_AuthAck(template uint8_t identifier := ?) :=
+   tr_PAP(PAP_AuthenticateAck, identifier, { ack := ? });
+template (value) PapPacket ts_PAP_AuthNak(uint8_t identifier := 0, charstring 
msg) :=
+   ts_PAP(PAP_AuthenticateNak, identifier, { nak := { msg_len := 0, msg := 
msg } });
+template PapPacket tr_PAP_AuthNak(template uint8_t identifier := ?) :=
+   tr_PAP(PAP_AuthenticateNak, identifier, { nak := ? });
+
+} with { encode "RAW" ; variant "FIELDORDER(msb)" }

--
To view, visit https://gerrit.osmocom.org/13607
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I31cb766bb701b8107df5de978d2b0b085977045a
Gerrit-Change-Number: 13607
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 


Change in osmo-ttcn3-hacks[master]: ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()

2019-04-11 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13564

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

Change subject: ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()
..

ggsn: Add TC_pdp4_act_deact_ipcp_pap_broken()

This test case reproduces a real-world PCO capture including a broken
PAP AuthenticationReq.  It triggers some weird behavior in OsmoGGSN
1.3.0 where it would send duplicate IPCP repsonses and no PAP response.

Change-Id: Ie89d984ed9e26fbbb2e4914bdb8623446d462a4c
Related: OS#3914
---
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/gen_links.sh
M library/GTP_Templates.ttcn
3 files changed, 46 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/64/13564/4
--
To view, visit https://gerrit.osmocom.org/13564
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie89d984ed9e26fbbb2e4914bdb8623446d462a4c
Gerrit-Change-Number: 13564
Gerrit-PatchSet: 4
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-gsm-manuals[master]: check-depends.sh: don't depend on git binary

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13596 )

Change subject: check-depends.sh: don't depend on git binary
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13596
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I46ad818a1d009c03357821f7c8100ecb5d62962e
Gerrit-Change-Number: 13596
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:18:44 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-gsm-manuals[master]: build/unix-time-to-fmt.py: use default python ver

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13595 )

Change subject: build/unix-time-to-fmt.py: use default python ver
..


Patch Set 1: Code-Review+2

Oh so actually print() with parenthesis works for python2, it's just 
parenthesis are optional, I didn't know that.


--
To view, visit https://gerrit.osmocom.org/13595
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8af9b8159f5c7e39b905f85edd1584cb4d5a33ef
Gerrit-Change-Number: 13595
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:18:15 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-gsm-manuals[master]: build/unix-time-to-fmt.py: use default python ver

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13595 )

Change subject: build/unix-time-to-fmt.py: use default python ver
..


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.osmocom.org/#/c/13595/1/build/unix-time-to-fmt.py
File build/unix-time-to-fmt.py:

https://gerrit.osmocom.org/#/c/13595/1/build/unix-time-to-fmt.py@22
PS1, Line 22: print(time.strftime(fmt, time.gmtime(float(sys.argv[1]
How this print function is supposed to work on python2? That's not compatible, 
print goes without paranthesis in python2.



--
To view, visit https://gerrit.osmocom.org/13595
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8af9b8159f5c7e39b905f85edd1584cb4d5a33ef
Gerrit-Change-Number: 13595
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:08:57 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in libosmocore[master]: add OSMO_IMSI_SIZE

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13575 )

Change subject: add OSMO_IMSI_SIZE
..


Patch Set 3:

I had the same thought as Vadim when I saw the name first time.

BTW, I recall speaking some time about this +2 being actually wrong (should be 
+1). Now that we are adding the symbol it may be a good time to identify 
whether it's correct or not (no necessary for this patch).


--
To view, visit https://gerrit.osmocom.org/13575
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id11ada4c96b79f7f0ad58185ab7dbf24622fb770
Gerrit-Change-Number: 13575
Gerrit-PatchSet: 3
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:06:32 +
Gerrit-HasComments: No
Gerrit-HasLabels: No


Change in osmo-hlr[master]: osmo-hlr: allow configuring db path from cfg file

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13586 )

Change subject: osmo-hlr: allow configuring db path from cfg file
..


Patch Set 1: Code-Review-1


--
To view, visit https://gerrit.osmocom.org/13586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I87b8673324e1e6225afb758fb4963ff3279ea3d8
Gerrit-Change-Number: 13586
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:03:31 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-hlr[master]: osmo-hlr: allow configuring db path from cfg file

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13586 )

Change subject: osmo-hlr: allow configuring db path from cfg file
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13586/1/src/hlr.c
File src/hlr.c:

https://gerrit.osmocom.org/#/c/13586/1/src/hlr.c@739
PS1, Line 739: osmo_talloc_replace_string
> Can we do this conditionally after parsing the VTY config?
Makes sense, took me a while to understand what you mean.

Best option is to do in line 778 (removing the if clause):
osmo_talloc_replace_string(g_hlr, _hlr->db_file_path, cmdline_opts.db_file ? 
: HLR_DEFAULT_DB_FILE_PATH);



--
To view, visit https://gerrit.osmocom.org/13586
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I87b8673324e1e6225afb758fb4963ff3279ea3d8
Gerrit-Change-Number: 13586
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 17:03:25 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-bts[master]: pcu_sock: use %zu conversion specifier for printing sizeof() result

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13267 )

Change subject: pcu_sock: use %zu conversion specifier for printing sizeof() 
result
..


Patch Set 4:

(1 comment)

https://gerrit.osmocom.org/#/c/13267/4/src/common/pcu_sock.c
File src/common/pcu_sock.c:

https://gerrit.osmocom.org/#/c/13267/4/src/common/pcu_sock.c@794
PS4, Line 794:  return 0;
Here too, memleak. Please Vadim either send a patch or otherwise tell me 
explicitly, I can do it in that case, np.



--
To view, visit https://gerrit.osmocom.org/13267
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: If5cb656537b1b73b9361a132801ab47ab7f8a709
Gerrit-Change-Number: 13267
Gerrit-PatchSet: 4
Gerrit-Owner: dexter 
Gerrit-Reviewer: Daniel Willmann 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Max 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Reviewer: dexter 
Gerrit-Comment-Date: Thu, 11 Apr 2019 16:46:12 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn.c: Refactor PCO processing during PDP activation

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13606 )

Change subject: ggsn.c: Refactor PCO processing during PDP activation
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c@606
PS1, Line 606:   cur + sizeof(struct pco_element) <= pco->v + pco->l;
> Drop cur: […]
You actually need to cast to uint8_t* during the sum in last line most probably



--
To view, visit https://gerrit.osmocom.org/13606
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4a7d09279b6b259e2b95f1f51159b16838b2d94c
Gerrit-Change-Number: 13606
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 16:13:34 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn.c: Refactor PCO processing during PDP activation

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13606 )

Change subject: ggsn.c: Refactor PCO processing during PDP activation
..


Patch Set 1:

(3 comments)

https://gerrit.osmocom.org/#/c/13606/1//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/#/c/13606/1//COMMIT_MSG@9
PS1, Line 9: The existing PCO processing is implemented in a rater convoluted
typo: rater


https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c@606
PS1, Line 606:   cur + sizeof(struct pco_element) <= pco->v + pco->l;
Drop cur:


for (pco_elem = (const struct pco_element *) co->v + 1;
 pco_elem + sizeof(*pco_elem) <= pco->v + pco->l;
 pco_elem = pco_elem + sizeof(*pco_elem) + pco_elem->length) { 
process_pco_element(pco_elem, resp, apn, pdp);}


https://gerrit.osmocom.org/#/c/13606/1/ggsn/ggsn.c@620
PS1, Line 620:
Extra line, remove it.



--
To view, visit https://gerrit.osmocom.org/13606
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I4a7d09279b6b259e2b95f1f51159b16838b2d94c
Gerrit-Change-Number: 13606
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-CC: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 16:03:05 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn: Remove magic numbers from pco_contains_proto()

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13567 )

Change subject: ggsn: Remove magic numbers from pco_contains_proto()
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13567
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I9871ffced677320aa82438332bfdb951ab129f04
Gerrit-Change-Number: 13567
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 15:52:18 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: ggsn: Verify that there are no duplicate PCO protocolIDs

2019-04-11 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13563

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

Change subject: ggsn: Verify that there are no duplicate PCO protocolIDs
..

ggsn: Verify that there are no duplicate PCO protocolIDs

Introduce a function to verify there's no duplicate ProtocolIDs
in the PCO returned from the GGSN.

Change-Id: I9d439dab1696196cd125f4d7113b426f1711a405
Related: OS#3914
---
M ggsn_tests/GGSN_Tests.ttcn
1 file changed, 37 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/63/13563/3
--
To view, visit https://gerrit.osmocom.org/13563
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I9d439dab1696196cd125f4d7113b426f1711a405
Gerrit-Change-Number: 13563
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-ggsn[master]: ggsn: Remove magic numbers from pco_contains_proto()

2019-04-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/13567 )

Change subject: ggsn: Remove magic numbers from pco_contains_proto()
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13567/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13567/1/ggsn/ggsn.c@474
PS1, Line 474:  uint8_t *cur = pco->v + 1 /*length*/ + offset;
> I think we can drop cur completely. […]
I'm removing this function a few patches later, so I don't think it's worth to 
spend time on it anymore.



--
To view, visit https://gerrit.osmocom.org/13567
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I9871ffced677320aa82438332bfdb951ab129f04
Gerrit-Change-Number: 13567
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 15:01:01 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: process_pco() const-ify 'apn' argument

2019-04-11 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/13566 )

Change subject: process_pco() const-ify 'apn' argument
..

process_pco() const-ify 'apn' argument

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

Approvals:
  Vadim Yanitskiy: Looks good to me, but someone else must approve
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index dd723e9..423f0c0 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -503,7 +503,7 @@
 }

 /* construct an IPCP PCO response from request*/
-static void build_ipcp_pco(struct apn_ctx *apn, struct pdp_t *pdp, struct msgb 
*msg)
+static void build_ipcp_pco(const struct apn_ctx *apn, struct pdp_t *pdp, 
struct msgb *msg)
 {
const struct in46_addr *dns1 = >v4.cfg.dns[0];
const struct in46_addr *dns2 = >v4.cfg.dns[1];
@@ -559,7 +559,7 @@
 }

 /* process one PCO request from a MS/UE, putting together the proper responses 
*/
-static void process_pco(struct apn_ctx *apn, struct pdp_t *pdp)
+static void process_pco(const struct apn_ctx *apn, struct pdp_t *pdp)
 {
struct msgb *msg = msgb_alloc(256, "PCO");
struct ippoolm_t *peer_v4 = pdp_get_peer_ipv(pdp, false);
@@ -573,7 +573,7 @@

if (pco_contains_proto(>pco_req, 0, PCO_P_DNS_IPv6_ADDR, 0)) {
for (i = 0; i < ARRAY_SIZE(apn->v6.cfg.dns); i++) {
-   struct in46_addr *i46a = >v6.cfg.dns[i];
+   const struct in46_addr *i46a = >v6.cfg.dns[i];
if (i46a->len != 16)
continue;
msgb_t16lv_put(msg, PCO_P_DNS_IPv6_ADDR, i46a->len, 
i46a->v6.s6_addr);
@@ -582,7 +582,7 @@

if (pco_contains_proto(>pco_req, 0, PCO_P_DNS_IPv4_ADDR, 0)) {
for (i = 0; i < ARRAY_SIZE(apn->v4.cfg.dns); i++) {
-   struct in46_addr *i46a = >v4.cfg.dns[i];
+   const struct in46_addr *i46a = >v4.cfg.dns[i];
if (i46a->len != 4)
continue;
msgb_t16lv_put(msg, PCO_P_DNS_IPv4_ADDR, i46a->len, 
(uint8_t *)>v4);

-- 
To view, visit https://gerrit.osmocom.org/13566
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2a96b0fbe077c7c49342553de0880bfc58318669
Gerrit-Change-Number: 13566
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 


Change in osmo-ggsn[master]: ggsn: Fix build_ipcp_pco() in presence of invalid IPCP content

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13570 )

Change subject: ggsn: Fix build_ipcp_pco() in presence of invalid IPCP content
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13570/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13570/1/ggsn/ggsn.c@534
PS1, Line 534:  ipcp_len = osmo_load16be(ipcp + 2); /* 1=code + 1=id */
ipcp_len can be dropped completely in favour of pco_ipcp->length.



--
To view, visit https://gerrit.osmocom.org/13570
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I8e9cffde092c8c5824abfaeecb742afcf949802c
Gerrit-Change-Number: 13570
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 14:23:52 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn: Remove magic numbers from ipcp_contains_option()

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13569 )

Change subject: ggsn: Remove magic numbers from ipcp_contains_option()
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13569/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13569/1/ggsn/ggsn.c@419
PS1, Line 419:  const uint8_t *cur_opt = ipcp + sizeof(struct ipcp_hdr);
Same as with previous commit: we can drop cur_opt completely.



--
To view, visit https://gerrit.osmocom.org/13569
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I5b1abc6f403f85986407e9e8359924dfcb58031a
Gerrit-Change-Number: 13569
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 14:21:49 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: ggsn: const-ify input / read-only arguments of PCO related functions

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13568 )

Change subject: ggsn: const-ify input / read-only arguments of PCO related 
functions
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13568
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia0877988180ded4e3c033d7f1fb6e1c2acd60163
Gerrit-Change-Number: 13568
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 14:19:22 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ggsn[master]: ggsn: Remove magic numbers from pco_contains_proto()

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13567 )

Change subject: ggsn: Remove magic numbers from pco_contains_proto()
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/13567/1/ggsn/ggsn.c
File ggsn/ggsn.c:

https://gerrit.osmocom.org/#/c/13567/1/ggsn/ggsn.c@474
PS1, Line 474:  uint8_t *cur = pco->v + 1 /*length*/ + offset;
I think we can drop cur completely.

struct pco_element *elem = (struct pco_element *) pco->v + 1 /*length*/ + 
offset;

while (elem + sizeof(*elem) <= pco->v+ pco->l) {
if (ntohs(elem->protocol_id) == prot && elem->length >= prot_minlen)
return (uint8_t*) elem;
elem = elem + elem->length + sizeof(*elem);
}
return NULL;



-- 
To view, visit https://gerrit.osmocom.org/13567
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I9871ffced677320aa82438332bfdb951ab129f04
Gerrit-Change-Number: 13567
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 11 Apr 2019 14:18:00 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-ggsn[master]: process_pco() const-ify 'apn' argument

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/13566 )

Change subject: process_pco() const-ify 'apn' argument
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/13566
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ggsn
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I2a96b0fbe077c7c49342553de0880bfc58318669
Gerrit-Change-Number: 13566
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 14:12:01 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ggsn[master]: ggsn.c: Refactor PCO processing during PDP activation

2019-04-11 Thread Harald Welte
Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/13606


Change subject: ggsn.c: Refactor PCO processing during PDP activation
..

ggsn.c: Refactor PCO processing during PDP activation

The existing PCO processing is implemented in a rater convoluted
way.  We scan the list of PCO elements several times for different
PCO protocols.  Let's change to a straight-forward model where we
simply do one iteration over the list of PCO elements and generate
responses step by step.

Change-Id: I4a7d09279b6b259e2b95f1f51159b16838b2d94c
---
M ggsn/ggsn.c
1 file changed, 96 insertions(+), 85 deletions(-)



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

diff --git a/ggsn/ggsn.c b/ggsn/ggsn.c
index eac7e16..c460b98 100644
--- a/ggsn/ggsn.c
+++ b/ggsn/ggsn.c
@@ -470,22 +470,6 @@
uint8_t data[0];
 } __attribute__((packed));

-/* determine if PCO contains given protocol */
-static const struct pco_element *pco_contains_proto(const struct ul255_t *pco, 
size_t offset,
-   uint16_t prot, size_t 
prot_minlen)
-{
-   const uint8_t *cur = pco->v + 1 /*length*/ + offset;
-
-   /* iterate over PCO and check if protocol contained */
-   while (cur + sizeof(struct pco_element) <= pco->v + pco->l) {
-   const struct pco_element *elem = (const struct pco_element 
*)cur;
-   if (ntohs(elem->protocol_id) == prot && elem->length >= 
prot_minlen)
-   return elem;
-   cur += elem->length + sizeof(struct pco_element);
-   }
-   return NULL;
-}
-
 /*! Get the peer of pdp based on IP version used.
  *  \param[in] pdp PDP context to select the peer from.
  *  \param[in] v4v6 IP version to select. Valid values are 4 and 6.
@@ -510,103 +494,130 @@
return NULL;
 }

-/* construct an IPCP PCO response from request*/
-static void build_ipcp_pco(const struct apn_ctx *apn, struct pdp_t *pdp, 
struct msgb *msg)
+static void process_pco_element_ipcp(const struct pco_element *pco_elem, 
struct msgb *resp,
+const struct apn_ctx *apn, struct pdp_t 
*pdp)
 {
+   struct ippoolm_t *peer_v4 = pdp_get_peer_ipv(pdp, false);
const struct in46_addr *dns1 = >v4.cfg.dns[0];
const struct in46_addr *dns2 = >v4.cfg.dns[1];
-   const struct pco_element *pco_ipcp;
+   uint8_t *start = resp->tail;
const uint8_t *ipcp;
uint16_t ipcp_len;
uint8_t *len1, *len2;
unsigned int len_appended;
ptrdiff_t consumed;
-   size_t remain, offset = 0;
+   size_t remain;

-   /* pco_contains_proto() returns a potentially unaligned pointer into 
pco_req->v (see OS#3194) */
-   pco_ipcp = pco_contains_proto(>pco_req, offset, PCO_P_IPCP, 
sizeof(struct ipcp_hdr));
-   while (pco_ipcp) {
-   uint8_t *start = msg->tail;
+   if (!peer_v4)
+   return;

-   ipcp = pco_ipcp->data;
-   consumed = (ipcp - >pco_req.v[0]);
-   remain = sizeof(pdp->pco_req.v) - consumed;
-   ipcp_len = osmo_load16be(ipcp + 2); /* 1=code + 1=id */
-   if (remain < 0 || remain < ipcp_len)
-   return;
+   ipcp = pco_elem->data;
+   consumed = (ipcp - >pco_req.v[0]);
+   remain = sizeof(pdp->pco_req.v) - consumed;
+   ipcp_len = osmo_load16be(ipcp + 2); /* 1=code + 1=id */
+   if (remain < 0 || remain < ipcp_len)
+   return;

-   /* Three byte T16L header */
-   msgb_put_u16(msg, 0x8021);  /* IPCP */
-   len1 = msgb_put(msg, 1);/* Length of contents: delay */
+   /* Three byte T16L header */
+   msgb_put_u16(resp, 0x8021); /* IPCP */
+   len1 = msgb_put(resp, 1);   /* Length of contents: delay */

-   msgb_put_u8(msg, 0x02); /* ACK */
-   msgb_put_u8(msg, ipcp[1]);  /* ID: Needs to match request */
-   msgb_put_u8(msg, 0x00); /* Length MSB */
-   len2 = msgb_put(msg, 1);/* Length LSB: delay */
+   msgb_put_u8(resp, 0x02);/* ACK */
+   msgb_put_u8(resp, ipcp[1]); /* ID: Needs to match request */
+   msgb_put_u8(resp, 0x00);/* Length MSB */
+   len2 = msgb_put(resp, 1);   /* Length LSB: delay */

-   if (dns1->len == 4 && ipcp_contains_option(ipcp, ipcp_len, 
IPCP_OPT_PRIMARY_DNS, 4)) {
-   msgb_put_u8(msg, 0x81); /* DNS1 Tag */
-   msgb_put_u8(msg, 2 + dns1->len);/* DNS1 Length, incl. 
TL */
-   msgb_put_u32(msg, ntohl(dns1->v4.s_addr));
-   }
-
-   if (dns2->len == 4 && ipcp_contains_option(ipcp, ipcp_len, 
IPCP_OPT_SECONDARY_DNS, 4)) {
-   msgb_put_u8(msg, 0x83); /* DNS2 Tag */
-

Change in osmo-hlr[master]: hlr.c: forward GSUP messages between clients

2019-04-11 Thread osmith
Hello Neels Hofmeyr, Jenkins Builder,

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

https://gerrit.osmocom.org/13006

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

Change subject: hlr.c: forward GSUP messages between clients
..

hlr.c: forward GSUP messages between clients

Allow clients to forward any GSUP message between clients. Determine the
sender and receiver from the new {source,dest}_name{,_len} IEs. Reject
messages with a forged source name.

This will be used for the inter-MSC handover.

Depends: Ic00b0601eacff6d72927cea51767801142ee75db (libosmocore.git)
Related: OS#3793
Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
---
M src/hlr.c
1 file changed, 78 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/06/13006/10
--
To view, visit https://gerrit.osmocom.org/13006
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
Gerrit-Change-Number: 13006
Gerrit-PatchSet: 10
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: osmith 
Gerrit-CC: Vadim Yanitskiy 


Change in osmo-ttcn3-hacks[master]: ggsn: Verify that there are no duplicate PCO protocolIDs

2019-04-11 Thread Harald Welte
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/13563

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

Change subject: ggsn: Verify that there are no duplicate PCO protocolIDs
..

ggsn: Verify that there are no duplicate PCO protocolIDs

Introduce a function to verify there's no duplicate ProtocolIDs
in the PCO returned from the GGSN.

Change-Id: I9d439dab1696196cd125f4d7113b426f1711a405
Related: OS#3914
---
M ggsn_tests/GGSN_Tests.ttcn
1 file changed, 38 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/63/13563/2
--
To view, visit https://gerrit.osmocom.org/13563
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I9d439dab1696196cd125f4d7113b426f1711a405
Gerrit-Change-Number: 13563
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)


Change in osmo-hlr[master]: hlr.c: forward GSUP messages between clients

2019-04-11 Thread osmith
osmith has posted comments on this change. ( https://gerrit.osmocom.org/13006 )

Change subject: hlr.c: forward GSUP messages between clients
..


Patch Set 8:

(3 comments)

https://gerrit.osmocom.org/#/c/13006/8/src/hlr.c
File src/hlr.c:

https://gerrit.osmocom.org/#/c/13006/8/src/hlr.c@478
PS8, Line 478: Cannot forward GSUP
> All "GSUP message forwarding error" messages in this function look different. 
> […]
Done


https://gerrit.osmocom.org/#/c/13006/8/src/hlr.c@483
PS8, Line 483: LOGL_NOTICE
> Let's rather use LOGL_INFO. […]
Done


https://gerrit.osmocom.org/#/c/13006/8/src/hlr.c@494
PS8, Line 494: gsup = NULL;
> The argument is defined as follows: […]
I think Neels put it there more of a reminder that accessing anything in gsup, 
like gsup->source_name may be deallocated at this point (since msg is 
deallocated). So we must not access it anymore below, and use the copy gsup_err 
instead.



--
To view, visit https://gerrit.osmocom.org/13006
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
Gerrit-Change-Number: 13006
Gerrit-PatchSet: 8
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: osmith 
Gerrit-CC: Vadim Yanitskiy 
Gerrit-Comment-Date: Thu, 11 Apr 2019 14:01:45 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-hlr[master]: hlr.c: forward GSUP messages between clients

2019-04-11 Thread osmith
Hello Neels Hofmeyr, Jenkins Builder,

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

https://gerrit.osmocom.org/13006

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

Change subject: hlr.c: forward GSUP messages between clients
..

hlr.c: forward GSUP messages between clients

Allow clients to forward any GSUP message between clients. Determine the
sender and receiver from the new {source,dest}_name{,_len} IEs. Reject
messages with a forged source name.

This will be used for the inter-MSC handover.

Depends: Ic00b0601eacff6d72927cea51767801142ee75db (libosmocore.git)
Related: OS#3793
Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
---
M src/hlr.c
1 file changed, 78 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/06/13006/9
--
To view, visit https://gerrit.osmocom.org/13006
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ia4f345abc877baaf0a8f73b8988e6514d9589bf5
Gerrit-Change-Number: 13006
Gerrit-PatchSet: 9
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: osmith 
Gerrit-CC: Vadim Yanitskiy 


Change in osmo-ci[master]: nightly-packages: Build latest tag of limesuite

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/13605


Change subject: nightly-packages: Build latest tag of limesuite
..

nightly-packages: Build latest tag of limesuite

Like we actually do already on latest-packages.

Change-Id: I5a9e97a7a93c1d2a9983926cd0f5d7255e9666bd
---
M scripts/osmocom-nightly-packages.sh
1 file changed, 13 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/05/13605/1

diff --git a/scripts/osmocom-nightly-packages.sh 
b/scripts/osmocom-nightly-packages.sh
index 5f97c3d..7501ff5 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -25,6 +25,17 @@
   osc co "$PROJ"
 }

+get_last_tag() {
+  project="$1"
+  if [ "$project" = "limesuite" ]; then
+ver_regexp="^v[0-9]*.[0-9]*.[0-9]*$"
+  else
+ver_regexp="^[0-9]*.[0-9]*.[0-9]*$"
+  fi
+  VER=$(git -C "${REPO}/${project}" tag -l --sort=v:refname | grep 
"$ver_regexp" | tail -n 1)
+  echo "${VER}"
+}
+
 get_commit_version() {
   # return a version based on the commit
   local version
@@ -130,10 +141,9 @@
 }

 checkout_limesuite() {
-  TAG="v18.10.0"
-
   cd "$REPO"
   git clone https://github.com/myriadrf/LimeSuite limesuite
+  TAG="$(get_last_tag limesuite)"
   cd limesuite
   git checkout "$TAG"
 }
@@ -192,7 +202,7 @@

   create_osmo_trx_debian8_jessie

-  build limesuite no_commit --git-upstream-tree=v18.10.0
+  build limesuite no_commit --git-upstream-tree="$(get_last_tag limesuite)"
   build libosmocore
   build libosmo-sccp
   build libosmo-abis

--
To view, visit https://gerrit.osmocom.org/13605
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a9e97a7a93c1d2a9983926cd0f5d7255e9666bd
Gerrit-Change-Number: 13605
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 


Change in osmo-ci[master]: nightly-packages: Remove unused variable

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/13603


Change subject: nightly-packages: Remove unused variable
..

nightly-packages: Remove unused variable

Change-Id: Ic120dbc134cba9bd77098ab14a5dba3d5c4d71b9
---
M scripts/osmocom-nightly-packages.sh
1 file changed, 0 insertions(+), 1 deletion(-)



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

diff --git a/scripts/osmocom-nightly-packages.sh 
b/scripts/osmocom-nightly-packages.sh
index 052eb09..26b8bc9 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -40,7 +40,6 @@
 get_commit_version() {
   # return a version based on the commit
   local version
-  local date

   # determine git version *and generate the .tarball-version file*
   test -x ./git-version-gen && ./git-version-gen . > .tarball-version 
2>/dev/null

--
To view, visit https://gerrit.osmocom.org/13603
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic120dbc134cba9bd77098ab14a5dba3d5c4d71b9
Gerrit-Change-Number: 13603
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 


Change in osmo-ci[master]: nightly-packages: Move some code and rename some vars to look similar...

2019-04-11 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/13604


Change subject: nightly-packages: Move some code and rename some vars to look 
similar to latest-packages
..

nightly-packages: Move some code and rename some vars to look similar to 
latest-packages

Change-Id: I177bb7fb75e293ef665e95363a38c6b4f8e49c13
---
M scripts/osmocom-latest-packages.sh
M scripts/osmocom-nightly-packages.sh
2 files changed, 28 insertions(+), 25 deletions(-)



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

diff --git a/scripts/osmocom-latest-packages.sh 
b/scripts/osmocom-latest-packages.sh
index d647d32..e70dd92 100755
--- a/scripts/osmocom-latest-packages.sh
+++ b/scripts/osmocom-latest-packages.sh
@@ -18,6 +18,7 @@
   exit 1
 fi

+### OBS build
 prepare() {
   # start with a checkout of the project
   if [ -d $PROJ ]; then
diff --git a/scripts/osmocom-nightly-packages.sh 
b/scripts/osmocom-nightly-packages.sh
index 26b8bc9..5f97c3d 100755
--- a/scripts/osmocom-nightly-packages.sh
+++ b/scripts/osmocom-nightly-packages.sh
@@ -1,33 +1,21 @@
 #!/bin/bash
+
 # requirements
 # apt install devscripts git-buildpackage osc git

 set -e
 set -x

+# OBS project name
+PROJ=network:osmocom:nightly
+
+DT=$(date +%Y%m%d)
+TOP=$(pwd)/$(mktemp -d nightly-3g_XX)
+
 if ! which osc >/dev/null 2>/dev/null ; then
   echo "osc binary not found"
   exit 1
 fi
-DT=$(date +%Y%m%d)
-PROJ=network:osmocom:nightly
-
-### common
-checkout() {
-  local name=$1
-  local branch=$2
-  local url="https://git.osmocom.org;
-
-  cd "$REPO"
-
-  if [ -n "$branch" ] ; then
-git clone "$url/$name" -b "$branch"
-  else
-git clone "$url/$name"
-  fi
-
-  cd -
-}

 ### OBS build
 prepare() {
@@ -56,6 +44,23 @@
   echo -n "$version"
 }

+### common
+checkout() {
+  local name=$1
+  local branch=$2
+  local url="https://git.osmocom.org;
+
+  cd "$REPO"
+
+  if [ -n "$branch" ] ; then
+git clone "$url/$name" -b "$branch"
+  else
+git clone "$url/$name"
+  fi
+
+  cd -
+}
+
 build() {
   local name=$1
   local changelog=$2
@@ -144,12 +149,11 @@
 }

 build_osmocom() {
-  BASE=$PWD
-  DATA=$BASE/data
-  REPO=$BASE/repo
+  DATA=$TOP/data
+  REPO=$TOP/repo

   # rather than including a dangerous 'rm -rf *' here, lets delegate to the 
user:
-  if [ -n "$(ls)" ]; then
+  if [ -n "$TOP" ]; then
 echo "ERROR: I need to run in an empty directory."
 exit 1
   fi
@@ -224,6 +228,4 @@
   post
 }

-TMPDIR=$(mktemp -d nightly-3g_XX)
-cd "$TMPDIR"
 build_osmocom

--
To view, visit https://gerrit.osmocom.org/13604
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I177bb7fb75e293ef665e95363a38c6b4f8e49c13
Gerrit-Change-Number: 13604
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 


  1   2   >