Commit Graph

6799 Commits

Author SHA1 Message Date
Neels Hofmeyr 106ba523c8 vlr_lu_fsm: fix missing event for IMEISV
Event VLR_ULA_E_ID_IMEISV is listed as permitted in VLR_ULA_S_WAIT_LU_COMPL,
but is missing from the switch() on the incoming event. So, sending an IMEISV
identity during the WAIT_LU_COMPL state would crash osmo-msc.

When receiving an IMEISV, vlr_subscr_set_imeisv() in turn calls
vlr_subscr_set_imei(), so as far as the lu_fsm is concerned, receiving an
IMEISV is identical to receiving an IMEI, and it can continue to send a Check
IMEI request to the HLR. Thus simply add VLR_ULA_E_ID_IMEISV to the
VLR_ULA_E_ID_IMEI switch case.

Change-Id: I11106cb108a4b1406ff9a8b8ff5761440a274dad
2019-08-08 02:08:55 +02:00
Neels Hofmeyr 7ea0db8f29 doc/sequence_charts: fix naming of mncc_fsm to mncc_call
mncc_fsm.[hc] were renamed to mncc_call.[hc] during patch review, which failed
to carry through to this sequence chart.

Also fix the MNCC_ST_* to MNCC_CALL_ST_* and MNCC_EV_* to MNCC_CALL_EV_*.

Change-Id: I03ee1b43ab95dca3c43fdb9e92dc158aad5a4203
2019-08-05 23:25:17 +02:00
Neels Hofmeyr 62c0a2a4ab doc/sequence_charts/mncc_fsm.msc: add SIP messages, tweak
- add SIP messages, taken from OS#1683
- change some wording and clarify some message ordering
- have a separate sipcon1 and sipcon2 for the MO and MT sides

Change-Id: I6782e416dbd8ee88d093cbef722b0c5084f3865c
2019-08-05 23:25:16 +02:00
Neels Hofmeyr 14c34d8bec add msc_vlr tests for UMTS without ciphering
Following I04ecd7a3b1cc603b2e3feb630e8c7c93fc36ccd7, have tests for UMTS
authentication both for cases with and without encryption.

- Rename test_umts_authen_utran to test_umts_auth_ciph_utran() (uses
  encryption).
- Again add test_umts_authen_utran() not using encryption.
- Likewise with test_umts_authen_resync_utran().

Some permutations are still missing, like UMTS AKA on GERAN with encryption
enabled; not bothering at the moment.

Related: OS#2783
Change-Id: I54227f1f08c38c0bf69b9c48924669c4829b04b9
2019-08-05 23:24:47 +02:00
Neels Hofmeyr a4d7a76816 do not force encryption on UTRAN
Remove the conditions that always enable encryption on UTRAN.

We so far lack an explicit configuration for UTRAN encryption, and this patch
does not add any either. Instead, whether UTRAN encryption is enabled is simply
triggered on whether GERAN has A5 encryption enabled (A5/n with n > 0). Though
GERAN and UTRAN encryption are not technically related at all, this makes UTRAN
behave like GERAN for now, until we implement a proper separate configuration
for UTRAN encryption.

Adjust the msc_vlr_test_* configuration by setting the net->a5_encryption_mask
such that the expected output remains unchanged. A subsequent patch
(I54227f1f08c38c0bf69b9c48924669c4829b04b9) will add more tests, particularly
cases of UTRAN without encryption.

Adjust manual and vty doc.

Related: OS#2783
Change-Id: I04ecd7a3b1cc603b2e3feb630e8c7c93fc36ccd7
2019-08-05 23:24:47 +02:00
Neels Hofmeyr 75bdbbf45d manual: adjust and fix auth and ciph docs
Change-Id: Iffe159d4c0e0e9439f8719e0ddd28f06d4c80d9f
2019-08-05 23:24:47 +02:00
Pau Espin 3e1e47679d Remove undefined param passed to logging_vty_add_cmds
Since March 15th 2017, libosmocore API logging_vty_add_cmds() had its
parameter removed (c65c5b4ea075ef6cef11fff9442ae0b15c1d6af7). However,
definition in C file doesn't contain "(void)", which means number of
parameters is undefined and thus compiler doesn't complain. Let's remove
parameters from all callers before enforcing "(void)" on it.

Change-Id: Ia2b24ffd7f9cbb271fcdb979b851f3a07b9d6d3e
Related: OS#4138
2019-08-05 16:07:08 +02:00
Keith Whyte ff17f8fd8a Set coding in mncc_set_cause()
GSM 04.08 10.5.4.11

The Release indication needs to have the Coding Standard set.

