Change in osmo-ttcn3-hacks[master]: ns2: add first sgsn test case TC_sns_sgsn_config_success

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25139 )

Change subject: ns2: add first sgsn test case TC_sns_sgsn_config_success
..

ns2: add first sgsn test case TC_sns_sgsn_config_success

Checks if the SGSN can success configures a SNS.

Change-Id: Ibacc2f6ad3053ff7b1e00054cabb9ec7010ffab2
---
A ns/NS_Tests.sgsn.sns.cfg
M ns/NS_Tests.ttcn
A ns/osmo-ns.sgsn.sns.cfg
3 files changed, 160 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ns/NS_Tests.sgsn.sns.cfg b/ns/NS_Tests.sgsn.sns.cfg
new file mode 100644
index 000..360d9f9
--- /dev/null
+++ b/ns/NS_Tests.sgsn.sns.cfg
@@ -0,0 +1,47 @@
+[ORDERED_INCLUDE]
+# Common configuration, shared between test suites
+"../Common.cfg"
+# testsuite specific configuration, not expected to change
+"./NS_Tests.default"
+
+[LOGGING]
+
+[MODULE_PARAMETERS]
+NS_Tests.mp_nsconfig := {
+   nsei := 1234,
+   nsvc := {
+   {
+   provider := {
+   ip := {
+   address_family := AF_INET,
+   local_ip := "127.0.0.1",
+   local_udp_port := 22000,
+   remote_ip := "127.0.0.1",
+   remote_udp_port := 23000
+   }
+   },
+   nsvci := 1234
+   },
+   {
+   provider := {
+   ip := {
+   address_family := AF_INET,
+   local_ip := "127.0.0.1",
+   local_udp_port := 22000,
+   remote_ip := "127.0.0.1",
+   remote_udp_port := 23001
+   }
+   },
+   nsvci := 1235
+   }
+   }
+}
+NS_Tests.mp_dialect := NS2_DIALECT_SNS
+NS_Tests.mp_sns_role := SNS_ROLE_SGSN;
+
+[TESTPORT_PARAMETERS]
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+NS_Tests.control
diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 0cef341..7d99fa8 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -698,6 +698,16 @@
f_clean_ns_codec();
 }

+testcase TC_sns_sgsn_config_success() runs on RAW_Test_CT {
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_outgoing_sns_size();
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
execute( TC_tx_reset() );
@@ -753,6 +763,10 @@
execute( TC_sns_bss_all_signalling_nsvcs_failed() );
execute( TC_sns_rx_size_force_unconf() );
}
+
+   if (mp_sns_role == SNS_ROLE_SGSN) {
+   execute( TC_sns_sgsn_config_success() );
+   }
}
 }

diff --git a/ns/osmo-ns.sgsn.sns.cfg b/ns/osmo-ns.sgsn.sns.cfg
new file mode 100644
index 000..bebc87e
--- /dev/null
+++ b/ns/osmo-ns.sgsn.sns.cfg
@@ -0,0 +1,99 @@
+!
+! OsmoNSdummy (1.4.0.326-f57c-dirty) configuration saved from vty
+!!
+!
+log stderr
+ logging filter all 1
+ logging color 0
+ logging print category-hex 0
+ logging print category 1
+ logging print extended-timestamp 1
+ logging print level 1
+ logging print file basename
+ logging level force-all info
+ logging level lglobal debug
+ logging level llapd debug
+ logging level linp debug
+ logging level lmux debug
+ logging level lmi debug
+ logging level lmib debug
+ logging level lsms debug
+ logging level lctrl debug
+ logging level lgtp debug
+ logging level lstats debug
+ logging level lgsup debug
+ logging level loap debug
+ logging level lss7 debug
+ logging level lsccp debug
+ logging level lsua debug
+ logging level lm3ua debug
+ logging level lmgcp debug
+ logging level ljibuf debug
+ logging level lrspro debug
+ logging level lns debug
+ logging level lnssignal debug
+ logging level lbssgp debug
+log gsmtap 127.0.0.1
+ logging filter all 0
+ logging color 1
+ logging print category-hex 1
+ logging print category 0
+ logging timestamp 0
+ logging print file 1
+ logging level lglobal debug
+ logging level llapd debug
+ logging level linp debug
+ logging level lmux debug
+ logging level lmi debug
+ logging level lmib debug
+ logging level lsms debug
+ logging level lctrl debug
+ logging level lgtp debug
+ logging level lstats debug
+ logging level lgsup debug
+ logging level loap debug
+ logging level lss7 debug
+ logging level lsccp debug
+ logging level lsua debug
+ logging l

Change in osmo-ttcn3-hacks[master]: ns2: add TC_sns_sgsn_add to test SNS ADD on the SGSN role

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25140 )

Change subject: ns2: add TC_sns_sgsn_add to test SNS ADD on the SGSN role
..

ns2: add TC_sns_sgsn_add to test SNS ADD on the SGSN role

Change-Id: I7474ea81ee905fb9fffb6c413b312e0b3547ea14
---
M ns/NS_Tests.ttcn
1 file changed, 20 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 7d99fa8..733bad1 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -708,6 +708,25 @@
f_clean_ns_codec();
 }

+testcase TC_sns_sgsn_add() runs on RAW_Test_CT {
+   g_handle_rx_alive := true;
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_init_ns_codec(mp_nsconfig, 1);
+   f_outgoing_sns_size(max_nsvcs := 4, num_ip := 4);
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   activate(as_rx_alive_tx_ack());
+
+   f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, 
"ip-sns-bind local2");
+   f_incoming_sns_add(idx_add := 1);
+   as_rx_alive_tx_ack(oneshot := true, idx := 1);
+
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
+
 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
execute( TC_tx_reset() );
@@ -766,6 +785,7 @@

if (mp_sns_role == SNS_ROLE_SGSN) {
execute( TC_sns_sgsn_config_success() );
+   execute( TC_sns_sgsn_add() );
}
}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25140
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7474ea81ee905fb9fffb6c413b312e0b3547ea14
Gerrit-Change-Number: 25140
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns2: mark TC_sns_bss_all_signalling_nsvcs_failed as broken

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25141 )

Change subject: ns2: mark TC_sns_bss_all_signalling_nsvcs_failed as broken
..

ns2: mark TC_sns_bss_all_signalling_nsvcs_failed as broken

The test case tests the wrong side. The signalling
and data weight are valid for the other side. The correct
test case needs to add a second bind on the ttcn3 side because
the signalling and data weight is valid for the remote side.

Change-Id: Ice79a038b0b8df9e69232bb24b2f2b18b3632758
---
M ns/NS_Tests.ttcn
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  dexter: Looks good to me, but someone else must approve



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 733bad1..e9c3bf4 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -654,6 +654,10 @@
  * 3. add second bind to SNS
  * 4. stop reacting to NS_ALIVE on first NSVC (only NSVC with sig weight)
  * 5. expect SNS SIZE
+ *
+ * Broken: the test case tests the wrong side. The signalling
+ * and data weight are valid for the other side. The correct
+ * test case needs to add a second bind on the ttcn3 side.
  */
 testcase TC_sns_bss_all_signalling_nsvcs_failed() runs on RAW_Test_CT {
g_handle_rx_alive := true;
@@ -779,7 +783,7 @@
execute( TC_sns_bss_add() );
execute( TC_sns_bss_del() );
execute( TC_sns_bss_add_change_del() );
-   execute( TC_sns_bss_all_signalling_nsvcs_failed() );
+   /* execute( TC_sns_bss_all_signalling_nsvcs_failed() ); 
*/
execute( TC_sns_rx_size_force_unconf() );
}


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25141
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ice79a038b0b8df9e69232bb24b2f2b18b3632758
Gerrit-Change-Number: 25141
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns2: add TC_sns_sgsn_del to test SNS DEL on the SGSN side

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25339 )

Change subject: ns2: add TC_sns_sgsn_del to test SNS DEL on the SGSN side
..

ns2: add TC_sns_sgsn_del to test SNS DEL on the SGSN side

Test the SNS DEL procedure when ns2 is operating the SGSN side.

Change-Id: If519da5212470957b922c569b2b8e5a50e12a8a8
---
M ns/NS_Tests.ttcn
1 file changed, 22 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index e9c3bf4..b45ab91 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -730,6 +730,27 @@
f_clean_ns_codec();
 }

+testcase TC_sns_sgsn_del() runs on RAW_Test_CT {
+   g_handle_rx_alive := true;
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_init_ns_codec(mp_nsconfig, 1);
+   f_outgoing_sns_size(max_nsvcs := 4, num_ip := 4);
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   activate(as_rx_alive_tx_ack());
+
+   f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, 
"ip-sns-bind local2");
+   f_incoming_sns_add(idx_add := 1);
+   as_rx_alive_tx_ack(oneshot := true, idx := 1);
+
+   /* delete the endpoint */
+   f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no 
ip-sns-bind local2");
+   f_incoming_sns_del(idx_del := 1);
+
+   setverdict(pass);
+   f_clean_ns_codec();
+}

 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
@@ -790,6 +811,7 @@
if (mp_sns_role == SNS_ROLE_SGSN) {
execute( TC_sns_sgsn_config_success() );
execute( TC_sns_sgsn_add() );
+   execute( TC_sns_sgsn_del() );
}
}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25339
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If519da5212470957b922c569b2b8e5a50e12a8a8
Gerrit-Change-Number: 25339
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns2: add TC_sns_sgsn_add_change_del similiar to the bss side

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25340 )

Change subject: ns2: add TC_sns_sgsn_add_change_del similiar to the bss side
..

ns2: add TC_sns_sgsn_add_change_del similiar to the bss side

1. do SNS configuration
2. add a bind
3. receive the SNS_ADD
4. before answering the SNS_ADD, change the weight via vty and remove the bind

Change-Id: I1a3d2273279f3def0d225ba78d400fb52a958c64
---
M ns/NS_Tests.ttcn
1 file changed, 47 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index b45ab91..c08f877 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -752,6 +752,52 @@
f_clean_ns_codec();
 }

+/* 1. do SNS configuration
+ * 2. add a bind
+ * 3. receive the SNS_ADD
+ * 4. before answering the SNS_ADD, change the weight via vty and remove the 
bind
+ */
+testcase TC_sns_sgsn_add_change_del() runs on RAW_Test_CT {
+   var PDU_NS rx;
+   var NSVCConfiguration nsvc_cfg;
+
+   g_handle_rx_alive := true;
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_init_ns_codec(mp_nsconfig, 1);
+   f_outgoing_sns_size(max_nsvcs := 4, num_ip := 4);
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   activate(as_rx_alive_tx_ack());
+   f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, 
"ip-sns-bind local2");
+
+   /* rx SNS ADD */
+   nsvc_cfg := g_nsconfig.nsvc[1];
+   if (nsvc_cfg.provider.ip.address_family == AF_INET) {
+   var template (omit) IP4_Elements v4_elem := { 
ts_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip,
+
nsvc_cfg.provider.ip.remote_udp_port,
+1, 1) };
+   rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, v4 := v4_elem), 
0);
+   } else {
+   var template (omit) IP6_Elements v6_elem := { 
ts_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip,
+
nsvc_cfg.provider.ip.remote_udp_port,
+1, 1) };
+   rx := f_ns_exp(tr_SNS_ADD(g_nsconfig.nsei, ?, omit, v6_elem), 
0);
+   }
+
+   /* delete the endpoint */
+   f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns 
signalling-weight 99 data-weight 99");
+   f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no 
ip-sns-bind local2");
+
+   /* accept the SNS_ADD */
+   NSCP[0].send(ts_SNS_ACK(g_nsconfig.nsei, rx.pDU_SNS_Add.transactionID));
+
+   f_incoming_sns_chg_weight(idx_chg := 1);
+   f_incoming_sns_del(idx_del := 1, w_sig := 99, w_user := 99);
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
execute( TC_tx_reset() );
@@ -812,6 +858,7 @@
execute( TC_sns_sgsn_config_success() );
execute( TC_sns_sgsn_add() );
execute( TC_sns_sgsn_del() );
+   execute( TC_sns_sgsn_add_change_del() );
}
}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25340
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I1a3d2273279f3def0d225ba78d400fb52a958c64
Gerrit-Change-Number: 25340
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2: move sns_event into internal.h to direct emit events

2021-09-05 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25144 )

Change subject: gprs_ns2: move sns_event into internal.h to direct emit events
..


Patch Set 5:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/25144/1/src/gb/gprs_ns_sns.c
File src/gb/gprs_ns_sns.c:

https://gerrit.osmocom.org/c/libosmocore/+/25144/1/src/gb/gprs_ns_sns.c@276
PS1, Line 276: enum g
> I'm also a bit puzzled by this. Moving the enum to ns2_internal. […]
This part was wrong! It was edited on accident (see ns.c -> ns1 code base).



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8e3fae4367c112b5a71bffb33c302d903855cddc
Gerrit-Change-Number: 25144
Gerrit-PatchSet: 5
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-CC: daniel 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Sun, 05 Sep 2021 19:46:34 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: laforge 
Comment-In-Reply-To: daniel 
Gerrit-MessageType: comment


Change in libosmocore[master]: gprs_ns2: use an event to free the nsvscs when using SNS

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25146 )

Change subject: gprs_ns2: use an event to free the nsvscs when using SNS
..

gprs_ns2: use an event to free the nsvscs when using SNS

Otherwise there could be recursive loop when free'ing NSVCs which
in the end create an event which the SNS want to free the NSVCs a
second time

Change-Id: Ie99ba5fe8a84519fe8a8c0abdf875606715ab7f6
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
3 files changed, 18 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 45cdfcc..83a8ca0 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -674,8 +674,12 @@
if (!nse || nse->freed)
return;

-   llist_for_each_entry_safe(nsvc, tmp, &nse->nsvc, list) {
-   gprs_ns2_free_nsvc(nsvc);
+   if (nse->bss_sns_fi) {
+   osmo_fsm_inst_dispatch(nse->bss_sns_fi, 
NS2_SNS_EV_REQ_FREE_NSVCS, NULL);
+   } else {
+   llist_for_each_entry_safe(nsvc, tmp, &nse->nsvc, list) {
+   gprs_ns2_free_nsvc(nsvc);
+   }
}
 }

diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 6096263..d2407f6 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -332,6 +332,7 @@
NS2_SNS_EV_RX_CHANGE_WEIGHT,
NS2_SNS_EV_RX_ACK,  /*!< Rx of SNS-ACK (response to 
ADD/DELETE/CHG_WEIGHT */
NS2_SNS_EV_REQ_NO_NSVC, /*!< no more NS-VC remaining (all dead) 
*/
+   NS2_SNS_EV_REQ_FREE_NSVCS,  /*!< free all NS-VCs */
NS2_SNS_EV_REQ_NSVC_ALIVE,  /*!< a NS-VC became alive */
NS2_SNS_EV_REQ_ADD_BIND,/*!< add a new local bind to 
this NSE */
NS2_SNS_EV_REQ_DELETE_BIND, /*!< remove a local bind from 
this NSE */
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 1b2864e..e96f6b3 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -84,6 +84,7 @@
{ NS2_SNS_EV_RX_ACK,"RX_ACK" },
{ NS2_SNS_EV_RX_CHANGE_WEIGHT,  "RX_CHANGE_WEIGHT" },
{ NS2_SNS_EV_REQ_NO_NSVC,   "REQ_NO_NSVC" },
+   { NS2_SNS_EV_REQ_FREE_NSVCS,"REQ_FREE_NSVCS" },
{ NS2_SNS_EV_REQ_NSVC_ALIVE,"REQ_NSVC_ALIVE"},
{ NS2_SNS_EV_REQ_ADD_BIND,  "REQ_ADD_BIND"},
{ NS2_SNS_EV_REQ_DELETE_BIND,   "REQ_DELETE_BIND"},
@@ -1564,6 +1565,7 @@
 {
struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
struct gprs_ns2_nse *nse = nse_inst_from_fi(fi);
+   struct gprs_ns2_vc *nsvc, *nsvc2;

/* reset when receiving NS2_SNS_EV_REQ_NO_NSVC */
switch (event) {
@@ -1574,11 +1576,14 @@

sns_failed(fi, "no remaining NSVC, resetting SNS FSM");
break;
+   case NS2_SNS_EV_REQ_FREE_NSVCS:
case NS2_SNS_EV_REQ_SELECT_ENDPOINT:
/* tear down previous state
 * gprs_ns2_free_nsvcs() will trigger NO_NSVC, prevent this 
from triggering a reselection */
gss->reselection_running = true;
-   gprs_ns2_free_nsvcs(nse);
+   llist_for_each_entry_safe(nsvc, nsvc2, &nse->nsvc, list) {
+   gprs_ns2_free_nsvc(nsvc);
+   }
ns2_clear_elems(&gss->local);
ns2_clear_elems(&gss->remote);

@@ -1613,6 +1618,7 @@
.states = ns2_sns_bss_states,
.num_states = ARRAY_SIZE(ns2_sns_bss_states),
.allstate_event_mask = S(NS2_SNS_EV_REQ_NO_NSVC) |
+  S(NS2_SNS_EV_REQ_FREE_NSVCS) |
   S(NS2_SNS_EV_REQ_SELECT_ENDPOINT) |
   S(NS2_SNS_EV_REQ_ADD_BIND) |
   S(NS2_SNS_EV_REQ_DELETE_BIND),
@@ -2329,6 +2335,9 @@
if (flag & 1)
osmo_fsm_inst_state_chg(fi, 
GPRS_SNS_ST_SGSN_WAIT_CONFIG, 0, 0);
break;
+   case NS2_SNS_EV_REQ_FREE_NSVCS:
+   sns_failed(fi, "On user request to free all NSVCs");
+   break;
default:
ns2_sns_st_all_action(fi, event, data);
break;
@@ -2341,6 +2350,7 @@
.num_states = ARRAY_SIZE(ns2_sns_sgsn_states),
.allstate_event_mask = S(NS2_SNS_EV_RX_SIZE) |
   S(NS2_SNS_EV_REQ_NO_NSVC) |
+  S(NS2_SNS_EV_REQ_FREE_NSVCS) |
   S(NS2_SNS_EV_REQ_ADD_BIND) |
   S(NS2_SNS_EV_REQ_DELET

Change in libosmocore[master]: gprs_ns2_sns: rework sns clean up

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25145 )

Change subject: gprs_ns2_sns: rework sns clean up
..

gprs_ns2_sns: rework sns clean up

Move the cleanup into it's own state. Also changing the
SGSN unconfigured state which won't be triggered when a
SIZE is received.

Change-Id: I2639345fdf3cd300a934238d676c543065ceaa8b
---
M src/gb/gprs_ns2_sns.c
1 file changed, 33 insertions(+), 16 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  daniel: Looks good to me, but someone else must approve



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 181d1a3..1b2864e 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -2059,6 +2059,29 @@
  * SGSN role
  ***/

+/* cleanup all state. If nsvc is given, don't remove this nsvc. (nsvc is given 
when a SIZE PDU received) */
+static void ns2_clear_sgsn(struct ns2_sns_state *gss, struct gprs_ns2_vc 
*size_nsvc)
+{
+   struct gprs_ns2_vc *nsvc, *nsvc2;
+
+   ns2_clear_elems(&gss->local);
+   ns2_clear_elems(&gss->remote);
+   llist_for_each_entry_safe(nsvc, nsvc2, &gss->nse->nsvc, list) {
+   /* Ignore the NSVC over which the SIZE PDU got received */
+   if (size_nsvc && size_nsvc == nsvc)
+   continue;
+
+   gprs_ns2_free_nsvc(nsvc);
+   }
+}
+
+static void ns2_sns_st_sgsn_unconfigured_onenter(struct osmo_fsm_inst *fi, 
uint32_t old_state)
+{
+   struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
+
+   ns2_clear_sgsn(gss, NULL);
+}
+
 static void ns2_sns_st_sgsn_unconfigured(struct osmo_fsm_inst *fi, uint32_t 
event, void *data)
 {
struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
@@ -2154,6 +2177,7 @@
  S(GPRS_SNS_ST_SGSN_WAIT_CONFIG),
.name = "UNCONFIGURED",
.action = ns2_sns_st_sgsn_unconfigured,
+   .onenter = ns2_sns_st_sgsn_unconfigured_onenter,
},
[GPRS_SNS_ST_SGSN_WAIT_CONFIG] = {
.in_event_mask = S(NS2_SNS_EV_RX_CONFIG) |
@@ -2167,6 +2191,7 @@
[GPRS_SNS_ST_SGSN_WAIT_CONFIG_ACK] = {
.in_event_mask = S(NS2_SNS_EV_RX_CONFIG_ACK),
.out_state_mask = S(GPRS_SNS_ST_UNCONFIGURED) |
+ S(GPRS_SNS_ST_SGSN_WAIT_CONFIG) |
  S(GPRS_SNS_ST_SGSN_WAIT_CONFIG_ACK) |
  S(GPRS_SNS_ST_CONFIGURED),
.name = "SGSN_WAIT_CONFIG_ACK",
@@ -2178,7 +2203,8 @@
 S(NS2_SNS_EV_RX_DELETE) |
 S(NS2_SNS_EV_RX_CHANGE_WEIGHT) |
 S(NS2_SNS_EV_REQ_NSVC_ALIVE),
-   .out_state_mask = S(GPRS_SNS_ST_UNCONFIGURED),
+   .out_state_mask = S(GPRS_SNS_ST_UNCONFIGURED) |
+ S(GPRS_SNS_ST_SGSN_WAIT_CONFIG),
.name = "CONFIGURED",
/* shared with BSS side; once configured there's no difference 
*/
.action = ns2_sns_st_configured,
@@ -2281,23 +2307,14 @@
/* perform state reset, if requested */
flag = *TLVP_VAL(tp, NS_IE_RESET_FLAG);
if (flag & 1) {
-   struct gprs_ns2_vc *nsvc, *nsvc2;
/* clear all state */
-   osmo_fsm_inst_state_chg(fi, GPRS_SNS_ST_UNCONFIGURED, 
0, 0);
+   /* TODO: ensure gss->sns_nsvc is always the NSVC on 
which we received the SIZE PDU */
gss->N = 0;
-   ns2_clear_elems(&gss->local);
-   ns2_clear_elems(&gss->remote);
-   llist_for_each_entry_safe(nsvc, nsvc2, &gss->nse->nsvc, 
list) {
-   if (nsvc == gss->sns_nsvc) {
-   /* keep the NSVC we need for SNS, but 
unconfigure it */
-   nsvc->sig_weight = 0;
-   nsvc->data_weight = 0;
-   ns2_vc_force_unconfigured(nsvc);
-   } else {
-   /* free all other NS-VCs */
-   gprs_ns2_free_nsvc(nsvc);
-   }
-   }
+   ns2_clear_sgsn(gss, gss->sns_nsvc);
+   /* keep the NSVC we need for SNS, but unconfigure it */
+   gss->sns_nsvc->sig_weight = 0;
+   gss->sns_nsvc->data_weight = 0;
+  

Change in libosmocore[master]: gprs_ns2: gprs_ns2_free_bind() should remove itself before removing n...

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25323 )

Change subject: gprs_ns2: gprs_ns2_free_bind() should remove itself before 
removing nsvcs
..

gprs_ns2: gprs_ns2_free_bind() should remove itself before removing nsvcs

When removing NSVCs before removing the bind from the SNS list, the removing 
NSVCs could
trigger a creation of a new NSVC on the same bind ending in a
while(true) loop.

Change-Id: I6f497348f75fb479427d8a4c23313e33fbc62036
---
M src/gb/gprs_ns2.c
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 83a8ca0..326312c 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1479,16 +1479,16 @@
return;

bind->freed = true;
-   llist_for_each_entry_safe(nsvc, tmp, &bind->nsvc, blist) {
-   gprs_ns2_free_nsvc(nsvc);
-   }
-
if (gprs_ns2_is_ip_bind(bind)) {
llist_for_each_entry(nse, &bind->nsi->nse, list) {
gprs_ns2_sns_del_bind(nse, bind);
}
}

+   llist_for_each_entry_safe(nsvc, tmp, &bind->nsvc, blist) {
+   gprs_ns2_free_nsvc(nsvc);
+   }
+
if (bind->driver->free_bind)
bind->driver->free_bind(bind);


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I6f497348f75fb479427d8a4c23313e33fbc62036
Gerrit-Change-Number: 25323
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2: move sns_event into internal.h to direct emit events

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25144 )

Change subject: gprs_ns2: move sns_event into internal.h to direct emit events
..

gprs_ns2: move sns_event into internal.h to direct emit events

When other parts of ns2 requires to emit an event to the SNS fsm it would
need a proxy function because the events are private to the
SNS file. To circumvent creating multiple proxy function make the events
available via a header file.

Change-Id: I8e3fae4367c112b5a71bffb33c302d903855cddc
---
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
2 files changed, 92 insertions(+), 92 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  daniel: Looks good to me, but someone else must approve



diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index 95efbae..6096263 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -320,6 +320,23 @@
void (*free_bind)(struct gprs_ns2_vc_bind *driver);
 };

+enum ns2_sns_event {
+   NS2_SNS_EV_REQ_SELECT_ENDPOINT, /*!< Select a SNS endpoint from the 
list */
+   NS2_SNS_EV_RX_SIZE,
+   NS2_SNS_EV_RX_SIZE_ACK,
+   NS2_SNS_EV_RX_CONFIG,
+   NS2_SNS_EV_RX_CONFIG_END,   /*!< SNS-CONFIG with end flag 
received */
+   NS2_SNS_EV_RX_CONFIG_ACK,
+   NS2_SNS_EV_RX_ADD,
+   NS2_SNS_EV_RX_DELETE,
+   NS2_SNS_EV_RX_CHANGE_WEIGHT,
+   NS2_SNS_EV_RX_ACK,  /*!< Rx of SNS-ACK (response to 
ADD/DELETE/CHG_WEIGHT */
+   NS2_SNS_EV_REQ_NO_NSVC, /*!< no more NS-VC remaining (all dead) 
*/
+   NS2_SNS_EV_REQ_NSVC_ALIVE,  /*!< a NS-VC became alive */
+   NS2_SNS_EV_REQ_ADD_BIND,/*!< add a new local bind to 
this NSE */
+   NS2_SNS_EV_REQ_DELETE_BIND, /*!< remove a local bind from 
this NSE */
+};
+
 enum ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind,
   struct msgb *msg,
   const struct osmo_sockaddr *remote,
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index a9ace5f..181d1a3 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -72,38 +72,21 @@
GPRS_SNS_ST_SGSN_WAIT_CONFIG_ACK,   /* !< SGSN role: Wait for 
CONFIG-ACK from BSS */
 };

-enum gprs_sns_event {
-   GPRS_SNS_EV_REQ_SELECT_ENDPOINT,/*!< Select a SNS endpoint from 
the list */
-   GPRS_SNS_EV_RX_SIZE,
-   GPRS_SNS_EV_RX_SIZE_ACK,
-   GPRS_SNS_EV_RX_CONFIG,
-   GPRS_SNS_EV_RX_CONFIG_END,  /*!< SNS-CONFIG with end flag 
received */
-   GPRS_SNS_EV_RX_CONFIG_ACK,
-   GPRS_SNS_EV_RX_ADD,
-   GPRS_SNS_EV_RX_DELETE,
-   GPRS_SNS_EV_RX_CHANGE_WEIGHT,
-   GPRS_SNS_EV_RX_ACK, /*!< Rx of SNS-ACK (response to 
ADD/DELETE/CHG_WEIGHT */
-   GPRS_SNS_EV_REQ_NO_NSVC,/*!< no more NS-VC remaining 
(all dead) */
-   GPRS_SNS_EV_REQ_NSVC_ALIVE, /*!< a NS-VC became alive */
-   GPRS_SNS_EV_REQ_ADD_BIND,   /*!< add a new local bind to 
this NSE */
-   GPRS_SNS_EV_REQ_DELETE_BIND,/*!< remove a local bind from 
this NSE */
-};
-
 static const struct value_string gprs_sns_event_names[] = {
-   { GPRS_SNS_EV_REQ_SELECT_ENDPOINT,  "REQ_SELECT_ENDPOINT" },
-   { GPRS_SNS_EV_RX_SIZE,  "RX_SIZE" },
-   { GPRS_SNS_EV_RX_SIZE_ACK,  "RX_SIZE_ACK" },
-   { GPRS_SNS_EV_RX_CONFIG,"RX_CONFIG" },
-   { GPRS_SNS_EV_RX_CONFIG_END,"RX_CONFIG_END" },
-   { GPRS_SNS_EV_RX_CONFIG_ACK,"RX_CONFIG_ACK" },
-   { GPRS_SNS_EV_RX_ADD,   "RX_ADD" },
-   { GPRS_SNS_EV_RX_DELETE,"RX_DELETE" },
-   { GPRS_SNS_EV_RX_ACK,   "RX_ACK" },
-   { GPRS_SNS_EV_RX_CHANGE_WEIGHT, "RX_CHANGE_WEIGHT" },
-   { GPRS_SNS_EV_REQ_NO_NSVC,  "REQ_NO_NSVC" },
-   { GPRS_SNS_EV_REQ_NSVC_ALIVE,   "REQ_NSVC_ALIVE"},
-   { GPRS_SNS_EV_REQ_ADD_BIND, "REQ_ADD_BIND"},
-   { GPRS_SNS_EV_REQ_DELETE_BIND,  "REQ_DELETE_BIND"},
+   { NS2_SNS_EV_REQ_SELECT_ENDPOINT,   "REQ_SELECT_ENDPOINT" },
+   { NS2_SNS_EV_RX_SIZE,   "RX_SIZE" },
+   { NS2_SNS_EV_RX_SIZE_ACK,   "RX_SIZE_ACK" },
+   { NS2_SNS_EV_RX_CONFIG, "RX_CONFIG" },
+   { NS2_SNS_EV_RX_CONFIG_END, "RX_CONFIG_END" },
+   { NS2_SNS_EV_RX_CONFIG_ACK, "RX_CONFIG_ACK" },
+   { NS2_SNS_EV_RX_ADD,"RX_ADD

Change in libosmocore[master]: gprs_ns2: don't use llist_for_each when freeing an element

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25147 )

Change subject: gprs_ns2: don't use llist_for_each when freeing an element
..

gprs_ns2: don't use llist_for_each when freeing an element

The problem are recursive execution because a free generates an event which 
could
allow the use to free a nsvcs while the llist_for_each() is still running.

Change-Id: I902557fb6e56e6588728a46e43a9cbe3215d5c68
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
3 files changed, 28 insertions(+), 20 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 326312c..a895e3d 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -664,22 +664,29 @@
talloc_free(nsvc);
 }

+void ns2_free_nsvcs(struct gprs_ns2_nse *nse)
+{
+   struct gprs_ns2_vc *nsvc;
+
+   /* prevent recursive free() when the user reacts on a down event and 
free() a second time */
+   while (!llist_empty(&nse->nsvc)) {
+   nsvc = llist_first_entry(&nse->nsvc, struct gprs_ns2_vc, list);
+   gprs_ns2_free_nsvc(nsvc);
+   }
+}
+
 /*! Destroy/release all NS-VC of given NSE
  *  \param[in] nse NSE
  */
 void gprs_ns2_free_nsvcs(struct gprs_ns2_nse *nse)
 {
-   struct gprs_ns2_vc *nsvc, *tmp;
-
if (!nse || nse->freed)
return;

if (nse->bss_sns_fi) {
osmo_fsm_inst_dispatch(nse->bss_sns_fi, 
NS2_SNS_EV_REQ_FREE_NSVCS, NULL);
} else {
-   llist_for_each_entry_safe(nsvc, tmp, &nse->nsvc, list) {
-   gprs_ns2_free_nsvc(nsvc);
-   }
+   ns2_free_nsvcs(nse);
}
 }

@@ -893,7 +900,6 @@
  *  \param[in] nse NS Entity to destroy */
 void gprs_ns2_free_nse(struct gprs_ns2_nse *nse)
 {
-   struct gprs_ns2_vc *nsvc, *nsvc2;
if (!nse || nse->freed)
return;

@@ -907,9 +913,7 @@
gprs_ns2_free_nsvcs(nse);
ns2_prim_status_ind(nse, NULL, 0, GPRS_NS2_AFF_CAUSE_FAILURE);
rate_ctr_group_free(nse->ctrg);
-   llist_for_each_entry_safe(nsvc, nsvc2, &nse->nsvc, list) {
-   gprs_ns2_free_nsvc(nsvc);
-   }
+   ns2_free_nsvcs(nse);

llist_del(&nse->list);
talloc_free(nse);
@@ -917,9 +921,11 @@

 void gprs_ns2_free_nses(struct gprs_ns2_inst *nsi)
 {
-   struct gprs_ns2_nse *nse, *ntmp;
+   struct gprs_ns2_nse *nse;

-   llist_for_each_entry_safe(nse, ntmp, &nsi->nse, list) {
+   /* prevent recursive free() when the user reacts on a down event and 
free() a second time */
+   while (!llist_empty(&nsi->nse)) {
+   nse = llist_first_entry(&nsi->nse, struct gprs_ns2_nse, list);
gprs_ns2_free_nse(nse);
}
 }
@@ -1473,19 +1479,21 @@
  *  \param[in] bind the bind we want to destroy */
 void gprs_ns2_free_bind(struct gprs_ns2_vc_bind *bind)
 {
-   struct gprs_ns2_vc *nsvc, *tmp;
+   struct gprs_ns2_vc *nsvc;
struct gprs_ns2_nse *nse;
if (!bind || bind->freed)
return;
-
bind->freed = true;
+
if (gprs_ns2_is_ip_bind(bind)) {
llist_for_each_entry(nse, &bind->nsi->nse, list) {
gprs_ns2_sns_del_bind(nse, bind);
}
}

-   llist_for_each_entry_safe(nsvc, tmp, &bind->nsvc, blist) {
+   /* prevent recursive free() when the user reacts on a down event and 
free() a second time */
+   while (!llist_empty(&bind->nsvc)) {
+   nsvc = llist_first_entry(&bind->nsvc, struct gprs_ns2_vc, 
blist);
gprs_ns2_free_nsvc(nsvc);
}

@@ -1500,9 +1508,11 @@

 void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi)
 {
-   struct gprs_ns2_vc_bind *bind, *tbind;
+   struct gprs_ns2_vc_bind *bind;

-   llist_for_each_entry_safe(bind, tbind, &nsi->binding, list) {
+   /* prevent recursive free() when the user reacts on a down event and 
free() a second time */
+   while (!llist_empty(&nsi->binding)) {
+   bind = llist_first_entry(&nsi->binding, struct 
gprs_ns2_vc_bind, list);
gprs_ns2_free_bind(bind);
}
 }
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index d2407f6..ca6bfb7 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -354,6 +354,7 @@
 enum gprs_ns2_vc_mode vc_mode,
 const char *id);

+void ns2_free_nsvcs(struct gprs_ns2_nse *nse);
 int ns2_bind_alloc(struct gprs_ns2_inst *nsi, const char *name,
   struct gprs_ns2_vc_bind **result);

diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index e96f6b3..

Change in libosmocore[master]: gprs_ns2_sns: implement local change weight procedure

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/23187 )

Change subject: gprs_ns2_sns: implement local change weight procedure
..

gprs_ns2_sns: implement local change weight procedure

When changing the bind ip-sns weight, initiate a
SNS CHANGE WEIGHT procedure to inform the other side.

Related: OS#5036
Change-Id: Icec4dabb46bc198f68f91bfe09ba279fbe68d454
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_sns.c
M src/gb/gprs_ns2_vty.c
M tests/gb/gprs_ns2_vty.vty
5 files changed, 460 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index a895e3d..adf3b32 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1440,6 +1440,7 @@
nsi->timeout[NS_TOUT_TSNS_PROV] = 3; /* 1..10 */
nsi->timeout[NS_TOUT_TSNS_SIZE_RETRIES] = 3;
nsi->timeout[NS_TOUT_TSNS_CONFIG_RETRIES] = 3;
+   nsi->timeout[NS_TOUT_TSNS_PROCEDURES_RETRIES] = 3;

return nsi;
 }
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index ca6bfb7..afe6b69 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -60,8 +60,8 @@
 struct gprs_ns2_vc_driver;
 struct gprs_ns2_vc_bind;

-#define NS_TIMERS_COUNT 10
-#define NS_TIMERS 
"(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov|tsns-size-retries|tsns-config-retries)"
+#define NS_TIMERS_COUNT 11
+#define NS_TIMERS 
"(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov|tsns-size-retries|tsns-config-retries|tsns-procedures-retries)"
 #define NS_TIMERS_HELP \
"(un)blocking Timer (Tns-block) timeout\n"  \
"(un)blocking Timer (Tns-block) number of retries\n"\
@@ -73,6 +73,7 @@
"SNS Provision Timer (Tsns-prov) timeout\n" \
"SNS Size number of retries\n"  \
"SNS Config number of retries\n"\
+   "SNS Procedures number of retries\n"\

 /* Educated guess - LLC user payload is 1500 bytes plus possible headers */
 #define NS_ALLOC_SIZE  3072
@@ -89,6 +90,7 @@
NS_TOUT_TSNS_PROV,
NS_TOUT_TSNS_SIZE_RETRIES,
NS_TOUT_TSNS_CONFIG_RETRIES,
+   NS_TOUT_TSNS_PROCEDURES_RETRIES,
 };

 enum nsvc_timer_mode {
@@ -336,6 +338,7 @@
NS2_SNS_EV_REQ_NSVC_ALIVE,  /*!< a NS-VC became alive */
NS2_SNS_EV_REQ_ADD_BIND,/*!< add a new local bind to 
this NSE */
NS2_SNS_EV_REQ_DELETE_BIND, /*!< remove a local bind from 
this NSE */
+   NS2_SNS_EV_REQ_CHANGE_WEIGHT,   /*!< a bind changed its weight 
*/
 };

 enum ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind,
diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 43e4920..9e30f62 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -70,6 +70,7 @@
GPRS_SNS_ST_CONFIGURED,
GPRS_SNS_ST_SGSN_WAIT_CONFIG,   /* !< SGSN role: Wait for 
CONFIG from BSS */
GPRS_SNS_ST_SGSN_WAIT_CONFIG_ACK,   /* !< SGSN role: Wait for 
CONFIG-ACK from BSS */
+   GPRS_SNS_ST_LOCAL_PROCEDURE,/*!< in process of a 
ADD/DEL/CHANGE procedure towards SGSN (BSS->SGSN) */
 };

 static const struct value_string gprs_sns_event_names[] = {
@@ -88,9 +89,17 @@
{ NS2_SNS_EV_REQ_NSVC_ALIVE,"REQ_NSVC_ALIVE"},
{ NS2_SNS_EV_REQ_ADD_BIND,  "REQ_ADD_BIND"},
{ NS2_SNS_EV_REQ_DELETE_BIND,   "REQ_DELETE_BIND"},
+   { NS2_SNS_EV_REQ_CHANGE_WEIGHT, "REQ_CHANGE_WEIGHT"},
{ 0, NULL }
 };

+enum sns_procedure {
+   SNS_PROC_NONE,  /*!< used as invalid/idle value */
+   SNS_PROC_ADD,
+   SNS_PROC_DEL,
+   SNS_PROC_CHANGE_WEIGHT,
+};
+
 struct sns_endpoint {
struct llist_head list;
struct osmo_sockaddr saddr;
@@ -99,6 +108,21 @@
 struct ns2_sns_bind {
struct llist_head list;
struct gprs_ns2_vc_bind *bind;
+   uint8_t change_weight_state;
+};
+
+struct ns2_sns_procedure {
+   struct llist_head list;
+   struct ns2_sns_bind *sbind;
+   uint16_t sig_weight;
+   uint16_t data_weight;
+   /* copy entry to protect against changes of gss->local */
+   struct gprs_ns_ie_ip4_elem ip4;
+   struct gprs_ns_ie_ip6_elem ip6;
+   enum sns_procedure procedure;
+   uint8_t trans_id;
+   /* is the procedure in process */
+   bool running;
 };

 struct ns2_sns_elems {
@@ -139,6 +163,9 @@
/* local configuration to send to the remote end */
struct ns2_sns_elems local;

+   /* local

Change in libosmocore[master]: gprs_ns2_sns: implement outbound SNS ADD procedures

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24123 )

Change subject: gprs_ns2_sns: implement outbound SNS ADD procedures
..

gprs_ns2_sns: implement outbound SNS ADD procedures

When adding a bind, the remote side needs to be
informed via the SNS ADD procedure.

Related: OS#5036
Change-Id: I71c33200bd1f0307ceb943ee958db5ebe3623d36
---
M src/gb/gprs_ns2_sns.c
1 file changed, 193 insertions(+), 36 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 9e30f62..0cb24c5 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -93,6 +93,8 @@
{ 0, NULL }
 };

+#define GPRS_SNS_FLAG_KEEP_SELECT_ENDPOINT_ORDER (void *) 1
+
 enum sns_procedure {
SNS_PROC_NONE,  /*!< used as invalid/idle value */
SNS_PROC_ADD,
@@ -1473,6 +1475,12 @@
 
/* also takes care of retransmitting */
switch (gss->current_procedure->procedure) {
+   case SNS_PROC_ADD:
+   if (gss->family == AF_INET)
+   ns2_tx_sns_add(gss->sns_nsvc, 
gss->current_procedure->trans_id, &gss->current_procedure->ip4, 1, NULL, 0);
+   else
+   ns2_tx_sns_add(gss->sns_nsvc, 
gss->current_procedure->trans_id, NULL, 0, &gss->current_procedure->ip6, 1);
+   break;
case SNS_PROC_CHANGE_WEIGHT:
if (gss->family == AF_INET)
ns2_tx_sns_change_weight(gss->sns_nsvc, 
gss->current_procedure->trans_id, &gss->current_procedure->ip4, 1, NULL, 0);
@@ -1484,6 +1492,65 @@
}
 }

+static void create_nsvc_for_new_sbind(struct ns2_sns_state *gss, struct 
ns2_sns_bind *sbind)
+{
+   struct gprs_ns2_nse *nse = gss->nse;
+   struct gprs_ns2_vc_bind *bind = sbind->bind;
+   struct gprs_ns2_vc *nsvc;
+   struct osmo_sockaddr remote = { };
+   unsigned int i;
+
+   /* iterate over all remote IPv4 endpoints */
+   for (i = 0; i < gss->remote.num_ip4; i++) {
+   const struct gprs_ns_ie_ip4_elem *ip4 = &gss->remote.ip4[i];
+
+   remote.u.sin.sin_family = AF_INET;
+   remote.u.sin.sin_addr.s_addr = ip4->ip_addr;
+   remote.u.sin.sin_port = ip4->udp_port;
+   /* we only care about UDP binds */
+   if (bind->ll != GPRS_NS2_LL_UDP)
+   continue;
+
+   nsvc = nsvc_for_bind_and_remote(nse, bind, &remote);
+   if (!nsvc) {
+   nsvc = gprs_ns2_ip_connect_inactive(bind, &remote, nse, 
0);
+   if (!nsvc) {
+   /* TODO: add to a list to send back a NS-STATUS 
*/
+   continue;
+   }
+   }
+
+   /* update data / signalling weight */
+   nsvc->data_weight = ip4->data_weight;
+   nsvc->sig_weight = ip4->sig_weight;
+   nsvc->sns_only = false;
+   }
+
+   /* iterate over all remote IPv4 endpoints */
+   for (i = 0; i < gss->remote.num_ip6; i++) {
+   const struct gprs_ns_ie_ip6_elem *ip6 = &gss->remote.ip6[i];
+
+   remote.u.sin6.sin6_family = AF_INET6;
+   remote.u.sin6.sin6_addr = ip6->ip_addr;
+   remote.u.sin6.sin6_port = ip6->udp_port;
+
+   /* we only care about UDP binds */
+   nsvc = nsvc_for_bind_and_remote(nse, bind, &remote);
+   if (!nsvc) {
+   nsvc = gprs_ns2_ip_connect_inactive(bind, &remote, nse, 
0);
+   if (!nsvc) {
+   /* TODO: add to a list to send back a NS-STATUS 
*/
+   continue;
+   }
+   }
+
+   /* update data / signalling weight */
+   nsvc->data_weight = ip6->data_weight;
+   nsvc->sig_weight = ip6->sig_weight;
+   nsvc->sns_only = false;
+   }
+}
+
 static void ns2_sns_st_local_procedure(struct osmo_fsm_inst *fi, uint32_t 
event, void *data)
 {
struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
@@ -1523,6 +1590,18 @@
}

switch (gss->current_procedure->procedure) {
+   case SNS_PROC_ADD:
+   switch (gss->family) {
+   case AF_INET:
+   add_ip4_elem(gss, &gss->local, 
&gss->current_procedure->ip4);
+   break;
+   case AF_INET6:
+   add_ip6_elem(gss, &gss->local, 
&gss->current_procedure->ip

Change in libosmocore[master]: gprs_ns2: also prevent recursive events when SGSN side cleans up

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25343 )

Change subject: gprs_ns2: also prevent recursive events when SGSN side cleans up
..

gprs_ns2: also prevent recursive events when SGSN side cleans up

When cleaning up the SGSN side (e.g. receiving a SNS SIZE PDU) the
clean up will result in a use-after-free bug when the SGSN side is still
alive.

Change-Id: I0f57dd0577d1fc7bd270f58e15f6f22eb130ef59
---
M src/gb/gprs_ns2_sns.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 3eff0f3..281f908 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -2732,6 +2732,7 @@
ns2_clear_procedures(gss);
ns2_clear_elems(&gss->local);
ns2_clear_elems(&gss->remote);
+   gss->block_no_nsvc_events = true;
llist_for_each_entry_safe(nsvc, nsvc2, &gss->nse->nsvc, list) {
/* Ignore the NSVC over which the SIZE PDU got received */
if (size_nsvc && size_nsvc == nsvc)
@@ -2739,6 +2740,7 @@

gprs_ns2_free_nsvc(nsvc);
}
+   gss->block_no_nsvc_events = false;
 }

 static void ns2_sns_st_sgsn_unconfigured_onenter(struct osmo_fsm_inst *fi, 
uint32_t old_state)

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0f57dd0577d1fc7bd270f58e15f6f22eb130ef59
Gerrit-Change-Number: 25343
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2_sns: implement outbound SNS DEL procedures

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/24591 )

Change subject: gprs_ns2_sns: implement outbound SNS DEL procedures
..

gprs_ns2_sns: implement outbound SNS DEL procedures

When removing a bind the remote side needs to be
informed via the SNS DELETE procedure.

Related: OS#5036
Change-Id: I53cd54dfd262c70c425c3f13dad3b29526daa523
---
M src/gb/gprs_ns2_sns.c
1 file changed, 95 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 0cb24c5..3eff0f3 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -150,6 +150,9 @@
/* prevent recursive reselection */
bool reselection_running;

+   /* protection against recursive free() */
+   bool block_no_nsvc_events;
+
/* The current initial SNS endpoints.
 * The initial connection will be moved into the NSE
 * if configured via SNS. Otherwise it will be removed
@@ -323,7 +326,8 @@
}
}

-   osmo_fsm_inst_dispatch(fi, NS2_SNS_EV_REQ_NO_NSVC, NULL);
+   if (gss->block_no_nsvc_events)
+   osmo_fsm_inst_dispatch(fi, NS2_SNS_EV_REQ_NO_NSVC, NULL);
 }

 static void ns2_clear_elems(struct ns2_sns_elems *elems)
@@ -595,6 +599,32 @@
return -1;
 }

+static int remove_bind_elem(struct ns2_sns_state *gss, struct ns2_sns_elems 
*elems, struct ns2_sns_bind *sbind)
+{
+   struct gprs_ns_ie_ip4_elem ip4;
+   struct gprs_ns_ie_ip6_elem ip6;
+   const struct osmo_sockaddr *saddr = 
gprs_ns2_ip_bind_sockaddr(sbind->bind);
+
+   switch (saddr->u.sa.sa_family) {
+   case AF_INET:
+   ip4.ip_addr = saddr->u.sin.sin_addr.s_addr;
+   ip4.udp_port = saddr->u.sin.sin_port;
+   ip4.sig_weight = sbind->bind->sns_sig_weight;
+   ip4.data_weight = sbind->bind->sns_data_weight;
+   return remove_ip4_elem(gss, elems, &ip4);
+   case AF_INET6:
+   memcpy(&ip6.ip_addr, &saddr->u.sin6.sin6_addr, sizeof(struct 
in6_addr));
+   ip6.udp_port = saddr->u.sin.sin_port;
+   ip6.sig_weight = sbind->bind->sns_sig_weight;
+   ip6.data_weight = sbind->bind->sns_data_weight;
+   return remove_ip6_elem(gss, elems, &ip6);
+   default:
+   return -1;
+   }
+
+   return -1;
+}
+
 static int do_sns_change_weight(struct osmo_fsm_inst *fi, const struct 
gprs_ns_ie_ip4_elem *ip4, const struct gprs_ns_ie_ip6_elem *ip6)
 {
struct ns2_sns_state *gss = (struct ns2_sns_state *) fi->priv;
@@ -1487,6 +1517,12 @@
else
ns2_tx_sns_change_weight(gss->sns_nsvc, 
gss->current_procedure->trans_id, NULL, 0, &gss->current_procedure->ip6, 1);
break;
+   case SNS_PROC_DEL:
+   if (gss->family == AF_INET)
+   ns2_tx_sns_del(gss->sns_nsvc, 
gss->current_procedure->trans_id, &gss->current_procedure->ip4, 1, NULL, 0);
+   else
+   ns2_tx_sns_del(gss->sns_nsvc, 
gss->current_procedure->trans_id, NULL, 0, &gss->current_procedure->ip6, 1);
+   break;
default:
break;
}
@@ -1599,8 +1635,11 @@
add_ip6_elem(gss, &gss->local, 
&gss->current_procedure->ip6);
break;
}
-   create_nsvc_for_new_sbind(gss, 
gss->current_procedure->sbind);
-   gprs_ns2_start_alive_all_nsvcs(nse);
+   /* the sbind can be NULL if the bind has been released 
by del_bind */
+   if (gss->current_procedure->sbind) {
+   create_nsvc_for_new_sbind(gss, 
gss->current_procedure->sbind);
+   gprs_ns2_start_alive_all_nsvcs(nse);
+   }
break;
case SNS_PROC_CHANGE_WEIGHT:
switch (gss->family) {
@@ -1633,6 +1672,16 @@
OSMO_ASSERT(0);
}
break;
+   case SNS_PROC_DEL:
+   switch (gss->family) {
+   case AF_INET:
+   remove_ip4_elem(gss, &gss->local, 
&gss->current_procedure->ip4);
+   break;
+   case AF_INET6:
+   remove_ip6_elem(gss, &gss->local, 
&gss->current_procedure->ip6);
+   break;

Change in libosmocore[master]: gprs_ns2: calculate the nse->*_sums before notifing the sns fsm

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25148 )

Change subject: gprs_ns2: calculate the nse->*_sums before notifing the sns fsm
..

gprs_ns2: calculate the nse->*_sums before notifing the sns fsm

The sns fsm needs these information to determine if there is a signalling nsvc 
left

Change-Id: I7b115921780bd1ae895d8b9d0d4aec3e1cbaaf58
---
M src/gb/gprs_ns2.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  daniel: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index adf3b32..6c48ca6 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1391,8 +1391,8 @@
 {
struct gprs_ns2_nse *nse = nsvc->nse;

-   ns2_sns_notify_alive(nse, nsvc, unblocked);
ns2_nse_data_sum(nse);
+   ns2_sns_notify_alive(nse, nsvc, unblocked);

if (unblocked == nse->alive)
return;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I7b115921780bd1ae895d8b9d0d4aec3e1cbaaf58
Gerrit-Change-Number: 25148
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2: add correct filename/linenr to sns failed log message

2021-09-05 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25149 )

Change subject: gprs_ns2: add correct filename/linenr to sns failed log message
..

gprs_ns2: add correct filename/linenr to sns failed log message

Change-Id: I117eaf8340fca50cb14392a3f05ea8feac1af3ed
---
M src/gb/gprs_ns2_sns.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  dexter: Looks good to me, but someone else must approve



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 281f908..7a3729b 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -199,7 +199,7 @@
struct ns2_sns_state *gss = fi->priv;

if (reason)
-   LOGPFSML(fi, LOGL_ERROR, "NSE %d: SNS failed: %s\n", 
gss->nse->nsei, reason);
+   LOGPFSMLSRC(fi, LOGL_ERROR, file, line, "NSE %d: SNS failed: 
%s\n", gss->nse->nsei, reason);

if (gss->role == GPRS_SNS_ROLE_SGSN) {
if (!gss->nse->persistent)

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I117eaf8340fca50cb14392a3f05ea8feac1af3ed
Gerrit-Change-Number: 25149
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in libosmocore[master]: ns2: nse: add a uptime/downtime to track the last state change

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25349 )


Change subject: ns2: nse: add a uptime/downtime to track the last state change
..

ns2: nse: add a uptime/downtime to track the last state change

To show adminstrator the last state change of a nse add a timestamp and
show it on the vty

> show ns nse 1234

NSEI 01234: UDP, ALIVE since 0d 0h 0m 16s
 FSM Instance Name: 'GPRS-NS2-SNS-SGSN(NSE01234-SNS)[0x612012a0]', ID: 
'NSE01234-SNS'
  Log-Level: 'DEBUG', State: 'CONFIGURED'
  Timer: 4
 Maximum number of remote  NS-VCs: 8, IPv4 Endpoints: 2, IPv6 Endpoints: 0
 [...]

Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_vty.c
3 files changed, 10 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/25349/1

diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 6c48ca6..c00537d 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -838,6 +838,7 @@
nse->mtu = 0;
llist_add_tail(&nse->list, &nsi->nse);
INIT_LLIST_HEAD(&nse->nsvc);
+   osmo_clock_gettime(CLOCK_MONOTONIC, &nse->ts_alive_change);

return nse;
 }
@@ -1400,6 +1401,7 @@
/* wait until both data_weight and sig_weight are != 0 before declaring 
NSE as alive */
if (unblocked && nse->sum_data_weight && nse->sum_sig_weight) {
nse->alive = true;
+   osmo_clock_gettime(CLOCK_MONOTONIC, &nse->ts_alive_change);
ns2_prim_status_ind(nse, NULL, 0, GPRS_NS2_AFF_CAUSE_RECOVERY);
nse->first = false;
return;
@@ -1408,6 +1410,7 @@
if (nse->alive && (nse->sum_data_weight == 0 || nse->sum_sig_weight == 
0)) {
/* nse became unavailable */
nse->alive = false;
+   osmo_clock_gettime(CLOCK_MONOTONIC, &nse->ts_alive_change);
ns2_prim_status_ind(nse, NULL, 0, GPRS_NS2_AFF_CAUSE_FAILURE);
}
 }
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index afe6b69..cd9969c 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -220,6 +220,9 @@

/*! recursive anchor */
bool freed;
+
+   /*! when the NSE became alive or dead */
+   struct timespec ts_alive_change;
 };

 /*! Structure representing a single NS-VC */
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 52ce207..86471b8 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -1900,8 +1900,10 @@
if (persistent_only && !nse->persistent)
return;

