Commit Graph

6912 Commits

Author SHA1 Message Date
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
Neels Hofmeyr 84ce206ae3 use osmo_sockaddr_str_is_nonzero()
Also regard an RTP port as invalid if the IP address is 0.0.0.0.
Achieve this by using osmo_sockaddr_str_is_nonzero() instead of
osmo_sockaddr_str_is_set().

Depends: I73cbcab90cffcdc9a5f8d5281c57c1f87b2c3550 (libosmocore)
Change-Id: I53ddb19a70fda3deb906464e1b89c12d9b4c7cbd
2019-11-01 17:35:17 +01:00
Neels Hofmeyr 523b92f3aa rtp_stream: sanely cancel MGW endpoint FSM notify
libosmo-mgcp-client recently introduced osmo_mgcpc_ep_cancel_notify() to cancel
notification if a notify target FSM deallocates. Use it for sanity in
rtp_stream FSM cleanup, the notify target for endpoint FSMs.

Depends: I41687d7f3a808587ab7f7520f46dcc3c29cff92d (osmo-mgw)
	 I14f7a46031327fb2b2047b998eae6ad0bb7324ad (osmo-mgw)
Change-Id: I351bb8e8fbc46eb629bcd599f6453e2c84c15015
2019-11-01 17:35:17 +01:00
Neels Hofmeyr 33f71a1200 fsm: use deferred deallocation
Since osmo-bsc uses the MGCP client FSMs, it is required to enable this new
feature to guarantee safe operation. The issue is described in detail in commit
logs linked below.

Notably, osmo-msc currently chooses to omit error handling during MGCP events
(marked "FIXME"). An upcoming patch implements this error handling, and would
make osmo-msc vulnerable to crash from unexpected MGCP messages without this.

Deferred FSM deallocation is a more general, simpler approach to
osmo_fsm_term_safely(), so we can switch that off now.

Depends: Ief4dba9ea587c9b4aea69993e965fbb20fb80e78 (libosmocore),
         I0adc13a1a998e953b6c850efa2761350dd07e03a (libosmocore)
Related: I7df2e9202b04e7ca7366bb0a8ec53cf3bb14faf3 (osmo-mgw)
Change-Id: I08c03946605aa12e0a5ce8b3c773704ef5327a7a
2019-11-01 17:33:02 +01:00
Neels Hofmeyr cf90bdb07d send MNCC REL only if MNCC has actually started
Change-Id: I07b2b6c0ee33f5d3e0a060c10cf36d5c7c9f0d9b
2019-10-29 16:46:32 +01:00
Neels Hofmeyr 0c1ed15336 log: ran_msg_a: tweak a message name
Change-Id: I691025cb957e9b87c8af2dc8eb741dcba6ca26e2
2019-10-29 16:46:32 +01:00
Neels Hofmeyr fe5ae8ef5b log: RANAP encode: use RANAP message names instead of BSSAP
Change-Id: Ib0e0630d775a28958ea86802f70cbeec07087f91
2019-10-29 16:46:32 +01:00
Neels Hofmeyr 72fc706af5 BSSMAP log tweak
Before:
  RAN decode: BSSMAP: Rx BSSMAP DT1 COMPLETE LAYER 3
After:
  RAN decode: BSSMAP: COMPLETE LAYER 3

This caught my attention while I was writing up a script to parse osmo-msc
logging to produce ladder diagrams.

Change-Id: I387dde8f2eb3edb35d22ce52dc0ed580978dea36
2019-10-29 16:46:32 +01:00
Neels Hofmeyr c67b4831c4 also log MNCC_SETUP_REQ
If an incoming MNCC_SETUP_REQ ends up in Paging (as usually it does), the early
return so far skipped logging of that MNCC message. Add this logging.

