aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-06-09 13:29:41 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-06-09 13:40:27 +0200
commitee1034795770ff11ade2215d5abcb3692237df52 (patch)
tree4b370f89c58471f6c80b0bdcd6ff0c80e757eb33
parente4e047bbec95aaede7ad381781e28ed3e98ccb44 (diff)
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
-rw-r--r--src/xua_asp_fsm.c17
1 files changed, 15 insertions, 2 deletions
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 @@ static void ipa_asp_fsm_wait_id_get(struct osmo_fsm_inst *fi, uint32_t event, vo
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 @@ static void ipa_asp_fsm_wait_id_get(struct osmo_fsm_inst *fi, uint32_t event, vo
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 @@ static const struct osmo_fsm_state ipa_asp_states[] = {
},
/* 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,
},