Commit Graph

7402 Commits

Author SHA1 Message Date
Alexander Couzens
0a613aa028 vlr_lu_fsm: terminate the FSM instead of dispatching only a signal to the parent
CS doesn't need this because the FSM is bound to the signalling connection,
but for PS, there is no direct signalling connection in the SGSN.

Change-Id: I27fd1048f85363797b43808d2061ce28be6da81b
2025-09-26 09:45:55 +00:00
Vadim Yanitskiy
d59562d1b4 tests/{ctrl,vty}_test_runner.py: dump stdout/stderr
From time to time, we're seeing the following error in Jenkins:

----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../tests/vty_test_runner.py", line 70, in tearDown
    raise Exception("Process returned %d" % rc)
Exception: Process returned -9
----------------------------------------------------------------------

Let's dump stdout/stderr of the process to get more information.

Change-Id: Ie6a2f5b1bc56d35513643b52923403798e5a0a5a
Related: OS#5665
2025-09-17 19:55:34 +07:00
Oliver Smith
ebbee0e250 gsm48_cc_tx_setup: fix speech bearer capabilities
Send the bearer capability IE from 3GPP TS 24.008 § D.1.2 for speech
instead of the result from gsm48_cc_tx_setup_set_bearer_cap() for the
network to MS direction. This is needed, because:

 - We shall send spare bits for the radio channel requirement in the
   network to MS direction, see 3GPP TS 24.008 § D.1.1 and Table
   10.5.102).

 - We could in theory send a speech version list that MS are then
   supposed to ignore (end of Table 10.5.103), but this causes bugs in
   some MS so it is better to not send it (OS#6656).

Related: OS#6657, OS#6655, OS#6656
Related: osmo-ttcn3-hacks I8fd33cf2f7fb8a1c34851ecf54fccddd2efd0536
Depends: libosmocore I97101c977104eae82e4850d40f9abd15aa03e33e
Change-Id: I7046e9244fd9d4301ee2c4df1147a619f753739c
2025-09-05 10:16:33 +02:00
Oliver Smith
d0999628fd gsm48_cc_tx_setup: remove extra bearer_cap var
Store the bearer capabilities directly in the transaction, instead of
storing them in a separate variable first, then copying it to the
transaction, then using both the separate variable and the copy in the
transaction later on. The extra variable is not needed and only makes it
more compilicated.

Add an explicit '.transfer = GSM48_BCAP_ITCAP_SPEECH,' while at it in
the speech case. This was already set implicitly because
GSM48_BCAP_ITCAP_SPEECH is 0.

Change-Id: I247ef10923c2875ca75e73046f4b8ed14190d4d2
2025-09-05 09:25:50 +02:00
Oliver Smith
9c28995398 gsm48_cc_tx_setup_encode_msg: split out
Change-Id: I443b4b54c6ad40d852e4c21c896c2d0da5fac239
2025-09-05 09:25:19 +02:00
Oliver Smith
b70947f99f gsm48_cc_tx_setup_set_bearer_cap: split out
Change-Id: I3fe6bb2af90d729bb32cae8f5a1a38dcf8f87eb9
2025-09-05 09:13:49 +02:00
Oliver Smith
eb9cd89089 gsm48_cc_tx_setup_select_codecs: split out
Change-Id: Ic502f9ed77ea57de4cf6d362c0e7070d9147d6f3
2025-09-05 09:13:47 +02:00
Oliver Smith
7ae6e6c509 gsm48_cc_tx_setup_set_transaction_id: tweak error msg
Reword the message to make it less confusing.

Change-Id: I4007e99b6abd9b2e05945ccdedaac185a2aea19e
2025-09-05 09:10:28 +02:00
Oliver Smith
e9438d874e gsm48_cc_tx_setup_set_transaction_id: split out
Move the code for setting the transaction ID to a separate function to
start making gsm48_cc_tx_setup shorter and easier to read. Return -1 on
error instead of rc from mncc_release_ind() as it returns 0 on success.

Make some tweaks while at it:
* Set LOGL_ERROR for the "TX Setup with assigned transaction" error.
* Add a log message for the "could not get a free transaction ID" case.
* Minor formatting tweaks.

Change-Id: I715f12d09570211a98b667c56960309bd326e8d8
2025-09-05 09:09:20 +02:00
Oliver Smith
10c52d551d gsm48_cc_tx_setup: move msgb_alloc down
Don't alloc msgb before it gets used.

Change-Id: I99edbdc915552a4ab28ef6f7a1e55818092a2e20
2025-09-03 15:55:01 +02:00
Oliver Smith
f40ff642d4 gsm48_cc_tx_setup: add goto error
Move common clean up code to a new error label.

Change-Id: Ic8268d32df968d2e7c80f62b4a4fe370052f999f
2025-09-03 15:54:54 +02:00
Oliver Smith
c6af9d90bd Bump version: 1.13.0.24-e1389 → 1.14.0
Change-Id: I1256e2485a846bc0c2fe53b4b1731956396a84c6
1.14.0
2025-08-27 08:23:05 +02:00
Oliver Smith
e13897ab2b tests/smpp: fix building for debian 13 armv7l
In Debian 13 armv7l, time_t is "long long int" instead of "long unsigned
int" as seen on x86_64 and aarch64. Fix it by casting to "long long
int".

Change-Id: I3801fc7d0a85036f1f9346c54824eff5c126f363
2025-08-26 09:33:22 +02:00
Alexander Couzens
b64f822ef8 vlr: when receiving imsi detach, purge the subscriber towards HLR
The HLR must know when a subscriber has been disconnected.

Change-Id: I9c2569c45e69b422ce26050b682e6eb26c1c2625
2025-08-25 16:59:42 +00:00
Alexander Couzens
5611c75328 vlr: extend the subscriber invalidate callback with reasons
The VLR must be allowed to notify the MSC if a subscriber becomes invalid.
There are multiple cases when this happens:
a) if the subscriber didn't do a Location Update Procedure within the
given periodic timer.
b) if the HLR does a Cancel Location Procedure with reason withdraw
c) if the HLR does a Cancel Location Procedure with reason update location.
d) duplicate entries (unsure if this is valid, but keeping the code as is)

