<p>laforge has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22899">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">NS_Emulation: Work around "alive" race condition in IP-SNS<br><br>We need to modify the state of each NS-VC within a NS-VCG/NSE once<br>we receive the final SNS-CONFIG-ACK PDU.  However, sometimes the<br>IUT sends its first NS-PDU _before_ we even have communicated the<br>state-change locally to all our NS-VCs.<br><br>In order to avoid the problem, let's mark the NS-VCs as alive before<br>sending the the SNS-CONFIG.  This means we have one RTT more time<br>to locally propagate the state change to all NS-VCs.<br><br>Change-Id: Idac522a81f01553df52dc012cbab15e1c73c0862<br>Closes: OS#5023<br>---<br>M library/NS_Emulation.ttcnpp<br>1 file changed, 12 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/99/22899/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp</span><br><span>index 1b9b1df..38f132a 100644</span><br><span>--- a/library/NS_Emulation.ttcnpp</span><br><span>+++ b/library/NS_Emulation.ttcnpp</span><br><span>@@ -263,7 +263,8 @@</span><br><span>       type enumerated NsCtrlRequest {</span><br><span>              StartAliveProcedure     (0),</span><br><span>                 DisableReq              (1),    /* administratively disable NS-VC */</span><br><span style="color: hsl(0, 100%, 40%);">-            EnableReq               (2)     /* administratively enable NS-VC */</span><br><span style="color: hsl(120, 100%, 40%);">+           EnableReq               (2),    /* administratively enable NS-VC */</span><br><span style="color: hsl(120, 100%, 40%);">+           ForceAliveState         (3)</span><br><span>  };</span><br><span> </span><br><span>       /* add one NSVC (component and table entry */</span><br><span>@@ -487,6 +488,10 @@</span><br><span>                                                                                 -> value sind sender vc {</span><br><span>                         /* blindly acknowledge whatever the PCU sends */</span><br><span>                     NSVC.send(SnsRequest:{sind.nsvci, ts_SNS_CONFIG_ACK(g_config.nsei, omit)}) to vc;</span><br><span style="color: hsl(120, 100%, 40%);">+                     /* switch to "alive" state already before sending the SNS-CONFIG, as otherwise</span><br><span style="color: hsl(120, 100%, 40%);">+                       * there would be a race condition between internally performing the state change</span><br><span style="color: hsl(120, 100%, 40%);">+                      * of all related NS-VCs and the first incoming NS-PDU after SNS-CONFIG-ACK */</span><br><span style="color: hsl(120, 100%, 40%);">+                        f_broadcast_ns_ctrl(NsCtrlRequest:ForceAliveState);</span><br><span>                  /* send a SNS-CONFIG in response and expect a SNS-CONFIG-ACK */</span><br><span>                      var template (omit) IP4_Elements v4;</span><br><span>                         var template (omit) IP6_Elements v6;</span><br><span>@@ -494,6 +499,9 @@</span><br><span>                   NSVC.send(SnsRequest:{sind.nsvci,</span><br><span>                                          ts_SNS_CONFIG(g_config.nsei, true, v4, v6)}) to vc;</span><br><span>                    alt {</span><br><span style="color: hsl(120, 100%, 40%);">+                 [] as_ns_common_status() {</span><br><span style="color: hsl(120, 100%, 40%);">+                            repeat;</span><br><span style="color: hsl(120, 100%, 40%);">+                               }</span><br><span>                    [] NSVC.receive(SnsIndication:{sind.nsvci,</span><br><span>                                                   tr_SNS_CONFIG_ACK(g_config.nsei, omit)}) from vc {</span><br><span>                           /* success */</span><br><span>@@ -735,8 +743,10 @@</span><br><span>                         setverdict(fail, "Unexpected SNS from NSVC: ", sreq);</span><br><span>                      self.stop;</span><br><span>           }</span><br><span style="color: hsl(0, 100%, 40%);">-               [] NS_SP.receive(NsCtrlRequest:StartAliveProcedure) {</span><br><span style="color: hsl(120, 100%, 40%);">+         [] NS_SP.receive(NsCtrlRequest:ForceAliveState) {</span><br><span>                    f_change_state(NSVC_S_ALIVE_UNBLOCKED);</span><br><span style="color: hsl(120, 100%, 40%);">+                       }</span><br><span style="color: hsl(120, 100%, 40%);">+             [] NS_SP.receive(NsCtrlRequest:StartAliveProcedure) {</span><br><span>                        f_sendAlive();</span><br><span>                       Tns_test.start;</span><br><span>              }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22899">change 22899</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/22899"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Idac522a81f01553df52dc012cbab15e1c73c0862 </div>
<div style="display:none"> Gerrit-Change-Number: 22899 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>