Commit Graph

7042 Commits

Author SHA1 Message Date
Vadim Yanitskiy 064a1e0c54 msc/sccp_ran.h: fix: do not pass -1 to osmo_rat_type_name()
The problem is that osmo_rat_type_name() calls get_value_string(),
so we first cast -1 to 'const enum osmo_rat_type' and then to
'uint32_t'. Let's rather use OSMO_RAT_UNKNOWN.

Found by GCC with -Wextra in CFLAGS:

  warning: operand of ?: changes signedness from ‘int’ to
	   ‘const enum osmo_rat_type’ due to unsignedness
	   of other operand [-Wsign-compare]

Change-Id: I63ba355102d3cc035ba90121e06aba7cf1776aa0
2020-01-27 18:21:08 +00:00
Vadim Yanitskiy 601af0ca00 vlr_sgs_fsm: add missing break, do not call to_null() twice
Change-Id: Ib5d1d7633ca6c32d7d63bb1481f51355c97b90fb
2020-01-27 18:21:08 +00:00
Vadim Yanitskiy 3daf0c2786 vlr: remove unused parameter 'log_level' of auth_fsm_start()
We unconditionally use logging level of the parent FSM anyway.
All callers of auth_fsm_start() always pass fi->log_level.

Change-Id: If2fdf2564eb56d3d94ec3800bdcb0aabcad4e48d
2020-01-27 18:21:08 +00:00
Vadim Yanitskiy fc2b019cd8 libmsc: move subscriber expiration timer T3212 to libvlr
Since the split of OsmoNiTB, OsmoMSC does not deal with the radio
access network directly. Therefore the only purpose of T3212 is to
control subscriber expiration in the local VLR. The timeout value
indicated in System Information Type 3 needs to be configured
separately in the BSC/RNC.

This means that we don't need to store it in deci-hours anymore.
Let's move T3212 to the group of VLR specific timers, so it can
be configured and introspected using the generic 'timer' command,
and deprecate the old '[no] periodic location update' command.

It should be also noted that in the old code subscriber expiration
timeout was actually set to twice the T3212 value plus one minute.
After this change, we apply the configured value 'as-is', but
keep the old behaviour for 'periodic location update' command.

Change-Id: I9b12066599a7c834a53a93acf5902d91273bc74f
2020-01-25 12:49:42 +07:00
Vadim Yanitskiy baf71a72ec libvlr: use generic osmo_tdef API for T3250, T3260, and T3270
These timers so far were implemented as a list of unsigned integers,
which has never been initialized to any reasonable defaults. Since
they are used as state timeouts in several FSMs, we might end up
staying in some state forever.

Let's migrate to generic osmo_tdef API and use default values from
table 11.2 of 3GPP TS 24.008. This way the user can introspect and
change their values from the VTY / configuration file.

Change-Id: Ia8cf98da0aea0e626c5ff088a833d7359c43847f
Related: OS#4368
2020-01-25 10:52:26 +07:00
Vadim Yanitskiy ffc7f39f01 VTY: add osmo_tdef introspection and configuration commands
This change introduces several new VTY commands letting the user
a possibility to introspect and reconfigure some of the existing
timers implemented using libosmocore's osmo_tdef API.

At the moment this covers the following timers:

  - MGW specific timers:
    - X1 - MGCP response timeout,
    - X2 - RTP stream establishing timeout,

  - RAN specific timers (same names for GERAN and UTRAN):
    - X1 - Authentication and Ciphering timeout,
    - X2 - RAN connection release sanity timeout,
    - X3 - Handover procedure timeout.

The following commands are introduced:

  - 'enable' node:
    - show timer [(mgw|mncc|sccp|geran|utran|sgs)] [TNNNN]

  - 'config-msc' node:
    - timer [(mgw|mncc|sccp|geran|utran|sgs)] [TNNNN] [(<0-2147483647>|default)]

Both MNCC and SCCP related timer definitions are empty at the
moment. Achieved by using osmo_tdef_group API of libosmovty.