Change-Id: Ie5b687318b106a230fcee52deba86649641004b3
2025-08-25 16:59:42 +00:00
Oliver Smith
ba9f30c5cc Fix building for debian 13 armv7l
In Debian 13 armv7l, time_t and suseconds_t are "long long int" instead
of "long unsigned int" as seen on x86_64 and aarch64. Fix it by casting
to "long long int".

Related: OS#6828
Change-Id: I3de792d62b1989cf35051cbecde98fa9030bfbf2
2025-08-14 13:34:26 +02:00
Vadim Yanitskiy
174ad8354f silent_call: check if subscriber has a connection
It makes no sense to initiate a silent call if subscriber already
has an active connection (e.g. when a normal call is ongoing).

Change-Id: I52b3be26c61cadacc4783b5c324809ecd6906b36
2025-08-14 16:48:01 +07:00
Vadim Yanitskiy
627d66b6e4 silent_call: use LOG_TRANS when msc_a is NULL
Change-Id: I917f45bc7f75dc0679079554d09891877516eac7
2025-08-13 20:18:29 +07:00
Matan Perelman
d0437fefa0 silent_call: Fix use after free of paging request
Before this change trans->paging_request was not assigned correctly.
In some cases it caused trans_free to not call paging_request_remove.
If the paging timeouts, paging_cb_silent would call trans_free again
with a stale pointer.

Change-Id: I93913d189800d71f82c013b6e946bd63db362f65
2025-08-10 17:52:22 +03:00
Pau Espin Pedrol
265f31dc57 sccp: Handle N-NOTICE.ind (Routing Failure of SCCP CL messages)
ITU Q.714 2.8:
"""
When an end node is informed of a routing failure, this information
is forwarded towards the SCCP user by using the N-DISCONNECT primitive
(refer to reason for release in 2.1.1.2.4/Q.711) or the N-NOTICE primitive
(refer to reason for return in 2.2.2.2.4/Q.711)
"""

We are already handling N-DISCONNECT.ind for CO messages, but
N-NOTICE.ind for CL messages was not being handled.

If CL messages are not arriving to the RAN peer, then reset the link
and mark the peer as disconnected, until a new RESET can successfully fo
through.

