client: Make ConfigClientBankReq with bankd_port == 0 trigger SRVC_E_DISCONNECT
If the server sends us ConfigClientBankReq with bankd_port == 0, then
this means that we shall disconnect from the bankd. Translate this to
the SRVC_E_DISCONNECT event towards the RSPRO connection FSM.
Change-Id: Idbfbfa0e84fa14dcb913b4dcbd943bc80ec175ac
Related: OS#4399
diff --git a/src/client/remsim_client.c b/src/client/remsim_client.c
index 07ffbde..dd78c8e 100644
--- a/src/client/remsim_client.c
+++ b/src/client/remsim_client.c
@@ -83,8 +83,11 @@
rspro_IpAddr2str(&pdu->msg.choice.configClientBankReq.bankd.ip));
rspro2bank_slot(&bc->bankd_slot, &pdu->msg.choice.configClientBankReq.bankSlot);
bc->bankd_conn.server_port = pdu->msg.choice.configClientBankReq.bankd.port;
- /* instruct bankd FSM to connect */
- osmo_fsm_inst_dispatch(bc->bankd_conn.fi, SRVC_E_ESTABLISH, NULL);
+ /* bankd port 0 is a magic value to indicate "no bankd" */
+ if (bc->bankd_conn.server_port == 0)
+ osmo_fsm_inst_dispatch(bc->bankd_conn.fi, SRVC_E_DISCONNECT, NULL);
+ else
+ osmo_fsm_inst_dispatch(bc->bankd_conn.fi, SRVC_E_ESTABLISH, NULL);
/* send response to server */
resp = rspro_gen_ConfigClientBankRes(ResultCode_ok);
server_conn_send_rspro(srvc, resp);
diff --git a/src/client/simtrace2-remsim_client.c b/src/client/simtrace2-remsim_client.c
index bee8fc9..2929574 100644
--- a/src/client/simtrace2-remsim_client.c
+++ b/src/client/simtrace2-remsim_client.c
@@ -1,4 +1,4 @@
-/* (C) 2018-2019 by Harald Welte <laforge@gnumonks.org>
+/* (C) 2018-2020 by Harald Welte <laforge@gnumonks.org>
* (C) 2018 by sysmocom - s.f.m.c. GmbH, Author: Kevin Redon
*
* All Rights Reserved
@@ -874,8 +874,11 @@
rspro_IpAddr2str(&pdu->msg.choice.configClientBankReq.bankd.ip));
rspro2bank_slot(&g_client->bankd_slot, &pdu->msg.choice.configClientBankReq.bankSlot);
g_client->bankd_conn.server_port = pdu->msg.choice.configClientBankReq.bankd.port;
- /* instruct bankd FSM to connect */
- osmo_fsm_inst_dispatch(g_client->bankd_conn.fi, SRVC_E_ESTABLISH, NULL);
+ /* bankd port 0 is a magic value to indicate "no bankd" */
+ if (g_client->bankd_conn.server_port == 0)
+ osmo_fsm_inst_dispatch(g_client->bankd_conn.fi, SRVC_E_DISCONNECT, NULL);
+ else
+ osmo_fsm_inst_dispatch(g_client->bankd_conn.fi, SRVC_E_ESTABLISH, NULL);
/* send response to server */
resp = rspro_gen_ConfigClientBankRes(ResultCode_ok);
server_conn_send_rspro(srvc, resp);
@@ -901,7 +904,7 @@
static void print_welcome(void)
{
printf("simtrace2-remsim-client - Remote SIM card client for SIMtrace\n"
- "(C) 2010-2019, Harald Welte <laforge@gnumonks.org>\n"
+ "(C) 2010-2020, Harald Welte <laforge@gnumonks.org>\n"
"(C) 2018, sysmocom -s.f.m.c. GmbH, Author: Kevin Redon <kredon@sysmocom.de>\n\n");
}