For phones that would display a message on screen, such as
"Number not in use", if the coding standard is not defined,
the display may show "Error in Connection"

Change-Id: Ib28b62a41d433e231cff5910d19455296b284df6
2019-08-02 08:08:33 +00:00
Neels Hofmeyr 4014e481d4 minor comments in msc_vty.c
Change-Id: I83d8c778190adb1e74debc8f8ddac6996de7c513
2019-07-29 18:39:50 +02:00
Pau Espin 637fc0218b doc: Add Osmux documentation to User Manual
Depends: osmo-gsm-manuals.git f3a734e6777a902abfb03257277454c7a879aeb7
Change-Id: I70c488c3d9b05599b834a8608e6361c8aa43ef31
2019-07-25 10:39:07 +00:00
Oliver Smith c0a5e71d0e vlr_lu_fsm.c: don't send LU reject twice
Don't call tx_lu_rej() in the "vlr_lu_compl" FSM. It is always getting
called in the parent "lu" FSM and is therefore redundant:

_vlr_lu_compl_fsm_done(fi, VLR_FSM_RESULT_FAILURE, cause)
-> osmo_fsm_inst_state_chg(fi, LU_COMPL_VLR_S_DONE, 0, 0)
-> vlr_lu_compl_fsm_dispatch_result()
-> lu_fsm_wait_lu_compl()/lu_fsm_wait_lu_compl_standalone()
-> lu_fsm_failure()
-> lfp->vlr->ops.tx_lu_rej()

I have noticed the bug with the TTCN3 tests. This patch fixes
TC_lu_imsi_auth_tmsi_check_imei_{nack,err} after stricter checking
in [1] and also TC_iu_mo_crcx_ran_reject.

[1] I836f76242463789c4c003feec757714827f2a31b (osmo-ttcn3-hacks)
Change-Id: I127b27937613ea0ff29d67991c0414fca6d441d9
2019-07-24 09:08:22 +02:00
Eric Wild fdda613af5 turn -Werror=null-dereference into a warning
There is unfortunately no way to suppres this witha pragma,
and gcc 9 uncovers quite a few new instaces with enabled LTO that can't/won't be fixed

Related: OS#4123
Change-Id: I615bb5be3671022c6b821575a61f945b50e8f2a5
2019-07-22 19:56:56 +00:00
Alexander Couzens efa7b97133 replace osmo_counter with stat_items
osmo_counter will be soon deprecated. Use the newer and more flexible
osmo_stat_item instead.

Depends on: Id2462c4866bd22bc2338c9c8f69b775f88ae7511 (libosmocore)
Change-Id: I6a20123b263f4f808153794ee8a735092deb399e
2019-07-18 14:50:51 +00:00
Thorsten Alteholz 3a357de631 fix spelling detected by lintian
Change-Id: I01e54b5cf111677079a8ad57645d3ceb7834702a
2019-07-16 20:12:03 +00:00
Oliver Smith aa0a295a3d contrib/jenkins.sh: run "make maintainer-clean"
Related: OS#3047
Change-Id: Ifc91733c7fe0c5a002037523116014bf270997ef
2019-07-11 03:42:36 +00:00
Vadim Yanitskiy 09ce3dcbdf libmsc/msc_vty.c: print subscriber expiration time
Change-Id: I092691a8c443f4c5ed4d33de2e551fef592c1baf
2019-07-09 07:14:09 +00:00
Vadim Yanitskiy d14422a236 Fix: add missing semicolons to OSMO_ASSERT statements
Change-Id: I4fae5fbab5fdbcce35906601d4f1031d971f4931
2019-07-09 07:13:45 +00:00
Vadim Yanitskiy 1c50044efb libmsc/ran_msg_iu.c: fix: properly handle SAPI IE of RANAP_DirectTransfer
The RANAP DirectTransfer message may contain an optional SAPI IE.
Thanks to our TTCN-3 tests (and Wireshark!), it was discovered
that this IE is ignored, so even if the MO SMS related messages
arrive on SAPI 3 (as per GSM TS 04.11, section 2.3) OsmoMSC sends
MT messages on SAPI 0.

In ran_iu_decode_l3() we need to check if the SAPI IE is present,
and tag the NAS PDU message buffer with a proper DLCI value.

This change makes the failing SMS related test cases pass.

Change-Id: I728b55b04e87fc23be6d4f8735e8cad82b6f640e
2019-06-20 16:54:45 +00:00
Vadim Yanitskiy 7659482318 libmsc/gsm_04_11.c: do not abuse LOG_TRANS() in gsm411_alloc_mt_trans()
This change is similar to I6b68a0f0b32eb126e0f7e914a314130254d28467.
If we 100% sure that trans == NULL, it makes more sense to use
generic LOGP(DLSMS, LOGL_*, ...) call, so the logs can reflect
more information than such dummy prefix:

  trans(NULL NULL callref-0x0 tid-0) ...