-   vty_out(vty, "NSEI %05u: %s, %s%s", nse->nsei, 
gprs_ns2_lltype_str(nse->ll),
-   nse->alive ? "ALIVE" : "DEAD", VTY_NEWLINE);
+   vty_out(vty, "NSEI %05u: %s, %s since ", nse->nsei, 
gprs_ns2_lltype_str(nse->ll),
+   nse->alive ? "ALIVE" : "DEAD");
+   vty_out_uptime(vty, &nse->ts_alive_change);
+   vty_out_newline(vty);

ns2_sns_dump_vty(vty, " ", nse, stats);
llist_for_each_entry(nsvc, &nse->nsvc, list) {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
Gerrit-Change-Number: 25349
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: vty: add vty_out_uptime() print the uptime to the vty

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25348 )


Change subject: vty: add vty_out_uptime() print the uptime to the vty
..

vty: add vty_out_uptime() print the uptime to the vty

vty_out_uptime() calculates the time difference to a given timespec
and print it in a human readable format (days, hours,
minutes, seconds) to the vty.

Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
---
M include/osmocom/vty/vty.h
M src/vty/vty.c
2 files changed, 22 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/25348/1

diff --git a/include/osmocom/vty/vty.h b/include/osmocom/vty/vty.h
index 3e6178f..a39780b 100644
--- a/include/osmocom/vty/vty.h
+++ b/include/osmocom/vty/vty.h
@@ -3,6 +3,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -219,6 +220,7 @@
 int vty_out (struct vty *, const char *, ...) VTY_PRINTF_ATTRIBUTE(2, 3);
 int vty_out_va(struct vty *vty, const char *format, va_list ap);
 int vty_out_newline(struct vty *);
+int vty_out_uptime(struct vty *vty, const struct timespec *starttime);
 int vty_read(struct vty *vty);
 //void vty_time_print (struct vty *, int);
 void vty_close (struct vty *);
diff --git a/src/vty/vty.c b/src/vty/vty.c
index a39f268..4cb0847 100644
--- a/src/vty/vty.c
+++ b/src/vty/vty.c
@@ -66,6 +66,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #ifndef MAXPATHLEN
@@ -332,6 +333,25 @@
return 0;
 }

+/*! calculates the time difference of a give timespec to the current time
+ *  and prints in a human readable format (days, hours, minutes, seconds).
+ */
+int vty_out_uptime(struct vty *vty, const struct timespec *starttime)
+{
+   struct timespec now;
+   struct timespec uptime;
+
+   osmo_clock_gettime(CLOCK_MONOTONIC, &now);
+   timespecsub(&now, starttime, &uptime);
+
+   int d = uptime.tv_sec / (3600 * 24);
+   int h = uptime.tv_sec / 3600 % 24;
+   int m = uptime.tv_sec / 60 % 60;
+   int s = uptime.tv_sec % 60;
+
+   return vty_out(vty, "%dd %dh %dm %ds", d, h, m, s);
+}
+
 /*! return the current index of a given VTY */
 void *vty_current_index(struct vty *vty)
 {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
Gerrit-Change-Number: 25348
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: ns2: nsvc: add a uptime/downtime to track the last state change

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25350 )


Change subject: ns2: nsvc: add a uptime/downtime to track the last state change
..

ns2: nsvc: add a uptime/downtime to track the last state change

To show adminstrator the last state change of a nsvc add a timestamp and
show it on the vty

> show ns nsei 1234
NSEI 01234: UDP, DEAD since 0d 0h 1m 42s
[...]
  4 NS-VC:
   UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 
udp)[127.0.0.1]:22000<>[127.0.0.1]:23001 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 
udp)[127.0.0.1]:22000<>[127.0.0.1]:23000 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 
udp)[127.0.0.1]:22001<>[127.0.0.1]:23000 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 
udp)[127.0.0.1]:22001<>[127.0.0.1]:23001 ALIVE since 0d 0h 0m 1s

Change-Id: Ie3a039a209869295afa5feda39297cee81fedf22
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_vc_fsm.c
M src/gb/gprs_ns2_vty.c
4 files changed, 16 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/25350/1

diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index c00537d..13bc890 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -621,6 +621,7 @@

llist_add_tail(&nsvc->list, &nse->nsvc);
llist_add_tail(&nsvc->blist, &bind->nsvc);
+   osmo_clock_gettime(CLOCK_MONOTONIC, &nse->ts_alive_change);
ns2_nse_update_mtu(nse);

return nsvc;
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index cd9969c..bfb12d9 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -270,6 +270,9 @@

/*! recursive anchor */
bool freed;
+
+   /*! when the NSVC became alive or dead */
+   struct timespec ts_alive_change;
 };

 /*! Structure repesenting a bind instance. E.g. IPv4 listen port. */
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 1fcc3ad..c8c9ae9 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -414,8 +414,10 @@
struct gprs_ns2_vc *nsvc = priv->nsvc;
struct gprs_ns2_nse *nse = nsvc->nse;

-   if (old_state != GPRS_NS2_ST_UNBLOCKED)
+   if (old_state != GPRS_NS2_ST_UNBLOCKED) {
RATE_CTR_INC_NS(nsvc, NS_CTR_UNBLOCKED);
+   osmo_clock_gettime(CLOCK_MONOTONIC, &nsvc->ts_alive_change);
+   }

priv->accept_unitdata = true;
ns2_nse_notify_unblocked(nsvc, true);
diff --git a/src/gb/gprs_ns2_vty.c b/src/gb/gprs_ns2_vty.c
index 86471b8..41f581e 100644
--- a/src/gb/gprs_ns2_vty.c
+++ b/src/gb/gprs_ns2_vty.c
@@ -1875,16 +1875,21 @@
 void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats)
 {
if (nsvc->nsvci_is_valid)
-   vty_out(vty, "   NSVCI %05u: %s %s %s%s", nsvc->nsvci,
+   vty_out(vty, "   NSVCI %05u: %s %s %s %s since ", nsvc->nsvci,
osmo_fsm_inst_state_name(nsvc->fi),
nsvc->persistent ? "PERSIST" : "DYNAMIC",
-   gprs_ns2_ll_str(nsvc), VTY_NEWLINE);
+   gprs_ns2_ll_str(nsvc),
+   ns2_vc_is_unblocked(nsvc) ? "ALIVE" : "DEAD");
else
-   vty_out(vty, "   %s %s sig_weight=%u data_weight=%u %s%s",
+   vty_out(vty, "   %s %s sig_weight=%u data_weight=%u %s %s since 
",
osmo_fsm_inst_state_name(nsvc->fi),
nsvc->persistent ? "PERSIST" : "DYNAMIC",
nsvc->sig_weight, nsvc->data_weight,
-   gprs_ns2_ll_str(nsvc), VTY_NEWLINE);
+   gprs_ns2_ll_str(nsvc),
+   ns2_vc_is_unblocked(nsvc) ? "ALIVE" : "DEAD");
+
+   vty_out_uptime(vty, &nsvc->ts_alive_change);
+   vty_out_newline(vty);

if (stats) {
vty_out_rate_ctr_group(vty, "", nsvc->ctrg);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie3a039a209869295afa5feda39297cee81fedf22
Gerrit-Change-Number: 25350
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: vty: add vty_out_uptime() print the uptime to the vty

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/c/libosmocore/+/25348 )

Change subject: vty: add vty_out_uptime() print the uptime to the vty
..

vty: add vty_out_uptime() print the uptime to the vty

vty_out_uptime() calculates the time difference to a given timespec
and print it in a human readable format (days, hours,
minutes, seconds) to the vty.

Related: OS#5028
Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
---
M include/osmocom/vty/vty.h
M src/vty/vty.c
2 files changed, 22 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/25348/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25348
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
Gerrit-Change-Number: 25348
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: nse: add a uptime/downtime to track the last state change

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/c/libosmocore/+/25349 )

Change subject: ns2: nse: add a uptime/downtime to track the last state change
..

ns2: nse: add a uptime/downtime to track the last state change

To show adminstrator the last state change of a nse add a timestamp and
show it on the vty

> show ns nse 1234

NSEI 01234: UDP, ALIVE since 0d 0h 0m 16s
 FSM Instance Name: 'GPRS-NS2-SNS-SGSN(NSE01234-SNS)[0x612012a0]', ID: 
'NSE01234-SNS'
  Log-Level: 'DEBUG', State: 'CONFIGURED'
  Timer: 4
 Maximum number of remote  NS-VCs: 8, IPv4 Endpoints: 2, IPv6 Endpoints: 0
 [...]

Related: OS#5028
Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_vty.c
3 files changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/25349/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25349
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
Gerrit-Change-Number: 25349
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: nsvc: add a uptime/downtime to track the last state change

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/c/libosmocore/+/25350 )

Change subject: ns2: nsvc: add a uptime/downtime to track the last state change
..

ns2: nsvc: add a uptime/downtime to track the last state change

To show adminstrator the last state change of a nsvc add a timestamp and
show it on the vty

> show ns nsei 1234
NSEI 01234: UDP, DEAD since 0d 0h 1m 42s
[...]
  4 NS-VC:
   UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 
udp)[127.0.0.1]:22000<>[127.0.0.1]:23001 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 
udp)[127.0.0.1]:22000<>[127.0.0.1]:23000 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 
udp)[127.0.0.1]:22001<>[127.0.0.1]:23000 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 
udp)[127.0.0.1]:22001<>[127.0.0.1]:23001 ALIVE since 0d 0h 0m 1s

Related: OS#5028
Change-Id: Ie3a039a209869295afa5feda39297cee81fedf22
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_vc_fsm.c
M src/gb/gprs_ns2_vty.c
4 files changed, 16 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/25350/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25350
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie3a039a209869295afa5feda39297cee81fedf22
Gerrit-Change-Number: 25350
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: nse: add a uptime/downtime to track the last state change

2021-09-05 Thread lynxis lazus
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/libosmocore/+/25349

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

Change subject: ns2: nse: add a uptime/downtime to track the last state change
..

ns2: nse: add a uptime/downtime to track the last state change

To show adminstrator the last state change of a nse add a timestamp and
show it on the vty

> show ns nse 1234

NSEI 01234: UDP, ALIVE since 0d 0h 0m 16s
 FSM Instance Name: 'GPRS-NS2-SNS-SGSN(NSE01234-SNS)[0x612012a0]', ID: 
'NSE01234-SNS'
  Log-Level: 'DEBUG', State: 'CONFIGURED'
  Timer: 4
 Maximum number of remote  NS-VCs: 8, IPv4 Endpoints: 2, IPv6 Endpoints: 0
 [...]

Related: OS#5028
Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_vty.c
M tests/gb/gprs_ns2_vty.vty
4 files changed, 12 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/49/25349/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25349
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I8143080a3c5c9a55d37dfad44ba2ac6561daa216
Gerrit-Change-Number: 25349
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: nsvc: add a uptime/downtime to track the last state change

2021-09-05 Thread lynxis lazus
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/libosmocore/+/25350

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

Change subject: ns2: nsvc: add a uptime/downtime to track the last state change
..

ns2: nsvc: add a uptime/downtime to track the last state change

To show adminstrator the last state change of a nsvc add a timestamp and
show it on the vty

> show ns nsei 1234
NSEI 01234: UDP, DEAD since 0d 0h 1m 42s
[...]
  4 NS-VC:
   UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 
udp)[127.0.0.1]:22000<>[127.0.0.1]:23001 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 
udp)[127.0.0.1]:22000<>[127.0.0.1]:23000 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=2 data_weight=2 
udp)[127.0.0.1]:22001<>[127.0.0.1]:23000 ALIVE since 0d 0h 0m 1s
   UNBLOCKED DYNAMIC sig_weight=1 data_weight=1 
udp)[127.0.0.1]:22001<>[127.0.0.1]:23001 ALIVE since 0d 0h 0m 1s

Related: OS#5028
Change-Id: Ie3a039a209869295afa5feda39297cee81fedf22
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_vc_fsm.c
M src/gb/gprs_ns2_vty.c
M tests/gb/gprs_ns2_vty.vty
5 files changed, 24 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/50/25350/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25350
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ie3a039a209869295afa5feda39297cee81fedf22
Gerrit-Change-Number: 25350
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-ttcn3-hacks[master]: ns: f_init_vty: only reset SNS configuration when using SNS.

2021-09-05 Thread lynxis lazus
Hello Jenkins Builder, laforge,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25342

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

Change subject: ns: f_init_vty: only reset SNS configuration when using SNS.
..

ns: f_init_vty: only reset SNS configuration when using SNS.

Change-Id: I9ecf0abe29e5acdd18f4b18b340baeb442cc09b6
---
M ns/NS_Tests.ttcn
1 file changed, 6 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/42/25342/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25342
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9ecf0abe29e5acdd18f4b18b340baeb442cc09b6
Gerrit-Change-Number: 25342
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-ttcn3-hacks[master]: ns: add TC_sns_bss_remove_bind_fail_sns to check SNS fails correct wh...

2021-09-05 Thread lynxis lazus
Hello Jenkins Builder, laforge,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25341

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

Change subject: ns: add TC_sns_bss_remove_bind_fail_sns to check SNS fails 
correct when removing a bind
..

ns: add TC_sns_bss_remove_bind_fail_sns to check SNS fails correct when 
removing a bind

This TC produces an abort of the ns2 dummy by the memory sanitizer.
Test if SNS fails when removing a bind which has the last valid connection.
The ns2 has 2 binds, ttcn3 1 bind. There are 2 NSVCs.

Bind -- NSVCs -- Bind.

(ns2)  (ttcn3)
1*---*1
/
2*-broken--/

Remove the 1st ns2 bind after the other NSVC has failed.

Change-Id: I8f7daee7a3bcadf64e8ae607619425adbefe3c4b
---
M ns/NS_Tests.ttcn
1 file changed, 39 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/41/25341/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25341
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8f7daee7a3bcadf64e8ae607619425adbefe3c4b
Gerrit-Change-Number: 25341
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: newpatchset


Change in osmo-ttcn3-hacks[master]: ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is transmi...

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25351 )


Change subject: ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is 
transmitted from the correct port
..

ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is transmitted from 
the correct port

Change-Id: Ib0fbf0cc87ff8f00fd4062b471d7a4835b45723c
---
M ns/NS_Tests.ttcn
1 file changed, 15 insertions(+), 0 deletions(-)



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

diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index a19477d..8553684 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -752,6 +752,20 @@
f_clean_ns_codec();
 }

+/* Ensure a SNS SIZE ACK is transmitted from the correct port */
+testcase TC_sns_sgsn_size_correct_port() runs on RAW_Test_CT {
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_init_ns_codec(mp_nsconfig, 1);
+   f_outgoing_sns_size(max_nsvcs := 10);
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   NSCP[0].receive(t_NS_ALIVE);
+   f_outgoing_sns_size(max_nsvcs := 10, idx := 1);
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
 testcase TC_sns_sgsn_add() runs on RAW_Test_CT {
g_handle_rx_alive := true;
f_init_vty();
@@ -900,6 +914,7 @@
execute( TC_sns_sgsn_add() );
execute( TC_sns_sgsn_del() );
execute( TC_sns_sgsn_add_change_del() );
+   execute( TC_sns_sgsn_size_correct_port() );
}
}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25351
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib0fbf0cc87ff8f00fd4062b471d7a4835b45723c
Gerrit-Change-Number: 25351
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: ns: always clean up the ns_codec

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25353 )


Change subject: ns: always clean up the ns_codec
..

ns: always clean up the ns_codec

The f_clean_ns_codec() was introduced later to clean up the ns_codec
properly.

Change-Id: I7a84f75ebd1c68b3c0a6b55b8c49903c51dd6b92
---
M ns/NS_Tests.ttcn
1 file changed, 19 insertions(+), 0 deletions(-)



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

diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 105d397..8b321ff 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -131,6 +131,7 @@

setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 testcase TC_tx_reset_tx_alive() runs on RAW_Test_CT {
@@ -145,6 +146,7 @@

setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 testcase TC_tx_reset_rx_alive() runs on RAW_Test_CT {
@@ -160,6 +162,7 @@

setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.2.1 transmit a UNIT DATA over a BLOCKED NSVC when ttcn3 blocked it
@@ -227,6 +230,7 @@
f_outgoing_ns_unblock();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.2 tx unblock retries
@@ -254,6 +258,7 @@
f_outgoing_ns_unblock();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.2 block procedure
@@ -318,6 +323,7 @@
 testcase TC_tx_block_by_vty() runs on RAW_Test_CT {
tx_block_by_vty(30.0);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.2 block precedure by vty and reset the NSVC.
@@ -336,6 +342,7 @@
[] T.timeout { setverdict(pass); }
}
deactivate(d);
+   f_clean_ns_codec();
 }

 /* 48.016 7.4.1 ignore unexpected NS_ALIVE ACK */
@@ -347,6 +354,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET with wrong nsei */
@@ -359,6 +367,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET with wrong nsvci */
@@ -371,6 +380,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET with wrong nsvci + nsei */
@@ -383,6 +393,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET_ACK with wrong nsei */
@@ -395,6 +406,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET_ACK with wrong nsvci */
@@ -407,6 +419,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET_ACK with wrong nsvci + nsei */
@@ -419,6 +432,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 ignore unexpected NS_RESET_ACK after NS_RESET+ALIVE */
@@ -439,6 +453,7 @@
f_ensure_no_ns(answer_alive := true, tout := 15.0);
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3 NS_RESET retries */
@@ -460,6 +475,7 @@
}

f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 behave RESET_ACK got dropped
@@ -493,6 +509,7 @@
}

f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.4 test procedure for frame relay with a single nsvci */
@@ -526,10 +543,12 @@

 testcase TC_alive_retries_single_reset() runs on RAW_Test_CT {
f_alive_retries_single(reset := true);
+   f_clean_ns_codec();
 }

 testcase TC_alive_retries_single_no_resp() runs on RAW_Test_CT {
f_alive_retries_single(reset := false);
+   f_clean_ns_codec();
 }

 /* 48.016 SNS test cases */

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25353
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7a84f75ebd1c68b3c0a6b55b8c49903c51dd6b92
Gerrit-Change-Number: 25353
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: ns: fix missing f_ prefix for function f_tx_block_by_vty

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25354 )


Change subject: ns: fix missing f_ prefix for function f_tx_block_by_vty
..

ns: fix missing f_ prefix for function f_tx_block_by_vty

All function should have this prefix

Change-Id: Id7b692b3b76946b36dcaa3d23b32b5ccb5007702
---
M ns/NS_Tests.ttcn
1 file changed, 4 insertions(+), 4 deletions(-)



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

diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 8b321ff..58aeacd 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -200,7 +200,7 @@
  * TTCN <-  NS: status (cause blocked)
  */
 testcase TC_rx_block_unitdata_over_blocked() runs on RAW_Test_CT {
-   tx_block_by_vty();
+   f_tx_block_by_vty();
f_sleep(1.0);

NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
@@ -301,7 +301,7 @@
  * TTCN <-  NS: block
  * TTCN  -> NS: block ack
  */
-function tx_block_by_vty(float guard_secs := 30.0) runs on RAW_Test_CT {
+function f_tx_block_by_vty(float guard_secs := 30.0) runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig, guard_secs := guard_secs);

@@ -321,7 +321,7 @@
 }

 testcase TC_tx_block_by_vty() runs on RAW_Test_CT {
-   tx_block_by_vty(30.0);
+   f_tx_block_by_vty(30.0);
f_sleep(1.0);
f_clean_ns_codec();
 }
@@ -332,7 +332,7 @@
 testcase TC_tx_block_by_vty_reset() runs on RAW_Test_CT {
timer T := 10.0;

-   tx_block_by_vty(60.0);
+   f_tx_block_by_vty(60.0);
f_outgoing_ns_reset();

var default d := activate(ax_rx_fail_on_any_ns());

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25354
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id7b692b3b76946b36dcaa3d23b32b5ccb5007702
Gerrit-Change-Number: 25354
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: ns: add tests to test UNITDATA over a BLOCKED nsvcs

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25352 )


Change subject: ns: add tests to test UNITDATA over a BLOCKED nsvcs
..

ns: add tests to test UNITDATA over a BLOCKED nsvcs

The UNITDATA should be rejected by a NS STATUS PDU.

Change-Id: I62ce93ca4953f8b0476a15479089db2f6c2fa684
---
M ns/NS_Tests.ttcn
1 file changed, 55 insertions(+), 2 deletions(-)



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

diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 8553684..105d397 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -162,6 +162,52 @@
f_sleep(1.0);
 }

+/* 48.016 7.2.1 transmit a UNIT DATA over a BLOCKED NSVC when ttcn3 blocked it
+ *
+ * TTCN  -> NS: reset
+ * TTCN <-  NS: reset ack
+ * TTCN  -> NS: unblock
+ * TTCN <-  NS: unblock ack
+ * TTCN  -> NS: block
+ * TTCN <-  NS: block ack
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: status (cause blocked)
+ */
+testcase TC_tx_block_unitdata_over_blocked() runs on RAW_Test_CT {
+   f_tx_block();
+   f_sleep(1.0);
+
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED));
+
+   setverdict(pass);
+   f_sleep(1.0);
+   f_clean_ns_codec();
+}
+
+/* 48.016 7.2.1 transmit a UNIT DATA over a BLOCKED NSVC when ns2 blocked it
+ *
+ * TTCN  -> NS: reset
+ * TTCN <-  NS: reset ack
+ * TTCN  -> NS: unblock
+ * TTCN <-  NS: unblock ack
+ * TTCN <-  NS: block
+ * TTCN  -> NS: block ack
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: status (cause blocked)
+ */
+testcase TC_rx_block_unitdata_over_blocked() runs on RAW_Test_CT {
+   tx_block_by_vty();
+   f_sleep(1.0);
+
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED));
+
+   setverdict(pass);
+   f_sleep(1.0);
+   f_clean_ns_codec();
+}
+
 /* 48.016 7.2 unblock procedure
  *
  * TTCN  -> NS: reset
@@ -219,9 +265,9 @@
  * TTCN  -> NS: block
  * TTCN <-  NS: block ack
  */