Change-Id: I6024c104b6101666c8aa1108a043910eb75db9a5
Related: OS#4368
2020-01-25 10:24:14 +07:00
Vadim Yanitskiy b7ddbf377f VTY: mark 'subscriber create imsi' command as deprecated
Neither it should appear in the interactive VTY nor in documentation.

Change-Id: I208faab69a40948af5d081edbeaf75f586dfb2e4
2020-01-25 08:17:56 +07:00
Vadim Yanitskiy 4b4a1a13bc msc/signal.h: remove unused (since the NiTB split up) signals
Change-Id: I3848d0db3c62de7613f609ad632641eb54453817
2020-01-20 11:40:45 +00:00
Vadim Yanitskiy 047dd50bc8 osmo-msc: fix: properly initialize default values for MGW timers
Otherwise they're all set to 0, if not configured in the VTY.

Change-Id: I4a0823c2f0ca50ed7407fb0457c54a485799c585
2020-01-19 03:59:47 +07:00
Vadim Yanitskiy ecfcd99c4b libvlr: remove unused 'periodic_lu_timer' from struct vlr_subscr
It's never used anywhere in the code.

Change-Id: I1b322b57fa0fd17ae2ebe1a2af2d8a93d81e14f0
2020-01-19 03:59:10 +07:00
Vadim Yanitskiy 95c46b11e9 manuals/vty: update the VTY reference to reflect recent changes
Change-Id: I14a5c9adff649406b4a079a75f86167ae6b95db4
2020-01-18 19:25:11 +07:00
Pablo Neira Ayuso 83616a8e5f libmsc: SMS, Avoid premature RP-ACK to MS
There was one libmsc commit to openbsc that was
thus far missing in osmo-msc.

This commit completes the work on delayed response
from an ESME. Without this patch, the SMR sends
an RP-ACK to the mobile station, and subsequently a
DELIVER_SM_REPONSE from the ESME provokes either a second
RP-ACK, or an RP-ERROR; both of which result in
"unhandled at this state (IDLE)" from the SMR

After this patch, we have two things corrected:

1) RP-ERROR respects Deliver-SM error cause.
2) No more "unhandled as this state" error from the SMR

Extract from original commit message:
--------
libmsc: annotate esme route in the sms object from deliver_to_esme()

Annotate this esme route, so we can use it to return -EINPROGRESS to
skip sending premature RP-ACK to the mobile station, in case we're
handling sms routes through SMPP.
--------

Fixes: #OS4351
Change-Id: Ic34d398e0a850856e20380ae35e5c2ae5e3c539b
2020-01-15 14:47:04 +00:00
Keith Whyte 2cad562eb2 Trivial: code simplification, return early
This commit also, (for what it is worth) removes a
difference to the same file in openbsc, which I found
while looking for changes that affected SMPP delivery.
This is essentially a "forward-port" of [1]

[1] https://gerrit.osmocom.org/#/c/openbsc/+/3899/

Change-Id: I350c19f5bb70b2656171c096334c2ee83f49df7e
2020-01-13 06:34:35 +01:00
Keith Whyte b67131595f Use GSM411_RP_* and not GSM48_CC_*
d34ed5768c introduced
comparison of GSM411_RP_CAUSE_MO_NUM_UNASSIGNED with
GSM48_CC_CAUSE_UNASSIGNED_NR

For consistency lets use the GSM411_RP constants
in SMS related code.

Change-Id: Ie54966560f66d2dcde905feb2eb19ef90406acd1
2020-01-11 13:07:14 +01:00
Pau Espin 4a5ba81f7d Bump version: 1.6.0.3-02dd2 → 1.6.1
Change-Id: I3ac4ca12139230863607980cd29250c12df319b7
2020-01-09 12:29:08 +01:00
Neels Hofmeyr 02dd265d68 vlr.c: fix condition to check MSISDN presence
msisdn_enc is a buffer, its address is always != 0

