summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2021-02-13 16:45:30 +0100
committerHarald Welte <laforge@osmocom.org>2021-02-13 16:49:25 +0100
commitc56800066d6e58adea8225fb2a4c87b135261c6b (patch)
tree430ea8d8c11d206e58a16e63b75b6dddb68a9232
parent516c5c725029d546602889a198507498a187443d (diff)
NS_Emulation: Work around "alive" race condition in IP-SNS
We need to modify the state of each NS-VC within a NS-VCG/NSE once we receive the final SNS-CONFIG-ACK PDU. However, sometimes the IUT sends its first NS-PDU _before_ we even have communicated the state-change locally to all our NS-VCs. In order to avoid the problem, let's mark the NS-VCs as alive before sending the the SNS-CONFIG. This means we have one RTT more time to locally propagate the state change to all NS-VCs. Change-Id: Idac522a81f01553df52dc012cbab15e1c73c0862 Closes: OS#5023
-rw-r--r--library/NS_Emulation.ttcnpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp
index 1b9b1df1..38f132a2 100644
--- a/library/NS_Emulation.ttcnpp
+++ b/library/NS_Emulation.ttcnpp
@@ -263,7 +263,8 @@ module NS_Emulation {
type enumerated NsCtrlRequest {
StartAliveProcedure (0),
DisableReq (1), /* administratively disable NS-VC */
- EnableReq (2) /* administratively enable NS-VC */
+ EnableReq (2), /* administratively enable NS-VC */
+ ForceAliveState (3)
};
/* add one NSVC (component and table entry */
@@ -487,6 +488,10 @@ module NS_Emulation {
-> value sind sender vc {
/* blindly acknowledge whatever the PCU sends */
NSVC.send(SnsRequest:{sind.nsvci, ts_SNS_CONFIG_ACK(g_config.nsei, omit)}) to vc;
+ /* switch to "alive" state already before sending the SNS-CONFIG, as otherwise
+ * there would be a race condition between internally performing the state change
+ * of all related NS-VCs and the first incoming NS-PDU after SNS-CONFIG-ACK */
+ f_broadcast_ns_ctrl(NsCtrlRequest:ForceAliveState);
/* send a SNS-CONFIG in response and expect a SNS-CONFIG-ACK */
var template (omit) IP4_Elements v4;
var template (omit) IP6_Elements v6;
@@ -494,6 +499,9 @@ module NS_Emulation {
NSVC.send(SnsRequest:{sind.nsvci,
ts_SNS_CONFIG(g_config.nsei, true, v4, v6)}) to vc;
alt {
+ [] as_ns_common_status() {
+ repeat;
+ }
[] NSVC.receive(SnsIndication:{sind.nsvci,
tr_SNS_CONFIG_ACK(g_config.nsei, omit)}) from vc {
/* success */
@@ -735,8 +743,10 @@ module NS_Emulation {
setverdict(fail, "Unexpected SNS from NSVC: ", sreq);
self.stop;
}
- [] NS_SP.receive(NsCtrlRequest:StartAliveProcedure) {
+ [] NS_SP.receive(NsCtrlRequest:ForceAliveState) {
f_change_state(NSVC_S_ALIVE_UNBLOCKED);
+ }
+ [] NS_SP.receive(NsCtrlRequest:StartAliveProcedure) {
f_sendAlive();
Tns_test.start;
}