osmo-msc/tests/msc_vlr
Neels Hofmeyr 3117b701c8 A5/n Ciph: request Classmark Update if missing
When the VLR requests a Ciphering Mode with vlr_ops.set_ciph_mode(), and if we
need a ciph algo flag from a Classmark information that is not yet known
(usually CM 2 during LU), send a BSSMAP Classmark Request to get it.

To manage the intermission of the Classmark Request, add
- msc_classmark_request_then_cipher_mode_cmd(),
- state SUBSCR_CONN_S_WAIT_CLASSMARK_UPDATE,
- event SUBSCR_CONN_E_CLASSMARK_UPDATE.

From state AUTH_CIPH, switch to state WAIT_CLASSMARK_UPDATE. Once the BSSMAP
Classmark Response, is received, switch back to SUBSCR_CONN_S_AUTH_CIPH and
re-initiate Ciphering Mode.

To be able to re-enter the Ciphering Mode algo decision, factor it out into
msc_geran_set_cipher_mode().

Rationale:

In the following commit, essentially we stopped supporting A5/3 ciphering:

commit 71330720b6
"MSC: Intersect configured A5 algorithms with MS-supported ones"
Change-Id: Id124923ee52a357cb7d3e04d33f585214774f3a3

A5/3 was no longer supported because from that commit on, we strictly checked
the MS-supported ciphers, but we did not have Classmark 2 available during
Location Updating.

This patch changes that: when Classmark 2 is missing, actively request it by a
BSSMAP Classmark Request; continue Ciphering only after the Response. Always
request missing Classmark, even if a lesser cipher were configured available.

If the Classmark Update response fails to come in, cause an attach failure.
Instead, we could attempt to use a lesser cipher that is also enabled. That is
left as a future feature, should that become relevant. I think it's unlikely.

Technically, we could now end up requesting a Classmark Updating both during LU
(vlr_lu_fsm) and CM Service/Paging Response (proc_arq_fsm), but in practice the
only time we lack a Classmark is: during Location Updating with A5/3 enabled.
A5/1 support is indicated in CM1 which is always available, and A5/3 support is
indicated in CM2, which is always available during CM Service Request as well
as Paging Response. So this patch has practical relevance only for Location
Updating. For networks that permit only A5/3, this patch fixes Location
Updating. For networks that support A5/3 and A5/1, so far we always used A5/1
during LU, and after this patch we request CM2 and likely use A5/3 instead.

In msc_vlr_test_gsm_ciph, verify that requesting Classmark 2 for A5/3 works
during LU. Also verify that the lack of a Classmark Response results in attach
failure.

In msc_vlr_test_gsm_ciph, a hacky unit test fakes a situation where a CM2 is
missing during proc_arq_fsm and proves that that code path works, even though
the practical relevance is currently zero. It would only become interesting if
ciphering algorithms A5/4 and higher became relevant, because support of those
would be indicated in Classmark 3, which would always require a Classmark
Request.

Related: OS#3043
Depends: I4a2e1d3923e33912579c4180aa1ff8e8f5abb7e7 (libosmocore)
Change-Id: I73c7cb6a86624695bd9c0f59abb72e2fdc655131
2018-09-17 02:08:07 +02:00
..
Makefile.am A5/n Ciph: request Classmark Update if missing 2018-09-17 02:08:07 +02:00
msc_vlr_test_authen_reuse.c msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_authen_reuse.err msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_authen_reuse.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_call.c properly receive BSSMAP Clear Complete and Iu Release Complete 2018-04-11 21:39:44 +00:00
msc_vlr_test_call.err msc conn ref counts: log human readable list of conn owners 2018-04-12 19:40:01 +00:00
msc_vlr_test_call.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_gsm_authen.c msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_gsm_authen.err msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_gsm_authen.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_gsm_ciph.c A5/n Ciph: request Classmark Update if missing 2018-09-17 02:08:07 +02:00
msc_vlr_test_gsm_ciph.err A5/n Ciph: request Classmark Update if missing 2018-09-17 02:08:07 +02:00
msc_vlr_test_gsm_ciph.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_hlr_reject.c properly receive BSSMAP Clear Complete and Iu Release Complete 2018-04-11 21:39:44 +00:00
msc_vlr_test_hlr_reject.err msc conn ref counts: log human readable list of conn owners 2018-04-12 19:40:01 +00:00
msc_vlr_test_hlr_reject.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_hlr_timeout.c properly receive BSSMAP Clear Complete and Iu Release Complete 2018-04-11 21:39:44 +00:00
msc_vlr_test_hlr_timeout.err msc conn ref counts: log human readable list of conn owners 2018-04-12 19:40:01 +00:00
msc_vlr_test_hlr_timeout.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_ms_timeout.c A5/n Ciph: request Classmark Update if missing 2018-09-17 02:08:07 +02:00
msc_vlr_test_ms_timeout.err A5/n Ciph: request Classmark Update if missing 2018-09-17 02:08:07 +02:00
msc_vlr_test_ms_timeout.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_no_authen.c msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_no_authen.err cosmetic: mute "COMPLETE_LAYER_3 not permitted" 2018-08-23 15:52:43 +02:00
msc_vlr_test_no_authen.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_reject_concurrency.c msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_reject_concurrency.err cosmetic: mute "COMPLETE_LAYER_3 not permitted" 2018-08-23 15:52:43 +02:00
msc_vlr_test_reject_concurrency.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_rest.c properly receive BSSMAP Clear Complete and Iu Release Complete 2018-04-11 21:39:44 +00:00
msc_vlr_test_rest.err store classmark in vlr_subscr, not conn 2018-09-17 01:12:13 +02:00
msc_vlr_test_rest.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_test_ss.c libmsc/gsm_09_11.c: implement network-initiated sessions 2018-07-30 21:28:01 +02:00
msc_vlr_test_ss.err cosmetic: mute "COMPLETE_LAYER_3 not permitted" 2018-08-23 15:52:43 +02:00
msc_vlr_test_ss.ok msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_umts_authen.c msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_umts_authen.err msc_vlr_tests: don't abuse USSD-request to conclude connections 2018-07-29 16:22:06 +02:00
msc_vlr_test_umts_authen.ok msc_vlr_tests: revert IMSI parameter and test nr output 2018-03-02 03:22:16 +01:00
msc_vlr_tests.c A5/n Ciph: request Classmark Update if missing 2018-09-17 02:08:07 +02:00
msc_vlr_tests.h A5/n Ciph: request Classmark Update if missing 2018-09-17 02:08:07 +02:00