Change-Id: Ib2294d2cd339c36df599d7d134f979a572ac308a
2020-01-06 18:00:40 +01:00
Neels Hofmeyr 27c8b033fc vlr_gsup_rx: fix uninitialized rc
Change-Id: Id7776a473b8356d1d136d78736698f20accc7a36
2020-01-06 18:00:31 +01:00
Vadim Yanitskiy a79aac0113 libmsc/gsm_04_08.c: fix: verify MI before calling vlr_subscr_rx_id_resp()
During the last congress, we have noticed that OsmoMSC crashes
on receipt of malformed MM Identity Response messages:

  BSSAP
      Message Type: Direct Transfer (0x01)
      Data Link Connection Identifier
          00.. .... = Control Channel: not further specified (0x0)
          ..00 0... = Spare: 0x0
          .... .000 = SAPI: RR/MM/CC (0x0)
      Length: 11
  GSM A-I/F DTAP - Identity Response
      Protocol Discriminator: Mobility Management messages (5)
          .... 0101 = Protocol discriminator: Mobility Management messages (0x5)
          0000 .... = Skip Indicator: No indication of selected PLMN (0)
      01.. .... = Sequence number: 1
      ..01 1001 = DTAP Mobility Management Message Type: Identity Response (0x19)
      Mobile Identity - Format Unknown
          Length: 8
          .... 1... = Odd/even indication: Odd number of identity digits
          .... .111 = Mobile Identity Type: Unknown (7)  <-- This makes OsmoMSC crash
              [Expert Info (Warning/Protocol): Unknown format 7]
                  [Unknown format 7]
                  [Severity level: Warning]
                  [Group: Protocol]

The value '111'B is not a valid Mobile Identity type, and shall be
considered as reserved according to 3GPP TS 24.008, section 10.5.1.4.
Later on it was discovered that '000'B also crashes OsmoMSC in the same way.

The crash itself is provoked by OSMO_ASSERT(0) in vlr_subscr_rx_id_resp().
Let's keep that assert in there, and make sure that:

  - on receipt of MM Identity Response, Mobile Identity type
    matches the one in MM Identity Request;

  - on receipt of RR Ciphering Mode Complete, Mobile Identity
    contains IMEI(SV) if present.

Change-Id: Ica4c90b8eb4d90325313c6eb400fa4a6bc5df825
TTCN-3 test case: I62f23355eb91df2edf9dc837c928cb86b530b743
Fixes: OS#4340
2020-01-05 11:23:09 +00:00
Pau Espin 6a0c4d9d24 Bump version: 1.5.0.72-6e72-dirty → 1.6.0
Change-Id: I315ba8c67fbb5bec520f1bc42aedd25d47e4ca95
2020-01-03 18:51:37 +01:00
Vadim Yanitskiy 6e72282454 libmsc/gsm_04_11_gsup.c: fix SM-RP-OA encoding for MO SMS over GSUP
We shall not include additional BCD length octet into the value part
of SM-RP-OA (Originating Address) IE. Instead, there should be
ToA/NPI header (1 octet).

Since we do not get ToN/NPI fields from the VLR/HLR, let's assume
the following default values:

  1... .... = Extension: No extension
  .001 .... = Type of number: International (1)
  .... 0001 = Numbering plan: ISDN/telephone (E.164/E.163) (1)

Change-Id: I0f32e2af0ed2d2fea6addf45efbdfee120c2425d
TTCN-3 test case: Ib467eeca6439bc6cce72293fbb5bb48f6d233db9
Related: OS#4324
2019-12-19 22:12:18 +09:00
Vadim Yanitskiy 61f4780f29 libmsc/gsm_04_11_gsup.c: do not init a buffer in gsm411_gsup_mo_fwd_sm_req()
Because there is no real need for that.

Change-Id: I19d4d0de0d5a46bf1de194b966f18ea8a84ced94
2019-12-19 22:08:23 +09:00
Neels Hofmeyr 3d6a8be0f9 sms log tweak
Change-Id: I77e7a1501f74b9045f032c5b6c2322025a11fd59
2019-12-12 15:46:57 +00:00
Neels Hofmeyr a252bcd089 sms db: when storing an SMS, retrieve the ID
seemed like a good idea, but not sure if we need it at all.