Change-Id: I3c1e633aee5dd7cd0d367404a3def9cffe0b3baa
2019-06-20 16:54:45 +00:00
Vadim Yanitskiy 59e0c6b46a gsm_04_11_gsup.c: fix broken reference counting for vsub
This change is similar to I5540556b1c75f6873883e46b78656f31fc1ef186.
In gsm411_gsup_rx() we do call vlr_subscr_find_by_imsi(), which
increases subscriber's reference count by one using the function
name as the token. However, we never release this token, so the
reference count grows on every received GSUP FORWARD-SM message.

Change-Id: Ic729beb5f94cbbfbb251bc9ab66a5e7b799286c0
2019-06-20 16:54:45 +00:00
Pau Espin fe5b7046ea sms_queue.c: Improve misleading log line
Otherwise when read in a log file it seems it's really going to send 20
sms even if there's none to send.

Change-Id: Ieb9bb61a90f295d2ba5fb67a2abee2d30785876d
2019-06-20 10:45:37 +02:00
Vadim Yanitskiy 718f32fa88 libvlr/vlr.c: do not expire subscribers if periodic LU is disabled
When periodic Location Update is disabled (T3212 = 0), it was noticed
that OsmoMSC does expire subscribers quite soon - after 60 seconds
(VLR_SUBSCRIBER_LU_EXPIRATION_INTERVAL) since the last LU.

In order to avoid that, we need to check T3212 timer value in
vlr_subscr_expire_lu(), and if it's equal to 0, do not expire
anybody until the explicit IMSI Detach.

Change-Id: I2ead2241a3394dbdd5417f4554190df3fd698af2
2019-06-19 14:36:28 +07:00
Vadim Yanitskiy 188dd5f4df tests/msc_vlr: fix: do not pass RAT type to expect_bssap_clear()
The function name implies OSMO_RAT_GERAN_A, and it has nothing
to do with other OSMO_RAT_* types. Found using clang:

  warning: too many arguments in call to 'expect_bssap_clear'
           expect_bssap_clear(OSMO_RAT_GERAN_A);
	                      ^^^^^^^^^^^^^^^^

Change-Id: Id3a3af33fcc5da4ca4c48a2f589a69f3568d2586
2019-06-19 02:05:08 +07:00
Daniel Willmann 7a2c9c91e9 manuals: Include overview chapter about counters
Change-Id: I8c3e8bcda27f35118ab0e3d75621a02eec86f15c
2019-06-18 18:07:43 +02:00
Daniel Willmann fb73e0c654 manuals: Update counter/vty documentation
Change-Id: I1ef0e8ae166d7fdc5e85716a961e8387d26bdd2c
Related: OS#1700
2019-06-18 12:51:07 +00:00
Daniel Willmann a794ff4f46 manuals: Add script to update vty/counter documentation from docker
Change-Id: I3f5573f81460b40d4606fbcf0febcfd078a7bdca
Related: OS#1700
2019-06-18 12:51:07 +00:00
Vadim Yanitskiy b3bdc768be libmsc/gsm_09_11.c: do not suppress rc of gsup_client_mux_tx()
Change-Id: Ide2440188fb6fe1c54681fef8ec4fed9e6da66e2
2019-06-17 22:23:09 +07:00
Vadim Yanitskiy 6632251572 libmsc/gsm_09_11.c: do not abuse LOG_TRANS() in gsm0911_rcv_nc_ss()
If we 100% sure that trans == NULL, it makes more sense to use
generic LOGP(DSS, LOGL_*, ...) call, so the logs can reflect
more information than such dummy prefix:

  trans(NULL NULL callref-0x0 tid-0) ...

Change-Id: I6b68a0f0b32eb126e0f7e914a314130254d28467
2019-06-17 22:13:03 +07:00
Vadim Yanitskiy e0da446e76 libmsc/gsm_09_11.c: fix broken reference counting for vsub
In gsm0911_gsup_rx() we do call vlr_subscr_find_by_imsi(), which
increases subscriber's reference count by one using the function
name as the token. However, we never release this token, so the
reference count grows on every received GSUP PROC-SS message.

