[PATCH] libmsc,sms: Properly calculate and store validity and received timestamps for incoming SMS.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Peter Stuge peter at stuge.se
Sat Mar 8 18:58:15 UTC 2014


Alexander Chemeris wrote:
> +++ b/openbsc/src/libmsc/gsm_04_11.c
> @@ -102,6 +102,10 @@ 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);
> +	time(&sms->valid_until);
> +	sms->valid_until += SMS_DEFAULT_VALIDITY_PERIOD;

In order to make this a bit more atomic I'd suggest replacing the
second time() with reuse of the first value.

sms->valid_until = sms->received_time + SMS_DEFAULT_VALIDITY_PERIOD;


The INSERT statement change is pretty gross but oh well.


//Peter




More information about the OpenBSC mailing list