aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2018-03-02msc_vlr_tests: improve cipher mode coverageNeels Hofmeyr6-51/+143
Actually call msc_vlr_set_ciph_mode() and wrap away a_iface_tx_cipher_mode() and ranap_iu_tx_sec_mode_cmd(). Hence we'll see decisions and errors in msc_vlr_set_ciph_mode() as well. Change-Id: Id23bc245d4b5707edcd27c44db272fbb211bf9bd
2018-03-02msc_vlr_tests: make all test functions staticNeels Hofmeyr11-71/+71
All functions in the individual msc_vlr_test_*.c files should be static; hence we would be warned if one of them were unused (forgotten to add to the tests array). Change-Id: Ia169c6a1443a48879ab4777e09c2040c48810bf6
2018-03-02msc_vlr_test_gsm_ciph: drop unused functionNeels Hofmeyr1-41/+0
This test is actually in msc_vlr_test_rest.c, shouldn't be copied here, and was anyway unused. Change-Id: I9bba10a05d43f7f94aa2cd6dcb63dd8f2f644d35
2018-03-02msc_vlr_tests: revert IMSI parameter and test nr outputNeels Hofmeyr35-316/+330
Three recently merged commits take the msc_vlr_tests in a wrong direction. The IMSI is usually encoded in the hex streams. The rationale behind hex streams is that it is a) easily copied from a wireshark trace and b) exactly the bytes as sent by an actual phone. It is hard to parameterize the IMSI because we would have to employ our encoding functions, which I intentionally want to keep out of the loop here. The test number should not appear in the normal test output, so that adding a test or changing their order does not affect expected output for following tests. The nr is simply for manual invocation, only seen when invoked with -v. Revert - "VLR tests: always print test parameters" b0a4314911140b1599cccfc8171fcdab4cd9bfab. - "Expand VLR tests" d5feadeee8dd24f991df2892d6bcf0be8b0cf707. - "Move IMSI into test parameters" 093300d141c300651954473d73138b72de04d931. Change-Id: Ie1b49237746751021da88f6f07bbb9f780d077c9
2018-02-27cosmetic: gsm_network_init(): imply default 001-01 PLMNNeels Hofmeyr1-1/+1
All callers pass mcc=1, mnc=1, so just have it as default. (Prepare for net->country_code etc to be replaced by net->plmn) Change-Id: Ibcd1cc38f170895305ae176a5574384c74a33939
2018-02-14remove unused "auth policy" VTY commandHarald Welte1-8/+0
This is yet another unsused bit from the OsmoNITB legacy. Related: OS#2528 Change-Id: I825e659da529257e5edec94d9d59f0e10c1b4c63
2018-02-14remove unused "authorized-regexp" VTY commandHarald Welte13-76/+72
This is another left-over VTY command from the OsmoNITB days. If such functionality is desired, it must be implemented in OsmoHLR, but not here. Related: OS#2528 Change-Id: Icf0897c47388e49ba7886b55acc728a6f7d213fe
2018-02-14remove bsc_api.h and all users - they're all dead codeHarald Welte1-1/+1
Related: OS#2528 Change-Id: I332aa8697c98a0d7b3db65f98711275da3d381d7
2018-02-07VLR tests: move network init into functionMax1-15/+25
That's a preparation step for properly splitting main function of different tests in follow-up function. Change-Id: I68a2e94cf79fcb83286eef981a8d88bdbe10ef69 Related: OS#2864
2018-02-07VLR tests: always print test parametersMax24-299/+293
For each test print: * the test number * IMSI Unfortunately tests are organized in such a way that we don't know the number of particular test in advance. Nevertheless, it make sense to always print it regardless of -v option presense. Related: OS#2864 Change-Id: I2e1d7701f5322d2311f32b796148a8b414f53b8e
2018-02-07VLR tests: remove weird codeMax1-1/+1
Having while(0) as a body for for() cycle generate too much WTF while looking at the code while not serving any obvious purpose. Let's just drop it to avoid confusing developers. Change-Id: I1f571ec319ff3231fd9acd4066e470476c3b1f78 Related: OS#2864
2018-02-07VLR tests: don't fail via assertMax1-4/+13
Don't fail tests using thwart_rx_non_initial_requests() via OSMO_ASSERT. Instead log extended error which will fail the test eventually but allows to gather additional info helpful for debugging. Change-Id: I2607cb1ac60941dbc22fca532ed2b3738bfbcc63 Related: OS#2864
2018-02-07Expand VLR testsMax12-6/+18
Print the IMSI used for each test. This enables expansion to tests with several IMSIs in follow-up patches. Change-Id: I7958608e5136351f7b7c0c57fe79791d989ce9c3 Related: OS#2864
2018-02-07VLR tests: mark static test functions as suchMax2-14/+7
Related: OS#2864 Change-Id: I5eac4c24257fd38068ba629d3c21848181703220
2018-02-07Move IMSI into test parametersMax8-52/+32
This makes test routines more flexible and allows to easier re-use them for tests with different IMSIs. Change-Id: I74d46fdb7e87dc04c6b82a0b6f3ce6bef60bde58 Related: OS#2864
2018-02-06Fix whitespace issuesMax2-3/+3
We don't usually put space before in-place increment or decrement. Let's make code look similar to other Osmocom projects. Change-Id: I5962431ad16c97e412939dc1b8949f6361a5c26e
2018-02-05mgcp: use osmo-mgw to switch rtp streamsPhilipp Maier2-8/+8
in the current implementation we still use osmo-bsc_mgcp, which has many problems and is also obsoleted by osmo-mgw. integrate osmo-mgw and re-implement the current switching using an osmo fsm. Depends: osmo-mgw Iab6a6038e7610c62f34e642cd49c93d11151252c Depends: osmo-iuh I3c1a0455c5f25cae41ee19229d6daf299e023062 Closes: OS#2605 Change-Id: Ieea9630358b3963261fa1993cf1f3b563ff23538
2018-02-03Implement checks for duplicate uplink UL L3 messageHarald Welte1-0/+40
According to TS 24.007 Section 11.2.3.2.3, it is possible that uplink L3 messages are duplicated in some scenarios, particularly during assignment/handover procedure. To avoid L3 entities from seeing duplicated messages, there's a modulo-2 or modulo-4 message sequence counter, based on which the MSC can detect and suppress such duplicate messages. It appears that even our unit tests were wrong in that regard so far. Rather than manually adjusting each and every message, let's make sure that the sequence number generation always increments as expected, and that during matching of incoming messages, sequence numbers are masked out. Note: the tests will only pass from libosmocore Change-Id Iec875a77f5458322dfbef174f5abfc0e8c09d464 onwards, due to gsm48_hdr_msg_type() being broken in earlier versions. Change-Id: Id15e399ab7e1b05dcd426b292886fa19d36082b1 Closes: #2908
2018-01-28Permit a set of multiple different A5 ciphersHarald Welte3-17/+17
So far, the administrator had to pick one particular cipher which would then be used throughout all subscribers/phones. This is a bit impractical, as e.g. not all phones support A5/3. Extend the VTY command syntax in a backwards-compatible way to permit for multiple ciphers. NOTE: Like the previous code, OsmoMSC does *not yet check* whether the configured cipher is compatible with the MS capabilities as reported in CLASSMARK! The network hence might choose an algorithm not supported by the phone. Fixing this is subject to another patch. Closes: OS#2460 Change-Id: I79a4e2892eb5fbecc3d84e11dceffb7149db264b
2018-01-28Shift ciphering algorithm selection from VLR to MSCHarald Welte5-28/+27
The VLR code seems to have the assumption that there is one particular algorithm to be used, as opposed to one of a set of algorithms. What's missing is basically to decide when/where to pick the best algorithm within the capabilities of the phone (classmark) and the network configuration (net->a5_encryption_mask). So far, libvlr has no notion of classmark. Rather, libmsc has. Why does the VLR care about the particular algorithm at all? The VLR should probably simply decide if it should use encryption or not, and if so, the MSC will figure which algorithm to use. Change-Id: I5ed80ca2086560a5975a758ec568a034a9a8ab89
2018-01-25Massive removal of unused code/structs/headersHarald Welte2-6/+0
osmo-msc still had large amounts of dead code that came along from openbsc.git. This commit removes a lot of it, mostly stuff relevant only to the BSC side of things (or even GPRS). Change-Id: I247def85da2dc3ec461389fb74414a0d964e7e3c Related: OS#2528
2018-01-24remove traces of bsc_subscriberHarald Welte12-73/+72
Change-Id: I8672f0a76cb47595444a7ddbc4f34fc4ddaeb375
2018-01-24Fix msc_vlr test results (.err) for new libosmocore GSM48_PDISC namesHarald Welte8-346/+346
In I8de7c01f9ea1d66c384e57449c4140186f5ce6c5, libosmocore introduced shorter names in gsm48_pdisc_names, which has implications on the expected test output Change-Id: I4421872a0d609dd50a6b911b928aa5e111d1ad24
2018-01-24Remove traces of meas_feedHarald Welte1-18/+0
Measurement reporting (and the relate feed) are functions of the BSC, not the MSC. This code should never have been inherited from OsmoNITB to OsmoMSC in the first place, let's remove it. Change-Id: I0d57ac214e574e267fa9752daf76566197b9aa64
2017-12-31VLR: log subscriber updateMax11-0/+53
* move log helpers to generic header * log subscriber update It's handy for troubleshooting issues with subscriber update via GSUP from HLR. Change-Id: I1958aeeb3ea99831c7e2c5ee9a6b59834baf4520
2017-12-27Migrate from OpenSSL to osmo_get_rand_id()Max4-10/+5
This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. Related: OS#1694 Change-Id: I71cd631704a4dc155c6c752fee2a42cd6e2fa336
2017-12-20fix: properly cancel all Paging on IMSI DetachNeels Hofmeyr2-4/+32
It's not clear cut which code is responsible for canceling pending requests, since the requests list is kept in vlr_subscr, but sending out Paging does certainly not belong in the VLR. Place the requests cleanup in gsm_04_08.c. Add to test_ms_timeout_paging() in msc_vlr_test_ms_timeout.c to verify that a pending paging is canceled on IMSI Detach. Change-Id: Ib8874a9d92f02b0826525b55518332f6899688fd
2017-12-20fix paging: add timeout to discard unsuccessful pagingNeels Hofmeyr2-0/+260
Currently, if there is no reply from the BSS / RNC, a subscriber will remain as "already paged" forever, and is never going to be paged again. Even on IMSI Detach, the pending request will keep a ref count on the vlr_subscr. Add a paging timeout, as gsm_network->paging_timeout and in the VTY on the 'msc' node as 'paging timeout (default|<1-65535>'. (There is a 'network' / 'T3113' in OsmoBSC, but to not confuse the two, give this a different name.) Add test_ms_timeout_paging() test to verify the timeout works. I hit this while testing Paging across multiple hNodeB, when a UE lost connection to the hNodeB. I noticed that no matter how long I wait, no Paging is sent out anymore, and found this embarrassing issue. Good grief... The choice of 10 seconds is taken from https://osmocom.org/issues/2756 Change-Id: I2db6f1e2ad341cf9c2cc7a21ec2fca0bae5b2db5
2017-12-18cosmetic prep: tell vlr_ops.set_ciph_mode() whether UMTS AKA is usedNeels Hofmeyr1-1/+1
In case of UMTS AKA, the Kc for ciphering must be derived from the 3G auth tokens. tuple->vec.kc was calculated from the GSM algorithm and is not necessarily a match for the UMTS AKA tokens. To decide (in an upcoming patch) whether to use UMTS AKA derived Kc or the Kc from the auth vector, the set_ciph_mode() from vlr_ops needs to know whether UMTS AKA is being used. This could possibly derived from the msc_conn_ref, but all flags are already available in the vlr_lu_fsm and vlr_access_req_fsm. Hence add a umts_aka flag to the set_ciph_mode() callback invocation. The VLR FSMs thus decide whether UMTS AKA or GSM AKA is to be used during Ciphering Mode Command, which makes more sense than re-implementing the same decision process in the MSC. I considered placing the Kc derivation in vlr_set_ciph_mode() and only tell the MSC's set_ciph_mode() implementation the precise keys it should use, but the RAN particulars, and whether a Kc is used at all, rather belong with the MSC. Related: OS#2745 Prepares: If04e405426c55a81341747a9b450a69188525d5c Change-Id: I983c48347faf4ee1b405d8174b4e006c904157cf
2017-12-18vlr: debug log: log Ciphering Mode detailsNeels Hofmeyr4-0/+26
Change-Id: Ib19dfd7255bda01ebace62386df4ec89697d9d14
2017-12-18cosmetic: msc_vlr_tests: log SMS details when invoked with -vNeels Hofmeyr1-0/+3
DLSMS logs SMS pointers, so is not suitable for logging them always. Allow logging for manual invocation, though. Change-Id: I1b7d2fd3fb38bf50eeabd6f7ef736d70a17de7a6
2017-12-03Remove unneeded .py scriptsMax2-10/+2
The ipa.py has been moved to osmo-python-tests as osmo_ipa - use it for vty and ctrl tests instead of local copy. The soap.py and twisted_ipa.py are not MSC-specific: leftovers from repository split which are now available in osmo-python-tests as well. Change-Id: Ia3ab77846c9beae7eca32a81079a4a9bfa4dcc75
2017-11-29Add basic CTRL testMax1-387/+8
All the CTRL tests were skipped automatically because they were inherited from before repo split time. This means that MSC CTRL interface was not tested at all. Add trivial test which uses generic rate counter introspection so we at least check that MSC's CTRL interface is not completely broken. Change-Id: I784feece666b00752a81f2c126e6f255505445be
2017-11-27fix use after free: missing conn_get on CC paging responseNeels Hofmeyr1-15/+15
Adjust test expectations accordingly. The error was: ==16084==ERROR: AddressSanitizer: heap-use-after-free on address 0x61500000f5f4 at pc 0x561be639ac2b bp 0x7ffc0aabbe40 sp 0x7ffc0aabbe38 READ of size 4 at 0x61500000f5f4 thread T0 #0 0x561be639ac2a in _msc_subscr_conn_put ../../../../src/osmo-msc/src/libmsc/osmo_msc.c:384 #1 0x561be636070b in rx_from_ms ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:204 #2 0x561be6360b21 in ms_sends_msg ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:217 #3 0x561be635b40a in test_call_mt ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_test_call.c:328 #4 0x561be6363bb7 in run_tests ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:802 #5 0x561be63524ea in main ../../../../src/osmo-msc/tests/msc_vlr/msc_vlr_tests.c:849 #6 0x7f6eebb3e2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0) #7 0x561be6352fb9 in _start (/n/s/osmo/make-3G/osmo-msc/tests/msc_vlr/msc_vlr_test_call+0xdafb9) Related: OS#2672 Change-Id: If0659a878deb383ed0300217e2c41c8c79b2b6a5
2017-11-27add msc_vlr_test_call to reproduce a sanitizer errorNeels Hofmeyr7-4/+1131
On MT call, there is a bug in CC conn use which leads to an early free and use-after-free. Add msc_vlr_test_call to show both MO and MT call legs separately and reproduce the failure. It is visible in a sanitizer build (on debian 9). A subsequent patch will fix the bug: If0659a878deb383ed0300217e2c41c8c79b2b6a5 Related: OS#2672 Change-Id: I6c3ca0c660388b1e2c82df17ec540c846201b0c7
2017-11-27subscr_conn: introduce usage tokens for ref error trackingNeels Hofmeyr10-766/+766
When hunting a conn use count bug, it was very hard to figure out who's (not) using the conn. To ease tracking down this bug and future bugs, explicitly name what a conn is being reserved for, and track in a bit mask. Show in the DREF logs what uses and un-uses a conn. See the test expectation updates, which nicely show how that clarifies the state of the conn in the logs. On errors, log them, but don't fail hard: if one conn use/un-use fails, we don't want to crash the entire MSC before we have to. Change-Id: I259aa0eec41efebb4c8221275219433eafaa549b
2017-11-22msc_vlr_tests: set a valid lac for fake connsNeels Hofmeyr11-72/+73
Change-Id: Ie647d93a54aefad5bde8a9411d983cd60714b83d
2017-11-22msc_vlr_tests: fix test nr arg: clear errno before strtol()Neels Hofmeyr1-0/+1
Change-Id: I8e9376f20a44f6348bcb85f0ff27a429dc90e1b8
2017-11-22sms_queue_test: sanitize: clean up talloc contexts when doneNeels Hofmeyr1-2/+22
To avoid sanitizer build failures, ensure that the talloc contexts are empty when done and free them. Separate the msgb context from the overall talloc context for clarity: if nested, the outer one would contain two blocks. Change the "sms_queue_test" context from 1 byte to 0 in order to get a size of zero in the end. Change-Id: If08ba48ab9c28bf3c2db4014837c1304cec04aaf
2017-11-20cosmetic: msc_vlr_tests: add comment to show expected tallocsNeels Hofmeyr1-0/+13
If something changed the talloc landscape, it is hard to find out what the test actually expected when it was written. Add the expectations in an inline comment. Change-Id: If92a18bb3dc24c2cf6498aa2da29266267488240
2017-11-20vlr_subscr_conn_timeout(): don't fire events to discarded fiNeels Hofmeyr2-7/+15
Terminating one of the FSM instances may effect termination and deallocation of the others, as well as the vlr_subscr itself. So, reserve the vlr_subscr locally, and then dispatch events to exactly those FSM instances that exist. The changes in expected output in the msc_vlr_tests shows that the subscriber was deallocated from the first FSM termination, and now sticks around until we've checked both FSMs are gone. Change-Id: I56551ecc10f5295fe75944bdde4b583b1b621811
2017-11-20subscr_conn: don't close after conn timeoutNeels Hofmeyr2-8/+0
If dispatching a conn timeout, the conn fsm will already have been discarded, and we cannot fire any more events to it. The expected test output changes illustrate that we are now omitting event dispatches that happen *after* the same FSM was already deallocated. Change-Id: I25af3e5a1b04e3a5c9f41956cbcbbdd8439c6457
2017-10-31tests: add msc_vlr_test_authen_reuseNeels Hofmeyr6-0/+2962
Change-Id: I185a2cbff6241a27722f1c37ae609f0fcc59a71e
2017-10-31cosmetic: vlr: rename auth_tuple_max_use_count to _reuse_Neels Hofmeyr1-4/+4
The name auth_tuple_max_use_count suggests that if I want to use each auth tuple exactly once, I need to set it to 1. Curiously, so far you need to set to intended uses - 1. Reflect this in its name by renaming to auth_tuple_max_reuse_count. I first considered to not rename but change the if-conditions so that == 1 means each tuple is used once, and upon struct vlr allocation, set the default to 1. That would also logically entail that setting to 0 means to re-use vectors infinitely often, like now a value < 0 does. That means, when allocating a vlr struct zeroed out, we would by default have the most dangerous/unsafe configuration. It's no problem to set a default to 1 upon allocation, but by renaming the variable instead, we get safer alloc-zero behavior and don't need to change any conditionals in the code (even though the patch ends up considerably larger from all the renaming). Change-Id: I0b036cae1536d5d6fb2304f837ed1a6c3713be55
2017-10-30msc_vlr_tests: fix rebuild: rebuild when src/ libs were rebuiltNeels Hofmeyr1-0/+3
Before this, a code change in libvlr or libmsc would not cause a rebuild of the tests. You'd have thought 'AM_LDADD' were the right name for the variable, but apparently it is just 'LDADD' instead. Tested that it works as intended. Change-Id: Icbdedc1581fa23abe9ed99cef3918592b25f30b3
2017-10-28osmo-msc: Don't link against libasn1cHarald Welte2-2/+0
osmo-msc doesn't use any API/symbols of libasn1c directlry. Rather, we use libosmo-ranap which in turn uses libasn1c. Let the linker work out that dependency. This fixes the following dpkg-shlibdeps warning: Change-Id: I2f840884d8f1cc542de1e26acd3d4215bd2fd899 dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/osmo-msc/usr/bin/osmo-msc was not linked against libasn1c.so.0 (it uses none of the library's symbols)
2017-10-03fix memory leak: vlr: vlr_gsupc_read_cb() must msgb_free()Neels Hofmeyr1-1/+1
Add required msgb_free() to vlr_gsupc_read_cb(). Adjust msc_vlr_tests.c gsup_rx() to *not* free the msgb again after vlr_gsupc_read_cb() did. Related: OS#2476 Change-Id: I347c53f57a7fa79921aed3f6e42599841acf27c0
2017-10-03remove further files and autotest/autoconf bits irrelevant to osmo-mscHarald Welte1-6/+0
Change-Id: I68e879e7474cbd3dd053f23bc4d5d22dc2748c5b
2017-09-15Remove rest_octets.hMax1-0/+1
The MSC should not fiddle with low-level SI details like rest octets anyway. Unfortunately simply removing the header is impossible as it causes massive fallout due to missing includes. Fixed it as well. The only other parameter which required removal is cell_ro_sel_par which is not referenced anywhere in the code anyway. Change-Id: Ibff77330de056fad4288cd4c48d016aad8105354
2017-09-08use separated libosmo-mgcp-client, apply rename to mgcp_client_*Neels Hofmeyr2-4/+4
After osmo-mgw changes I8e0b2d2a399b77086a36606f5e427271c6242df1 and I99f7faab637cfcc22ece64a1dbcbe590f2042187, apply linking of new libosmo-mgcp-client and renames to drop the "gw" from mgcp_client_*. Also rename the gsm_network.mgcpgw to mgw, to indicate that the MGCP client is used to contact the MGW (Media Gateway). Depends: I8e0b2d2a399b77086a36606f5e427271c6242df1 (osmo-mgw) I99f7faab637cfcc22ece64a1dbcbe590f2042187 (osmo-mgw) Change-Id: I093ad02ca0e532f659447c785e09678b3e6f220d