Change-Id: Iddd10c8f97310b600374ff0141ea06e03087da8f
Related: OS#5917
2025-07-16 18:02:44 +02:00
Pau Espin Pedrol
6bb84e2c6c ran_peer: Introduce stats msc.ran_peers.{total,active}
Change-Id: I36e40510c9a95f0c9cf5f32d2a7baab840aa8660
2025-07-14 19:57:13 +02:00
Pau Espin Pedrol
98a4550612 msc: Initial implementation of N-PCSTATE.ind
Related: OS#5917
Change-Id: Ice1b2c163b1b0d134fcaa1c8bf543038a35fabdf
2025-07-14 18:47:25 +02:00
Pau Espin Pedrol
faac99c70f ran_peer: Drop unused events CONNECTION_{SUCCESS,TIMEOUT}
Change-Id: Ib22be87dc68ab12783eb9140b4a9e04bec06bdab
2025-07-14 18:47:25 +02:00
Pau Espin Pedrol
1c7e5bf604 ran_peer: Avoid paging attempt if not ready
If the link is not ready it will fail to transmit the msg anyway,
so there's no use in trying to submit a page over it.

Change-Id: Ia858291f4454e4caf293e1aaf60ea04d2d4a64e9
2025-07-14 18:47:25 +02:00
Pau Espin Pedrol
f1b11dd154 ran_peer: Mark multiple funcs as static
Change-Id: I8783fdee16be4f2006464d59cf49d5939208ca20
2025-07-14 18:03:23 +02:00
Pau Espin Pedrol
d57f915e95 constify ptr arg in ran_peer_find_by_addr()
Change-Id: I0d725d3994e1d4192a29930515176a8f08fa33bd
2025-07-14 17:54:31 +02:00
Pau Espin Pedrol
90a400a2a1 vty: Get rid of unneeded iu_client vty config
Use of osmo-iuh's iu_client API was removed from osmo-msc long time ago
(see c4628a3ad4), and its removal is also
scheduled in osmo-sgsn.

Still, some small reference bits were still left. Remove them.

The VTY init functions being dropped basically set g_rab_assign_addr_enc,
which doesn't really seem to be used at all, only place is that file for
vty related stuff which has actually no use in
osmo-msc.
Other 2 are asn1c debugging related, which can also probably be dropped.

This completelly removes references to iu_client.h in osmo-msc.

Related: OS#5487
Change-Id: I9cf83f2255e1e9aa83f3139b88ea81b2f5b686c3
2025-07-14 14:05:34 +00:00
Pau Espin Pedrol
21a9f87a24 msc_main: Remove unnedeed include of ranap/iu_client.h
iu_client is so far only used to set up some VTY configs in msc_vty.c,
hence not needed here.

Change-Id: I4716c5229273b74ee165ebaaf0914e9eebef9e6f
2025-07-14 14:04:02 +00:00
Alexander Couzens
66e95ffe8f libvlr: replace strncpy with OSMO_STRLCPY_ARRAY
The compile warns about these strncpys because they
might not null terminated.
Even the next line ensures this.

Also replace osmo_strlcpy with OSMO_STRLCPY_ARRAY
when possible.

Change-Id: I96a27ef42cb06dd2365f5c9902933323c7caf9a8
2025-06-03 15:02:32 +02:00
Vadim Yanitskiy
86cdab3a63 gsm0911_rcv_nc_ss(): avoid assertion failure in msc_a_put()
It was reported by a user that osmo-msc hits an assertion failure:

  Assert failed osmo_use_count_get_put(&msc_a->use_count, "cm_service_ss", -1) == 0 gsm_09_11.c:147

It's yet unclear how can this happen, because the MS/UE shall not be
sending SS/USSD messages without a prior CM Service Request.  However,
I was able to write an "evil MS" testcase that reproduces the problem
(see the related patch).  This is pretty much a DoS vector, so let's
add safety checks preventing this to gsm0911_rcv_nc_ss().

Change-Id: I724f0f0c9ef8611d3c3653e9370361b252127f72
Related: osmo-ttcn3-hacks.git If1d85a1b4b63b01b4565e53677acfd21e664e799
Related: 5fb4a9efcf ("Release BSS connection when SS message is rejected")
Related: OS#6756
2025-04-16 18:51:00 +07:00
Vadim Yanitskiy
f7f0f451a0 SMS-over-GSUP: properly update MSC_CTR_SMS_RP_ERR_{MEM,OTHER}
These counters have not been updated in SMS-over-GSUP mode so far.
Move the logic updating counters to the common code path.
Take a chance to use rate_ctr_inc2().

