Change in libosmo-sccp[master]: ipa_asp_fsm: Support server starting handshake with ID_GET or ID_ACK

pespin gerrit-no-reply at lists.osmocom.org
Wed Jun 9 11:45:11 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/24638 )


Change subject: ipa_asp_fsm: Support server starting handshake with ID_GET or ID_ACK
......................................................................

ipa_asp_fsm: Support server starting handshake with ID_GET or ID_ACK

The behavior here since to have changed at least a couple times in
history, always apparently breaking some compatibility:

* libosmo-sccp.git a0dd986f5506ee8a625e827bc029d1aa962b6f65
  (SCCPLite MSC sends IPA ID ACK at startup) [10th July 2018]
* libosmo-sccp.git 9c0fae14d105b64ec9e8ff7322fa4aca782e54d1
  (Reverts back to sending IPA ID GET at startup [29th April 2021]
* osmo-ttcn3-hacks.git 3bf31d216a18c1d6a6e298a592f873beea322939
  (Changes server emulation to send IPA ID ACK when BSC connects to it) [24th August 2018)

So it seems the proper way is to start handshake:
CLI <- SRV: IPA ID GET
CLI -> SRV: IPA ID RESP
CLI <- SRV: IPA ID ACK
CLI -> SRV: IPA ID ACK

However, it seems some SCCPLite MSCs (acting as IPA srv) skip the first
ID GET + ID RESP handshake and go directly for ACKs:
CLI <- SRV: IPA ID ACK
CLI -> SRV: IPA ID ACK

So, let's make everybody happy and support both cases in the client FSM.
If server sends us IPA ID ACK first, simply send back an IPA ID ACK and
be done with it, otherwise if it sends us an IPA ID GET, go for the full
handshake.

Change-Id: Ie9968ce8cd8582deb583024ff3e46736a07883fe
---
M src/xua_asp_fsm.c
1 file changed, 15 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/38/24638/1

diff --git a/src/xua_asp_fsm.c b/src/xua_asp_fsm.c
index e4fb928..5fe1d80 100644
--- a/src/xua_asp_fsm.c
+++ b/src/xua_asp_fsm.c
@@ -964,6 +964,7 @@
 	struct msgb *msg_get, *msg_resp;
 	const uint8_t *req_data;
 	int data_len;
+	int fd;
 
 	switch (event) {
 	case IPA_ASP_E_ID_GET:
@@ -986,6 +987,16 @@
 		osmo_ss7_asp_send(asp, msg_resp);
 		osmo_fsm_inst_state_chg(fi, IPA_ASP_S_WAIT_ID_ACK, 10, T_WAIT_ID_ACK);
 		break;
+	case IPA_ASP_E_ID_ACK:
+		/* Some SCCPLite MSCs are known to send an ACK directly instead
+		 * of GET. Support them and skip the GET+RESP handshake by
+		 * sending ACK2 to server directly */
+		fd = get_fd_from_iafp(iafp);
+		if (fd >= 0) {
+			ipaccess_send_id_ack(fd);
+			osmo_fsm_inst_state_chg(fi, IPA_ASP_S_ACTIVE, 0, 0);
+		}
+		break;
 	}
 }
 
@@ -1114,8 +1125,10 @@
 	},
 	/* Client Side */
 	[IPA_ASP_S_WAIT_ID_GET] = {
-		.in_event_mask = S(IPA_ASP_E_ID_GET),
-		.out_state_mask = S(IPA_ASP_S_WAIT_ID_ACK),
+		.in_event_mask = S(IPA_ASP_E_ID_GET) |
+				 S(IPA_ASP_E_ID_ACK), /* support broken MSCs skipping GET+RESP */
+		.out_state_mask = S(IPA_ASP_S_WAIT_ID_ACK) |
+				  S(IPA_ASP_S_ACTIVE),  /* support broken MSCs skipping GET+RESP */
 		.name = "WAIT_ID_GET",
 		.action = ipa_asp_fsm_wait_id_get,
 	},

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/24638
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: Ie9968ce8cd8582deb583024ff3e46736a07883fe
Gerrit-Change-Number: 24638
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210609/adf11608/attachment.htm>


More information about the gerrit-log mailing list