-testcase TC_tx_block() runs on RAW_Test_CT {
+function f_tx_block(float guard_secs := 30.0) runs on RAW_Test_CT {
f_init_vty();
-   f_init_ns_codec(mp_nsconfig, guard_secs := 30.0);
+   f_init_ns_codec(mp_nsconfig, guard_secs := guard_secs);

/* do a NS Reset procedure */
f_outgoing_ns_reset();
@@ -235,6 +281,11 @@
f_sleep(1.0);
 }

+testcase TC_tx_block() runs on RAW_Test_CT {
+   f_tx_block()
+   f_clean_ns_codec();
+}
+
 /* 48.016 7.2 block procedure by vty
  *
  * TTCN  -> NS: reset
@@ -860,6 +911,8 @@
execute( TC_tx_block() );
execute( TC_tx_block_by_vty() );
execute( TC_tx_block_by_vty_reset() );
+   execute( TC_tx_block_unitdata_over_blocked() );
+   execute( TC_rx_block_unitdata_over_blocked() );
// execute( TC_block_other_nsvc() ); // reset, unblock, 
sleep(1), block over another nsvci
/* 48.016 7.2 Unblock procedure */
execute( TC_tx_unblock() );

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25352
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I62ce93ca4953f8b0476a15479089db2f6c2fa684
Gerrit-Change-Number: 25352
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: ns: add test case for UNITDATA transmission

2021-09-05 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25355 )


Change subject: ns: add test case for UNITDATA transmission
..

ns: add test case for UNITDATA transmission

Change-Id: I5f59581d4257436eb9651c0c5ab5dd002f23d834
---
M ns/NS_Tests.ttcn
1 file changed, 28 insertions(+), 1 deletion(-)



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

diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 58aeacd..c3247fc 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -77,6 +77,7 @@
map(self:NSVTY, system:NSVTY);
f_vty_set_prompts(NSVTY);
f_vty_transceive(NSVTY, "enable");
+   f_vty_config2(NSVTY, {}, "mirror-mode disable");
f_vty_transceive(NSVTY, "nsvc nsei " & int2str(mp_nsconfig.nsei) & " 
force-unconfigured");
if (mp_dialect == NS2_DIALECT_SNS) {
f_vty_config2(NSVTY, {"ns", "nse " & 
int2str(mp_nsconfig.nsei)}, "ip-sns-bind local");
@@ -218,7 +219,7 @@
  * TTCN  -> NS: unblock
  * TTCN <-  NS: unblock ack
  */
-testcase TC_tx_unblock() runs on RAW_Test_CT {
+function f_tx_unblock() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig, guard_secs := 30.0);

@@ -229,6 +230,10 @@

f_outgoing_ns_unblock();
setverdict(pass);
+}
+
+testcase TC_tx_unblock() runs on RAW_Test_CT {
+   f_tx_unblock();
f_sleep(1.0);
f_clean_ns_codec();
 }
@@ -922,6 +927,27 @@
f_clean_ns_codec();
 }

+/* 48.016 7.2 transmit a UNITDATA over an ALIVE connection
+ *
+ * TTCN  -> NS: reset
+ * TTCN <-  NS: reset ack
+ * TTCN  -> NS: unblock
+ * TTCN <-  NS: unblock ack
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: unitdata (mirror)
+ */
+testcase TC_tx_unitdata() runs on RAW_Test_CT {
+   f_tx_unblock();
+
+   f_vty_config2(NSVTY, {}, "mirror-mode enable");
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_vty_config2(NSVTY, {}, "mirror-mode disable");
+
+   f_sleep(1.0);
+   f_clean_ns_codec();
+}
+
 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
execute( TC_tx_reset() );
@@ -965,6 +991,7 @@
}

execute( TC_no_reset_alive_ack() );
+   execute( TC_tx_unitdata() );
}

if (mp_dialect == NS2_DIALECT_SNS) {

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5f59581d4257436eb9651c0c5ab5dd002f23d834
Gerrit-Change-Number: 25355
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: gprs_ns2: improve reselection protection

2021-09-06 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25150 )

Change subject: gprs_ns2: improve reselection protection
..

gprs_ns2: improve reselection protection

Change-Id: I375a7639fb8e0f92fd67bb4176bd6219978aa428
---
M src/gb/gprs_ns2_sns.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 7a3729b..22ca7b2 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -2227,6 +2227,7 @@
gss->initial = NULL;
ns2_prim_status_ind(gss->nse, NULL, 0, 
GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS);
osmo_fsm_inst_state_chg(fi, GPRS_SNS_ST_UNCONFIGURED, 
0, 3);
+   gss->reselection_running = false;
return;
} else if (!gss->initial) {
gss->initial = llist_first_entry(&gss->sns_endpoints, 
struct sns_endpoint, list);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I375a7639fb8e0f92fd67bb4176bd6219978aa428
Gerrit-Change-Number: 25150
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2_sns: ensure the SNS fsm behave correct when no signalling NS...

2021-09-06 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25151 )

Change subject: gprs_ns2_sns: ensure the SNS fsm behave correct when no 
signalling NSVCs are present
..

gprs_ns2_sns: ensure the SNS fsm behave correct when no signalling NSVCs are 
present

When no remaining signalling NSVCs are available the SNS must be
restarted (BSS) or go into unconfigured state (SGSN).

Change-Id: I95e6bbb7a418d647a8426804879571597ae06ff8
---
M src/gb/gprs_ns2_sns.c
1 file changed, 19 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 22ca7b2..c1be0ab 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -201,6 +201,7 @@
if (reason)
LOGPFSMLSRC(fi, LOGL_ERROR, file, line, "NSE %d: SNS failed: 
%s\n", gss->nse->nsei, reason);

+   gss->alive = false;
if (gss->role == GPRS_SNS_ROLE_SGSN) {
if (!gss->nse->persistent)
gprs_ns2_free_nse(gss->nse);
@@ -2599,19 +2600,33 @@
if (gss->block_no_nsvc_events)
return;

-   if (alive == gss->alive)
+   if (gss->alive && nse->sum_sig_weight == 0) {
+   sns_failed(nse->bss_sns_fi, "No signalling NSVC available");
return;
+   }

/* check if this is the current SNS NS-VC */
-   if (nsvc == gss->sns_nsvc) {
+   if (nsvc == gss->sns_nsvc && !alive) {
/* only replace the SNS NS-VC if there are other alive NS-VC.
 * There aren't any other alive NS-VC when the SNS fsm just 
reached CONFIGURED
 * and couldn't confirm yet if the NS-VC comes up */
-   if (gss->alive && !alive)
-   ns2_sns_replace_nsvc(nsvc);
+   llist_for_each_entry(tmp, &nse->nsvc, list) {
+   if (nsvc == tmp)
+   continue;
+   if (ns2_vc_is_unblocked(nsvc)) {
+   ns2_sns_replace_nsvc(nsvc);
+   break;
+   }
+   }
}

+   if (alive == gss->alive)
+   return;
+
if (alive) {
+   /* we need at least a signalling NSVC before become alive */
+   if (nse->sum_sig_weight == 0)
+   return;
gss->alive = true;
osmo_fsm_inst_dispatch(nse->bss_sns_fi, 
NS2_SNS_EV_REQ_NSVC_ALIVE, NULL);
} else {

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I95e6bbb7a418d647a8426804879571597ae06ff8
Gerrit-Change-Number: 25151
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2: ensure the incoming NSVC is also the outgoing NSVC

2021-09-06 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25344 )

Change subject: gprs_ns2: ensure the incoming NSVC is also the outgoing NSVC
..

gprs_ns2: ensure the incoming NSVC is also the outgoing NSVC

Previous the SNS NSVC (the NSVC used for all SNS traffic) was never changed 
except
when the choosen NSVC went dead or got freed.
When receiving a SNS SIZE PDU over a different NSVC than the current SNS
NSVC the answer would be transmitted to a different port.

Change-Id: I36cd9488b8bca5cb99dae5cf50a55ee282e0557b
---
M src/gb/gprs_ns2_sns.c
1 file changed, 1 insertion(+), 2 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  daniel: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index c1be0ab..7619b66 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -2326,8 +2326,7 @@
/* FIXME: how to resolve SNS FSM Instance by NSEI (SGSN)? */
fi = nse->bss_sns_fi;
gss = (struct ns2_sns_state *) fi->priv;
-   if (!gss->sns_nsvc)
-   gss->sns_nsvc = nsvc;
+   gss->sns_nsvc = nsvc;

LOGPFSML(fi, LOGL_DEBUG, "NSEI=%u Rx SNS PDU type %s\n", nsei,
 get_value_string(gprs_ns_pdu_strings, nsh->pdu_type));

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I36cd9488b8bca5cb99dae5cf50a55ee282e0557b
Gerrit-Change-Number: 25344
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-MessageType: merged


Change in docker-playground[master]: ttcn3-ns-test: add second NSVC to allow SNS tests to work

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/docker-playground/+/25373 )


Change subject: ttcn3-ns-test: add second NSVC to allow SNS tests to work
..

ttcn3-ns-test: add second NSVC to allow SNS tests to work

The SNS tests need both NSVCs. The NS_Tests.sns.cfg from the
ttcn3 repository can be used as reference.

Change-Id: I92f2ca61af1e3d0427e6810eddab8f2d6299242d
---
M ttcn3-ns-test/sns/NS_Tests.cfg
M ttcn3-ns-test/sns/osmo-ns-dummy.cfg
2 files changed, 17 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground 
refs/changes/73/25373/1

diff --git a/ttcn3-ns-test/sns/NS_Tests.cfg b/ttcn3-ns-test/sns/NS_Tests.cfg
index bc3c870..680e67e 100644
--- a/ttcn3-ns-test/sns/NS_Tests.cfg
+++ b/ttcn3-ns-test/sns/NS_Tests.cfg
@@ -22,6 +22,18 @@
}
},
nsvci := 1234
+   },
+   {
+   provider := {
+   ip := {
+   address_family := AF_INET,
+   local_ip := "172.18.29.10",
+   local_udp_port := 22000,
+   remote_ip := "172.18.29.101",
+   remote_udp_port := 23001
+   }
+   },
+   nsvci := 1235
}
}
 }
diff --git a/ttcn3-ns-test/sns/osmo-ns-dummy.cfg 
b/ttcn3-ns-test/sns/osmo-ns-dummy.cfg
index 985aff3..64ce4b1 100644
--- a/ttcn3-ns-test/sns/osmo-ns-dummy.cfg
+++ b/ttcn3-ns-test/sns/osmo-ns-dummy.cfg
@@ -89,8 +89,12 @@
  timer tsns-config-retries 3
  bind udp local
   listen 172.18.29.101 23000
-  accept-ipaccess
   ip-sns signalling-weight 2 data-weight 2
+  accept-ipaccess
+ bind udp local2
+  listen 172.18.29.101 23001
+  ip-sns signalling-weight 1 data-weight 1
+  accept-ipaccess
  nse 1234
   ip-sns-remote 172.18.29.10 22000
   ip-sns-bind local

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/25373
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I92f2ca61af1e3d0427e6810eddab8f2d6299242d
Gerrit-Change-Number: 25373
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in docker-playground[master]: ttcn3-ns-test-sgsn-sns: add test run for ns sgsn role with sns

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/docker-playground/+/25374 )


Change subject: ttcn3-ns-test-sgsn-sns: add test run for ns sgsn role with sns
..

ttcn3-ns-test-sgsn-sns: add test run for ns sgsn role with sns

Change-Id: I1a9205885d381c04141dad752de0b39d9268ab69
---
A ttcn3-ns-test-sgsn-sns/jenkins.sh
A ttcn3-ns-test-sgsn-sns/sgsn-sns
A ttcn3-ns-test/jenkins-sgsn-sns.sh
A ttcn3-ns-test/sgsn-sns/NS_Tests.cfg
A ttcn3-ns-test/sgsn-sns/osmo-ns-dummy.cfg
5 files changed, 187 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground 
refs/changes/74/25374/1

diff --git a/ttcn3-ns-test-sgsn-sns/jenkins.sh 
b/ttcn3-ns-test-sgsn-sns/jenkins.sh
new file mode 12
index 000..b4143ac
--- /dev/null
+++ b/ttcn3-ns-test-sgsn-sns/jenkins.sh
@@ -0,0 +1 @@
+../ttcn3-ns-test/jenkins-sgsn-sns.sh
\ No newline at end of file
diff --git a/ttcn3-ns-test-sgsn-sns/sgsn-sns b/ttcn3-ns-test-sgsn-sns/sgsn-sns
new file mode 12
index 000..761f95d
--- /dev/null
+++ b/ttcn3-ns-test-sgsn-sns/sgsn-sns
@@ -0,0 +1 @@
+../ttcn3-ns-test/sgsn-sns/
\ No newline at end of file
diff --git a/ttcn3-ns-test/jenkins-sgsn-sns.sh 
b/ttcn3-ns-test/jenkins-sgsn-sns.sh
new file mode 100755
index 000..4460380
--- /dev/null
+++ b/ttcn3-ns-test/jenkins-sgsn-sns.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+. ../jenkins-common.sh
+IMAGE_SUFFIX="${IMAGE_SUFFIX:-master}"
+docker_images_require \
+   "osmo-ns-$IMAGE_SUFFIX" \
+   "ttcn3-ns-test"
+
+set_clean_up_trap
+set -e
+
+SUBNET=32
+network_create $SUBNET
+
+mkdir $VOL_BASE_DIR/ns-tester
+cp sgsn-sns/NS_Tests.cfg $VOL_BASE_DIR/ns-tester/
+
+mkdir $VOL_BASE_DIR/ns
+cp sgsn-sns/osmo-ns-dummy.cfg $VOL_BASE_DIR/ns/
+
+echo Starting container with osmo-ns-dummy
+docker run --rm \
+   $(docker_network_params $SUBNET 101) \
+   --ulimit core=-1 \
+   -v $VOL_BASE_DIR/ns:/data \
+   --name ${BUILD_TAG}-ns-sgsn-sns -d \
+   $DOCKER_ARGS \
+   $REPO_USER/osmo-ns-$IMAGE_SUFFIX \
+   /bin/sh -c "/usr/local/bin/osmo-ns-dummy -c 
/data/osmo-ns-dummy.cfg -p 4240 >>/data/osmo-ns-dummy.log 2>&1"
+
+echo Starting container with NS testsuite
+docker run --rm \
+   $(docker_network_params $SUBNET 10) \
+   --ulimit core=-1 \
+   -e "TTCN3_PCAP_PATH=/data" \
+   -v $VOL_BASE_DIR/ns-tester:/data \
+   --name ${BUILD_TAG}-ttcn3-ns-test-sgsn-sns \
+   $DOCKER_ARGS \
+   $REPO_USER/ttcn3-ns-test
diff --git a/ttcn3-ns-test/sgsn-sns/NS_Tests.cfg 
b/ttcn3-ns-test/sgsn-sns/NS_Tests.cfg
new file mode 100644
index 000..d84f43c
--- /dev/null
+++ b/ttcn3-ns-test/sgsn-sns/NS_Tests.cfg
@@ -0,0 +1,46 @@
+[ORDERED_INCLUDE]
+"/osmo-ttcn3-hacks/Common.cfg"
+"/osmo-ttcn3-hacks/ns/NS_Tests.default"
+
+[LOGGING]
+
+[TESTPORT_PARAMETERS]
+*.NSVTY.CTRL_HOSTNAME := "172.18.32.101"
+
+[MODULE_PARAMETERS]
+NS_Tests.mp_nsconfig := {
+   nsei := 1234,
+   nsvc := {
+   {
+   provider := {
+   ip := {
+   address_family := AF_INET,
+   local_ip := "172.18.32.10",
+   local_udp_port := 22000,
+   remote_ip := "172.18.32.101",
+   remote_udp_port := 23000
+   }
+   },
+   nsvci := 1234
+   },
+   {
+   provider := {
+   ip := {
+   address_family := AF_INET,
+   local_ip := "172.18.32.10",
+   local_udp_port := 22000,
+   remote_ip := "172.18.32.101",
+   remote_udp_port := 23001
+   }
+   },
+   nsvci := 1235
+   }
+   }
+}
+NS_Tests.mp_dialect := NS2_DIALECT_SNS
+NS_Tests.mp_sns_role := SNS_ROLE_SGSN
+
+[MAIN_CONTROLLER]
+
+[EXECUTE]
+NS_Tests.control
diff --git a/ttcn3-ns-test/sgsn-sns/osmo-ns-dummy.cfg 
b/ttcn3-ns-test/sgsn-sns/osmo-ns-dummy.cfg
new file mode 100644
index 000..d1c6bef
--- /dev/null
+++ b/ttcn3-ns-test/sgsn-sns/osmo-ns-dummy.cfg
@@ -0,0 +1,100 @@
+!
+! OsmoNSdummy (1.4.0.326-f57c-dirty) configuration saved from vty
+!!
+!
+log stderr
+ logging filter all 1
+ logging color 0
+ logging print category-hex 0
+ logging print category 1
+ logging print extended-timestamp 1
+ logging print level 1
+ logging print file basename
+ l

Change in osmo-ttcn3-hacks[master]: ns: add test case for SIZE after a successful configuration

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25382 )


Change subject: ns: add test case for SIZE after a successful configuration
..

ns: add test case for SIZE after a successful configuration

Change-Id: I5a7d55e9b3d28872baa4259f3db8c0d6081d
---
M ns/NS_Tests.ttcn
1 file changed, 17 insertions(+), 0 deletions(-)



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

diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index c3247fc..3d7b31a 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -827,6 +827,22 @@
f_clean_ns_codec();
 }

+/* Ensure a SIZE after a success full configuration is handled */
+testcase TC_sns_sgsn_size_after_success() runs on RAW_Test_CT {
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_outgoing_sns_size();
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   NSCP[0].receive(t_NS_ALIVE);
+
+   f_outgoing_sns_size();
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
 /* Ensure a SNS SIZE ACK is transmitted from the correct port */
 testcase TC_sns_sgsn_size_correct_port() runs on RAW_Test_CT {
f_init_vty();
@@ -1014,6 +1030,7 @@
execute( TC_sns_sgsn_del() );
execute( TC_sns_sgsn_add_change_del() );
execute( TC_sns_sgsn_size_correct_port() );
+   execute( TC_sns_sgsn_size_after_success() );
}
}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25382
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5a7d55e9b3d28872baa4259f3db8c0d6081d
Gerrit-Change-Number: 25382
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: ns2: nsvc: reject UNITDATA when the remote BLOCK'ed

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25383 )


Change subject: ns2: nsvc: reject UNITDATA  when the remote BLOCK'ed
..

ns2: nsvc: reject UNITDATA  when the remote BLOCK'ed

When the remote initiated the BLOCK the nsvc would still accept UNITDATA
over this nsvc.

Change-Id: I3ed4aa105a84e448082d3028fe844aae7720426b
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 1 insertion(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/83/25383/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index c8c9ae9..aafd4cd 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -440,6 +440,7 @@
break;
case GPRS_NS2_EV_RX_BLOCK:
priv->initiate_block = false;
+   priv->accept_unitdata = false;
ns2_tx_block_ack(priv->nsvc);
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED,
0, 2);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3ed4aa105a84e448082d3028fe844aae7720426b
Gerrit-Change-Number: 25383
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: ns2: fix a crash when receiving a SIZE while configured

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25384 )


Change subject: ns2: fix a crash when receiving a SIZE while configured
..

ns2: fix a crash when receiving a SIZE while configured

The ns2_vc_force_unconfigured() needs to be protected otherwise it would free
gss->nsvc which will be used later. It further would run into another
SNS failure which is wrong too.

Change-Id: If14b9e3fcd5d139457b10d06517302168091d8d8
---
M src/gb/gprs_ns2_sns.c
1 file changed, 2 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/84/25384/1

diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 7619b66..0afc06e 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -3021,7 +3021,9 @@
/* keep the NSVC we need for SNS, but unconfigure it */
gss->sns_nsvc->sig_weight = 0;
gss->sns_nsvc->data_weight = 0;
+   gss->block_no_nsvc_events = true;
ns2_vc_force_unconfigured(gss->sns_nsvc);
+   gss->block_no_nsvc_events = false;
ns2_sns_compute_local_ep_from_binds(fi);
}


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If14b9e3fcd5d139457b10d06517302168091d8d8
Gerrit-Change-Number: 25384
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: ns2: add tc TC_mirror_unitdata_tx_status_blocked

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25389 )


Change subject: ns2: add tc TC_mirror_unitdata_tx_status_blocked
..

ns2: add tc TC_mirror_unitdata_tx_status_blocked

Change-Id: I9be2037b9228d2400bd293841ae6b957cb25c501
---
M ns/NS_Tests.ttcn
1 file changed, 29 insertions(+), 0 deletions(-)



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

diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 3d7b31a..b57d686 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -964,6 +964,34 @@
f_clean_ns_codec();
 }

+/* 48.016 7.2 ensure tx status (blocked) is correctly parsed
+ *
+ * TTCN  -> NS: reset
+ * TTCN <-  NS: reset ack
+ * TTCN  -> NS: unblock
+ * TTCN <-  NS: unblock ack
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: unitdata (mirror)
+ * TTCN  -> NS: status (blocked)
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: status (blocked)
+ */
+testcase TC_mirror_unitdata_tx_status_blocked() runs on RAW_Test_CT {
+   f_tx_unblock();
+
+   f_vty_config2(NSVTY, {}, "mirror-mode enable");
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   var PDU_NS pdu := f_ns_exp(tr_NS_UNITDATA(t_SduCtrlB, 42, 
'0011234242230101'O));
+
+   NSCP[0].send(ts_NS_STATUS(NS_CAUSE_NSVC_BLOCKED, pdu));
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED));
+
+   f_vty_config2(NSVTY, {}, "mirror-mode disable");
+   f_sleep(1.0);
+   f_clean_ns_codec();
+}
+
 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
execute( TC_tx_reset() );
@@ -974,6 +1002,7 @@
execute( TC_tx_block_by_vty_reset() );
execute( TC_tx_block_unitdata_over_blocked() );
execute( TC_rx_block_unitdata_over_blocked() );
+   execute( TC_mirror_unitdata_tx_status_blocked() );
// execute( TC_block_other_nsvc() ); // reset, unblock, 
sleep(1), block over another nsvci
/* 48.016 7.2 Unblock procedure */
execute( TC_tx_unblock() );

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25389
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9be2037b9228d2400bd293841ae6b957cb25c501
Gerrit-Change-Number: 25389
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: gprs_ns2: fix NS STATUS validation

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25390 )


Change subject: gprs_ns2: fix NS STATUS validation
..

gprs_ns2: fix NS STATUS validation

The wrong TLVs were used.

Change-Id: I01339d93469285cc5340500717ab2b696284e12a
---
M src/gb/gprs_ns2_message.c
1 file changed, 3 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/90/25390/1

diff --git a/src/gb/gprs_ns2_message.c b/src/gb/gprs_ns2_message.c
index dccf51d..5e3e025 100644
--- a/src/gb/gprs_ns2_message.c
+++ b/src/gb/gprs_ns2_message.c
@@ -95,12 +95,11 @@
return -1;
}

-   uint8_t _cause = tlvp_val8(tp, NS_IE_VCI, 0);
-
+   uint8_t _cause = tlvp_val8(tp, NS_IE_CAUSE, 0);
switch (_cause) {
case NS_CAUSE_NSVC_BLOCKED:
case NS_CAUSE_NSVC_UNKNOWN:
-   if (!TLVP_PRES_LEN(tp, NS_IE_CAUSE, 1)) {
+   if (!TLVP_PRES_LEN(tp, NS_IE_VCI, 1)) {
*cause = NS_CAUSE_MISSING_ESSENT_IE;
return -1;
}
@@ -110,7 +109,7 @@
case NS_CAUSE_PROTO_ERR_UNSPEC:
case NS_CAUSE_INVAL_ESSENT_IE:
case NS_CAUSE_MISSING_ESSENT_IE:
-   if (!TLVP_PRES_LEN(tp, NS_IE_CAUSE, 1)) {
+   if (!TLVP_PRES_LEN(tp, NS_IE_PDU, 1)) {
*cause = NS_CAUSE_MISSING_ESSENT_IE;
return -1;
}

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I01339d93469285cc5340500717ab2b696284e12a
Gerrit-Change-Number: 25390
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: gprs_ns2: fix a white space

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25391 )


Change subject: gprs_ns2: fix a white space
..

gprs_ns2: fix a white space

Change-Id: I2207d13ae451ce49482625fac43b6ab1c0f215e8
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/91/25391/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index aafd4cd..aa4f31d 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -855,7 +855,7 @@
}
}