Change-Id: I5540556b1c75f6873883e46b78656f31fc1ef186
2019-06-17 21:57:30 +07:00
Vadim Yanitskiy 944d6a2acb libmsc/gsm_09_11.c: avoid double zero-initialization of gsup_msg
Change-Id: Ib991b01534499401e7a0c3de49ceba770fdd9b48
2019-06-17 21:57:30 +07:00
Vadim Yanitskiy f177590488 libmsc/gsm_09_11.c: properly handle OSMO_GSUP_MSGT_PROC_SS_ERROR
This message can be used by the HLR/EUSE to indicate that something
went wrong, e.g. the connection with EUSE is lost, EUSE or the MS
did not respond in time, etc. OsmoMSC needs to release the SS/USSD
transaction, and send GSM 04.80 RELEASE COMPLETE message to the MS
if there is an active RAN connection.

Change-Id: I076d12ef24d7320eda1df1ee4588da7375ef3d9e
Related: (TTCN-3) I5586a88136c936441a842f49248824680603672e
Related: OS#2931
2019-06-17 21:08:14 +07:00
Vadim Yanitskiy 7480852eea libmsc/gsm_09_11.c: inform HLR/EUSE if Paging has failed
Change-Id: Ie2ac06aadb18251310e0cfd85bb0d9865470aab7
Related: (TTCN-3) I1f53c56d569c8ac4071835685bbe3bc9e0ebd7f0
Related: OS#2931
2019-06-17 21:06:43 +07:00
Vadim Yanitskiy 805eca2b3e libmsc/msc_net_init.c: pass pointer to gsm_network directly
Change-Id: I122d2880b356997c60df5f0cf4f5ecb3abb2e672
2019-06-17 21:06:43 +07:00
Vadim Yanitskiy 95b040c45a libmsc/gsm_09_11.c: drop meaningless check for concurrent paging
This check was copy-pasted from the CC handling code during the
initial development of "SS/USSD over GSUP" feature. It probably
makes sense for MT calls, but definitely not for SS/USSD.

Change-Id: I2899a23ee49fd7917443943629603700a5025cf4
2019-06-17 21:06:43 +07:00
Vadim Yanitskiy ae95436c7a libmsc/gsm_09_11.c: drop rudimentary vsub->cgi.lai.lac check
This check was copy-pasted either from CC, or from SMS handling
code during the initial development of "SS/USSD over GSUP". Now
this is the only one survived after the recent refactoring.

I doubt this is exactly the right way to check whether subscriber
is attached or not. Moreover, this check should rather be done in
a single place, rather then in each CC/SS/SMS handler separately.

Change-Id: I7bd48860e923cb1f1a5bccc4b0f497ec1a7bcf84
2019-06-17 21:06:43 +07:00
Vadim Yanitskiy db5bc701a8 libmsc/gsm_09_11.c: log network-originated session establishment error
Change-Id: I090c25de3421f770115ed68a7ecc050694cedff7
2019-06-17 21:06:43 +07:00
Vadim Yanitskiy 10c3ce563b libmsc/gsm_09_11.c: do not abuse LOG_TRANS() and early trans allocation
In case of network-originated SS/USSD session establishment, we
need to verify the received GSUP PROC_SS_REQ message and make
sure that all mandatory IEs are present.

There is no sensible need to allocate a new transaction before
doing all the checks, other than the ability to use LOG_TRANS().
This complicates the code, so let's avoid the early allocation.

Change-Id: I4e027b19e8065a39324a1647957cef4066b82ce7
2019-06-17 21:01:09 +07:00
Eric Wild 58abc67caa libvlr: fix sgsn tmsi creation, replace constant with define
reported by _dev_zero in #osmocom

Change-Id: Ib5679ab5d06b6ef735725b4a68eeb1e9cbcc11ba
Depends-On: libosmocore I52b9f6b5f3e96d85a390ba2af21d7814df8aaeec
2019-06-17 12:51:27 +00:00
Vadim Yanitskiy 01926fc240 libmsc/paging.c: cosmetic: remove leading space in log line
Change-Id: Ie7816f3b30a6c6ac5175646b479eb9a3e76429e1
2019-06-16 00:22:13 +07:00
Vadim Yanitskiy 08553e0f10 libmsc/paging.c: cosmetic: actually use default branch of switch
Change-Id: I9b566885f722a28816760532b645f606fdf4faeb
2019-06-16 00:22:13 +07:00
Vadim Yanitskiy a12ac82352 libmsc/paging.c: avoid double zero-initialization
Change-Id: Icc839370fc39ab57078ec6deeac337ed2f37793c
2019-06-16 00:22:13 +07:00
Vadim Yanitskiy 6539bfb8e3 libmsc/msc_a.c: fix: remove dummy allstate_action of msc_a_fsm
Since [1] has been merged to libosmocore, it was discovered that
the 'msc_a' FSM has a dummy 'allstate_action' handler assigned,
but 'allstate_event_mask' is 0x00 at the same time.