Change-Id: I1495dd562a06cf6c1e9453a1fe111bdf8f4be081
2019-10-29 16:46:32 +01:00
Oliver Smith a7ec369a28 tests: only check IU configs if IU is enabled
Fix vty tests that are failing since libosmocore change
Ic225232fbfca49ba868427eaf898e1f6e34e1ca8. If OsmoMSC is built without
IU support, it fails with "cs7-instance-iu" in the config.

Change-Id: Ie56da9167badfd2399b566af91a345103f46c2a1
2019-10-29 15:47:48 +01:00
Neels Hofmeyr 467bb87f44 log: drop duplicate MNCC log
Change-Id: I46055a4f7a6ae517772c6794faad8c775454974a
2019-10-21 00:40:31 +02:00
Neels Hofmeyr c192c0bf71 log which DTAP messages are sent to RAN
So far, the logging said only "RAN encode: BSSMAP: DTAP", but not *which* DTAP
message, which is in fact a very interesting detail when reading osmo-msc logs.

Change-Id: I0cb8d1e3307737ffe53730c64bb984adacedb2da
2019-10-21 00:40:31 +02:00
Neels Hofmeyr f636e6cedd LOG_TRANS for CC: always log CC state
For all CC type transaction logging, log the current trans->cc.state string for
all LOG_TRANS*() logging.

Change-Id: I67be12c74c679ce684f8c0b9b4e0d96299849dc6
2019-10-21 00:40:31 +02:00
Alexander Couzens a09f4987c1 vlr_auth_fsm: on SAI use the GSUP provided GMM cause code
The HLR might respond with a specific GMM cause code. E.g. roaming not
allowed which needs to be passed down the layers.

Change-Id: I9af515dc52834b7c57c42fc3a76ee2c682734e2a
2019-10-17 08:02:07 +00:00
Alexander Couzens 7312b15830 make vlr_gmm_cause_to_mm_cause public
To be used by vlr_auth_fsm

Change-Id: I9e13e756f359a9b9e6a2056ab37adf0af14afec1
2019-10-17 08:01:42 +00:00
Neels Hofmeyr 1bfe0e1cd1 catch GSUP auth result without auth_fsm
When a vlr_subscr receives an Send Auth Info result, properly check whether the
subscriber has an auth_fsm.

Before, a missing auth_fsm would crash osmo-msc with:

    vlr.c:762 Trying to dispatch event 1 to non-existent FSM instance!

Related: OS#4191
Change-Id: I1995d8f68cfde1140968fb9a97bd054de950de2e
2019-09-26 23:05:51 +00:00
Philipp Maier 002fb01faa paging: Send SGsAP-SERVICE-ABORT-REQUEST on paging timeout
When pagig for a CS-Call via SGs times out, the MME expects to be
informed about this via an SGsAP-SERVICE-ABORT-REQUEST, make sure this
message is sent, but only for CS-Fallback calls.

Change-Id: I3f8f153afe24cf2efa245713509bdc8488902877
Depends: osmo-ttcn3-hacks I99950a17ccf26aaa0eebded5480f33be4c57586a
Related: OS#3614
2019-09-26 19:23:54 +00:00
Philipp Maier 6dcdfb036a sgs_iface: Accept messages with unknown TLV elements
3GPP TS 29.118, chapter 7.5 states that unknown TLV elements should be
ignored rather than that the whole message is discarded a STATUS message
is sent. Lets turn the returncode check of the tlv_parse() call into a
log message and continue normally.

Change-Id: Ic6714451ad970043d4765f8420d753daf5294a44
Related: OS#4214
2019-09-24 11:48:19 +02:00
Neels Hofmeyr e9a3911844 fix error on BSSMAP Cipher Mode Complete L3 msg IE
When an MS returns the IMEISV in the BSSMAP Cipher Mode Complete message in
the Layer 3 Message Contents IE, do not re-invoke the decode_cb() a second
time, but instead point to it from the ran_msg.cipher_mode_complete struct.

