summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/gsm_04_11.c
diff options
context:
space:
mode:
authorAlexander Chemeris <Alexander.Chemeris@gmail.com>2013-11-26 15:04:48 -0600
committerAlexander Chemeris <Alexander.Chemeris@gmail.com>2014-03-12 21:21:32 +0400
commitc70e1282d692e376542b3f789e5340d02af78f17 (patch)
treeb7a5820411d9ae58e4b7591a64f376cc7665a59e /openbsc/src/libmsc/gsm_04_11.c
parent9d911d59a022f8f109849cc1abdf1a2adb9c4e7f (diff)
libmsc,sms: Properly calculate and store validity and received timestamps for incoming SMS.achemeris/sms-validity-fix
Diffstat (limited to 'openbsc/src/libmsc/gsm_04_11.c')
-rw-r--r--openbsc/src/libmsc/gsm_04_11.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index 566feb981..15b17c3ae 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -102,6 +102,9 @@ struct gsm_sms *sms_from_text(struct gsm_subscriber *receiver,
sms->protocol_id = 0; /* implicit */
sms->data_coding_scheme = dcs;
strncpy(sms->dst.addr, receiver->extension, sizeof(sms->dst.addr)-1);
+ /* Timestamps */
+ time(&sms->received_time);
+ sms->valid_until = sms->received_time + SMS_DEFAULT_VALIDITY_PERIOD;
/* Generate user_data */
sms->user_data_len = gsm_7bit_encode_n(sms->user_data, sizeof(sms->user_data),
sms->text, NULL);
@@ -384,7 +387,9 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
sms_alphabet == DCS_7BIT_DEFAULT ? gsms->text :
osmo_hexdump(gsms->user_data, gsms->user_data_len));
- gsms->validity_minutes = gsm340_validity_period(sms_vpf, sms_vp);
+ gsms->received_time = time(NULL);
+ gsms->valid_until = gsm340_validity_time(gsms->received_time,
+ sms_vpf, sms_vp);
/* FIXME: This looks very wrong */
send_signal(0, NULL, gsms, 0);