It basically doesn't make any sense, and moreover does cause
warnings and build failures.

[1] https://git.osmocom.org/libosmocore/commit/?id=b3f94eb39e19366c3458643ee329a73155d46ff8
[1] https://gerrit.osmocom.org/#/c/libosmocore/+/14361/

Change-Id: Ieb81b7a07ced1c40ba70d2adb0df68160ee62118
2019-06-16 00:12:17 +07:00
Vadim Yanitskiy 49d45f1e85 libmsc/gsm_04_08.c: clean up unused leftover includes
During the recent refactoring, some code parts has been moved out
of 'gsm_04_08.c', but the related header files were forgotten.

Change-Id: I61e728069a1e79bf72c01ef9d9fc5fb171d3892e
2019-06-15 11:24:00 +00:00
Vadim Yanitskiy efb1f60c76 libmsc/gsm_09_11.c: send GSUP PROS_SS ERROR message when needed
OsmoMSC should notify the remote SS/USSD entity if:

  - received GSUP message has unexpected session state;
  - received GSUP message has unknown session ID;
  - received GSUP message missing mandatory IE(s);
  - NCSS transaction establishment failed;
  - NCSS message delivery failed.

Change-Id: Ief9f8a197b0860072b671edfc55180f619860d9d
Related: (TTCN-3) Ie267ee174c5061cd3fc102a2824abe03d73f3aac
Related: OS#2931
2019-06-15 15:38:03 +07:00
Vadim Yanitskiy 04bbfb83d4 libmsc/gsm_09_11.c: fix: return trans from establish_nc_ss_trans()
It is expected that establish_nc_ss_trans() returns an allocated
transaction in successful case, or NULL in case of error. The
function assumes two scenarios:

  - the subscriber already has an active RAN connection,
  - RAN connection needs to be established (Paging).

In the first case, a pointer to the transaction is returned as
expected, but in case of Paging, NULL has always been returned,
even if there were no errors. Let's fix this.

Change-Id: I9dcee64dd0b435ef29630c223132b81724701f93
2019-06-15 15:38:03 +07:00
Vadim Yanitskiy 20edc9723e gsup_client_mux_tx_error_reply(): fix: do not omit SM-RP-MR IE
The SM-RP-MR (Message Reference for SM Service) value in the response
(no matter result or error) shall match the value from the request.

Change-Id: Ifb6e749928548e6febfe7768aefe9a2a3ecf4de0
2019-06-15 13:13:50 +07:00
Vadim Yanitskiy c33d94be93 gsup_client_mux_tx_error_reply(): fix: do not omit message class IE
Found using the new TC_mt_ussd_for_unknown_subscr test case.

Change-Id: Id00a99b713a6b97c455b8e6ae49abea163e8281f
Related: (TTCN-3) Id35cd3ec15d1bab15260312d7bbb41e2d10349fe
Related: OS#2931
2019-06-15 13:13:50 +07:00
Vadim Yanitskiy 463005e246 gsup_client_mux_tx_error_reply(): fix: do not omit session IEs
For SS/USSD, it's important to have both session state and ID IEs.
Found using the new TC_mt_ussd_for_unknown_subscr test case.

Change-Id: I57317a7b8036d1ffd36e2021efc146db4633da84
Related: (TTCN-3) Id35cd3ec15d1bab15260312d7bbb41e2d10349fe
Related: OS#2931
2019-06-15 13:13:50 +07:00
Vadim Yanitskiy 4d0066ceb6 gsup_client_mux_tx_error_reply(): fix: do not override IMSI
I am not a big fan of using such syntax sugar for initializing
structures, and this is one of the reasons: it's much easier
to shoot yourself in the foot.

IMSI was copied to the new GSUP message, but then overridden.
Found using the new TC_mt_ussd_for_unknown_subscr test case.

Change-Id: If81c3fa56951185339f33a523ab6364594101be1
Related: (TTCN-3) Id35cd3ec15d1bab15260312d7bbb41e2d10349fe
Related: OS#2931
2019-06-14 21:51:49 +00:00
Vadim Yanitskiy 3d603034a9 libmsc/gsm_0(4|9)_11_gsup.c: print error message if subscr is not known
Change-Id: I0b9d4128c853866d7d834f381ad520f78f441afe
Related: (TTCN-3) Id35cd3ec15d1bab15260312d7bbb41e2d10349fe
Related: OS#2931
2019-06-15 01:15:06 +07:00