osmo-msc/src/libmsc
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.c add LOG_RAN_CONN() to use the conn->fi->id for context 2019-01-12 09:51:22 +00:00
a_iface_bssap.c Handle LCLS-NOTIFICATION message from BSS 2019-01-24 17:37:08 +00:00
a_reset.c combine several small .h in msc_common.h 2018-11-30 22:46:15 +01:00
ctrl_commands.c cosmetic: remove forgotten debug printf 2018-11-08 11:10:15 +01:00
db.c libmsc/db.c: cosmetic: mark missing breaks in switch as intended 2018-11-21 19:48:16 +07:00
gsm_04_08.c gsm_04_08: Fix nullpointer deref 2019-01-12 10:26:00 +00:00
gsm_04_08_cc.c Various logging fixes 2019-01-24 19:08:07 +00:00
gsm_04_11.c libmsc/gsm_04_11.c: introduce and use gsm411_assign_sm_rp_mr() 2019-02-01 18:55:54 +00:00
gsm_04_11_gsup.c transaction: change arguments of trans_find_by_sm_rp_mr() 2019-02-01 18:55:54 +00:00
gsm_04_14.c rename gsm_subscriber_connection to ran_conn 2018-11-30 22:45:42 +01:00
gsm_04_80.c fix build: apply msgb_wrap_with_TL() rename 2019-01-22 01:58:55 +01:00
gsm_09_11.c Various logging fixes 2019-01-24 19:08:07 +00:00
gsm_subscriber.c use osmo_rat_type from libosmocore 2019-01-04 17:26:14 +00:00
iu_dummy.c refactor log ctx for vlr_subscr and ran_conn 2019-01-12 09:51:22 +00:00
iucs.c use osmo_rat_type from libosmocore 2019-01-04 17:26:14 +00:00
iucs_ranap.c use osmo_rat_type from libosmocore 2019-01-04 17:26:14 +00:00
mncc.c Massive removal of unused code/structs/headers 2018-01-25 00:18:05 +01:00
mncc_builtin.c MNCC: use log wrapper for call processing 2018-12-23 09:51:53 +00:00
mncc_sock.c libmsc/mncc_sock.c: Add lchan_type_offset in queue_hello() 2018-08-10 14:31:30 +00:00
msc_ifaces.c use osmo_rat_type from libosmocore 2019-01-04 17:26:14 +00:00
msc_mgcp.c tweak fsm_msc_mgcp FSM and FI name 2019-01-12 09:51:22 +00:00
msc_vty.c vty: make 'sh connect/transact' readable again 2019-01-17 19:27:05 +01:00
osmo_msc.c abort assignment on Assignment Failure 2019-01-04 16:24:59 +00:00
ran_conn.c libmsc/ran_conn.c: cosmetic: use tabs instead of N * 8 spaces 2019-01-26 11:36:14 +07:00
rrlp.c move ran_conn declarations to new ran_conn.h 2018-11-30 22:46:15 +01:00
silent_call.c combine several small .h in msc_common.h 2018-11-30 22:46:15 +01:00
smpp_openbsc.c Make alert notifications vty configurable per ESME 2019-01-17 14:03:27 +00:00
smpp_smsc.c Make alert notifications vty configurable per ESME 2019-01-17 14:03:27 +00:00
smpp_smsc.h Make alert notifications vty configurable per ESME 2019-01-17 14:03:27 +00:00
smpp_utils.c dissolve libcommon: drop debug.c 2018-03-22 17:05:42 +01:00
smpp_vty.c Cosmetic: Fix spelling in smpp vty 2019-01-17 14:04:07 +00:00
sms_queue.c GSM_EXTENSION_LENGTH -> VLR_MSISDN_LENGTH 2018-11-30 22:46:15 +01:00
transaction.c transaction: change arguments of trans_find_by_sm_rp_mr() 2019-02-01 18:55:54 +00:00