gbproxy: Use correct NRI in suspend/resume

We cannot choose a random TLLI anymore, as this will obviously end up
at a random SGSN, and not the one we're targeting.

Change-Id: I665eda9e04cbf505f55abc9bcd414d6cbd6a36dd
This commit is contained in:
Harald Welte 2021-01-15 20:38:58 +01:00
parent 009637505f
commit 99ed50731a
1 changed files with 12 additions and 6 deletions

View File

@ -1066,11 +1066,14 @@ testcase TC_radio_status() runs on test_CT
f_cleanup();
}
private function f_suspend_one(integer sgsn_idx, integer pcu_idx, integer bvc_idx, integer suffix)
private function f_suspend_one(integer sgsn_idx, integer nri_idx, integer pcu_idx, integer bvc_idx,
integer suffix)
runs on GlobalTest_CT
{
var RoutingAreaIdentification ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id;
var OCT4 tlli := f_gprs_tlli_random();
var OCT4 p_tmsi := f_gen_tmsi(suffix, nri_v := mp_sgsn_nri[sgsn_idx][nri_idx],
nri_bitlen := mp_nri_bitlength);
var OCT4 tlli := f_gprs_tlli_from_tmsi(p_tmsi, TLLI_LOCAL);
var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_SUSPEND(tlli, ra_id);
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_SUSPEND(tlli, ra_id);
@ -1098,7 +1101,7 @@ private function f_TC_suspend() runs on GlobalTest_CT {
/* TODO: Generate RA ID for each ConnHdlr */
for (i := 0; i < 10; i := i+1) {
f_suspend_one(0, 0, 0, i);
f_suspend_one(sgsn_idx := 0, nri_idx := 0, pcu_idx := 0, bvc_idx := 0, suffix := i);
}
setverdict(pass);
}
@ -1110,11 +1113,14 @@ testcase TC_suspend() runs on GlobalTest_CT
f_cleanup();
}
private function f_resume_one(integer sgsn_idx, integer pcu_idx, integer bvc_idx, integer suffix)
private function f_resume_one(integer sgsn_idx, integer nri_idx, integer pcu_idx, integer bvc_idx,
integer suffix)
runs on GlobalTest_CT
{
var RoutingAreaIdentification ra_id := g_pcu[pcu_idx].cfg.bvc[bvc_idx].cell_id.ra_id;
var OCT4 tlli := f_gprs_tlli_random();
var OCT4 p_tmsi := f_gen_tmsi(suffix, nri_v := mp_sgsn_nri[sgsn_idx][nri_idx],
nri_bitlen := mp_nri_bitlength);
var OCT4 tlli := f_gprs_tlli_from_tmsi(p_tmsi, TLLI_LOCAL);
var template (value) PDU_BSSGP pdu_tx := ts_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));
/* we cannot use pdu_tx as there are some subtle differences in the length field :/ */
var template (present) PDU_BSSGP pdu_rx := tr_BSSGP_RESUME(tlli, ra_id, int2oct(suffix, 1));
@ -1141,7 +1147,7 @@ private function f_TC_resume() runs on GlobalTest_CT {
var integer i;
for (i := 0; i < 10; i := i+1) {
f_resume_one(0, 0, 0, i);
f_resume_one(sgsn_idx := 0, nri_idx := 0, pcu_idx := 0, bvc_idx := 0, suffix := i);
}
setverdict(pass);
}