Change in osmo-ttcn3-hacks[master]: sgsn: Add TC_llc_null to test if SGSN survives a LLC NULL packet

Harald Welte gerrit-no-reply at lists.osmocom.org
Tue Apr 23 20:37:50 UTC 2019


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/13760


Change subject: sgsn: Add TC_llc_null to test if SGSN survives a LLC NULL packet
......................................................................

sgsn: Add TC_llc_null to test if SGSN survives a LLC NULL packet

This test case reproduces a bug in OsmoSGSN where it would crash
as a result to sending LLC NULL frames.

Change-Id: I38326f2ebaaff009d4357edad9511ce2ce7736fd
Related: OS#3952
---
M sgsn/SGSN_Tests.ttcn
1 file changed, 25 insertions(+), 2 deletions(-)



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

diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 74cdece..5280e50 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -375,12 +375,16 @@
 	f_sleep(20.0);
 }
 
+function f_send_llc(template (value) PDU_LLC llc_pdu, integer gb_index := 0) runs on BSSGP_ConnHdlr {
+	var octetstring llc_enc := enc_PDU_LLC(valueof(llc_pdu));
+	BSSGP[gb_index].send(ts_BSSGP_UL_UD(g_pars.tlli, g_pars.bssgp_cell_id[gb_index], llc_enc));
+}
+
 function f_send_l3_gmm_llc(template PDU_L3_MS_SGSN l3_mo, integer gb_index := 0) runs on BSSGP_ConnHdlr {
 	var octetstring l3_enc := enc_PDU_L3_MS_SGSN(valueof(l3_mo));
 	var BIT4 sapi := f_llc_sapi_by_l3_mo(valueof(l3_mo));
 	var integer n_u := f_llc_get_n_u_tx(llc[bit2int(sapi)]);
-	var octetstring llc_enc := enc_PDU_LLC(valueof(ts_LLC_UI(l3_enc, sapi, '0'B, n_u)));
-	BSSGP[gb_index].send(ts_BSSGP_UL_UD(g_pars.tlli, g_pars.bssgp_cell_id[gb_index], llc_enc));
+	f_send_llc(ts_LLC_UI(l3_enc, sapi, '0'B, n_u));
 }
 
 altstep as_mm_identity() runs on BSSGP_ConnHdlr {
@@ -2153,6 +2157,23 @@
 	vc_conn.done;
 }
 
+
+/* Send LLC NULL to see if the SGSN survives it (OS#3952) */
+private function f_TC_llc_null(charstring id) runs on BSSGP_ConnHdlr {
+	f_gmm_attach(false, false);
+	f_sleep(1.0);
+	f_send_llc(ts_LLC_NULL('0'B, c_LLC_SAPI_LLGMM, LLC_CR_UL_CMD));
+	/* try another attach to see if SGSN is still alive */
+	f_gmm_attach(false, false);
+}
+testcase TC_llc_null() runs on test_CT {
+	var BSSGP_ConnHdlr vc_conn;
+	f_init();
+	f_sleep(1.0);
+	vc_conn := f_start_handler(refers(f_TC_llc_null), testcasename(), g_gb, 41);
+	vc_conn.done;
+}
+
 control {
 	execute( TC_attach() );
 	execute( TC_attach_mnc3() );
@@ -2197,6 +2218,8 @@
 	execute( TC_attach_pdp_act_deact_mt_t3395_expire() );
 	execute( TC_attach_pdp_act_user_error_ind_ggsn() );
 	execute( TC_attach_gmm_attach_req_while_gmm_attach() );
+
+	execute( TC_llc_null() );
 }
 
 

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

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I38326f2ebaaff009d4357edad9511ce2ce7736fd
Gerrit-Change-Number: 13760
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190423/b5deb53a/attachment.html>


More information about the gerrit-log mailing list