osmo-msc/include/osmocom/msc
Vadim Yanitskiy c7de62cc53 libmsc/gsm_04_11.c: introduce and use gsm411_assign_sm_rp_mr()
Initially, it was assumed that if there is no active RAN connection,
we can just start counting from 0x00, as there are no other SMS
related transactions, and transaction itself is allocated using
talloc_zero(). Until now it was looking good, but...

As soon as we establish RAN connection with subscriber, we already
have a transaction with SM-RP-MR 0x00, but conn->next_rp_ref also
remains 0x00 - it isn't being increased!

It means that we can face a SM-RP-MR conflict (or collision) if
another MT SMS would arrive to the MSC (from SMSC over GSUP)
when this transaction is still active, i.e. the first SMS is
still being sent, because conn->next_rp_ref++ would
return 0x00 again.

Moreover, there might be already a MO SMS transaction, and using
the conn->next_rp_ref counter wouldn't prevent us from having
duplicate SM-RP-MR value.

Let's get rid of this per-connection counter, and introduce a
function instead, that would iterate over existing transactions
and look for an unused SM-RP-MR value.

This change makes the following test cases pass:

  - TC_gsup_mt_sms_rp_mr,
  - TC_gsup_mo_mt_sms_rp_mr.

Discovered by: Neels Hofmeyr
Related Change-Id: (TTCN) I3a52d44f4abde9b6b471b9108c1cee905884c9bc
Related Change-Id: (TTCN) I17cbbaa64d9bce770f985588e93cd3eecd732120
Change-Id: Ife6d954c46b7d8348a4221ab677d0355eb3ee7ac
2019-02-01 18:55:54 +00:00
..
Makefile.am libmsc/gsm_04_11.c: forward MO SMS messages over GSUP 2018-12-30 11:48:22 +01:00
a_iface.h add LOG_RAN_CONN() to use the conn->fi->id for context 2019-01-12 09:51:22 +00:00
a_iface_bssap.h Don't answer to BSC-originated RESET with another RESET 2018-02-09 02:20:51 +01:00
a_reset.h a_reset: cleanup + remove dead code 2018-05-17 20:14:01 +00:00
db.h cosmetic: drop some unused opaque struct defs 2018-11-30 22:46:15 +01:00
debug.h dissolve libcommon: drop debug.c 2018-03-22 17:05:42 +01:00
gsm_04_08.h rename gsm_subscriber_connection to ran_conn 2018-11-30 22:45:42 +01:00
gsm_04_11.h libmsc/gsm_04_11.c: accept MT SMS messages over GSUP 2019-01-11 21:42:43 +00:00
gsm_04_11_gsup.h libmsc/gsm_04_11.c: accept MT SMS messages over GSUP 2019-01-11 21:42:43 +00:00
gsm_04_14.h rename gsm_subscriber_connection to ran_conn 2018-11-30 22:45:42 +01:00
gsm_04_80.h rename gsm_subscriber_connection to ran_conn 2018-11-30 22:45:42 +01:00
gsm_09_11.h rename gsm_subscriber_connection to ran_conn 2018-11-30 22:45:42 +01:00
gsm_data.h libmsc/VTY: introduce kill-switch for routing SMS over GSUP 2018-12-30 11:48:22 +01:00
gsm_data_shared.h combine several small .h in msc_common.h 2018-11-30 22:46:15 +01:00
gsm_subscriber.h move gsm_cbfn to gsm_subscriber.h, the only user 2018-11-30 22:46:15 +01:00
iu_dummy.h cosmetic: drop some unused opaque struct defs 2018-11-30 22:46:15 +01:00
iucs.h move ran_conn declarations to new ran_conn.h 2018-11-30 22:46:15 +01:00
iucs_ranap.h rename include/openbsc to include/osmocom/msc 2017-09-06 16:41:25 +02:00
mncc.h MNCC: use explicit struct type in gsm_call 2019-01-16 12:56:59 +00:00
mncc_int.h rename include/openbsc to include/osmocom/msc 2017-09-06 16:41:25 +02:00
msc_common.h add VTY commands: mncc internal / external (== -M) 2018-12-05 19:35:11 +00:00
msc_ifaces.h rename gsm_subscriber_connection to ran_conn 2018-11-30 22:45:42 +01:00
msc_mgcp.h abort assignment on Assignment Failure 2019-01-04 16:24:59 +00:00
ran_conn.h libmsc/gsm_04_11.c: introduce and use gsm411_assign_sm_rp_mr() 2019-02-01 18:55:54 +00:00
rrlp.h RRLP: migrate and share mode definitions from msc_vty.c 2018-08-05 11:33:20 +00:00
signal.h rename gsm_subscriber_connection to ran_conn 2018-11-30 22:45:42 +01:00
silent_call.h rename gsm_subscriber_connection to ran_conn 2018-11-30 22:45:42 +01:00
smpp.h rename include/openbsc to include/osmocom/msc 2017-09-06 16:41:25 +02:00
sms_queue.h Add a VTY command which deletes all expired SMS. 2018-01-25 16:16:15 +00:00
transaction.h transaction: change arguments of trans_find_by_sm_rp_mr() 2019-02-01 18:55:54 +00:00
vlr.h VLR: send CHECK-IMEI to EIR/HLR 2019-01-16 10:42:56 +00:00
vty.h use vty->type instead of local variable 2018-12-21 12:38:47 +00:00