Change-Id: I97b4699e5b2c44989368004a53e26ca5daaa7b14
Related: SYS#7323
2025-04-16 02:14:54 +07:00
Vadim Yanitskiy
ce80fdf587 SMS-over-GSUP: send network-originated MT-forwardSM-Err
When SMS-over-GSUP is enabled, there's currently no indication of
failed MT SMS delivery due to paging timeout or connection issues.
In such cases, the SMSC that initiated the MT-forwardSM-Req receives
no response at all.  This leaves the SMSC with no clear criterion
for retrying delivery other than a generic timeout.

So far, MT-forwardSM-Err was only sent when the MS/UE explicitly
indicated an error (via RP-ERROR).  This patch extends its use to
also cover situations where no RP-ACK or RP-ERROR is received,
allowing the network to notify the SMSC of delivery failure
due to lower-layer issues.

The key difference between the MS/UE-originated and network-originated
MT-forwardSM-Err messages is presence/absence of the following IEs:

* SM-RP-Cause IE -- indicated by the MS/UE,
* Cause IE -- indicated by the network.

Either of these IEs shall always be present.

Change-Id: I51d92752471147e6d21a5059bebb0702b32642a5
Related: osmo-ttcn3-hacks.git Ief16753783e044911f1e3cef8d7012810d709e61
Related: osmo-ttcn3-hacks.git Ic27d943645fdff8d34f958e3bf16c8ee6e8368d2
Related: SYS#7323
2025-04-08 04:50:35 +07:00
Vadim Yanitskiy
d6bb80b496 gsm0911_gsup_rx(): invalidate vsub pointer
Calling vlr_subscr_put() in gsm0911_gsup_rx() may result in free()ing
the memory pointed by vsub, so let's set it to NULL to prevent
potential use-after-free.

Change-Id: If81df71a52e4fa972b48c61d1ed1361c6629ae94
2025-03-28 17:04:41 +07:00
Pau Espin Pedrol
1e886e4b99 Drop use of deprecated vty is_config_node() cb
This callback was drepecated and is not ever called since
libosmocore.git 70ce871532ab21955e0955d7e230eae65438f047 (release 1.3.0).

See also libosmocore.git d31de237582f6fe3315d61bb9a488d4cda92654e.

Change-Id: Id6620095af153781cde926458f54fed5bd51a9e7
2025-03-04 18:17:54 +01:00
Andreas Eversberg
a28c6efc4f Indicate error and release BSS connection when SMS transaction fails
When the creation of the transaction structure fails, the MSC will
send a CP-ERROR message.

This patch ensures that the MSC_A use counter is decremented, so
that the BSS connection is released, if it is not used by any other
transaction.

Without this patch, the msc_a_fsm would wait 5 seconds for an initial
transaction before releasing the BSS connection.

Related: OS#6427
Change-Id: I82da9c283205c69b19ceb4ba40ac5aa7f37d159b
2025-02-25 12:54:22 +00:00
Andreas Eversberg
bce6b7e1eb Release BSS connection when CC transaction fails
When the creation of the transaction structure fails, the MSC will
send a RELEASE COMPLETE message.

This patch ensures that the MSC_A use counter is decremented, so
that the BSS connection is released, if it is not used by any other
transaction.

Without this patch, the msc_a_fsm would wait 5 seconds for an initial
transaction before releasing the BSS connection.

Related: OS#6427
Change-Id: Icb893d5c1ce4c77a29259ce66189576dcaa5a44a
2025-02-25 12:54:22 +00:00
Oliver Smith
3ffa34f13c Bump version: 1.12.1.34-1e24a-dirty → 1.13.0
Change-Id: Ia34d0c57a8d17a115a4f7e35ec8eb1470c5fb16e
1.13.0
2025-02-12 13:10:31 +01:00
Simon Cornish
1e24ae38af Include SM-RP-UI in outgoing GSUP message when presesnt
An SMS deliver report may be returned from the UE for any MT SMS.  A
common use is for remote communication with the SIM (UICC) whereby a
command requires Proof of Receipt in an SMS deliver report (see 3GPP
31.115)

SMS-DELIVER-REPORT TPDU is defined in 3GPP 23.040 s9.2.2.1a and
carried as a RP-User-Data element within an RP-ERROR or RP-ACK PDU

In 3GPP 24.011, the definition of RP-ACK (s7.3.3) and RP-ERROR
(s7.3.4) shows RP-User-Data encoded as an optional TLV.

In MAP (3GPP 29.002) the MSC transfers the user data in either
SM-RP-UI parameter (s7.6.8.4) or SM-DeliveryFailureCause
diagnosticInfo (s7.6.1h)

