From ab50cc295b85b65ee3bcfb4ade1be183819622a2 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 25 Nov 2020 17:11:08 +0100 Subject: [PATCH] BSSGP_Emulation: Fix inbound BVC-RESET We cannot handle this in as_ptp_allstate(), as the respective clauses are never hit: In as_ptp_unblocked() we broadcast all BSSGP messages without a TLLI, "hiding" the BVC-RESET handling. Change-Id: Ie3e7a997554e6af42ae7e7294829b6f8d2447d60 --- library/BSSGP_Emulation.ttcnpp | 41 ++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/library/BSSGP_Emulation.ttcnpp b/library/BSSGP_Emulation.ttcnpp index 2a87b3556..c430f877a 100644 --- a/library/BSSGP_Emulation.ttcnpp +++ b/library/BSSGP_Emulation.ttcnpp @@ -994,6 +994,8 @@ private altstep as_ptp_blocked() runs on BSSGP_BVC_CT { f_ptp_change_state(BVC_S_UNBLOCKED); } + [] as_ptp_handle_inbound_reset(); + [] g_T2.timeout { /* BVC-RESET-ACK PDU was not received within T2: retransmit */ f_ptp_sendReset(g_last_reset_cause); @@ -1041,6 +1043,8 @@ private altstep as_ptp_unblocked() runs on BSSGP_BVC_CT { f_ptp_sendBlock(g_last_block_cause); } + [] as_ptp_handle_inbound_reset(); + /* simply acknowledge all per-BVC Flow Control Messages */ [g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_FC_BVC, g_cfg.bvci)) -> value udi { var OCT1 tag := udi.bssgp.pDU_BSSGP_FLOW_CONTROL_BVC.tag.unstructured_Value; @@ -1148,6 +1152,26 @@ private altstep as_ptp_unblocked() runs on BSSGP_BVC_CT { } } +private altstep as_ptp_handle_inbound_reset() runs on BSSGP_BVC_CT { + var NsUnitdataIndication udi; + /* we are a SGSN: BSS/PCU-originated RESET must have a cell ID */ + [g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_RESET(?, g_cfg.bvci, g_cfg.cell_id), 0)) -> value udi { + log("Rx BVC-RESET from BVCI=", g_cfg.bvci); + /* Respond to RESET with correct BVCI but without CellID */ + BVC.send(ts_ptp_BnsUdReq(ts_BVC_RESET_ACK(g_cfg.bvci, omit), 0, g_bvc_lsp)); + /* FIXME: reset all state? What about clients? */ + f_ptp_change_state(BVC_S_UNBLOCKED); + } + /* we are a BSS/PCU: SGSN-originated RESET must not have a cell ID */ + [not g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_RESET(?, g_cfg.bvci, omit), 0)) -> value udi { + log("Rx BVC-RESET from BVCI=", g_cfg.bvci); + /* Respond to RESET with correct BVCI with CellID */ + BVC.send(ts_ptp_BnsUdReq(ts_BVC_RESET_ACK(g_cfg.bvci, g_cfg.cell_id), 0, g_bvc_lsp)); + /* FIXME: reset all state? What about clients? */ + f_ptp_change_state(BVC_S_UNBLOCKED); + } +} + /* Events permitted in all states */ private altstep as_ptp_allstate() runs on BSSGP_BVC_CT { var NsUnitdataIndication udi; @@ -1171,23 +1195,6 @@ private altstep as_ptp_allstate() runs on BSSGP_BVC_CT { } } - /* we are a SGSN: BSS/PCU-originated RESET must have a cell ID */ - [g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_RESET(?, g_cfg.bvci, g_cfg.cell_id), 0)) -> value udi { - log("Rx BVC-RESET from BVCI=", g_cfg.bvci); - /* Respond to RESET with correct BVCI but without CellID */ - BVC.send(ts_ptp_BnsUdReq(ts_BVC_RESET_ACK(g_cfg.bvci, omit), 0, g_bvc_lsp)); - /* FIXME: reset all state? What about clients? */ - f_ptp_change_state(BVC_S_UNBLOCKED); - } - /* we are a BSS/PCU: SGSN-originated RESET must not have a cell ID */ - [not g_sgsn_role] BVC.receive(tr_ptp_BnsUdInd(tr_BVC_RESET(?, g_cfg.bvci, omit), 0)) -> value udi { - log("Rx BVC-RESET from BVCI=", g_cfg.bvci); - /* Respond to RESET with correct BVCI with CellID */ - BVC.send(ts_ptp_BnsUdReq(ts_BVC_RESET_ACK(g_cfg.bvci, g_cfg.cell_id), 0, g_bvc_lsp)); - /* FIXME: reset all state? What about clients? */ - f_ptp_change_state(BVC_S_UNBLOCKED); - } - /* Ignore those for now */ [] BVC.receive(ASP_Event:?) { } [] BVC.receive(BssgpStatusIndication:?) { }