-   if (nsvc->nsvci_is_valid && TLVP_PRESENT(tp,  NS_IE_VCI)) {
+   if (nsvc->nsvci_is_valid && TLVP_PRESENT(tp, NS_IE_VCI)) {
nsvci = tlvp_val16be(tp, NS_IE_VCI);
if (nsvci != nsvc->nsvci) {
/* 48.016 § 7.3.1 send RESET_ACK to wrong NSVCI + 
ignore */

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2207d13ae451ce49482625fac43b6ab1c0f215e8
Gerrit-Change-Number: 25391
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC UNKNOWN/NSV...

2021-09-06 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25392 )


Change subject: gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC 
UNKNOWN/NSVC BLOCKED
..

gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC UNKNOWN/NSVC BLOCKED

A STATUS PDU with cause code NSVC UNKNOWN/NSVC BLOCKED informs the other
side about a state mismatch between the side.

Change-Id: Ib6a2424f3027a30f14ef0a9fc2230e6aae9a2a04
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 27 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/92/25392/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index aa4f31d..fa8cec2 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -618,7 +618,9 @@
 {
struct gprs_ns2_vc_priv *priv = fi->priv;
struct gprs_ns2_inst *nsi = ns_inst_from_fi(fi);
+   struct tlv_parsed *tp;
struct msgb *msg = data;
+   uint8_t cause;

switch (event) {
case GPRS_NS2_EV_REQ_OM_RESET:
@@ -709,6 +711,27 @@
if (fi->state == GPRS_NS2_ST_BLOCKED)
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED, 
nsi->timeout[NS_TOUT_TNS_BLOCK], 0);
break;
+   case GPRS_NS2_EV_RX_STATUS:
+   tp = data;
+   cause = tlvp_val8(tp, NS_IE_CAUSE, 0);
+   switch (cause) {
+   case NS_CAUSE_NSVC_BLOCKED:
+   if (fi->state != GPRS_NS2_ST_BLOCKED) {
+   LOG_NS_SIGNAL(priv->nsvc, "Rx", NS_PDUT_STATUS, 
LOGL_ERROR, ": remote side reported blocked state.\n");
+   priv->initiate_block = false;
+   priv->accept_unitdata = false;
+   osmo_fsm_inst_state_chg(fi, 
GPRS_NS2_ST_BLOCKED, nsi->timeout[NS_TOUT_TNS_BLOCK], 0);
+   }
+   break;
+   case NS_CAUSE_NSVC_UNKNOWN:
+   if (fi->state != GPRS_NS2_ST_RESET && fi->state != 
GPRS_NS2_ST_UNCONFIGURED) {
+   LOG_NS_SIGNAL(priv->nsvc, "Rx", NS_PDUT_STATUS, 
LOGL_ERROR, ": remote side reported unknown nsvc.\n");
+   osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, 
nsi->timeout[NS_TOUT_TNS_RESET], 0);
+   }
+   break;
+   }
+
+   break;
}
 }

@@ -728,6 +751,7 @@
   S(GPRS_NS2_EV_RX_RESET) |
   S(GPRS_NS2_EV_RX_ALIVE) |
   S(GPRS_NS2_EV_RX_ALIVE_ACK) |
+  S(GPRS_NS2_EV_RX_STATUS) |
   S(GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED) |
   S(GPRS_NS2_EV_REQ_OM_RESET) |
   S(GPRS_NS2_EV_REQ_OM_BLOCK) |
@@ -896,6 +920,9 @@
/* UNITDATA have to free msg because it might send the msg 
layer upwards */
osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_UNITDATA, msg);
return 0;
+   case NS_PDUT_STATUS:
+   osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_STATUS, tp);
+   break;
default:
LOGPFSML(fi, LOGL_ERROR, "NSEI=%u Rx unknown NS PDU type %s\n", 
nsvc->nse->nsei,
 get_value_string(gprs_ns_pdu_strings, nsh->pdu_type));

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib6a2424f3027a30f14ef0a9fc2230e6aae9a2a04
Gerrit-Change-Number: 25392
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: ns: f_init_vty: only reset SNS configuration when using SNS.

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25342 )

Change subject: ns: f_init_vty: only reset SNS configuration when using SNS.
..


Patch Set 2: Code-Review+2

1 + 1 = 2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25342
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9ecf0abe29e5acdd18f4b18b340baeb442cc09b6
Gerrit-Change-Number: 25342
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:38:06 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is transmi...

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25351 )

Change subject: ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is 
transmitted from the correct port
..


Patch Set 1:

1 + 1 = 2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25351
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib0fbf0cc87ff8f00fd4062b471d7a4835b45723c
Gerrit-Change-Number: 25351
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:38:14 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is transmi...

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25351 )

Change subject: ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is 
transmitted from the correct port
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25351
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib0fbf0cc87ff8f00fd4062b471d7a4835b45723c
Gerrit-Change-Number: 25351
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:38:18 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: add tests to test UNITDATA over a BLOCKED nsvcs

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25352 )

Change subject: ns: add tests to test UNITDATA over a BLOCKED nsvcs
..


Patch Set 1: Code-Review+2

1 + 1 = 2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25352
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I62ce93ca4953f8b0476a15479089db2f6c2fa684
Gerrit-Change-Number: 25352
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:38:24 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: always clean up the ns_codec

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25353 )

Change subject: ns: always clean up the ns_codec
..


Patch Set 1: Code-Review+2

1 + 1 = 2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25353
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7a84f75ebd1c68b3c0a6b55b8c49903c51dd6b92
Gerrit-Change-Number: 25353
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:38:29 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: add test case for UNITDATA transmission

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25355 )

Change subject: ns: add test case for UNITDATA transmission
..


Patch Set 1: Code-Review+2

1 + 1 = 2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5f59581d4257436eb9651c0c5ab5dd002f23d834
Gerrit-Change-Number: 25355
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:38:35 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: add test case for SIZE after a successful configuration

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25382 )

Change subject: ns: add test case for SIZE after a successful configuration
..


Patch Set 1: Code-Review+2

1 + 1 = 2


-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25382
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5a7d55e9b3d28872baa4259f3db8c0d6081d
Gerrit-Change-Number: 25382
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:38:40 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns2: add tc TC_mirror_unitdata_tx_status_blocked

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25389 )

Change subject: ns2: add tc TC_mirror_unitdata_tx_status_blocked
..


Patch Set 1: Code-Review+2

1 + 1 = 2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25389
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9be2037b9228d2400bd293841ae6b957cb25c501
Gerrit-Change-Number: 25389
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:38:44 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: add TC_sns_bss_remove_bind_fail_sns to check SNS fails correct wh...

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25341 )

Change subject: ns: add TC_sns_bss_remove_bind_fail_sns to check SNS fails 
correct when removing a bind
..


Patch Set 2: Code-Review+2

(1 comment)

1 + 1 = 2

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25341/2/ns/NS_Tests.ttcn
File ns/NS_Tests.ttcn:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25341/2/ns/NS_Tests.ttcn@715 
PS2, Line 715: /* 2nd bind won't have a valid connection to the ttcn3 */
> the other test cases you've added in the patchset are easy to read. […]
If ttcn3 doesn't answer to NS_ALIVE, the second NSVC will become broken.



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25341
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8f7daee7a3bcadf64e8ae607619425adbefe3c4b
Gerrit-Change-Number: 25341
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:42:43 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: osmith 
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: f_init_vty: only reset SNS configuration when using SNS.

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25342 )

Change subject: ns: f_init_vty: only reset SNS configuration when using SNS.
..

ns: f_init_vty: only reset SNS configuration when using SNS.

Change-Id: I9ecf0abe29e5acdd18f4b18b340baeb442cc09b6
---
M ns/NS_Tests.ttcn
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 51a30ab..a19477d 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -78,10 +78,12 @@
f_vty_set_prompts(NSVTY);
f_vty_transceive(NSVTY, "enable");
f_vty_transceive(NSVTY, "nsvc nsei " & int2str(mp_nsconfig.nsei) & " 
force-unconfigured");
-   f_vty_config2(NSVTY, {"ns", "nse " & int2str(mp_nsconfig.nsei)}, 
"ip-sns-bind local");
-   f_vty_config2(NSVTY, {"ns", "nse " & int2str(mp_nsconfig.nsei)}, "no 
ip-sns-bind local2");
-   f_vty_config2(NSVTY, {"ns", "bind udp local"}, "ip-sns 
signalling-weight 1 data-weight 1");
-   f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns 
signalling-weight 1 data-weight 1");
+   if (mp_dialect == NS2_DIALECT_SNS) {
+   f_vty_config2(NSVTY, {"ns", "nse " & 
int2str(mp_nsconfig.nsei)}, "ip-sns-bind local");
+   f_vty_config2(NSVTY, {"ns", "nse " & 
int2str(mp_nsconfig.nsei)}, "no ip-sns-bind local2");
+   f_vty_config2(NSVTY, {"ns", "bind udp local"}, "ip-sns 
signalling-weight 1 data-weight 1");
+   f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns 
signalling-weight 1 data-weight 1");
+   }
 }

 /* ensure no matching message is received within 'tout' */

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25342
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9ecf0abe29e5acdd18f4b18b340baeb442cc09b6
Gerrit-Change-Number: 25342
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is transmi...

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25351 )

Change subject: ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is 
transmitted from the correct port
..

ns: add TC_sns_sgsn_size_correct_port to check if SIZE_ACK is transmitted from 
the correct port

Change-Id: Ib0fbf0cc87ff8f00fd4062b471d7a4835b45723c
---
M ns/NS_Tests.ttcn
1 file changed, 15 insertions(+), 0 deletions(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index a19477d..8553684 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -752,6 +752,20 @@
f_clean_ns_codec();
 }

+/* Ensure a SNS SIZE ACK is transmitted from the correct port */
+testcase TC_sns_sgsn_size_correct_port() runs on RAW_Test_CT {
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_init_ns_codec(mp_nsconfig, 1);
+   f_outgoing_sns_size(max_nsvcs := 10);
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   NSCP[0].receive(t_NS_ALIVE);
+   f_outgoing_sns_size(max_nsvcs := 10, idx := 1);
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
 testcase TC_sns_sgsn_add() runs on RAW_Test_CT {
g_handle_rx_alive := true;
f_init_vty();
@@ -900,6 +914,7 @@
execute( TC_sns_sgsn_add() );
execute( TC_sns_sgsn_del() );
execute( TC_sns_sgsn_add_change_del() );
+   execute( TC_sns_sgsn_size_correct_port() );
}
}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25351
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib0fbf0cc87ff8f00fd4062b471d7a4835b45723c
Gerrit-Change-Number: 25351
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns: add tests to test UNITDATA over a BLOCKED nsvcs

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25352 )

Change subject: ns: add tests to test UNITDATA over a BLOCKED nsvcs
..

ns: add tests to test UNITDATA over a BLOCKED nsvcs

The UNITDATA should be rejected by a NS STATUS PDU.

Change-Id: I62ce93ca4953f8b0476a15479089db2f6c2fa684
---
M ns/NS_Tests.ttcn
1 file changed, 55 insertions(+), 2 deletions(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 8553684..105d397 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -162,6 +162,52 @@
f_sleep(1.0);
 }

+/* 48.016 7.2.1 transmit a UNIT DATA over a BLOCKED NSVC when ttcn3 blocked it
+ *
+ * TTCN  -> NS: reset
+ * TTCN <-  NS: reset ack
+ * TTCN  -> NS: unblock
+ * TTCN <-  NS: unblock ack
+ * TTCN  -> NS: block
+ * TTCN <-  NS: block ack
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: status (cause blocked)
+ */
+testcase TC_tx_block_unitdata_over_blocked() runs on RAW_Test_CT {
+   f_tx_block();
+   f_sleep(1.0);
+
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED));
+
+   setverdict(pass);
+   f_sleep(1.0);
+   f_clean_ns_codec();
+}
+
+/* 48.016 7.2.1 transmit a UNIT DATA over a BLOCKED NSVC when ns2 blocked it
+ *
+ * TTCN  -> NS: reset
+ * TTCN <-  NS: reset ack
+ * TTCN  -> NS: unblock
+ * TTCN <-  NS: unblock ack
+ * TTCN <-  NS: block
+ * TTCN  -> NS: block ack
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: status (cause blocked)
+ */
+testcase TC_rx_block_unitdata_over_blocked() runs on RAW_Test_CT {
+   tx_block_by_vty();
+   f_sleep(1.0);
+
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED));
+
+   setverdict(pass);
+   f_sleep(1.0);
+   f_clean_ns_codec();
+}
+
 /* 48.016 7.2 unblock procedure
  *
  * TTCN  -> NS: reset
@@ -219,9 +265,9 @@
  * TTCN  -> NS: block
  * TTCN <-  NS: block ack
  */
-testcase TC_tx_block() runs on RAW_Test_CT {
+function f_tx_block(float guard_secs := 30.0) runs on RAW_Test_CT {
f_init_vty();
-   f_init_ns_codec(mp_nsconfig, guard_secs := 30.0);
+   f_init_ns_codec(mp_nsconfig, guard_secs := guard_secs);

/* do a NS Reset procedure */
f_outgoing_ns_reset();
@@ -235,6 +281,11 @@
f_sleep(1.0);
 }

+testcase TC_tx_block() runs on RAW_Test_CT {
+   f_tx_block()
+   f_clean_ns_codec();
+}
+
 /* 48.016 7.2 block procedure by vty
  *
  * TTCN  -> NS: reset
@@ -860,6 +911,8 @@
execute( TC_tx_block() );
execute( TC_tx_block_by_vty() );
execute( TC_tx_block_by_vty_reset() );
+   execute( TC_tx_block_unitdata_over_blocked() );
+   execute( TC_rx_block_unitdata_over_blocked() );
// execute( TC_block_other_nsvc() ); // reset, unblock, 
sleep(1), block over another nsvci
/* 48.016 7.2 Unblock procedure */
execute( TC_tx_unblock() );

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25352
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I62ce93ca4953f8b0476a15479089db2f6c2fa684
Gerrit-Change-Number: 25352
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns: always clean up the ns_codec

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25353 )

Change subject: ns: always clean up the ns_codec
..

ns: always clean up the ns_codec

The f_clean_ns_codec() was introduced later to clean up the ns_codec
properly.

Change-Id: I7a84f75ebd1c68b3c0a6b55b8c49903c51dd6b92
---
M ns/NS_Tests.ttcn
1 file changed, 19 insertions(+), 0 deletions(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 105d397..8b321ff 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -131,6 +131,7 @@

setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 testcase TC_tx_reset_tx_alive() runs on RAW_Test_CT {
@@ -145,6 +146,7 @@

setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 testcase TC_tx_reset_rx_alive() runs on RAW_Test_CT {
@@ -160,6 +162,7 @@

setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.2.1 transmit a UNIT DATA over a BLOCKED NSVC when ttcn3 blocked it
@@ -227,6 +230,7 @@
f_outgoing_ns_unblock();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.2 tx unblock retries
@@ -254,6 +258,7 @@
f_outgoing_ns_unblock();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.2 block procedure
@@ -318,6 +323,7 @@
 testcase TC_tx_block_by_vty() runs on RAW_Test_CT {
tx_block_by_vty(30.0);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.2 block precedure by vty and reset the NSVC.
@@ -336,6 +342,7 @@
[] T.timeout { setverdict(pass); }
}
deactivate(d);
+   f_clean_ns_codec();
 }

 /* 48.016 7.4.1 ignore unexpected NS_ALIVE ACK */
@@ -347,6 +354,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET with wrong nsei */
@@ -359,6 +367,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET with wrong nsvci */
@@ -371,6 +380,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET with wrong nsvci + nsei */
@@ -383,6 +393,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET_ACK with wrong nsei */
@@ -395,6 +406,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET_ACK with wrong nsvci */
@@ -407,6 +419,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 NS_RESET_ACK with wrong nsvci + nsei */
@@ -419,6 +432,7 @@
f_fails_except_reset();
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3.1 ignore unexpected NS_RESET_ACK after NS_RESET+ALIVE */
@@ -439,6 +453,7 @@
f_ensure_no_ns(answer_alive := true, tout := 15.0);
setverdict(pass);
f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.3 NS_RESET retries */
@@ -460,6 +475,7 @@
}

f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 behave RESET_ACK got dropped
@@ -493,6 +509,7 @@
}

f_sleep(1.0);
+   f_clean_ns_codec();
 }

 /* 48.016 7.4 test procedure for frame relay with a single nsvci */
@@ -526,10 +543,12 @@

 testcase TC_alive_retries_single_reset() runs on RAW_Test_CT {
f_alive_retries_single(reset := true);
+   f_clean_ns_codec();
 }

 testcase TC_alive_retries_single_no_resp() runs on RAW_Test_CT {
f_alive_retries_single(reset := false);
+   f_clean_ns_codec();
 }

 /* 48.016 SNS test cases */

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25353
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7a84f75ebd1c68b3c0a6b55b8c49903c51dd6b92
Gerrit-Change-Number: 25353
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns: add TC_sns_bss_remove_bind_fail_sns to check SNS fails correct wh...

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25341 )

Change subject: ns: add TC_sns_bss_remove_bind_fail_sns to check SNS fails 
correct when removing a bind
..

ns: add TC_sns_bss_remove_bind_fail_sns to check SNS fails correct when 
removing a bind

This TC produces an abort of the ns2 dummy by the memory sanitizer.
Test if SNS fails when removing a bind which has the last valid connection.
The ns2 has 2 binds, ttcn3 1 bind. There are 2 NSVCs.

Bind -- NSVCs -- Bind.

(ns2)  (ttcn3)
1*---*1
/
2*-broken--/

Remove the 1st ns2 bind after the other NSVC has failed.

Change-Id: I8f7daee7a3bcadf64e8ae607619425adbefe3c4b
---
M ns/NS_Tests.ttcn
1 file changed, 39 insertions(+), 0 deletions(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index c08f877..51a30ab 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -78,6 +78,7 @@
f_vty_set_prompts(NSVTY);
f_vty_transceive(NSVTY, "enable");
f_vty_transceive(NSVTY, "nsvc nsei " & int2str(mp_nsconfig.nsei) & " 
force-unconfigured");
+   f_vty_config2(NSVTY, {"ns", "nse " & int2str(mp_nsconfig.nsei)}, 
"ip-sns-bind local");
f_vty_config2(NSVTY, {"ns", "nse " & int2str(mp_nsconfig.nsei)}, "no 
ip-sns-bind local2");
f_vty_config2(NSVTY, {"ns", "bind udp local"}, "ip-sns 
signalling-weight 1 data-weight 1");
f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns 
signalling-weight 1 data-weight 1");
@@ -686,6 +687,43 @@
f_clean_ns_codec();
 }

+/* Test if SNS fails when removing a bind which has the last valid connection
+ *
+ * ns2 has 2 binds, ttcn3 1 bind.
+ *
+ * nsvcs:
+ * ns2  ttcn3
+ * 1*---*1
+ * /
+ * 2*-broken--/
+ *
+ * remove the 1st ns2 bind.
+ */
+testcase TC_sns_bss_remove_bind_fail_sns() runs on RAW_Test_CT {
+   g_handle_rx_alive := true;
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_init_ns_codec(mp_nsconfig, 1);
+   f_incoming_sns_size();
+   f_incoming_sns_config();
+   f_outgoing_sns_config();
+   var default d := activate(as_rx_alive_tx_ack());
+
+   f_vty_config2(NSVTY, {"ns", "bind udp local2"}, "ip-sns 
signalling-weight 1 data-weight 1");
+   f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, 
"ip-sns-bind local2");
+   f_incoming_sns_add(idx_add := 1, w_sig := 1, w_user := 1);
+   /* 2nd bind won't have a valid connection to the ttcn3 */
+   NSCP[1].receive(t_NS_ALIVE);
+   NSCP[1].receive(t_NS_ALIVE);
+   NSCP[1].receive(t_NS_ALIVE);
+   NSCP[1].receive(t_NS_ALIVE);
+   NSCP[1].receive(t_NS_ALIVE);
+   f_sleep(1.0);
+   f_vty_config2(NSVTY, {"ns", "nse " & int2str(g_nsconfig.nsei)}, "no 
ip-sns-bind local");
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
 testcase TC_idle() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig, guard_secs := 30.0);
@@ -852,6 +890,7 @@
execute( TC_sns_bss_add_change_del() );
/* execute( TC_sns_bss_all_signalling_nsvcs_failed() ); 
*/
execute( TC_sns_rx_size_force_unconf() );
+   execute( TC_sns_bss_remove_bind_fail_sns() );
}

if (mp_sns_role == SNS_ROLE_SGSN) {

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25341
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I8f7daee7a3bcadf64e8ae607619425adbefe3c4b
Gerrit-Change-Number: 25341
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns: fix missing f_ prefix for function f_tx_block_by_vty

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25354 )

Change subject: ns: fix missing f_ prefix for function f_tx_block_by_vty
..

ns: fix missing f_ prefix for function f_tx_block_by_vty

All function should have this prefix

Change-Id: Id7b692b3b76946b36dcaa3d23b32b5ccb5007702
---
M ns/NS_Tests.ttcn
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  osmith: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 8b321ff..58aeacd 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -200,7 +200,7 @@
  * TTCN <-  NS: status (cause blocked)
  */
 testcase TC_rx_block_unitdata_over_blocked() runs on RAW_Test_CT {
-   tx_block_by_vty();
+   f_tx_block_by_vty();
f_sleep(1.0);

NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
@@ -301,7 +301,7 @@
  * TTCN <-  NS: block
  * TTCN  -> NS: block ack
  */
-function tx_block_by_vty(float guard_secs := 30.0) runs on RAW_Test_CT {
+function f_tx_block_by_vty(float guard_secs := 30.0) runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig, guard_secs := guard_secs);

@@ -321,7 +321,7 @@
 }

 testcase TC_tx_block_by_vty() runs on RAW_Test_CT {
-   tx_block_by_vty(30.0);
+   f_tx_block_by_vty(30.0);
f_sleep(1.0);
f_clean_ns_codec();
 }
@@ -332,7 +332,7 @@
 testcase TC_tx_block_by_vty_reset() runs on RAW_Test_CT {
timer T := 10.0;

-   tx_block_by_vty(60.0);
+   f_tx_block_by_vty(60.0);
f_outgoing_ns_reset();

var default d := activate(ax_rx_fail_on_any_ns());

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25354
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Id7b692b3b76946b36dcaa3d23b32b5ccb5007702
Gerrit-Change-Number: 25354
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns: add test case for UNITDATA transmission

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25355 )

Change subject: ns: add test case for UNITDATA transmission
..

ns: add test case for UNITDATA transmission

Change-Id: I5f59581d4257436eb9651c0c5ab5dd002f23d834
---
M ns/NS_Tests.ttcn
1 file changed, 28 insertions(+), 1 deletion(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 58aeacd..c3247fc 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -77,6 +77,7 @@
map(self:NSVTY, system:NSVTY);
f_vty_set_prompts(NSVTY);
f_vty_transceive(NSVTY, "enable");
+   f_vty_config2(NSVTY, {}, "mirror-mode disable");
f_vty_transceive(NSVTY, "nsvc nsei " & int2str(mp_nsconfig.nsei) & " 
force-unconfigured");
if (mp_dialect == NS2_DIALECT_SNS) {
f_vty_config2(NSVTY, {"ns", "nse " & 
int2str(mp_nsconfig.nsei)}, "ip-sns-bind local");
@@ -218,7 +219,7 @@
  * TTCN  -> NS: unblock
  * TTCN <-  NS: unblock ack
  */
-testcase TC_tx_unblock() runs on RAW_Test_CT {
+function f_tx_unblock() runs on RAW_Test_CT {
f_init_vty();
f_init_ns_codec(mp_nsconfig, guard_secs := 30.0);

@@ -229,6 +230,10 @@

f_outgoing_ns_unblock();
setverdict(pass);
+}
+
+testcase TC_tx_unblock() runs on RAW_Test_CT {
+   f_tx_unblock();
f_sleep(1.0);
f_clean_ns_codec();
 }
@@ -922,6 +927,27 @@
f_clean_ns_codec();
 }

+/* 48.016 7.2 transmit a UNITDATA over an ALIVE connection
+ *
+ * TTCN  -> NS: reset
+ * TTCN <-  NS: reset ack
+ * TTCN  -> NS: unblock
+ * TTCN <-  NS: unblock ack
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: unitdata (mirror)
+ */
+testcase TC_tx_unitdata() runs on RAW_Test_CT {
+   f_tx_unblock();
+
+   f_vty_config2(NSVTY, {}, "mirror-mode enable");
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_vty_config2(NSVTY, {}, "mirror-mode disable");
+
+   f_sleep(1.0);
+   f_clean_ns_codec();
+}
+
 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
execute( TC_tx_reset() );
@@ -965,6 +991,7 @@
}

execute( TC_no_reset_alive_ack() );
+   execute( TC_tx_unitdata() );
}

if (mp_dialect == NS2_DIALECT_SNS) {

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25355
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5f59581d4257436eb9651c0c5ab5dd002f23d834
Gerrit-Change-Number: 25355
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns: add test case for SIZE after a successful configuration

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25382 )

Change subject: ns: add test case for SIZE after a successful configuration
..

ns: add test case for SIZE after a successful configuration

Change-Id: I5a7d55e9b3d28872baa4259f3db8c0d6081d
---
M ns/NS_Tests.ttcn
1 file changed, 17 insertions(+), 0 deletions(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index c3247fc..3d7b31a 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -827,6 +827,22 @@
f_clean_ns_codec();
 }

+/* Ensure a SIZE after a success full configuration is handled */
+testcase TC_sns_sgsn_size_after_success() runs on RAW_Test_CT {
+   f_init_vty();
+   f_init_ns_codec(mp_nsconfig);
+   f_outgoing_sns_size();
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   NSCP[0].receive(t_NS_ALIVE);
+
+   f_outgoing_sns_size();
+   f_outgoing_sns_config();
+   f_incoming_sns_config();
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
 /* Ensure a SNS SIZE ACK is transmitted from the correct port */
 testcase TC_sns_sgsn_size_correct_port() runs on RAW_Test_CT {
f_init_vty();
@@ -1014,6 +1030,7 @@
execute( TC_sns_sgsn_del() );
execute( TC_sns_sgsn_add_change_del() );
execute( TC_sns_sgsn_size_correct_port() );
+   execute( TC_sns_sgsn_size_after_success() );
}
}
 }

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25382
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5a7d55e9b3d28872baa4259f3db8c0d6081d
Gerrit-Change-Number: 25382
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in osmo-ttcn3-hacks[master]: ns2: add tc TC_mirror_unitdata_tx_status_blocked

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25389 )

Change subject: ns2: add tc TC_mirror_unitdata_tx_status_blocked
..

ns2: add tc TC_mirror_unitdata_tx_status_blocked

Change-Id: I9be2037b9228d2400bd293841ae6b957cb25c501
---
M ns/NS_Tests.ttcn
1 file changed, 29 insertions(+), 0 deletions(-)

Approvals:
  lynxis lazus: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index 3d7b31a..b57d686 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -964,6 +964,34 @@
f_clean_ns_codec();
 }

+/* 48.016 7.2 ensure tx status (blocked) is correctly parsed
+ *
+ * TTCN  -> NS: reset
+ * TTCN <-  NS: reset ack
+ * TTCN  -> NS: unblock
+ * TTCN <-  NS: unblock ack
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: unitdata (mirror)
+ * TTCN  -> NS: status (blocked)
+ * TTCN  -> NS: unitdata
+ * TTCN <-  NS: status (blocked)
+ */
+testcase TC_mirror_unitdata_tx_status_blocked() runs on RAW_Test_CT {
+   f_tx_unblock();
+
+   f_vty_config2(NSVTY, {}, "mirror-mode enable");
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   var PDU_NS pdu := f_ns_exp(tr_NS_UNITDATA(t_SduCtrlB, 42, 
'0011234242230101'O));
+
+   NSCP[0].send(ts_NS_STATUS(NS_CAUSE_NSVC_BLOCKED, pdu));
+   NSCP[0].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED));
+
+   f_vty_config2(NSVTY, {}, "mirror-mode disable");
+   f_sleep(1.0);
+   f_clean_ns_codec();
+}
+
 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
