aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMychaela N. Falconia <falcon@freecalypso.org>2023-09-25 05:20:02 +0000
committerMychaela N. Falconia <falcon@freecalypso.org>2023-09-25 05:20:02 +0000
commitdbe8889120c36a32b0d2fa47caae8c7b6f5d7475 (patch)
tree813cc17e4b2943c568cb3c3d3b507f83229bff17
parent02c49373f37dc1e16b33c4cee18625d7a70bf290 (diff)
SMS over GSUP: set source_name in GSUP reply messages
For MO-forwardSM and MT-forwardSM request messages, OsmoHLR applies routing based on the SMSC address for MO or based on the IMSI for MT. However, reply messages following these requests are routed passively based on the destination_name IE. This passive message routing path requires the source_name IE to be set as well - implement this source_name setting. Related: OS#6135 Change-Id: I0b7f4760bdce8a38d43d3860086c6dfb7b390701
-rw-r--r--include/osmocom/msc/gsup_client_mux.h1
-rw-r--r--src/libmsc/gsm_04_11_gsup.c2
-rw-r--r--src/libmsc/gsup_client_mux.c20
3 files changed, 23 insertions, 0 deletions
diff --git a/include/osmocom/msc/gsup_client_mux.h b/include/osmocom/msc/gsup_client_mux.h
index 07f17c260..501b81dbe 100644
--- a/include/osmocom/msc/gsup_client_mux.h
+++ b/include/osmocom/msc/gsup_client_mux.h
@@ -28,6 +28,7 @@ int gsup_client_mux_start(struct gsup_client_mux *gcm, const char *gsup_server_a
struct ipaccess_unit *ipa_dev);
int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg);
+void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm, struct osmo_gsup_message *gsup_msg);
void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig,
enum gsm48_gmm_cause cause);
diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index 6225c6c4f..d1c2f2759 100644
--- a/src/libmsc/gsm_04_11_gsup.c
+++ b/src/libmsc/gsm_04_11_gsup.c
@@ -201,6 +201,7 @@ int gsm411_gsup_mt_fwd_sm_res(struct gsm_trans *trans, uint8_t sm_rp_mr)
/* Ensure routing through OsmoHLR to the MT-sending SMSC */
gsup_msg.destination_name = trans->sms.gsup_source_name;
gsup_msg.destination_name_len = trans->sms.gsup_source_name_len;
+ gsup_client_mux_tx_set_source(trans->net->gcm, &gsup_msg);
return gsup_client_mux_tx(trans->net->gcm, &gsup_msg);
}
@@ -222,6 +223,7 @@ int gsm411_gsup_mt_fwd_sm_err(struct gsm_trans *trans,
/* Ensure routing through OsmoHLR to the MT-sending SMSC */
gsup_msg.destination_name = trans->sms.gsup_source_name;
gsup_msg.destination_name_len = trans->sms.gsup_source_name_len;
+ gsup_client_mux_tx_set_source(trans->net->gcm, &gsup_msg);
/* SM-RP-Cause value */
gsup_msg.sm_rp_cause = &cause;
diff --git a/src/libmsc/gsup_client_mux.c b/src/libmsc/gsup_client_mux.c
index 9a0dc1667..1a3611f6e 100644
--- a/src/libmsc/gsup_client_mux.c
+++ b/src/libmsc/gsup_client_mux.c
@@ -136,6 +136,25 @@ int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_messa
return osmo_gsup_client_send(gcm->gsup_client, msg);
}
+/* Set GSUP source_name to our local IPA name */
+void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm,
+ struct osmo_gsup_message *gsup_msg)
+{
+ const char *local_msc_name;
+
+ if (!gcm)
+ return;
+ if (!gcm->gsup_client)
+ return;
+ if (!gcm->gsup_client->ipa_dev)
+ return;
+ local_msc_name = gcm->gsup_client->ipa_dev->serno;
+ if (!local_msc_name)
+ return;
+ gsup_msg->source_name = (const uint8_t *) local_msc_name;
+ gsup_msg->source_name_len = strlen(local_msc_name) + 1;
+}
+
/* Transmit GSUP error in response to original message */
void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig,
enum gsm48_gmm_cause cause)
@@ -158,6 +177,7 @@ void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct os
};
OSMO_STRLCPY_ARRAY(gsup_reply.imsi, gsup_orig->imsi);
+ gsup_client_mux_tx_set_source(gcm, &gsup_reply);
/* For SS/USSD, it's important to keep both session state and ID IEs */
if (gsup_orig->session_state != OSMO_GSUP_SESSION_STATE_NONE) {