Change-Id: I5fa55307a6abb8bbfe56619235d7b79fbbda6caf
2019-12-12 15:46:41 +00:00
Oliver Smith 6dbdf1454d osmoappdesc.py, tests: switch to python 3
Make build and external tests work with python3, so we can drop
the python2 dependency.

This should be merged shortly after osmo-python-tests was migrated to
python3, and the jenkins build slaves were (automatically) updated to
have the new osmo-python-tests installed.

Related: OS#2819
Depends: osmo-python-tests I3ffc3519bf6c22536a49dad7a966188ddad351a7
Change-Id: I53ccde96dd3785098df0f7d693c504c8b8302e90
2019-12-12 09:29:19 +00:00
Neels Hofmeyr 63b246453b gsup: indicate CN-Domain in SendAuthInfo Requests
In order for osmo-hlr to be able to 100% guarantee distinct INDs for CS and PS,
set CN-Domain = CS in all SendAuthInfo Requests.

In Milenage auth, it is highly desirable that osmo-hlr guarantees use of
distinct INDs for CS and PS domains.  If an MSC and SGSN attached at the same
time use the same IND bucket to generate Milenage SQN, that collision would
rapidly waste SQNs and load osmo-hlr with requesting new auth tuples on each
CS/PS Complete-Layer3.

So far, osmo-msc did not indicate the CN domain in the GSUP SendAuthInfo
Request, which was neither required nor evaluated. The CN-Domain is only sent
for the UpdateLocation Request that usually follows later.

Related: OS#4318
Change-Id: I22f44068268e62801cadbf6542efaf153423cd65
2019-12-12 02:10:06 +01:00
Harald Welte abbdbfbbab msc: exit(2) on unsupported positional arguments on command line
Change-Id: Iad858974e9d97ae14f3da6dc21267aafafcda0ef
2019-12-03 22:19:32 +01:00
Vadim Yanitskiy db4839c267 libmsc: fix potential NULL-pointer dereferences detected by GCC's LTO
Change-Id: Ib7ba8909dce64d1b8ff3a53495fe3eefc446ed8e
2019-12-02 08:44:53 +00:00
Vadim Yanitskiy c6b088bf38 counters: polish documentation of cm_service_request / paging_resp
Change-Id: I273bc4165c70cd54ed94ff5f99377189f3306f51
2019-12-02 08:44:42 +00:00
Vadim Yanitskiy 1448052f37 counters: clarify documentation for MSC_CTR_CALL_* entries
Change-Id: Iad1ef917a229c3be51bd8fbe155f009f81e7d72a
2019-12-02 08:44:42 +00:00
Vadim Yanitskiy bc7dabd38d counters: clarify documentation for MSC_CTR_LOC_UPDATE_* entries
Change-Id: I4f4a0d644db0a2dd7c8eefd846ea6913c0b780ce
2019-12-02 08:44:42 +00:00
Vadim Yanitskiy 1ce842de39 counters: clarify documentation for MSC_CTR_SMS_* entries
Please note that counter "sms:delivered" assumes "Delivered MT SMS",
but actually counts total number MT SMS delivery attempts. This
change describes its _actual_ (erroneous) behaviour.