execute( TC_tx_reset() );
@@ -974,6 +1002,7 @@
execute( TC_tx_block_by_vty_reset() );
execute( TC_tx_block_unitdata_over_blocked() );
execute( TC_rx_block_unitdata_over_blocked() );
+   execute( TC_mirror_unitdata_tx_status_blocked() );
// execute( TC_block_other_nsvc() ); // reset, unblock, 
sleep(1), block over another nsvci
/* 48.016 7.2 Unblock procedure */
execute( TC_tx_unblock() );

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25389
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I9be2037b9228d2400bd293841ae6b957cb25c501
Gerrit-Change-Number: 25389
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in libosmocore[master]: ns2: fix a crash when receiving a SIZE while configured

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25384 )

Change subject: ns2: fix a crash when receiving a SIZE while configured
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/25384/1/src/gb/gprs_ns2_sns.c
File src/gb/gprs_ns2_sns.c:

https://gerrit.osmocom.org/c/libosmocore/+/25384/1/src/gb/gprs_ns2_sns.c@3025
PS1, Line 3025: 
ns2_vc_force_unconfigured(gss->sns_nsvc);
> * What about other calls to this function? […]
Because ns2_vc_force_unconfigured() is called by different parts. 
ns2_vc_force_unconfigured() is part of the NSVC. While SNS is a different part 
of the system (like a class).
Only in this case we want to ignore event because they would trigger other 
actions.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If14b9e3fcd5d139457b10d06517302168091d8d8
Gerrit-Change-Number: 25384
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-CC: osmith 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:50:59 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: osmith 
Gerrit-MessageType: comment


Change in osmo-ci[master]: jobs/ttcn3-testsuites.yml: add ttcn3-ns-test-fr

2021-09-07 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/25375 )

Change subject: jobs/ttcn3-testsuites.yml: add ttcn3-ns-test-fr
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/25375
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ifb08fafa408b8c622998080b4ec2932b0c3fd3bb
Gerrit-Change-Number: 25375
Gerrit-PatchSet: 1
Gerrit-Owner: osmith 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Tue, 07 Sep 2021 12:53:15 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in docker-playground[master]: ttcn3-ns-test: add second NSVC to allow SNS tests to work

2021-09-07 Thread lynxis lazus
lynxis lazus has removed daniel from this change.  ( 
https://gerrit.osmocom.org/c/docker-playground/+/25373 )

Change subject: ttcn3-ns-test: add second NSVC to allow SNS tests to work
..


Removed reviewer daniel.
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/25373
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I92f2ca61af1e3d0427e6810eddab8f2d6299242d
Gerrit-Change-Number: 25373
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-MessageType: deleteReviewer


Change in docker-playground[master]: ttcn3-ns-test-sgsn-sns: add test run for ns sgsn role with sns

2021-09-07 Thread lynxis lazus
lynxis lazus has removed daniel from this change.  ( 
https://gerrit.osmocom.org/c/docker-playground/+/25374 )

Change subject: ttcn3-ns-test-sgsn-sns: add test run for ns sgsn role with sns
..


Removed reviewer daniel.
--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/25374
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I1a9205885d381c04141dad752de0b39d9268ab69
Gerrit-Change-Number: 25374
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: deleteReviewer


Change in libosmocore[master]: ns2: nsvc: reject UNITDATA when the remote BLOCK'ed

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25383 )

Change subject: ns2: nsvc: reject UNITDATA  when the remote BLOCK'ed
..

ns2: nsvc: reject UNITDATA  when the remote BLOCK'ed

When the remote initiated the BLOCK the nsvc would still accept UNITDATA
over this nsvc.

Change-Id: I3ed4aa105a84e448082d3028fe844aae7720426b
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 1fcc3ad..7649798 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -438,6 +438,7 @@
break;
case GPRS_NS2_EV_RX_BLOCK:
priv->initiate_block = false;
+   priv->accept_unitdata = false;
ns2_tx_block_ack(priv->nsvc);
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED,
0, 2);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I3ed4aa105a84e448082d3028fe844aae7720426b
Gerrit-Change-Number: 25383
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2: fix a white space

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25391 )

Change subject: gprs_ns2: fix a white space
..

gprs_ns2: fix a white space

Change-Id: I2207d13ae451ce49482625fac43b6ab1c0f215e8
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved
  osmith: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 7649798..989a00c 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -853,7 +853,7 @@
}
}

-   if (nsvc->nsvci_is_valid && TLVP_PRESENT(tp,  NS_IE_VCI)) {
+   if (nsvc->nsvci_is_valid && TLVP_PRESENT(tp, NS_IE_VCI)) {
nsvci = tlvp_val16be(tp, NS_IE_VCI);
if (nsvci != nsvc->nsvci) {
/* 48.016 § 7.3.1 send RESET_ACK to wrong NSVCI + 
ignore */

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2207d13ae451ce49482625fac43b6ab1c0f215e8
Gerrit-Change-Number: 25391
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2: fix NS STATUS validation

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25390 )

Change subject: gprs_ns2: fix NS STATUS validation
..

gprs_ns2: fix NS STATUS validation

The wrong TLVs were used.

Change-Id: I01339d93469285cc5340500717ab2b696284e12a
---
M src/gb/gprs_ns2_message.c
1 file changed, 3 insertions(+), 4 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_message.c b/src/gb/gprs_ns2_message.c
index dccf51d..5e3e025 100644
--- a/src/gb/gprs_ns2_message.c
+++ b/src/gb/gprs_ns2_message.c
@@ -95,12 +95,11 @@
return -1;
}

-   uint8_t _cause = tlvp_val8(tp, NS_IE_VCI, 0);
-
+   uint8_t _cause = tlvp_val8(tp, NS_IE_CAUSE, 0);
switch (_cause) {
case NS_CAUSE_NSVC_BLOCKED:
case NS_CAUSE_NSVC_UNKNOWN:
-   if (!TLVP_PRES_LEN(tp, NS_IE_CAUSE, 1)) {
+   if (!TLVP_PRES_LEN(tp, NS_IE_VCI, 1)) {
*cause = NS_CAUSE_MISSING_ESSENT_IE;
return -1;
}
@@ -110,7 +109,7 @@
case NS_CAUSE_PROTO_ERR_UNSPEC:
case NS_CAUSE_INVAL_ESSENT_IE:
case NS_CAUSE_MISSING_ESSENT_IE:
-   if (!TLVP_PRES_LEN(tp, NS_IE_CAUSE, 1)) {
+   if (!TLVP_PRES_LEN(tp, NS_IE_PDU, 1)) {
*cause = NS_CAUSE_MISSING_ESSENT_IE;
return -1;
}

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I01339d93469285cc5340500717ab2b696284e12a
Gerrit-Change-Number: 25390
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in libosmocore[master]: gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC UNKNOWN/NSV...

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25392 )

Change subject: gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC 
UNKNOWN/NSVC BLOCKED
..

gprs_ns2: nsvc: react on STATUS PDUs with cause code NSVC UNKNOWN/NSVC BLOCKED

A STATUS PDU with cause code NSVC UNKNOWN/NSVC BLOCKED informs the other
side about a state mismatch between the side.

Change-Id: Ib6a2424f3027a30f14ef0a9fc2230e6aae9a2a04
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 27 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 989a00c..03a355b 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -616,7 +616,9 @@
 {
struct gprs_ns2_vc_priv *priv = fi->priv;
struct gprs_ns2_inst *nsi = ns_inst_from_fi(fi);
+   struct tlv_parsed *tp;
struct msgb *msg = data;
+   uint8_t cause;

switch (event) {
case GPRS_NS2_EV_REQ_OM_RESET:
@@ -707,6 +709,27 @@
if (fi->state == GPRS_NS2_ST_BLOCKED)
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED, 
nsi->timeout[NS_TOUT_TNS_BLOCK], 0);
break;
+   case GPRS_NS2_EV_RX_STATUS:
+   tp = data;
+   cause = tlvp_val8(tp, NS_IE_CAUSE, 0);
+   switch (cause) {
+   case NS_CAUSE_NSVC_BLOCKED:
+   if (fi->state != GPRS_NS2_ST_BLOCKED) {
+   LOG_NS_SIGNAL(priv->nsvc, "Rx", NS_PDUT_STATUS, 
LOGL_ERROR, ": remote side reported blocked state.\n");
+   priv->initiate_block = false;
+   priv->accept_unitdata = false;
+   osmo_fsm_inst_state_chg(fi, 
GPRS_NS2_ST_BLOCKED, nsi->timeout[NS_TOUT_TNS_BLOCK], 0);
+   }
+   break;
+   case NS_CAUSE_NSVC_UNKNOWN:
+   if (fi->state != GPRS_NS2_ST_RESET && fi->state != 
GPRS_NS2_ST_UNCONFIGURED) {
+   LOG_NS_SIGNAL(priv->nsvc, "Rx", NS_PDUT_STATUS, 
LOGL_ERROR, ": remote side reported unknown nsvc.\n");
+   osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, 
nsi->timeout[NS_TOUT_TNS_RESET], 0);
+   }
+   break;
+   }
+
+   break;
}
 }

@@ -726,6 +749,7 @@
   S(GPRS_NS2_EV_RX_RESET) |
   S(GPRS_NS2_EV_RX_ALIVE) |
   S(GPRS_NS2_EV_RX_ALIVE_ACK) |
+  S(GPRS_NS2_EV_RX_STATUS) |
   S(GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED) |
   S(GPRS_NS2_EV_REQ_OM_RESET) |
   S(GPRS_NS2_EV_REQ_OM_BLOCK) |
@@ -894,6 +918,9 @@
/* UNITDATA have to free msg because it might send the msg 
layer upwards */
osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_UNITDATA, msg);
return 0;
+   case NS_PDUT_STATUS:
+   osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_STATUS, tp);
+   break;
default:
LOGPFSML(fi, LOGL_ERROR, "NSEI=%u Rx unknown NS PDU type %s\n", 
nsvc->nse->nsei,
 get_value_string(gprs_ns_pdu_strings, nsh->pdu_type));

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib6a2424f3027a30f14ef0a9fc2230e6aae9a2a04
Gerrit-Change-Number: 25392
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in libosmocore[master]: ns2: fix a crash when receiving a SIZE while configured

2021-09-07 Thread lynxis lazus
lynxis lazus has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25384 )

Change subject: ns2: fix a crash when receiving a SIZE while configured
..

ns2: fix a crash when receiving a SIZE while configured

The ns2_vc_force_unconfigured() needs to be protected otherwise it would free
gss->nsvc which will be used later. It further would run into another
SNS failure which is wrong too.

Change-Id: If14b9e3fcd5d139457b10d06517302168091d8d8
---
M src/gb/gprs_ns2_sns.c
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/gb/gprs_ns2_sns.c b/src/gb/gprs_ns2_sns.c
index 7619b66..0afc06e 100644
--- a/src/gb/gprs_ns2_sns.c
+++ b/src/gb/gprs_ns2_sns.c
@@ -3021,7 +3021,9 @@
/* keep the NSVC we need for SNS, but unconfigure it */
gss->sns_nsvc->sig_weight = 0;
gss->sns_nsvc->data_weight = 0;
+   gss->block_no_nsvc_events = true;
ns2_vc_force_unconfigured(gss->sns_nsvc);
+   gss->block_no_nsvc_events = false;
ns2_sns_compute_local_ep_from_binds(fi);
}


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: If14b9e3fcd5d139457b10d06517302168091d8d8
Gerrit-Change-Number: 25384
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Reviewer: pespin 
Gerrit-CC: osmith 
Gerrit-MessageType: merged


Change in libosmocore[master]: vty: add vty_out_uptime() print the uptime to the vty

2021-09-23 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25348 )

Change subject: vty: add vty_out_uptime() print the uptime to the vty
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/25348/2/src/vty/vty.c
File src/vty/vty.c:

https://gerrit.osmocom.org/c/libosmocore/+/25348/2/src/vty/vty.c@339
PS2, Line 339: int vty_out_uptime(struct vty *vty, const struct timespec 
*starttime)
> I recall we already have some libosmocore APIs to get this kind of strings.
what do you mean exactly?



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
Gerrit-Change-Number: 25348
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 23 Sep 2021 08:16:07 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in libosmocore[master]: vty: add vty_out_uptime() print the uptime to the vty

2021-09-23 Thread lynxis lazus
Hello osmith, Jenkins Builder, pespin,

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

https://gerrit.osmocom.org/c/libosmocore/+/25348

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

Change subject: vty: add vty_out_uptime() print the uptime to the vty
..

vty: add vty_out_uptime() print the uptime to the vty

vty_out_uptime() calculates the time difference to a given timespec
and print it in a human readable format (days, hours,
minutes, seconds) to the vty.

Related: OS#5028
Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
---
M include/osmocom/vty/vty.h
M src/vty/command.c
M src/vty/vty.c
3 files changed, 25 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/48/25348/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25348
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I264a3f49096b96646e0a1f5366623ac20d860793
Gerrit-Change-Number: 25348
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: ensure the NSVC is in the correct mode for NSVC UNKNOWN/NSVC BLO...

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/2 )


Change subject: ns2: ensure the NSVC is in the correct mode for NSVC 
UNKNOWN/NSVC BLOCKED cause codes
..

ns2: ensure the NSVC is in the correct mode for NSVC UNKNOWN/NSVC BLOCKED cause 
codes

Those cause codes are only valid for BLOCK/RESET NSVCs.

Change-Id: I560f1c8c2826befd03641bebffe156ac070061c2
---
M src/gb/gprs_ns2_message.c
1 file changed, 5 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/55/2/1

diff --git a/src/gb/gprs_ns2_message.c b/src/gb/gprs_ns2_message.c
index 2dbbf5e..a77a79c 100644
--- a/src/gb/gprs_ns2_message.c
+++ b/src/gb/gprs_ns2_message.c
@@ -103,6 +103,11 @@
*cause = NS_CAUSE_MISSING_ESSENT_IE;
return -1;
}
+
+   if (nsvc->mode != GPRS_NS2_VC_MODE_BLOCKRESET) {
+   *cause = NS_CAUSE_PDU_INCOMP_PSTATE;
+   return -1;
+   }
break;
case NS_CAUSE_SEM_INCORR_PDU:
case NS_CAUSE_PDU_INCOMP_PSTATE:

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I560f1c8c2826befd03641bebffe156ac070061c2
Gerrit-Change-Number: 2
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI instead of u...

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25554 )


Change subject: ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI 
instead of using the nsvc nsvci
..

ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI instead of using the 
nsvc nsvci

The BLOCK and BLOCK ACK PDUs can be send over a working NSVC to inform
the NSE that a NSVC is blocked.

Change-Id: I6189229fdc1f054e86811bc60cb7646e1f758a78
---
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_message.c
M src/gb/gprs_ns2_vc_fsm.c
M tests/gb/gprs_ns2_test.c
4 files changed, 25 insertions(+), 15 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/54/25554/1

diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index bfb12d9..a5d78d4 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -422,8 +422,8 @@
   unsigned int num_ip6_elems);

 /* transmit message over a VC */
-int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause);
-int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc);
+int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause, uint16_t *nsvci);
+int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc, uint16_t *nsvci);

 int ns2_tx_reset(struct gprs_ns2_vc *nsvc, uint8_t cause);
 int ns2_tx_reset_ack(struct gprs_ns2_vc *nsvc);
diff --git a/src/gb/gprs_ns2_message.c b/src/gb/gprs_ns2_message.c
index 5e3e025..2dbbf5e 100644
--- a/src/gb/gprs_ns2_message.c
+++ b/src/gb/gprs_ns2_message.c
@@ -207,11 +207,16 @@
  *  \param[in] vc NS-VC on which the NS-BLOCK is to be transmitted
  *  \param[in] cause Numeric NS Cause value
  *  \returns 0 in case of success */
-int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause)
+int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause, uint16_t *nsvci)
 {
struct msgb *msg;
struct gprs_ns_hdr *nsh;
-   uint16_t nsvci = osmo_htons(nsvc->nsvci);
+   uint16_t encoded_nsvci;
+
+   if (nsvci)
+   encoded_nsvci = osmo_htons(*nsvci);
+   else
+   encoded_nsvci = osmo_htons(nsvc->nsvci);

log_set_context(LOG_CTX_GB_NSE, nsvc->nse);
log_set_context(LOG_CTX_GB_NSVC, nsvc);
@@ -229,7 +234,7 @@
nsh->pdu_type = NS_PDUT_BLOCK;

msgb_tvlv_put(msg, NS_IE_CAUSE, 1, &cause);
-   msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *) &nsvci);
+   msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *) &encoded_nsvci);

LOG_NS_SIGNAL(nsvc, "Tx", nsh->pdu_type, LOGL_INFO, " cause=%s\n", 
gprs_ns2_cause_str(cause));
return ns_vc_tx(nsvc, msg);
@@ -238,11 +243,16 @@
 /*! Transmit a NS-BLOCK-ACK on a given NS-VC.
  *  \param[in] nsvc NS-VC on which the NS-BLOCK is to be transmitted
  *  \returns 0 in case of success */
-int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc)
+int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc, uint16_t *nsvci)
 {
struct msgb *msg;
struct gprs_ns_hdr *nsh;
-   uint16_t nsvci = osmo_htons(nsvc->nsvci);
+   uint16_t encoded_nsvci;
+
+   if (nsvci)
+   encoded_nsvci = osmo_htons(*nsvci);
+   else
+   encoded_nsvci = osmo_htons(nsvc->nsvci);

log_set_context(LOG_CTX_GB_NSE, nsvc->nse);
log_set_context(LOG_CTX_GB_NSVC, nsvc);
@@ -257,7 +267,7 @@
nsh = (struct gprs_ns_hdr *) msg->l2h;
nsh->pdu_type = NS_PDUT_BLOCK_ACK;

-   msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *) &nsvci);
+   msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *) &encoded_nsvci);

LOG_NS_TX_SIGNAL(nsvc, nsh->pdu_type);
return ns_vc_tx(nsvc, msg);
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index fa8cec2..a366c93 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -348,7 +348,7 @@
if (old_state == GPRS_NS2_ST_RESET) {
osmo_timer_del(&fi->timer);
} else {
-   ns2_tx_block(priv->nsvc, NS_CAUSE_OM_INTERVENTION);
+   ns2_tx_block(priv->nsvc, NS_CAUSE_OM_INTERVENTION, 
NULL);
}
} else if (priv->initiate_block) {
ns2_tx_unblock(priv->nsvc);
@@ -369,12 +369,12 @@
break;
case GPRS_NS2_EV_RX_BLOCK:
priv->accept_unitdata = false;
-   ns2_tx_block_ack(priv->nsvc);
+   ns2_tx_block_ack(priv->nsvc, NULL);
osmo_timer_del(&fi->timer);
break;
case GPRS_NS2_EV_RX_UNBLOCK:
priv->accept_unitdata = false;
-   ns2_tx_block(priv->nsvc, NS_CAUSE_OM_INTERVENTION);
+   ns2_tx_block(priv->nsvc, NS_CAUSE_OM_INTERVENTION, 
NULL);
osmo_time

Change in libosmocore[master]: ns2: fsm: add comment don't answer on a STATUS with a STATUS

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25556 )


Change subject: ns2: fsm: add comment don't answer on a STATUS with a STATUS
..

ns2: fsm: add comment don't answer on a STATUS with a STATUS

