<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/24638">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ipa_asp_fsm: Support server starting handshake with ID_GET or ID_ACK<br><br>The behavior here since to have changed at least a couple times in<br>history, always apparently breaking some compatibility:<br><br>* libosmo-sccp.git a0dd986f5506ee8a625e827bc029d1aa962b6f65<br>  (SCCPLite MSC sends IPA ID ACK at startup) [10th July 2018]<br>* libosmo-sccp.git 9c0fae14d105b64ec9e8ff7322fa4aca782e54d1<br>  (Reverts back to sending IPA ID GET at startup [29th April 2021]<br>* osmo-ttcn3-hacks.git 3bf31d216a18c1d6a6e298a592f873beea322939<br>  (Changes server emulation to send IPA ID ACK when BSC connects to it) [24th August 2018)<br><br>So it seems the proper way is to start handshake:<br>CLI <- SRV: IPA ID GET<br>CLI -> SRV: IPA ID RESP<br>CLI <- SRV: IPA ID ACK<br>CLI -> SRV: IPA ID ACK<br><br>However, it seems some SCCPLite MSCs (acting as IPA srv) skip the first<br>ID GET + ID RESP handshake and go directly for ACKs:<br>CLI <- SRV: IPA ID ACK<br>CLI -> SRV: IPA ID ACK<br><br>So, let's make everybody happy and support both cases in the client FSM.<br>If server sends us IPA ID ACK first, simply send back an IPA ID ACK and<br>be done with it, otherwise if it sends us an IPA ID GET, go for the full<br>handshake.<br><br>Change-Id: Ie9968ce8cd8582deb583024ff3e46736a07883fe<br>---<br>M src/xua_asp_fsm.c<br>1 file changed, 15 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/38/24638/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c</span><br><span>index e4fb928..5fe1d80 100644</span><br><span>--- a/src/xua_asp_fsm.c</span><br><span>+++ b/src/xua_asp_fsm.c</span><br><span>@@ -964,6 +964,7 @@</span><br><span>         struct msgb *msg_get, *msg_resp;</span><br><span>     const uint8_t *req_data;</span><br><span>     int data_len;</span><br><span style="color: hsl(120, 100%, 40%);">+ int fd;</span><br><span> </span><br><span>  switch (event) {</span><br><span>     case IPA_ASP_E_ID_GET:</span><br><span>@@ -986,6 +987,16 @@</span><br><span>                osmo_ss7_asp_send(asp, msg_resp);</span><br><span>            osmo_fsm_inst_state_chg(fi, IPA_ASP_S_WAIT_ID_ACK, 10, T_WAIT_ID_ACK);</span><br><span>               break;</span><br><span style="color: hsl(120, 100%, 40%);">+        case IPA_ASP_E_ID_ACK:</span><br><span style="color: hsl(120, 100%, 40%);">+                /* Some SCCPLite MSCs are known to send an ACK directly instead</span><br><span style="color: hsl(120, 100%, 40%);">+                * of GET. Support them and skip the GET+RESP handshake by</span><br><span style="color: hsl(120, 100%, 40%);">+             * sending ACK2 to server directly */</span><br><span style="color: hsl(120, 100%, 40%);">+         fd = get_fd_from_iafp(iafp);</span><br><span style="color: hsl(120, 100%, 40%);">+          if (fd >= 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                     ipaccess_send_id_ack(fd);</span><br><span style="color: hsl(120, 100%, 40%);">+                     osmo_fsm_inst_state_chg(fi, IPA_ASP_S_ACTIVE, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+          }</span><br><span style="color: hsl(120, 100%, 40%);">+             break;</span><br><span>       }</span><br><span> }</span><br><span> </span><br><span>@@ -1114,8 +1125,10 @@</span><br><span>  },</span><br><span>   /* Client Side */</span><br><span>    [IPA_ASP_S_WAIT_ID_GET] = {</span><br><span style="color: hsl(0, 100%, 40%);">-             .in_event_mask = S(IPA_ASP_E_ID_GET),</span><br><span style="color: hsl(0, 100%, 40%);">-           .out_state_mask = S(IPA_ASP_S_WAIT_ID_ACK),</span><br><span style="color: hsl(120, 100%, 40%);">+           .in_event_mask = S(IPA_ASP_E_ID_GET) |</span><br><span style="color: hsl(120, 100%, 40%);">+                                 S(IPA_ASP_E_ID_ACK), /* support broken MSCs skipping GET+RESP */</span><br><span style="color: hsl(120, 100%, 40%);">+             .out_state_mask = S(IPA_ASP_S_WAIT_ID_ACK) |</span><br><span style="color: hsl(120, 100%, 40%);">+                            S(IPA_ASP_S_ACTIVE),  /* support broken MSCs skipping GET+RESP */</span><br><span>          .name = "WAIT_ID_GET",</span><br><span>             .action = ipa_asp_fsm_wait_id_get,</span><br><span>   },</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmo-sccp/+/24638">change 24638</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/libosmo-sccp/+/24638"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmo-sccp </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ie9968ce8cd8582deb583024ff3e46736a07883fe </div>
<div style="display:none"> Gerrit-Change-Number: 24638 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>