When the MSC-A decodes the Ciphering Mode Complete message, it always wants to
also decode the enclosed DTAP from the Layer 3 Message Contents IE. However,
when the MSC-I preliminarily decodes messages, it often just wants to identify
specific messages without fully acting on them, let alone dispatching RAN_UP_L2
events more than once. So leave it up to the supplied decode_cb passed to
ran_dec_l2() implementations to decide whether to decode the DTAP.

In msc_a.c hence evaluate the DTAP by passing a msgb to msc_a_up_l3(), which
will evaluate the RR Ciphering Mode Complete message found in the BSSMAP Cipher
Mode Complete's Layer 3 Message Contents IE.

Particularly, the previous choice of calling the decode_cb a second time for
the enclosed DTAP caused a header/length parsing error: the second decode_cb
call tried to mimick DTAP by overwriting the l3h pointer and truncating the
length of the msgb, but subsequently ran_a_decode_l2() would again derive the
l3h from the l2h, obliterating the intended re-interpretation as DTAP, and
hence the previous truncation caused error messages on each and every Cipher
Mode Complete message, like:

DBSSAP ERROR libmsc/ran_msg_a.c:764 msc_a(IMSI-26242340300XXXX:MSISDN-XXXX:TMSI-0xA73E055A:GERAN-A-77923:LU)[0x5563947521e0]{MSC_A_ST_AUTH_CIPH}: RAN decode: BSSMAP: BSSMAP data truncated, discarding message

This error was seen a lot at CCCamp2019.

Modifying the msgb was a bad idea to begin with, the approach taken in this
patch is much cleaner.

Note that apparently many phones include the IMEISV in the Cipher Mode Complete
message even though the BSSMAP Cipher Mode Command did not include the Cipher
Response Mode IE. So, even though we did not specifically ask for the Cipher
Mode Complete to include any identity, many MS default to including the IMEISV
of their own accord. Reproduce: attach to osmo-msc with ciphering enabled using
a Samsung Galaxy S4mini.

Related: OS#4168
Change-Id: Icd8dad18d6dda24d075dd8da72c3d6db1302090d
2019-09-18 15:31:13 +02:00
Alexander Couzens eb1b03a98a vlr: gmm_cause_to_fsm_and_mm_cause() drop fsm_cause_p argument
It's always set to OSMO_TERM_ERROR. Move the assignment to the caller.
In prepartion to use gmm_cause_to_fsm_and_mm_cause() in vlr_auth_fsm.

Change-Id: Ie4720ad40ef7bcfc528d8d63bfc606c9c0545fb2
2019-09-16 17:57:39 +00:00
Pau Espin b08a380420 vty: fix access to wrong argv in paging response-timer
Fixes: 2ff5bcdc38
Change-Id: I667cf4c8e3e7b6e77ea6ed8ae603727ad22a2ee2
2019-09-16 19:01:40 +02:00
Neels Hofmeyr 01653252b4 msc_a fsm: ignore state chg to same state
We sometimes see errors like

   libmsc/msc_a.c:361 msc_a(...){MSC_A_ST_RELEASING}: transition to state MSC_A_ST_RELEASING not permitted!

i.e. changing state to the state msc_a is already in.

Ignore re-entering the same state for most state changes. However, there is one
state change in msc_a where re-entering the MSC_A_ST_VALIDATE_L3 is necessary
to start the timeout.

Hence add msc_a_state_chg_always() and use that for re-entering
MSC_A_ST_VALIDATE_L3. Change msc_a_state_chg() to skip no-op state changes.

This should silence all no-op state change error messages for msc_a.