Change-Id: Ib8f700f9193a96a7bada3b0293dcecf6a05d6efc
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 1 insertion(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/56/25556/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index a366c93..d09c31a 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -861,6 +861,7 @@
/* TODO: handle BLOCK/UNBLOCK/ALIVE with different VCI */

if (ns2_validate(nsvc, nsh->pdu_type, msg, tp, &cause)) {
+   /* don't answer on a STATUS with a STATUS */
if (nsh->pdu_type != NS_PDUT_STATUS) {
rc = ns2_tx_status(nsvc, cause, 0, msg);
goto out;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ib8f700f9193a96a7bada3b0293dcecf6a05d6efc
Gerrit-Change-Number: 25556
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: ns2: correct parse a STATUS PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25557 )


Change subject: ns2: correct parse a STATUS PDU which was received over a 
different NSVC
..

ns2: correct parse a STATUS PDU which was received over a different NSVC

STATUS PDU can be send over a different NSVC than the NSVC.
E.g. informing a NSVC got blocked in case of a lower-layer failure.

Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 24 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/25557/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index d09c31a..3395254 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -851,6 +851,7 @@
 int ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed 
*tp)
 {
struct gprs_ns_hdr *nsh = (struct gprs_ns_hdr *) msg->l2h;
+   struct gprs_ns2_vc *target_nsvc = NULL;
struct osmo_fsm_inst *fi = nsvc->fi;
int rc = 0;
uint8_t cause;
@@ -884,11 +885,27 @@
nsvci = tlvp_val16be(tp, NS_IE_VCI);
if (nsvci != nsvc->nsvci) {
/* 48.016 § 7.3.1 send RESET_ACK to wrong NSVCI + 
ignore */
-   if (nsh->pdu_type == NS_PDUT_RESET)
+   if (nsh->pdu_type == NS_PDUT_RESET) {
ns2_tx_reset_ack(nsvc);
+   } else if (nsh->pdu_type == NS_PDUT_STATUS) {
+   /* this is a PDU received over a NSVC and 
reports a status for another NSVC */
+   target_nsvc = 
gprs_ns2_nsvc_by_nsvci(nsvc->nse->nsi,  nsvci);
+   if (!target_nsvc) {
+   LOGPFSML(fi, LOGL_ERROR, "Received a 
STATUS PDU for unknown NSVC (NSVCI %d)\n", nsvci);
+   goto out;
+   }

-   LOG_NS_SIGNAL(nsvc, "Rx", nsh->pdu_type, LOGL_ERROR, " 
with wrong NSVCI=%05u. Ignoring PDU.\n", nsvci);
-   goto out;
+   if (target_nsvc->nse != nsvc->nse) {
+   LOGPFSML(fi, LOGL_ERROR, "Received a 
STATUS PDU for a NSVC (NSVCI %d) but it belongs to a different NSE!\n", nsvci);
+   /* send out status */
+   goto out;
+   }
+
+   /* the status will be passed to the nsvc/target 
nsvc in the switch */
+   } else {
+   LOG_NS_SIGNAL(nsvc, "Rx", nsh->pdu_type, 
LOGL_ERROR, " with wrong NSVCI=%05u. Ignoring PDU.\n", nsvci);
+   goto out;
+   }
}
}

@@ -922,7 +939,10 @@
osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_UNITDATA, msg);
return 0;
case NS_PDUT_STATUS:
-   osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_STATUS, tp);
+   if (target_nsvc)
+   osmo_fsm_inst_dispatch(target_nsvc->fi, 
GPRS_NS2_EV_RX_STATUS, tp);
+   else
+   osmo_fsm_inst_dispatch(fi, GPRS_NS2_EV_RX_STATUS, tp);
break;
default:
LOGPFSML(fi, LOGL_ERROR, "NSEI=%u Rx unknown NS PDU type %s\n", 
nsvc->nse->nsei,

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
Gerrit-Change-Number: 25557
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: ns2: correct parse a BLOCK PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25558 )


Change subject: ns2: correct parse a BLOCK PDU which was received over a 
different NSVC
..

ns2: correct parse a BLOCK PDU which was received over a different NSVC

BLOCK PDU can be send over a different NSVC than the NSVC.
E.g. informing a NSVC got blocked in case of a lower-layer failure.

Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 33 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/25558/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index 3395254..b528a06 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -118,6 +118,7 @@
GPRS_NS2_EV_REQ_OM_RESET,   /* vty cmd: reset */
GPRS_NS2_EV_REQ_OM_BLOCK,   /* vty cmd: block */
GPRS_NS2_EV_REQ_OM_UNBLOCK, /* vty cmd: unblock*/
+   GPRS_NS2_EV_RX_BLOCK_FOREIGN,   /* received a BLOCK over 
another NSVC */
 };

 static const struct value_string ns2_vc_event_names[] = {
@@ -127,6 +128,7 @@
{ GPRS_NS2_EV_RX_UNBLOCK,   "RX-UNBLOCK" },
{ GPRS_NS2_EV_RX_UNBLOCK_ACK,   "RX-UNBLOCK_ACK" },
{ GPRS_NS2_EV_RX_BLOCK, "RX-BLOCK" },
+   { GPRS_NS2_EV_RX_BLOCK_FOREIGN, "RX-BLOCK_FOREIGN" },
{ GPRS_NS2_EV_RX_BLOCK_ACK, "RX-BLOCK_ACK" },
{ GPRS_NS2_EV_RX_ALIVE, "RX-ALIVE" },
{ GPRS_NS2_EV_RX_ALIVE_ACK, "RX-ALIVE_ACK" },
@@ -368,8 +370,12 @@
osmo_timer_del(&fi->timer);
break;
case GPRS_NS2_EV_RX_BLOCK:
+   case GPRS_NS2_EV_RX_BLOCK_FOREIGN:
priv->accept_unitdata = false;
-   ns2_tx_block_ack(priv->nsvc, NULL);
+   /* the BLOCK ACK for foreign BLOCK PDUs (rx over 
another nsvc) will be send
+* from the receiving nsvc */
+   if (event == GPRS_NS2_EV_RX_BLOCK)
+   ns2_tx_block_ack(priv->nsvc, NULL);
osmo_timer_del(&fi->timer);
break;
case GPRS_NS2_EV_RX_UNBLOCK:
@@ -380,6 +386,9 @@
}
} else if (priv->initiate_block) {
switch (event) {
+   case GPRS_NS2_EV_RX_BLOCK_FOREIGN:
+   /* the block ack will be send by the rx NSVC */
+   break;
case GPRS_NS2_EV_RX_BLOCK:
/* TODO: BLOCK is a UNBLOCK_NACK */
ns2_tx_block_ack(priv->nsvc, NULL);
@@ -396,6 +405,9 @@
} else {
/* we are on the receiving end. The initiator who sent RESET is 
responsible to UNBLOCK! */
switch (event) {
+   case GPRS_NS2_EV_RX_BLOCK_FOREIGN:
+   /* the block ack will be send by the rx NSVC */
+   break;
case GPRS_NS2_EV_RX_BLOCK:
ns2_tx_block_ack(priv->nsvc, NULL);
break;
@@ -438,10 +450,14 @@
case GPRS_NS2_EV_RX_UNBLOCK:
ns2_tx_unblock_ack(priv->nsvc);
break;
+   case GPRS_NS2_EV_RX_BLOCK_FOREIGN:
case GPRS_NS2_EV_RX_BLOCK:
priv->initiate_block = false;
priv->accept_unitdata = false;
-   ns2_tx_block_ack(priv->nsvc, NULL);
+   /* the BLOCK ACK for foreign BLOCK PDUs (rx over another nsvc) 
will be send
+* from the receiving nsvc */
+   if (event == GPRS_NS2_EV_RX_BLOCK)
+   ns2_tx_block_ack(priv->nsvc, NULL);
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_BLOCKED,
0, 2);
break;
@@ -887,21 +903,26 @@
/* 48.016 § 7.3.1 send RESET_ACK to wrong NSVCI + 
ignore */
if (nsh->pdu_type == NS_PDUT_RESET) {
ns2_tx_reset_ack(nsvc);
-   } else if (nsh->pdu_type == NS_PDUT_STATUS) {
-   /* this is a PDU received over a NSVC and 
reports a status for another NSVC */
+   } else if (nsh->pdu_type == NS_PDUT_BLOCK || 
nsh->pdu_type == NS_PDUT_STATUS) {
+   /* this is a PDU received over a NSVC and 
reports a status/block for another NSVC */
target_nsvc = 
gprs_ns2_nsvc_by_nsvci(nsvc->nse->nsi,  nsvci);
if (!target

Change in libosmocore[master]: ns2: trigger a reset in case of receiving a NS STATUS with incompatib...

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25559 )


Change subject: ns2: trigger a reset in case of receiving a NS STATUS with 
incompatible protocol state
..

ns2: trigger a reset in case of receiving a NS STATUS with incompatible 
protocol state

Change-Id: I912315f816bd0597d4646627dbfdd270fbae2509
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 6 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/25559/1

diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index b528a06..d8b9ca0 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -745,6 +745,12 @@
osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, 
nsi->timeout[NS_TOUT_TNS_RESET], 0);
}
break;
+   case NS_CAUSE_PDU_INCOMP_PSTATE:
+   if (fi->state != GPRS_NS2_ST_RESET && fi->state != 
GPRS_NS2_ST_UNCONFIGURED) {
+   LOG_NS_SIGNAL(priv->nsvc, "Rx", NS_PDUT_STATUS, 
LOGL_ERROR, ": remote side reported incompatible protocol state.\n");
+   osmo_fsm_inst_state_chg(fi, GPRS_NS2_ST_RESET, 
nsi->timeout[NS_TOUT_TNS_RESET], 0);
+   }
+   break;
}

break;

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I912315f816bd0597d4646627dbfdd270fbae2509
Gerrit-Change-Number: 25559
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: ns2: trigger a reset in case of receiving a NS STATUS with incompatib...

2021-09-23 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25559 )

Change subject: ns2: trigger a reset in case of receiving a NS STATUS with 
incompatible protocol state
..


Patch Set 1: Code-Review-1

I'm uncertain about this commit. keeping it in WIP and gerrit for later. I'm 
unsure if we should trigger a reset here. Maybe parsing the PDU as far as 
possible to know if it's UNITDATA (to ignore) or not and to decide if a reset 
is correct.


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I912315f816bd0597d4646627dbfdd270fbae2509
Gerrit-Change-Number: 25559
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: Jenkins Builder
Gerrit-Comment-Date: Thu, 23 Sep 2021 11:42:21 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: ns: add test case TC_tx_blocked_foreign_nsvc

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25560 )


Change subject: ns: add test case TC_tx_blocked_foreign_nsvc
..

ns: add test case TC_tx_blocked_foreign_nsvc

Check if a BLOCK PDU over a different/foreign connection is parsed.
* 2x initialize NSVC (RESET/UNBLOCK)
* TTCN  0-> NS: block (nsvci 1)
* TTCN  <-0 NS: block ack (nsvci 1)
* TTCN  1-> NS: unit data (nsvci 1)
* TTCN  <-1 NS: status (blocked)

Change-Id: I2b37a712bd70037b35b9deb8dab4a72d1e1d29fb
---
M ns/NS_Tests.ttcn
M ns/NS_Tests.udp.cfg
M ns/osmo-ns.udp.cfg
3 files changed, 54 insertions(+), 0 deletions(-)



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

diff --git a/ns/NS_Tests.ttcn b/ns/NS_Tests.ttcn
index b57d686..722f8ec 100644
--- a/ns/NS_Tests.ttcn
+++ b/ns/NS_Tests.ttcn
@@ -992,6 +992,43 @@
f_clean_ns_codec();
 }

+/* 48.016 7.2 ensure tx status (blocked) is correctly parsed over a foreign 
NSVC
+ *
+ * 2x initialize NSVC (RESET/UNBLOCK)
+ * TTCN  0-> NS: block (nsvci 1)
+ * TTCN  <-0 NS: block ack (nsvci 1)
+ * TTCN  1-> NS: unit data (nsvci 1)
+ * TTCN  <-1 NS: status (blocked)
+ */
+testcase TC_tx_blocked_foreign_nsvc() runs on RAW_Test_CT {
+   f_init_vty();
+   f_vty_config2(NSVTY, {}, "mirror-mode enable");
+   f_init_ns_codec(mp_nsconfig, idx := 0);
+   f_init_ns_codec(mp_nsconfig, idx := 1);
+
+   /* do a NS Reset procedure */
+   f_outgoing_ns_reset(idx := 0);
+   f_outgoing_ns_reset(idx := 1);
+
+   /* send alive acks */
+   activate(as_rx_alive_tx_ack(idx := 0));
+   activate(as_rx_alive_tx_ack(idx := 1));
+
+   f_outgoing_ns_unblock(idx := 0);
+   f_outgoing_ns_unblock(idx := 1);
+
+   /* both NSVC are alive and unblocked */
+   NSCP[0].send(ts_NS_BLOCK(NS_CAUSE_TRANSIT_NETWORK_FAILURE, 
g_nsconfig.nsvc[1].nsvci));
+   f_ns_exp(tr_NS_BLOCK_ACK(g_nsconfig.nsvc[1].nsvci));
+
+   NSCP[1].send(ts_NS_UNITDATA(t_SduCtrlB, 42, '0011234242230101'O));
+   f_ns_exp(tr_NS_STATUS(NS_CAUSE_NSVC_BLOCKED), idx := 1);
+
+   setverdict(pass);
+   f_clean_ns_codec();
+}
+
+
 control {
if (mp_dialect == NS2_DIALECT_STATIC_RESETBLOCK or mp_dialect == 
NS2_DIALECT_IPACCESS) {
execute( TC_tx_reset() );
@@ -1003,6 +1040,7 @@
execute( TC_tx_block_unitdata_over_blocked() );
execute( TC_rx_block_unitdata_over_blocked() );
execute( TC_mirror_unitdata_tx_status_blocked() );
+   execute( TC_tx_blocked_foreign_nsvc() );
// execute( TC_block_other_nsvc() ); // reset, unblock, 
sleep(1), block over another nsvci
/* 48.016 7.2 Unblock procedure */
execute( TC_tx_unblock() );
diff --git a/ns/NS_Tests.udp.cfg b/ns/NS_Tests.udp.cfg
index f040998..cdb071d 100644
--- a/ns/NS_Tests.udp.cfg
+++ b/ns/NS_Tests.udp.cfg
@@ -21,6 +21,18 @@
}
},
nsvci := 1234
+   },
+   {
+   provider := {
+   ip := {
+   address_family := AF_INET,
+   local_ip := "127.0.0.1",
+   local_udp_port := 22001,
+   remote_ip := "127.0.0.1",
+   remote_udp_port := 23001
+   }
+   },
+   nsvci := 1235
}
}
 }
diff --git a/ns/osmo-ns.udp.cfg b/ns/osmo-ns.udp.cfg
index 9591427..b327c32 100644
--- a/ns/osmo-ns.udp.cfg
+++ b/ns/osmo-ns.udp.cfg
@@ -91,5 +91,9 @@
  bind udp local
   listen 127.0.0.1 23000
   accept-ipaccess
+ bind udp local2
+  listen 127.0.0.1 23001
+  accept-ipaccess
  nse 1234
   nsvc ipa local 127.0.0.1 22000 nsvci 1234
+  nsvc ipa local2 127.0.0.1 22001 nsvci 1235

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25560
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I2b37a712bd70037b35b9deb8dab4a72d1e1d29fb
Gerrit-Change-Number: 25560
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in docker-playground[master]: ttcn3-ns-test: add second NSVC to allow TC_tx_blocked_foreign_nsvc to...

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/docker-playground/+/25561 )


Change subject: ttcn3-ns-test: add second NSVC to allow 
TC_tx_blocked_foreign_nsvc to work
..

ttcn3-ns-test: add second NSVC to allow TC_tx_blocked_foreign_nsvc to work

TC_tx_blocked_foreign_nsvc requires to ipa NSVCs

Change-Id: I3a4baaacdbaab245ba10a1857f0183e56defcdf4
---
M ttcn3-ns-test/NS_Tests.cfg
M ttcn3-ns-test/osmo-ns-dummy.cfg
2 files changed, 16 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/docker-playground 
refs/changes/61/25561/1

diff --git a/ttcn3-ns-test/NS_Tests.cfg b/ttcn3-ns-test/NS_Tests.cfg
index 1bb202d..1ba93ab 100644
--- a/ttcn3-ns-test/NS_Tests.cfg
+++ b/ttcn3-ns-test/NS_Tests.cfg
@@ -22,6 +22,18 @@
}
},
nsvci := 1234
+   },
+   {
+   provider := {
+   ip := {
+   address_family := AF_INET,
+   local_ip := "172.18.28.10",
+   local_udp_port := 22001,
+   remote_ip := "172.18.28.101",
+   remote_udp_port := 23001
+   }
+   },
+   nsvci := 1235
}
}
 }
diff --git a/ttcn3-ns-test/osmo-ns-dummy.cfg b/ttcn3-ns-test/osmo-ns-dummy.cfg
index 1da041d..b839252 100644
--- a/ttcn3-ns-test/osmo-ns-dummy.cfg
+++ b/ttcn3-ns-test/osmo-ns-dummy.cfg
@@ -90,5 +90,9 @@
  bind udp local
   listen 172.18.28.101 23000
   accept-ipaccess
+ bind udp local2
+  listen 172.18.28.101 23001
+  accept-ipaccess
  nse 1234
   nsvc ipa local 172.18.28.10 22000 nsvci 1234
+  nsvc ipa local2 172.18.28.10 22001 nsvci 1235

--
To view, visit https://gerrit.osmocom.org/c/docker-playground/+/25561
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: docker-playground
Gerrit-Branch: master
Gerrit-Change-Id: I3a4baaacdbaab245ba10a1857f0183e56defcdf4
Gerrit-Change-Number: 25561
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in osmo-ttcn3-hacks[master]: ns: add test case TC_tx_blocked_foreign_nsvc

2021-09-23 Thread lynxis lazus
Hello Jenkins Builder,

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

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25560

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

Change subject: ns: add test case TC_tx_blocked_foreign_nsvc
..

ns: add test case TC_tx_blocked_foreign_nsvc

Check if a BLOCK PDU over a different/foreign connection is parsed.
* 2x initialize NSVC (RESET/UNBLOCK)
* TTCN  0-> NS: block (nsvci 1)
* TTCN  <-0 NS: block ack (nsvci 1)
* TTCN  1-> NS: unit data (nsvci 1)
* TTCN  <-1 NS: status (blocked)

Change-Id: I2b37a712bd70037b35b9deb8dab4a72d1e1d29fb
---
M ns/NS_Tests.ttcn
M ns/NS_Tests.udp.cfg
M ns/osmo-ns.udp.cfg
3 files changed, 54 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/60/25560/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25560
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I2b37a712bd70037b35b9deb8dab4a72d1e1d29fb
Gerrit-Change-Number: 25560
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI instead of u...

2021-09-23 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25554 )

Change subject: ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI 
instead of using the nsvc nsvci
..


Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/c/libosmocore/+/25554/1/src/gb/gprs_ns2_message.c
File src/gb/gprs_ns2_message.c:

https://gerrit.osmocom.org/c/libosmocore/+/25554/1/src/gb/gprs_ns2_message.c@208
PS1, Line 208:  *  \param[in] cause Numeric NS Cause value
> missing update of doc.
Done


https://gerrit.osmocom.org/c/libosmocore/+/25554/1/src/gb/gprs_ns2_message.c@245
PS1, Line 245:  *  \returns 0 in case of success */
> missing update of doc.
Done



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I6189229fdc1f054e86811bc60cb7646e1f758a78
Gerrit-Change-Number: 25554
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Thu, 23 Sep 2021 13:53:43 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in libosmocore[master]: ns2: correct parse a STATUS PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25557 )

Change subject: ns2: correct parse a STATUS PDU which was received over a 
different NSVC
..


Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/c/libosmocore/+/25557/1/src/gb/gprs_ns2_vc_fsm.c
File src/gb/gprs_ns2_vc_fsm.c:

https://gerrit.osmocom.org/c/libosmocore/+/25557/1/src/gb/gprs_ns2_vc_fsm.c@854
PS1, Line 854:  struct gprs_ns2_vc *target_nsvc = NULL;
> what about setting target_nsvc = nsvc; here...
Ack


https://gerrit.osmocom.org/c/libosmocore/+/25557/1/src/gb/gprs_ns2_vc_fsm.c@942
PS1, Line 942:  if (target_nsvc)
>  and always use target_nsvc here.
Ack



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
Gerrit-Change-Number: 25557
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Thu, 23 Sep 2021 14:04:34 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in libosmocore[master]: ns2: correct parse a STATUS PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25557 )

Change subject: ns2: correct parse a STATUS PDU which was received over a 
different NSVC
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/c/libosmocore/+/25557/1//COMMIT_MSG
Commit Message:

https://gerrit.osmocom.org/c/libosmocore/+/25557/1//COMMIT_MSG@9
PS1, Line 9: STATUS PDU can be send over a different NSVC than the NSVC.
> "than the target NSVC"?
unsure.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
Gerrit-Change-Number: 25557
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Thu, 23 Sep 2021 14:06:19 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in libosmocore[master]: ns2: correct parse a BLOCK PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25558 )

Change subject: ns2: correct parse a BLOCK PDU which was received over a 
different NSVC
..


Patch Set 1:

(6 comments)

This change is ready for review.

https://gerrit.osmocom.org/c/libosmocore/+/25558/1/src/gb/gprs_ns2_vc_fsm.c
File src/gb/gprs_ns2_vc_fsm.c:

https://gerrit.osmocom.org/c/libosmocore/+/25558/1/src/gb/gprs_ns2_vc_fsm.c@375
PS1, Line 375:  /* the BLOCK ACK for foreign BLOCK PDUs (rx 
over another nsvc) will be send
> You can probably move this above, immediatelly below "ase 
> GPRS_NS2_EV_RX_BLOCK:" and fall through.
I don't like the fallthrough here. IMHO it doesn't really help the readability.


https://gerrit.osmocom.org/c/libosmocore/+/25558/1/src/gb/gprs_ns2_vc_fsm.c@390
PS1, Line 390:  /* the block ack will be send by the rx NSVC */
> be sent
Done


https://gerrit.osmocom.org/c/libosmocore/+/25558/1/src/gb/gprs_ns2_vc_fsm.c@409
PS1, Line 409:  /* the block ack will be send by the rx NSVC */
> be sent
Done


https://gerrit.osmocom.org/c/libosmocore/+/25558/1/src/gb/gprs_ns2_vc_fsm.c@457
PS1, Line 457:  /* the BLOCK ACK for foreign BLOCK PDUs (rx over 
another nsvc) will be send
> be sent
Done


https://gerrit.osmocom.org/c/libosmocore/+/25558/1/src/gb/gprs_ns2_vc_fsm.c@459
PS1, Line 459:  if (event == GPRS_NS2_EV_RX_BLOCK)
> same, move above and fall through?
I don't like the fallthrough here.


https://gerrit.osmocom.org/c/libosmocore/+/25558/1/src/gb/gprs_ns2_vc_fsm.c@941
PS1, Line 941:  if (target_nsvc) {
> and from my previous post, you can also use always target_nsvc here. […]
I like to keep the fi as it is in the other messages.



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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
Gerrit-Change-Number: 25558
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-CC: pespin 
Gerrit-Comment-Date: Thu, 23 Sep 2021 14:30:38 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin 
Gerrit-MessageType: comment


Change in libosmocore[master]: ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI instead of u...

2021-09-23 Thread lynxis lazus
Hello Jenkins Builder, pespin, daniel,

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

https://gerrit.osmocom.org/c/libosmocore/+/25554

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

Change subject: ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI 
instead of using the nsvc nsvci
..

ns2: message: BLOCK/BLOCK ACK allow to use a given NSVCI instead of using the 
nsvc nsvci

The BLOCK and BLOCK ACK PDUs can be send over a working NSVC to inform
the NSE that a NSVC is blocked.

Change-Id: I6189229fdc1f054e86811bc60cb7646e1f758a78
---
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_message.c
M src/gb/gprs_ns2_vc_fsm.c
M tests/gb/gprs_ns2_test.c
4 files changed, 27 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/54/25554/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25554
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I6189229fdc1f054e86811bc60cb7646e1f758a78
Gerrit-Change-Number: 25554
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: correct parse a BLOCK PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
Hello Jenkins Builder, daniel,

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

https://gerrit.osmocom.org/c/libosmocore/+/25558

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

Change subject: ns2: correct parse a BLOCK PDU which was received over a 
different NSVC
..

ns2: correct parse a BLOCK PDU which was received over a different NSVC

BLOCK PDU can be send over a different NSVC than the NSVC.
E.g. informing a NSVC got blocked in case of a lower-layer failure.

Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 38 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/25558/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25558
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
Gerrit-Change-Number: 25558
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: correct parse a STATUS PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
Hello Jenkins Builder, laforge, daniel,

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

https://gerrit.osmocom.org/c/libosmocore/+/25557

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

Change subject: ns2: correct parse a STATUS PDU which was received over a 
different NSVC
..

ns2: correct parse a STATUS PDU which was received over a different NSVC

STATUS PDU can be send over a different NSVC than the NSVC which
generated the STATUS PDU. E.g. informing a NSVC got blocked in case of a 
lower-layer failure.

Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 20 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/25557/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25557
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
Gerrit-Change-Number: 25557
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: implement status with nsvci

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/25562 )


Change subject: implement status with nsvci
..

implement status with nsvci

Change-Id: I373eb48697097cdfa45748a091c11f7b3f0345fa
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_message.c
M src/gb/gprs_ns2_vc_fsm.c
4 files changed, 12 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/25562/1

diff --git a/src/gb/gprs_ns2.c b/src/gb/gprs_ns2.c
index 6bccf65..3bb04ae 100644
--- a/src/gb/gprs_ns2.c
+++ b/src/gb/gprs_ns2.c
@@ -1356,7 +1356,7 @@
if (rc < 0) {
LOGP(DLNS, LOGL_NOTICE, "Error during TLV Parse\n");
if (nsh->pdu_type != NS_PDUT_STATUS)
-   ns2_tx_status(nsvc, NS_CAUSE_PROTO_ERR_UNSPEC, 
0, msg);
+   ns2_tx_status(nsvc, NS_CAUSE_PROTO_ERR_UNSPEC, 
0, msg, NULL);
return rc;
}
return ns2_vc_rx(nsvc, msg, &tp);
diff --git a/src/gb/gprs_ns2_internal.h b/src/gb/gprs_ns2_internal.h
index a5d78d4..0959d2b 100644
--- a/src/gb/gprs_ns2_internal.h
+++ b/src/gb/gprs_ns2_internal.h
@@ -439,7 +439,7 @@
 struct msgb *msg);

 int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause,
-  uint16_t bvci, struct msgb *orig_msg);
+ uint16_t bvci, struct msgb *orig_msg, uint16_t *nsvci);

 /* driver */
 struct gprs_ns2_vc *ns2_ip_bind_connect(struct gprs_ns2_vc_bind *bind,
diff --git a/src/gb/gprs_ns2_message.c b/src/gb/gprs_ns2_message.c
index de30470..cc95334 100644
--- a/src/gb/gprs_ns2_message.c
+++ b/src/gb/gprs_ns2_message.c
@@ -432,13 +432,14 @@
  *  \param[in] cause Numeric NS cause value
  *  \param[in] bvci BVCI to be reset within NSVC
  *  \param[in] orig_msg message causing the STATUS
+ *  \param[in] nsvci if given this NSVCI will be encoded. If NULL the 
nsvc->nsvci will be used.
  *  \returns 0 in case of success */
 int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause,
-  uint16_t bvci, struct msgb *orig_msg)
+ uint16_t bvci, struct msgb *orig_msg, uint16_t *nsvci)
 {
struct msgb *msg = ns2_msgb_alloc();
struct gprs_ns_hdr *nsh;
-   uint16_t nsvci = osmo_htons(nsvc->nsvci);
+   uint16_t encoded_nsvci;
unsigned int orig_len, max_orig_len;

log_set_context(LOG_CTX_GB_NSE, nsvc->nse);
@@ -459,7 +460,11 @@
case NS_CAUSE_NSVC_BLOCKED:
case NS_CAUSE_NSVC_UNKNOWN:
/* Section 9.2.7.1: Static conditions for NS-VCI */
-   msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *)&nsvci);
+   if (nsvci)
+   encoded_nsvci = osmo_htons(*nsvci);
+   else
+   encoded_nsvci = osmo_htons(nsvc->nsvci);
+   msgb_tvlv_put(msg, NS_IE_VCI, 2, (uint8_t *)&encoded_nsvci);
break;
case NS_CAUSE_SEM_INCORR_PDU:
case NS_CAUSE_PDU_INCOMP_PSTATE:
diff --git a/src/gb/gprs_ns2_vc_fsm.c b/src/gb/gprs_ns2_vc_fsm.c
index d09c31a..1a632b1 100644
--- a/src/gb/gprs_ns2_vc_fsm.c
+++ b/src/gb/gprs_ns2_vc_fsm.c
@@ -679,7 +679,7 @@

ns2_tx_status(priv->nsvc,
  NS_CAUSE_NSVC_BLOCKED,
- 0, msg);
+ 0, msg, NULL);
break;
/* ALIVE can receive UNITDATA if the ALIVE_ACK is lost */
case GPRS_NS2_ST_RECOVERING:
@@ -863,7 +863,7 @@
if (ns2_validate(nsvc, nsh->pdu_type, msg, tp, &cause)) {
/* don't answer on a STATUS with a STATUS */
if (nsh->pdu_type != NS_PDUT_STATUS) {
-   rc = ns2_tx_status(nsvc, cause, 0, msg);
+   rc = ns2_tx_status(nsvc, cause, 0, msg, NULL);
goto out;
}
}

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I373eb48697097cdfa45748a091c11f7b3f0345fa
Gerrit-Change-Number: 25562
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


Change in libosmocore[master]: ns2: message: allow to pass a foreign NSVCI to STATUS PDU

2021-09-23 Thread lynxis lazus
lynxis lazus has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/c/libosmocore/+/25562 )

Change subject: ns2: message: allow to pass a foreign NSVCI to STATUS PDU
..

ns2: message: allow to pass a foreign NSVCI to STATUS PDU