Change-Id: I081cf962ce2658ceab02699f3cdee19658d00939
Related: OS#4273
2019-12-02 08:44:42 +00:00
Harald Welte 34a8cc33a2 Check for osmo_fsm_register() error return value
Change-Id: I4cce3d6798fe3184a3085d114b749b4645620978
2019-12-01 15:32:09 +01:00
Harald Welte 22d0ba860d manual: Fix copy+paste error
Change-Id: I2c03d8424c218155dae9038dd7cc5660a290c5c8
2019-12-01 15:31:52 +01:00
Harald Welte e000050971 check for osmo_ss7_init() error return value
Change-Id: I2bc34f3962ca7355f20757e36a86ab2fd1a7aef6
2019-12-01 13:19:51 +01:00
Neels Hofmeyr 11bf0bc09c msc_vlr_test_call: rename lu_utran_tmsi
Change-Id: I46a41321e6d1be3672a56a6e3cc36f013fdcd396
2019-11-28 02:52:55 +01:00
Neels Hofmeyr 35fb679ab0 msc_vlr_tests: log descriptions in color with -v
Change-Id: I2b28a94a5b27932e343952ba82e7e11c46f5e87d
2019-11-28 02:52:55 +01:00
Neels Hofmeyr 07351d8f78 msc_vlr_test_call.c: add MNCC logging
Change-Id: I03b25c134553c620d3fa9d23a67ad39414546861
2019-11-28 02:52:55 +01:00
Neels Hofmeyr e0f906c42c msc_vlr_tests: better err logging for dtap msgs
Change-Id: I3edd90be40555dd648e9f16db5b6040665a19a95
2019-11-28 02:52:55 +01:00
Neels Hofmeyr b455205783 MNCC v6: add optional SDP to the socket protocol
Add a char buffer of 1024 characters length as space for SDP to pass to /
receive from MNCC.

Actually support receiving MNCC without such an SDP tail. The main reason for
this is to avoid the need to adjust the ttcn3 implementation of MNCC: it would
stop working for older osmo-msc.

Older or non-SIP MNCC peers could operate the previous MNCC protocol unchanged
(save the protocol number bump) without having to implement SDP.

The SDP part in the MNCC protocol will be used in upcoming patch
I8c3b2de53ffae4ec3a66b9dabf308c290a2c999f.

This patch must be merged at the same time as osmo-sip-connector patch
Iaca9ed6611fc5ca8ca749bbbefc31f54bea5e925, so that both sides have a matching
MNCC protocol version number.

Change-Id: Ie16f0804c4d99760cd4a0c544d0889b6313eebb7
2019-11-28 02:52:55 +01:00
Neels Hofmeyr eef4578102 add sdp_msg API: SDP parsing/composition
Rationale: in order to add full SDP to the MNCC protocol (upcoming patch
I8c3b2de53ffae4ec3a66b9dabf308c290a2c999f), we need to parse and compose SDP
messages. Obviously, libosmo-mgcp-client already contains similar code, but
that is unfortunately heavily glued to the actual MGCP implementation. The
simplest solution is to create this separate implementation, copy-pasting from
the existing libosmo-mgcp-client code as is convenient.

This API is added here to probe whether it works well. When it does, the
intention is to "move it up" to osmo-mgw and overhaul the SDP parsing in our
MGCP client and MGCP server APIs using this same API.

Change-Id: If3ce23cd5bab15e2ab4c52ef3e4c75979dffe931
2019-11-28 02:52:55 +01:00
Neels Hofmeyr bde605dfc5 fix incoming call while Paging
Do not free the CC transaction when an MT subscriber is already being Paged.
Instead, invoke another paging request, which paging.c will correctly add to
the list of pending paging response callbacks to run.

A ttcn3 test is linked in the related patch (s.b.).

Related: OS#4240
Related: Ieeae6322d4e80893ea3408c6b74bf8e32bea8e46
Change-Id: Idd4537b5f4817d17e5c87d9a93775a32aee0e7be
2019-11-28 02:52:55 +01:00
Neels Hofmeyr 00a476bc24 msc_a CC: add some basic sanity tests
Change-Id: I9d7d7d4073282abc6c02a6a297c807dc70c5154c
2019-11-28 02:46:05 +01:00
Neels Hofmeyr cc918cb416 fail on invalid RTP address from MGW
When the CRCX OK returns an invalid RTP address, abort the call; fixes
MSC_Tests.TC_invalid_mgcp_crash.