Related: OS#4169
Change-Id: I0c74c10b5fa7bbdd6ae3674926cc0393edf15a35
2019-09-03 13:59:05 +00:00
Neels Hofmeyr f092301a0f ran_dec logging: log message sizes on errors
Change-Id: Id08e4ee5a4dbf552dbb107d8f0519110664f6acb
2019-09-03 13:59:05 +00:00
Neels Hofmeyr 4b78b29b8c vlr: don't log about "gratuitous ID RESPONSE"
If an ID Response comes in during a non-LU L3 Complete (Paging or CM Service
Request), no event needs to be dispatched. So far vlr_subscr_rx_id_resp()
logged a NOTICE "gratuitous ID RESPONSE?!?" if no lu_fsm is present.

An ID Response can come in particularly as payload with a BSSMAP Cipher Mode
Complete message, even though osmo-msc didn't explicitly ask for it.

It is not an error to get a Cipher Mode Complete containing an ID Response
during Paging or CM Service Request, so remove the confusing log message.

Related: OS#4168 (only loosely related)
Change-Id: I8a5b8735eb41cd0976c7ab32cdd55440d3ef70ac
2019-09-03 13:59:05 +00:00
Keith Whyte 991bb422d4 Implement a global switch on the network to disable call waiting.
Add a network -> callwaiting VTY command as boolean.

When this is enabled (default) there is no change to
operation previous to this commit.

When this switch is disabled with "no call-waiting" in vty
then when a call arrives, we will check if we have an active
call transaction for this subscriber, no matter if it is
establishing, established, or alerting, in any of these cases we
will return USER BUSY to the calling party.

Change-Id: I3eb6f23f7103e3002874fb5d3a30c9de952202ae
2019-09-03 11:47:13 +00:00
Neels Hofmeyr 7c8df44adc cosmetic: fix call_leg_ensure_ci() decl. arg name to match impl.
Change-Id: I576bc5c1fd63fe8048a7a6a2d06763fc3221fa49
2019-09-02 11:07:49 +02:00
Neels Hofmeyr b4ef5e7bd1 msc_a.c, CC trans: change a comment to a debug log
Change-Id: I5a3cc6219080910119b0c9ff11fc2b9eb96a06e5
2019-09-02 11:07:49 +02:00
Neels Hofmeyr 43e8d4d412 gsm48_tch_rtp_create(): check against NULL mgcp_info
osmo_mgcpc_ep_ci_get_rtp_info() might return a NULL mgcp_info, guard against
that.

Fixes: CID#203651
Change-Id: I98fe5860c49751ade1af10d99487aba259504f23
2019-09-02 11:07:49 +02:00
Neels Hofmeyr be5f033475 msc_vlr_tests: GSUP: don't care about extra IEs
To not break the msc_vlr tests by new GSUP IEs added to some of the GSUP
messages, make msc_vlr_tests only match the start of the GSUP message and not
care about extra IEs. The extra IEs are anyway seen in the expected logs.

The reason to drop the msgb_eq_data_print() is because it is useless for
mismatching lengths. It will always print only the length mismatch, instead we
need to be able to compare with what was expected.

Change-Id: I38d51eeafab04ece83e4bb87bfaa967506f97b11
2019-09-02 11:07:49 +02:00
Neels Hofmeyr 38816dab97 log, cosmetic: add "RR" to "Ciphering Mode Complete"
Distinguish the enclosed DTAP RR Ciphering Mode Complete message from the outer
BSSMAP Cipher Mode Complete message in the DEBUG log.

Change-Id: I80c69b491e2ddb932bc4295a01caaf6a903b1fe4
2019-09-02 11:06:05 +02:00
Neels Hofmeyr 43a349fd63 tweak CC cause for incoming call to unattached nr
So far we sent CC cause "Unassigned Number"

But the MSC doesn't trivially know whether the HLR has the number assigned or
not: any handset that is currently switched off would cause "Unassigned number"
to be displayed on the caller's handset.

Rather send a temporary failure cause code.

Send this cause code for all cases, because claiming that an assigned number is
unassigned is worse than rejecting an unassigned number with a temporary
failure.

Change-Id: Ia3d4f67b53fcc2654ff048fbc338e92cb763a095
2019-08-29 05:42:02 +00:00