To answer correct on a BLOCK PDU with a different NSVCI, the
STATUS PDU needs also a NSVCI parameter.

Change-Id: I373eb48697097cdfa45748a091c11f7b3f0345fa
---
M src/gb/gprs_ns2.c
M src/gb/gprs_ns2_internal.h
M src/gb/gprs_ns2_message.c
M src/gb/gprs_ns2_vc_fsm.c
4 files changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/62/25562/2
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25562
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I373eb48697097cdfa45748a091c11f7b3f0345fa
Gerrit-Change-Number: 25562
Gerrit-PatchSet: 2
Gerrit-Owner: lynxis lazus 
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: correct parse a STATUS PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
Hello Jenkins Builder, laforge, daniel,

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

https://gerrit.osmocom.org/c/libosmocore/+/25557

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

Change subject: ns2: correct parse a STATUS PDU which was received over a 
different NSVC
..

ns2: correct parse a STATUS PDU which was received over a different NSVC

STATUS PDU can be send over a different NSVC than the NSVC which
generated the STATUS PDU. E.g. informing a NSVC got blocked in case of a 
lower-layer failure.

Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 20 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/57/25557/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25557
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I5c9e9de10c669c1226da67bb9e2663c5cfe828a8
Gerrit-Change-Number: 25557
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: laforge 
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in libosmocore[master]: ns2: correct parse a BLOCK PDU which was received over a different NSVC

2021-09-23 Thread lynxis lazus
Hello Jenkins Builder, daniel,

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

https://gerrit.osmocom.org/c/libosmocore/+/25558

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

Change subject: ns2: correct parse a BLOCK PDU which was received over a 
different NSVC
..

ns2: correct parse a BLOCK PDU which was received over a different NSVC

BLOCK PDU can be send over a different NSVC than the NSVC.
E.g. informing a NSVC got blocked in case of a lower-layer failure.

Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
---
M src/gb/gprs_ns2_vc_fsm.c
1 file changed, 38 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/25558/3
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/25558
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I483e3a1d3b8c43bbb0cc6185b7f7f772bcb264bf
Gerrit-Change-Number: 25558
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-CC: pespin 
Gerrit-MessageType: newpatchset


Change in osmo-ttcn3-hacks[master]: gbproxy: Check SGSN-orignated BVC RESET if BSS BVC is gone

2021-09-24 Thread lynxis lazus
lynxis lazus has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25575 )

Change subject: gbproxy: Check SGSN-orignated BVC RESET if BSS BVC is gone
..


Patch Set 1:

would be great to add a 2nd test case for this.


--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/25575
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic57b39a77adf71abda99ef8af7da1592e2225a0d
Gerrit-Change-Number: 25575
Gerrit-PatchSet: 1
Gerrit-Owner: daniel 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Comment-Date: Fri, 24 Sep 2021 14:18:12 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[S] Change in libosmocore[master]: WIP: gsup: add message type for osmo-epdg CEIA interface

2023-03-23 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/32033 )


Change subject: WIP: gsup: add message type for osmo-epdg CEIA interface
..

WIP: gsup: add message type for osmo-epdg CEIA interface

The CEIA interface is an interface between osmo-epdg and
strongswan.
It is used by the osmo-epdg to synchronize state.

Change-Id: I6f7c20340c99f94b1326a8a7dc99c86cf6a0dbc3
---
M include/osmocom/gsm/gsup.h
M src/gsm/gsup.c
2 files changed, 23 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/32033/1

diff --git a/include/osmocom/gsm/gsup.h b/include/osmocom/gsm/gsup.h
index 56d7a30..6e7fcf0 100644
--- a/include/osmocom/gsm/gsup.h
+++ b/include/osmocom/gsm/gsup.h
@@ -198,6 +198,10 @@
OSMO_GSUP_MSGT_E_ABORT  = 0b01001011,

OSMO_GSUP_MSGT_ROUTING_ERROR= 0b01001110,
+
+   OSMO_GSUP_MSGT_EPDG_TUNNEL_REQUEST  = 0b0101,
+   OSMO_GSUP_MSGT_EPDG_TUNNEL_ERROR= 0b01010001,
+   OSMO_GSUP_MSGT_EPDG_TUNNEL_RESULT   = 0b01010010,
 };

 #define OSMO_GSUP_MSGT_E_ROUTING_ERROR OSMO_GSUP_MSGT_ROUTING_ERROR
@@ -281,6 +285,7 @@
OSMO_GSUP_MESSAGE_CLASS_SMS = 2,
OSMO_GSUP_MESSAGE_CLASS_USSD = 3,
OSMO_GSUP_MESSAGE_CLASS_INTER_MSC = 4,
+   OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG = 5,
/* Keep this as last entry with a value of max(enum 
osmo_gsup_message_class) + 1.
 * This value shall serve as the size for an array to aid de-muxing all 
known GSUP classes. */
OSMO_GSUP_MESSAGE_CLASS_ARRAYSIZE
diff --git a/src/gsm/gsup.c b/src/gsm/gsup.c
index ef33ed0..58ead06 100644
--- a/src/gsm/gsup.c
+++ b/src/gsm/gsup.c
@@ -103,6 +103,10 @@

OSMO_VALUE_STRING(OSMO_GSUP_MSGT_ROUTING_ERROR),

+   OSMO_VALUE_STRING(OSMO_GSUP_MSGT_EPDG_TUNNEL_REQUEST),
+   OSMO_VALUE_STRING(OSMO_GSUP_MSGT_EPDG_TUNNEL_RESULT),
+   OSMO_VALUE_STRING(OSMO_GSUP_MSGT_EPDG_TUNNEL_ERROR),
+
{ 0, NULL }
 };

@@ -911,6 +915,7 @@
{ OSMO_GSUP_MESSAGE_CLASS_SMS, "SMS" },
{ OSMO_GSUP_MESSAGE_CLASS_USSD, "USSD" },
{ OSMO_GSUP_MESSAGE_CLASS_INTER_MSC, "Inter-MSC" },
+   { OSMO_GSUP_MESSAGE_CLASS_IPSEC_EPDG, "IPSEC-EPDG" },
{}
 };


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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I6f7c20340c99f94b1326a8a7dc99c86cf6a0dbc3
Gerrit-Change-Number: 32033
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


[M] Change in osmo-ttcn3-hacks[master]: HLR_Tests: add testcase for multiple APNs in subscriber data

2023-04-26 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/32510 )


Change subject: HLR_Tests: add testcase for multiple APNs in subscriber data
..

HLR_Tests: add testcase for multiple APNs in subscriber data

With a new HLR version there are multiple APN possible in the
Subscriber Data (PDP Info).

Change-Id: I8d0c08272bc239370e800d6014ab9c68087b8989
Signed-off-by: Alexander Couzens 
---
M hlr/HLR_Tests.ttcn
M library/GSUP_Types.ttcn
2 files changed, 130 insertions(+), 2 deletions(-)



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

diff --git a/hlr/HLR_Tests.ttcn b/hlr/HLR_Tests.ttcn
index 959c680..a778703 100644
--- a/hlr/HLR_Tests.ttcn
+++ b/hlr/HLR_Tests.ttcn
@@ -535,12 +535,15 @@
return ret;
 }
 
+/* return_isd -> return the Insert Subscriber Data instead of the Update 
Location Result */
 function f_perform_UL(hexstring imsi, template hexstring msisdn,
template (omit) integer exp_err_cause := omit,
GSUP_CnDomain dom := OSMO_GSUP_CN_DOMAIN_PS,
-   template (omit) octetstring source_name := omit)
+   template (omit) octetstring source_name := omit,
+   boolean return_isd := false)
 runs on HLR_ConnHdlr return GSUP_PDU {
var GSUP_PDU ret;
+   var GSUP_PDU isd;
timer T := 3.0;
var boolean exp_fail := false;
var boolean isd_done := false;
@@ -570,7 +573,7 @@
setverdict(fail, "Unexpected UL ERROR");
mtc.stop;
}
-   [not exp_fail and not isd_done] GSUP.receive(tr_GSUP_ISD_REQ(imsi, 
msisdn, destination_name := source_name)) -> value ret {
+   [not exp_fail and not isd_done] GSUP.receive(tr_GSUP_ISD_REQ(imsi, 
msisdn, destination_name := source_name)) -> value isd {
GSUP.send(ts_GSUP_ISD_RES(imsi, source_name := source_name));
isd_done := true;
repeat;
@@ -584,6 +587,10 @@
mtc.stop;
}
}
+   if (return_isd) {
+   return isd;
+   }
+
return ret;
 }

@@ -994,6 +1001,7 @@
res := f_perform_UL(g_pars.sub.imsi, g_pars.sub.msisdn, source_name := 
g_pars.source_name);
setverdict(pass);
 }
+
 testcase TC_gsup_ul() runs on test_CT {
var HlrSubscriberList sl;
var GSUP_PDU res;
@@ -1015,6 +1023,70 @@
setverdict(pass);
 }

+private function f_TC_gsup_ul_subscriber_data() runs on HLR_ConnHdlr {
+   var GSUP_PDU isd;
+   log("GSUP ul subscriber_data", isd);
+   isd := f_perform_UL(g_pars.sub.imsi, g_pars.sub.msisdn, source_name := 
g_pars.source_name, return_isd := true);
+
+   template GSUP_IEs tr_pdp_info_internet := {
+   tr_GSUP_IE_PDP_CONTEXT_ID('01'O),
+   tr_GSUP_IE_APN(char2oct("internet"))
+   }
+   template GSUP_IEs tr_pdp_info_wildcard := {
+   tr_GSUP_IE_PDP_CONTEXT_ID('02'O),
+   tr_GSUP_IE_APN(char2oct("*"))
+   }
+
+   /* Search for PDP info 'internet', '*' */
+   var boolean found := false;
+   var GSUP_IeValue ievalue;
+   var GSUP_IEs pdp_info;
+   found := f_gsup_find_nested_ie_multiple(isd.ies, OSMO_GSUP_PDP_INFO_IE, 
0, ievalue);
+   if (not found) {
+   setverdict(fail, "Multiple APNs: Coulnd't find first PDP Info 
IE in: ", isd);
+   return;
+   }
+   pdp_info := ievalue.pdp_info;
+   if (not match(pdp_info, tr_pdp_info_internet)) {
+   setverdict(fail, "Multiple APNs: first PDP Info doesn't match: 
", pdp_info, "on Template: ", tr_pdp_info_internet);
+   return;
+   }
+
+   /* wildcard '*' */
+   found := f_gsup_find_nested_ie_multiple(isd.ies, OSMO_GSUP_PDP_INFO_IE, 
1, ievalue);
+   if (not found) {
+   setverdict(fail, "Multiple APNs: Coulnd't find second PDP Info 
IE in: ", isd);
+   return;
+   }
+   pdp_info := ievalue.pdp_info;
+   if (not match(pdp_info, tr_pdp_info_wildcard)) {
+   setverdict(fail, "Multiple APNs: second PDP Info doesn't match: 
", pdp_info, "on Template: ", tr_pdp_info_wildcard);
+   return;
+   }
+
+   setverdict(pass);
+}
+
+testcase TC_gsup_ul_subscriber_data() runs on test_CT {
+   /* Do a GSUP Update Location Request to get a Insert Subscriber Data 
Request (ISD).
+* Check for multiple APN in the ISD:
+* SGSN  -> HLR: Update Location Request
+* SGSN <-  HLR: Insert Subscriber Data Request (Check the TLV)
+* SGSN  -> HLR: Insert Subscriber Data Resul

[M] Change in osmo-hlr[master]: hlr: use talloc for memory allocation in osmo_gsup_create_insert_subs...

2023-04-26 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-hlr/+/32511 )


Change subject: hlr: use talloc for memory allocation in 
osmo_gsup_create_insert_subscriber_data_msg
..

hlr: use talloc for memory allocation in 
osmo_gsup_create_insert_subscriber_data_msg

Don't use static buffers for APN and MSISDN.
When encoding multiple APNs the static buffer might be to small.
In prepration to support multiple APNs in subscriber data

Change-Id: I00b5c2dfadcf6e0740e93b4c3292d2654d22e80c
---
M include/osmocom/hlr/gsup_server.h
M src/gsup_server.c
M src/hlr.c
M src/lu_fsm.c
4 files changed, 38 insertions(+), 34 deletions(-)



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

diff --git a/include/osmocom/hlr/gsup_server.h 
b/include/osmocom/hlr/gsup_server.h
index 9c562e2..86ae4ec 100644
--- a/include/osmocom/hlr/gsup_server.h
+++ b/include/osmocom/hlr/gsup_server.h
@@ -69,8 +69,6 @@
 int osmo_gsup_configure_wildcard_apn(struct osmo_gsup_message *gsup,
 uint8_t *apn_buf, size_t apn_buf_size);
 int osmo_gsup_create_insert_subscriber_data_msg(struct osmo_gsup_message 
*gsup, const char *imsi, const char *msisdn,
-   uint8_t *msisdn_enc, size_t 
msisdn_enc_size,
-   uint8_t *apn_buf, size_t 
apn_buf_size,
-   enum osmo_gsup_cn_domain cn_domain);
+   enum osmo_gsup_cn_domain cn_domain, 
void *talloc_ctx);
 int osmo_gsup_forward_to_local_peer(struct osmo_gsup_server *server, const 
struct osmo_cni_peer_id *to_peer,
struct osmo_gsup_req *req, struct 
osmo_gsup_message *modified_gsup);
diff --git a/src/gsup_server.c b/src/gsup_server.c
index f0d8101..b14a791 100644
--- a/src/gsup_server.c
+++ b/src/gsup_server.c
@@ -446,19 +446,16 @@
  * \param[out] gsup  The gsup message to populate.
  * \param[in] imsi  The subscriber's IMSI.
  * \param[in] msisdn The subscriber's MSISDN.
- * \param[out] msisdn_enc A buffer large enough to store the MSISDN in encoded 
form.
- * \param[in] msisdn_enc_size Size of the buffer (must be >= 
OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN).
- * \param[out] apn_buf A buffer large enough to store an APN (required if 
cn_domain is OSMO_GSUP_CN_DOMAIN_PS).
- * \param[in] apn_buf_size Size of APN buffer (must be >= APN_MAXLEN).
  * \param[in] cn_domain The CN Domain of the subscriber connection.
+ * \param[in] talloc_ctx To allocation memory for dynamic fields (msisdn, apn) 
in the gsup field
  * \returns 0 on success, and negative on error.
  */
 int osmo_gsup_create_insert_subscriber_data_msg(struct osmo_gsup_message 
*gsup, const char *imsi, const char *msisdn,
-   uint8_t *msisdn_enc, size_t 
msisdn_enc_size,
-   uint8_t *apn_buf, size_t 
apn_buf_size,
-   enum osmo_gsup_cn_domain 
cn_domain)
+   enum osmo_gsup_cn_domain 
cn_domain,
+   void *talloc_ctx)
 {
int len;
+   char *msisdn_buf = talloc_size(talloc_ctx, 
OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN);

OSMO_ASSERT(gsup);
*gsup = (struct osmo_gsup_message){
@@ -467,27 +464,22 @@

osmo_strlcpy(gsup->imsi, imsi, sizeof(gsup->imsi));

-   if (msisdn_enc_size < OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN)
-   return -ENOSPC;
-
-   OSMO_ASSERT(msisdn_enc);
-   len = gsm48_encode_bcd_number(msisdn_enc, msisdn_enc_size, 0, msisdn);
+   len = gsm48_encode_bcd_number(msisdn_buf, 
OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN, 0, msisdn);
if (len < 1) {
LOGP(DLGSUP, LOGL_ERROR, "%s: Error: cannot encode MSISDN 
'%s'\n", imsi, msisdn);
return -ENOSPC;
}
-   gsup->msisdn_enc = msisdn_enc;
+   gsup->msisdn_enc = msisdn_buf;
gsup->msisdn_enc_len = len;

#pragma message "FIXME: deal with encoding the following data: 
gsup.hlr_enc"

gsup->cn_domain = cn_domain;
if (gsup->cn_domain == OSMO_GSUP_CN_DOMAIN_PS) {
-   OSMO_ASSERT(apn_buf_size >= APN_MAXLEN);
-   OSMO_ASSERT(apn_buf);
+   char *apn_buf = talloc_size(talloc_ctx, APN_MAXLEN);
/* FIXME: PDP infos - use more fine-grained access control
   instead of wildcard APN */
-   osmo_gsup_configure_wildcard_apn(gsup, apn_buf, apn_buf_size);
+   osmo_gsup_configure_wildcard_apn(gsup, apn_buf, APN_MAXLEN);
}

return 0;
diff --git a/src/hlr.c b/src/hlr.c
index 8183d9b..9f9cb58 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -85,8 +85,7 @@

   

[L] Change in osmo-hlr[master]: Add support for multiple APN profiles for subscriber data

2023-04-26 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-hlr/+/32512 )


Change subject: Add support for multiple APN profiles for subscriber data
..

Add support for multiple APN profiles for subscriber data

Previous the HLR sent in the Insert Subscriber Data call only the
wildcard APN as a single entry.
This violates the spec because the first entry (with the lowest context_id) is
always the default APN, but it is forbidden to have a wildcard APN as default 
apn.

Introduce a default template/profile which can contain multiple APNs.
This profile is always sent out to the SGSN/MME as part of 
Insert-Subscriber-Data.
In the future a subscriber might have a profile template name written into the
database which will resolve to a "pdp-profile premium" in the configuration.

To be backward compatible, if the pdp-profile default section is missing,
the HLR will send out only a wildcard APN.

Config example:

hlr
 ps
  pdp-profile default
   profile 1
apn internet
   profile 2
apn *

TODO: check if SGSN is fine with this
TODO: check if we can inform all PS session on change of the config
Change-Id: I540132ee5dcfd09f4816e02e702927e1074ca50f
---
M doc/examples/osmo-hlr.cfg
M include/osmocom/hlr/hlr.h
A include/osmocom/hlr/hlr_ps.h
M include/osmocom/hlr/hlr_vty.h
M src/gsup_server.c
M src/hlr_vty.c
M tests/test_nodes.vty
7 files changed, 316 insertions(+), 5 deletions(-)



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

diff --git a/doc/examples/osmo-hlr.cfg b/doc/examples/osmo-hlr.cfg
index dabfc8e..dd5292e 100644
--- a/doc/examples/osmo-hlr.cfg
+++ b/doc/examples/osmo-hlr.cfg
@@ -24,3 +24,9 @@
   bind ip 127.0.0.1
  ussd route prefix *#100# internal own-msisdn
  ussd route prefix *#101# internal own-imsi
+ ps
+  pdp-profiles default
+   profile 1
+apn internet
+   profile 2
+apn *
diff --git a/include/osmocom/hlr/hlr.h b/include/osmocom/hlr/hlr.h
index b27fb3d..dc0c77e 100644
--- a/include/osmocom/hlr/hlr.h
+++ b/include/osmocom/hlr/hlr.h
@@ -58,6 +58,14 @@
struct hlr_euse *euse_default;
enum gsm48_gmm_cause reject_cause;
enum gsm48_gmm_cause no_proxy_reject_cause;
+   /* PS: APN default configuration used by Subscription Data on ISR */
+   struct {
+   struct {
+   bool enabled;
+   struct osmo_gsup_pdp_info 
pdp_infos[OSMO_GSUP_MAX_NUM_PDP_INFO];
+   size_t num_pdp_infos;
+   } pdp_profile;
+   } ps;

/* NCSS (call independent) session guard timeout value */
int ncss_guard_timeout;
diff --git a/include/osmocom/hlr/hlr_ps.h b/include/osmocom/hlr/hlr_ps.h
new file mode 100644
index 000..d84a0af
--- /dev/null
+++ b/include/osmocom/hlr/hlr_ps.h
@@ -0,0 +1,37 @@
+/* OsmoHLR packet switched header */
+
+/* (C) 2023 sysmocom s.f.m.c. GmbH 
+ * All Rights Reserved
+ *
+ * Author: Alexander Couzens 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+struct hlr_pdp_profile {
+   struct llist_head list;
+   int context_id;
+   const char *apn;
+}
+
+
+/* PS: APN default configuration used by Subscription Data on ISR */
+struct {
+   struct {
+   bool enabled;
+   struct osmo_gsup_pdp_info pdp_infos[OSMO_GSUP_MAX_NUM_PDP_INFO];
+   size_t num_pdp_infos;
+   } pdp_profile;
+} ps;
diff --git a/include/osmocom/hlr/hlr_vty.h b/include/osmocom/hlr/hlr_vty.h
index 83691b8..1674075 100644
--- a/include/osmocom/hlr/hlr_vty.h
+++ b/include/osmocom/hlr/hlr_vty.h
@@ -35,6 +35,9 @@
MSLOOKUP_SERVER_NODE,
MSLOOKUP_SERVER_MSC_NODE,
MSLOOKUP_CLIENT_NODE,
+   PS_NODE,
+   PS_PDP_PROFILES_NODE,
+   PS_PDP_PROFILES_PROFILE_NODE,
 };


diff --git a/src/gsup_server.c b/src/gsup_server.c
index b14a791..5230e69 100644
--- a/src/gsup_server.c
+++ b/src/gsup_server.c
@@ -32,6 +32,7 @@

 #include 
 #include 
+#include 

 #define LOG_GSUP_CONN(conn, level, fmt, args...) \
LOGP(DLGSUP, level, "GSUP peer %s: " fmt, \
@@ -455,7 +456,7 @@
void *talloc_ctx)
 {
int len;
-   char *msisdn_buf = talloc_size(talloc_ctx, 
OSMO_GSUP_MAX_CALLED_PARTY_BCD_LEN);
+

[S] Change in ...osmo_dia2gsup[master]: Allow to add APN wildcard via configuration

2023-04-26 Thread lynxis lazus
lynxis lazus has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/32513 )


Change subject: Allow to add APN wildcard via configuration
..

Allow to add APN wildcard via configuration

If the osmo-hlr doesn't send a default APN but it is required.
Set application environment append_default_apn to "true".
See the example sys.config.

Change-Id: I5767cb3c4082809f2ac5a4361a4758b54f24ad48
---
M examples/sys.config
M src/server_cb.erl
2 files changed, 44 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_dia2gsup 
refs/changes/13/32513/1

diff --git a/examples/sys.config b/examples/sys.config
index 8814893..8ad9bdf 100644
--- a/examples/sys.config
+++ b/examples/sys.config
@@ -8,5 +8,7 @@

 {origin_host, "hss.localdomain"},
 {origin_realm, "localdomain"},
-{vendor_id, 0}
+{vendor_id, 0},
+% Append default APN to diameter
+{append_default_apn, "false"}
 ]}].
diff --git a/src/server_cb.erl b/src/server_cb.erl
index fc8e397..709ef44 100644
--- a/src/server_cb.erl
+++ b/src/server_cb.erl
@@ -136,6 +136,22 @@
 'Pre-emption-Vulnerability'=1}
}).

+-spec gen_default_apn(integer()) -> #'APN-Configuration'{}.
+gen_default_apn(ContextIdentifier) ->
+   #'APN-Configuration'{'Context-Identifier' = ContextIdentifier,
+'PDN-Type' = ?PDN_TYPE_DEFAULT,
+% The EPS-Subscribed-QoS-Profile AVP and the AMBR 
AVP shall be present in the
+% APN-Configuration AVP when the APN-Configuration 
AVP is sent in the
+% APN-Configuration-Profile AVP and when the 
APN-Configuration-Profile AVP is
+% sent within a ULA (as part of the 
Subscription-Data AVP).
+'EPS-Subscribed-QoS-Profile' = ?EPS_QOS_DEFAULT,
+'AMBR' = #'AMBR'{'Max-Requested-Bandwidth-UL' = 
1,
+ 'Max-Requested-Bandwidth-DL' = 
1},
+% The default APN Configuration shall not contain 
the Wildcard APN (see 3GPP TS
+% 23.003 [3], clause 9.2); the default APN shall 
always contain an explicit APN
+'Service-Selection' = "*"
+   }.
+
 -spec gsup_pdp2dia_apn('GSUPPdpInfo'()) -> #'APN-Configuration'{}.
 gsup_pdp2dia_apn(GsupPdpInfo) ->
#'APN-Configuration'{'Context-Identifier' = maps:get(pdp_context_id, 
GsupPdpInfo),
@@ -275,7 +291,18 @@
  
'PDP-Context'=PdpContexts},

% build the APN-Configuration-Profile
-   ApnCfgList = lists:map(fun 
gsup_pdp2dia_apn/1, PdpInfoList),
+   ApnCfgList2 = lists:map(fun 
gsup_pdp2dia_apn/1, PdpInfoList),
+   % append default apn
+   AppendDefaultApn = 
application:get_env(osmo_dia2gsup, append_default_apn, "true"),
+   case AppendDefaultApn of
+   "true" ->
+   LastApn = 
lists:last(ApnCfgList2),
+   ApnCfgList = 
ApnCfgList2 ++ 
[gen_default_apn(LastApn#'APN-Configuration'.'Context-Identifier' + 1)];
+   _ ->
+   ApnCfgList = ApnCfgList2
+   end,
+   lager:info("ApnCfgList: ~p~n", 
[ApnCfgList]),
+
FirstApn = lists:nth(1, ApnCfgList),
DefaultCtxId = 
FirstApn#'APN-Configuration'.'Context-Identifier',
ApnCfgProf = 
#'APN-Configuration-Profile'{'Context-Identifier' = DefaultCtxId,

--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/32513
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: erlang/osmo_dia2gsup
Gerrit-Branch: master
Gerrit-Change-Id: I5767cb3c4082809f2ac5a4361a4758b54f24ad48
Gerrit-Change-Number: 32513
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus 
Gerrit-MessageType: newchange


<    5   6   7   8   9   10   11   12   13   14   >