The original crash happened when adding this error handling without this commit
I08c03946605aa12e0a5ce8b3c773704ef5327a7a ("fsm: use deferred deallocation" for
osmo-mgw I7df2e9202b04e7ca7366bb0a8ec53cf3bb14faf3 "fix use-after-free: require
new fsm deferred dealloc, check for term"). With this error handling added,
even though avoiding a crash, the test does not pass yet, because instead of
rejecting the call, it currently composes an Assignment Command without a
Transport Layer Address. Fix that.

Change-Id: I00c3b5ff74c05bcc2b7c39375c33419916a57193
2019-11-28 02:45:40 +01:00
Martin Hauke 3f07daceef Fix some typos
Fix typos and common misspellings in code comments and log messages.

Change-Id: Ie66b89065f2100c1d2125ce5a6c9b1d58df7c8ad
2019-11-19 01:04:34 +00:00
Neels Hofmeyr 8a50cfbc4e BSSMAP: decode Codec List (BSS Supported)
Actually decode the Codec List (BSS Supported) in BSSMAP, in both the Complete
Layer 3 Information and the Assignment Complete messages.

An upcoming patch improves codec negotiation and requires the BSS supported
codecs, which are so far ignored (which is/was a pity as osmo-bsc goes at great
lengths to compose those IEs).

Change-Id: I66c735c79e982388f06b5de783aa584c9d13569e
2019-11-05 01:33:30 +01:00
Neels Hofmeyr 3f391dd77d fix msc_vlr_test_call.c
Substantial parts of the CC / MNCC call establishment were so far completely
missing from the msc_vlr_test_call.c tests. With my new insights on CC and MNCC
procedures, complete the tests.

Root reason: since I am going to re-order the sequence of events to enable
codec negotiation via SDP in MNCC, I want to have comprehensive tests of the CC
procedures to see the effect as diffs in the test output.

Change-Id: Ie995e264eb1e3dd9558a1753ff6f9b55c1d084e1
2019-11-05 01:33:30 +01:00
Neels Hofmeyr e04cd98121 cc trans: remove unused tch_rtp_create
Use of this flag was dropped when adding inter-BSC and inter-MSC Handover
support, I forgot to remove it.

Change-Id: I5ec78e30eb36fbe78a3f7c46bfa44af5a4eb7bf2
2019-11-05 01:33:30 +01:00
Neels Hofmeyr 82f58fed6a charts: add full MO and MT voice call diagram
Add voice_call_full.msc, generated from a real 2G<->3G voice call log fed to
msc_log_to_ladder.py.

The idea is to document how the voice call sequence of events changes in
upcoming patches.

Change-Id: I8a907d6a4ece1f3ad78da75a8c3e3e76afd5418d
2019-11-01 17:35:17 +01:00
Neels Hofmeyr 0f6664bb3d add msc_log_to_ladder.py
Add script that reads in an osmo-msc log output and extracts the interesting
information for displaying a sequence chart of voice call log, in mscgen
format.

I want to visualize how the sequence of messages changes across patches. It is
error prone to do it manually, and re-doing the sequence chart for every patch
(and patch rework) would be prohibitively time consuming.

Change-Id: I2e4d8778f7b83dee558517a9b23450b817ee325d
2019-11-01 17:35:17 +01:00
Neels Hofmeyr f439ff121f CC: add error handling for CRCX responses
Fix three 'FIXME: ERROR HANDLING' occurences in the code that reacts upon the
MGW providing (or failing to provide) an RTP port for the RAN side. From an
earlier stage of the code, the cleanup for this situation was extremely
complex, and hence the choice was to simply wait for the call to time out and
fail. But since we have implemented safe deallocation of nested FSMs in
libosmocore, the situation has become rather trivial: simply free the CC
transactions, and all the rest will immediately release, and terminate
correctly without crashing.

A ttcn3 test for this is MSC_Tests:TC_invalid_mgcp_crash, which actually also
needs the change to osmo_sockaddr_str_is_nonzero() in preceding patch
I53ddb19a70fda3deb906464e1b89c12d9b4c7cbd, so that a seemingly valid MGCP
message ends up causing a failure in the on_success() branch of
mgcp_client_endpoint_fsm.c.

Change-Id: I8313bed1d782100bebeac7d8fc040557c4cb653e
2019-11-01 17:35:17 +01:00