With GSUP the osmo_gsup_message struct member sm_rp_ui is used to
carry the user data in both cases.

Change-Id: I90a607900ac7c86b200c79b7e8c460d4cbb3c3ce
2025-01-30 18:04:25 +00:00
Alexander Couzens
3073635707 vlr: only set HLR number if field is present
Change-Id: I26dc4c00b81723cd7ead095a515269afd0f73f8e
2025-01-13 20:08:49 +01:00
Alexander Couzens
b8e419069b vlr: on subscriber disconnect, check if LU & Auth FSM are even valid
Those fsm can be NULL.

Change-Id: Iaea7d37cfa439fd1adea7440409f6248aef947ef
2025-01-13 20:08:49 +01:00
Alexander Couzens
177184ee2e vlr: Add support for CS and PS timers
To prepare for PS support, add related PS timers
and try to keep the code simple to support both domains.
Use osmo_tdef_fsm_inst_state_chg() where possible because
this way we can have a t_def pointer which we set at the start.

Change-Id: I364973b8d9e277ec5963343c0a83061e81a5baba
2025-01-07 11:41:16 +01:00
Pau Espin Pedrol
e2931c27ce jenkins.sh: No need to build libosmo-sigtran with doxygen
Change-Id: I5fdb9b139c1c233a0499ba1fbcd9046491714dd4
2024-12-10 16:55:48 +01:00
Pau Espin Pedrol
db268fa642 vty: Avoid accessing gsupclient object fields directly
Use new APIs recently added.

Change-Id: I7ead95bb86d1ab510090c29390255007923f895f
Depends: osmo-hlr.git Change-Id I401af83232022f1c141eef1f428cbe206a8aaaa2
2024-12-04 14:44:43 +01:00
Pau Espin Pedrol
c67e71275d Use gsup_client_mux from libosmo-gsup-client
gsup_client_mux code was cloned a couple months ago to
libosmo-gsup-client, use it in osmo-msc and drop its own copy.

The code was not dropped at the time because it required tweaking the
unit tests, because they were wrapping some underlaying functions which
cannot be wrapped anymore since the code using them is now inside the
separate already-linked libosmo-gsup-client.so.
Solve it by actually wrapping one layer up in the gsup_client_mux itself
since it now something we mantain here anymore.

Change-Id: I34d02ae219f3ec8daf47942c46f52b21eab21242
2024-12-04 14:44:39 +01:00
Alexander Couzens
40bb1f5b6e vlr: add bool is_ps to vlr_alloc()
The vlr must known if it is CS or PS. As this is a very
severe configuration entry, add it to the main allocation.

Change-Id: Ib77aad8492a198131c966d4ac4cf8f5f727edcfa
2024-11-25 15:40:56 +01:00
Alexander Couzens
826e2a14a2 vlr: vlr_auth_fsm: make the fsm private
Like all the other libvlr fsm, they are private to their own files,
keep the vlr_auth_fsm the same and be consistant.

Change-Id: Iec85f299cd99879475ab094998433d935e980394
2024-11-25 15:40:55 +01:00
Alexander Couzens
6729fa349b vlr: make vlr_parq_fsm_init() private
All other fsm initialisation are internal to the libvlr code.

Change-Id: I3b4cfc01e6dd5434c74b4fa24a3e0945668b2a74
2024-11-25 15:37:38 +01:00
Alexander Couzens
88b7d99932 vlr: drop msc/debug.h header
Since logging is done different, remove the MSC specific header.

Change-Id: I8fa2f16c07ef54be3a125c19e0990a68c4d5d2cf
2024-11-25 15:37:38 +01:00
Alexander Couzens
ac492ce788 vlr: add a logging layer
To prepare the split off into a separate library,
the logging can't use log category from a define.
Use the same strategy as all the other osmo libraries and
use a global array which is set on initialisation to define the logging
categories.

Change-Id: I6d87b38d6d7d704c7c7b2c90ad12187e4b953b8b
2024-11-25 15:37:35 +01:00
Pau Espin Pedrol
d2ed119f05 jenkins.sh: libosmo-netif no longer depends on libosmo-abis
Change-Id: I4d4ddaed02bb9e09251996315ed12d912b490851
Depends: libosmo-abis.git Change-Id I079dc3999de508301dd37ed03e399356a58d3cab
Depends: libosmo-netif.git Change-Id I13d6e88158f6d9ce017986283183ee9c2cc68cae
2024-11-21 14:56:35 +01:00