From 531d3a4b118230255c46476ecc14ee488760b93e Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 20 Apr 2020 10:29:19 +0700 Subject: [PATCH] SMS-over-GSUP: move net->sms_over_gsup check to gsm411_gsup_rx() Change-Id: I89988b7148b164af304ecae1f53b74f322fdc7bd --- src/libmsc/gsm_04_11_gsup.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c index dfc90cc12..1751655d1 100644 --- a/src/libmsc/gsm_04_11_gsup.c +++ b/src/libmsc/gsm_04_11_gsup.c @@ -149,14 +149,6 @@ static int gsm411_gsup_mo_handler(struct gsm_network *net, struct vlr_subscr *vs OSMO_ASSERT(0); } - /* Make sure that 'SMS over GSUP' is expected */ - if (!net->sms_over_gsup) { - /* TODO: notify sender about that? */ - LOGP(DLSMS, LOGL_NOTICE, "Unexpected MO SMS over GSUP " - "(sms-over-gsup is not enabled), ignoring message...\n"); - return -EIO; - } - /* Verify GSUP message */ if (!gsup_msg->sm_rp_mr) goto msg_error; @@ -241,14 +233,6 @@ static int gsm411_gsup_mt_handler(struct gsm_network *net, struct vlr_subscr *vs LOGP(DLSMS, LOGL_DEBUG, "RX MT-forwardSM-Req\n"); - /* Make sure that 'SMS over GSUP' is expected */ - if (!net->sms_over_gsup) { - LOGP(DLSMS, LOGL_NOTICE, "Unexpected MT SMS over GSUP " - "(sms-over-gsup is not enabled), ignoring message...\n"); - /* TODO: notify sender about that? */ - return -EIO; - } - /** * Verify GSUP message * @@ -296,6 +280,14 @@ int gsm411_gsup_rx(struct gsup_client_mux *gcm, void *data, const struct osmo_gs struct vlr_subscr *vsub; int rc; + /* Make sure that 'SMS over GSUP' is expected */ + if (!net->sms_over_gsup) { + /* TODO: notify sender about that? */ + LOGP(DLSMS, LOGL_NOTICE, "Unexpected MO/MT SMS over GSUP " + "(sms-over-gsup is not enabled), ignoring message...\n"); + return -EIO; + } + vsub = vlr_subscr_find_by_imsi(net->vlr, gsup_msg->imsi, __func__); if (!vsub) { LOGP(DLSMS, LOGL_ERROR, "Rx %s for unknown subscriber, rejecting\n",