summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2017-09-10 21:29:12 +0200
committerHarald Welte <laforge@gnumonks.org>2017-09-11 18:39:07 +0000
commit9051421d75eed22c02f01b373cfab58dbadcd4b5 (patch)
tree499e6eb06cecdf573f7a855aa9d515a3756ba2e2 /openbsc/src/libmsc
parentf52cf145acea5db288543de0f2e886988d5676cf (diff)
libmsc: annotate esme route in the sms object from deliver_to_esme()
Annotate this esme route, so we can use it to return -EINPROGRESS to skip sending premature RP-ACK to the mobile station, in case we're handling sms routes through SMPP. Now that we have this information in place, we use it wherever possible to avoid kludgy checks on sms->receiver. sms_free() already releases references to this object, so we should be fine with this. Fixes: 4e5b90a594f9 ("libmsc: remove 'deferred' parameter in sms_route_mt_sms()") Change-Id: Ib8a8fd9bbb0d3b6aff7931e4bacbea99d000e484
Diffstat (limited to 'openbsc/src/libmsc')
-rw-r--r--openbsc/src/libmsc/gsm_04_11.c11
-rw-r--r--openbsc/src/libmsc/smpp_openbsc.c4
2 files changed, 12 insertions, 3 deletions
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index ddef444c5..27bffc9b3 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -519,7 +519,10 @@ static int gsm340_rx_tpdu(struct gsm_trans *trans, struct msgb *msg,
rc = sms_route_mt_sms(conn, gsms);
- /* This SMS got routed through SMPP or no receiver exists. */
+ /* This SMS got routed through SMPP. */
+ if (gsms->smpp.esme)
+ return -EINPROGRESS;
+
if (!gsms->receiver)
return rc;
@@ -613,8 +616,10 @@ static int gsm411_rx_rp_ud(struct msgb *msg, struct gsm_trans *trans,
return gsm411_send_rp_ack(trans, rph->msg_ref);
else if (rc > 0)
return gsm411_send_rp_error(trans, rph->msg_ref, rc);
- else
- return rc;
+ else if (rc == -EINPROGRESS)
+ rc = 0;
+
+ return rc;
}
/* Receive a 04.11 RP-DATA message in accordance with Section 7.3.1.2 */
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index af2d1be62..3fe2dfd0b 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -714,6 +714,10 @@ static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms,
if (ret < 0)
return ret;
+ OSMO_ASSERT(!sms->smpp.esme);
+ smpp_esme_get(esme);
+ sms->smpp.esme = esme;
+
return smpp_cmd_enqueue(esme, conn->subscr, sms,
deliver.sequence_number);
}