aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmsc/gsm_04_08.c
AgeCommit message (Collapse)AuthorFilesLines
2018-10-21gsm0407_is_duplicate(): Handle error ret of gsm0407_pdisc_ctr_bin()Harald Welte1-1/+2
Change-Id: If9525694bcbc5c6c0e622e899dd634dc11ed61c4 Fixes: Coverity CID#182702
2018-09-18fix Classmark Update without VLR subscriberNeels Hofmeyr1-0/+21
This recent patch moves Classmark storage to the VLR subscriber, and introduced a segfault when a Classmark Update is received during IMSI detach: commit 986fe7ed18580775bed91399a1f02eae60bda251 change-id I27081bf6e9e017923b2d02607f7ea06beddad82a Mon Sep 17 01:12:13 2018 +0200 "store classmark in vlr_subscr, not conn" It assumed that we would never accept any Classmark Update messages unless we also have a valid subscriber for it. Well, that is proven wrong by the ttcn3-msc-test TC_imsi_detach_by_imsi(), which brings osmo-msc to its knees. Fix: in case of no valid vlr_subscr being present, store Classmark in the conn temporarily, and copy any received Classmark to VLR subscriber as soon as it gets associated with the conn (if at all). Change-Id: Ib2a2ae6bf86e8f29fc6751a8b5cdb7187cd70290
2018-09-17A5/n Ciph: request Classmark Update if missingNeels Hofmeyr1-46/+88
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 71330720b6efdda2fcfd3e9c0cb45f89e32e5670 "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-17store classmark in vlr_subscr, not connNeels Hofmeyr1-49/+60
Store all Classmark information in the VLR. So, we now always know the Classmark 1 (mandatory IE for LU). This is visible in the msc_vlr_tests -- they no longer indicate "assuming A5/1 is supported" because classmark 1 is missing, because we now know the Classmark 1. Rationale: During Location Updating, we receive Classmark 1; during CM Service Request and Paging Response, we receive Classmark 2. So far we stored these only for the duration of the conn, so as soon as a LU is complete, we would forget CM1. In other words, for anything else than a LU Request, we had no Classmark 1 available at all. During Ciphering Mode Command, we rely on Classmark 1 to determine whether A5/1 is supported. That is moot if we don't even have a Classmark 1 for any CM Service Request or Paging Response initiated connections. The only reason that A5/1 worked is that we assume A5/1 to work if Classmark 1 is missing. To add to the confusion, if a phone indicated that it did *not* support A5/1 in the Classmark 1, according to spec we're supposed to not service it at all. A code comment however says that we instead want to heed the flag -- which so far was only present in a Location Updating initiated connection. Now we can make this decision without assuming things. This got my attention while hacking on sending a BSSMAP Classmark Request from the MSC if it finds missing Classmark information, and was surprised to see it it lacking CM1 to decide about A5/1. Change-Id: I27081bf6e9e017923b2d02607f7ea06beddad82a
2018-07-30libmsc/gsm_09_11.c: forward SS/USSD messages to HLR over GSUPVadim Yanitskiy1-1/+7
In order to be able to support external SS/USSD gateway, we should not terminate the GSM 04.80 messages at OsmoMSC. Instead, we need to follow the GSM TS 09.11 specification, and forward all messages unhandled by OsmoMSC to OsmoHLR over GSUP protocol. This change implements forwarding of MO SS/USSD messages. The forwarding assumes transcoding between GSM 04.80 messages and GSUP messages. The payload of Facility IE is carried 'as is'. As a side-effect, this will disable the osmo-msc internal handler implementing the "*#100#" for obtaining the subscribers own phone number. In order to re-gain this functionality, you will need a modern osmo-hlr (Change-Id I1d09fab810a6bb9ab02904de72dbc9e8a414f9f9) and the following line in your osmo-hlr.cfg: hlr ussd route prefix *#100# internal own-msisdn TTCN-3 test case: I01de73aced6057328a121577a5a83bc2615fb2d4 Change-Id: Ide5f7e350b537db80cd8326fc59c8bf2e01cb68c
2018-07-29libvlr/vlr.c: forward unhandled GSUP messages towards MSCVadim Yanitskiy1-0/+13
Some internal sub-systems, such as SS/USSD or SMS implementation, may also need to use GSUP connection with HLR. Previously, it was only available within the libvlr code, and nowhere else. Let's introduce the generic GSUP message router, which will receive messages unhandled by VLR itself, and route them to a handler depending on the message type. Change-Id: Ib8146ce5788c8f249dcaa39d61bd0388574bf892
2018-07-25libmsc: move L3 call-control to separate C file (gsm_04_08_cc.c)Harald Welte1-2066/+20
The CC sub-layer is fairly self-contained, so let's move it to a separate C source file. The old gsm_04_08.c file now only contains the 04.07 / DTAP core and MM sub-layer handling. I did this initially as an experiment to see how self-contained our CC implementation really is. Given this rather straight-forward patch builds fine, CC really is self-contained (yay!). Change-Id: Idb8dd7a8d9d8b4a28c492f12da3cc3305b695cca
2018-06-12libmsc/gsm_04_08.c: expose gsm48_tx_simple()Vadim Yanitskiy1-4/+8
This function could be also used by other parts of code, e.g. by gsm_04_11.c or by gsm_09_11.c, during initialization of a new transaction. No need to hide it. Change-Id: I9a9d17fca4901163dae10d76455aa4cf54497156
2018-06-12Use proper naming for GSM TS 09.11 implementationVadim Yanitskiy1-2/+2
During a long time, we had both file and symbol names, actually related to Supplementary Services, with the 'ussd' abbreviation. This is not absolutely wrong, but isn't correct at the same time. USSD is a kind of Supplementary Services, this is only a part of them. There are also 'structured' Supplementary Services, which can be call related or call independent. The "Signalling interworking for supplementary services" is defined by GSM TS 09.11, and this is exactly what MSC should implement. Let's use the specification number for naming, as we do e.g. in the GSM 04.11 (SMS) implementation. Change-Id: Ic1eaceddb58132318e4e941be542da34b8ebefe1
2018-04-24setup_trig_pag_evt: Fix heap-use-after-freePau Espin Pedrol1-1/+1
Catched by osmo-gsm-tester running test voice:octphy. Fixes following AddressSanitizer report: ==18864==ERROR: AddressSanitizer: heap-use-after-free on address 0x61a000016f18 at pc 0x55f1b29eee5c bp 0x7ffdaa2ac000 sp 0x7ffdaa2abff8 WRITE of size 8 at 0x61a000016f18 thread T0 #0 0x55f1b29eee5b in setup_trig_pag_evt osmo-msc/src/libmsc/gsm_04_08.c:1490 #1 0x55f1b2a086c1 in subscr_paging_dispatch osmo-msc/src/libmsc/gsm_subscriber.c:101 #2 0x7fb88e07c1c9 in osmo_timers_update libosmocore/src/timer.c:257 #3 0x7fb88e07f1b1 in osmo_select_main libosmocore/src/select.c:253 #4 0x55f1b29b600b in main osmo-msc/msc_main.c:694 #5 0x7fb88bebe2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0) #6 0x55f1b29b69f9 in _start (osmo-msc/bin/osmo-msc+0xf09f9) Related: OS#3198 Change-Id: Ie7fdca4d48e247c77a53e81aec2b6bacd8fef678
2018-04-24setup_trig_pag_evt: Always log correct paging failure casePau Espin Pedrol1-2/+3
Change-Id: I5c7a49b42b6ced1a5e0afb3485eaf94ef55bbf23
2018-04-24setup_trig_pag_evt: Remove uneeded default case in switch statementPau Espin Pedrol1-4/+2
Take the chance to pass a var of type enum instead, so the compiler warns us if a new enum value is added. For instance, if we remove GSM_PAGING_EXPIRED from the switch statement: src/libmsc/gsm_04_08.c:1463:2: warning: enumeration value ‘GSM_PAGING_EXPIRED’ not handled in switch [-Wswitch] switch (paging_event) { ^~~~~~ Change-Id: I65d871704b9636c594dc982200fbe7f7ce6784f5
2018-04-12refactor VLR FSM result handlingNeels Hofmeyr1-30/+5
Instead of keeping separate enums for FSM results and translating between those and the actual 04.08 reject causes that will ultimately reach the MS, just pass enum gsm48_reject_value cause codes around everywhere. Collapse some VLR *_timeout() and *_cancel() api to just *_cancel() with a gsm48 cause arg. (Hopefully) improve a few reject causes, but otherwise just aim for more transparent decisions on which cause value is used, for future fixes of returned causes. Depends: I6661f139e68a498fb1bef10c266c2f064b72774a (libosmocore) Change-Id: I27bf8d68737ff1f8dc6d11fb1eac3d391aab0cb1
2018-04-11refactor subscr_conn and subscr_conn_fsm de-/allocNeels Hofmeyr1-38/+64
Refactor: 1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm. 2. Add separate AUTH_CIPH state to the FSM. 3. Use conn->use_count to trigger conn release. 4. Add separate RELEASING state to the FSM. 5. Add rate counters for each of the three Complete Layer 3 types. Details: 1. Glue the gsm_subscriber_connection alloc to the subscr_conn_fsm. Historically, a gsm_subscriber_connection was allocated in libbsc land, and only upon Complete Layer 3 did libmsc add the fsm instance. After splitting openbsc.git into a separate osmo-msc, this is no longer necessary, hence: Closely tie gsm_subscriber_connection allocation to the subscr_conn_fsm instance: talloc the conn as a child of the FSM instance, and discard the conn as soon as the FSM terminates. 2. Add separate AUTH_CIPH state to the FSM. Decoding the Complete Layer 3 message is distinctly separate from waiting for the VLR FSMs to conclude. Use the NEW state as "we don't know if this is a valid message yet", and the AUTH_CIPH state as "evaluating, don't release". A profound effect of this: should we for any odd reason fail to leave the FSM's NEW state, the conn will be released right at the end of msc_compl_l3(), without needing to trigger release in each code path. 3. Use conn->use_count to trigger conn release. Before, the FSM itself would hold a use count on the conn, and hence we would need to ask it whether it is ready to release the conn yet by dispatching events, to achieve a use_count decrement. Instead, unite the FSM instance and conn, and do not hold a use count by the FSM. Hence, trigger an FSM "UNUSED" event only when the use_count reaches zero. As long as use counts are done correctly, the FSM will terminate correctly. These exceptions: - The new AUTH_CIPH state explicitly ignores UNUSED events, since we expect the use count to reach zero while evaluating Authentication and Ciphering. (I experimented with holding a use count by AUTH_CIPH onenter() and releasing by onleave(), but the use count and thus the conn are released before the next state can initiate transactions that would increment the use count again. Same thing for the VLR FSMs holding a use count, they should be done before we advance to the next state. The easiest is to simply expect zero use count during the AUTH_CIPH state.) - A CM Service Request means that even though the MSC would be through with all it wants to do, we shall still wait for a request to follow from the MS. Hence the FSM holds a use count on itself while a CM Service is pending. - While waiting for a Release/Clear Complete, the FSM holds a use count on itself. 4. Add separate RELEASING state to the FSM. If we decide to release for other reasons than a use count reaching zero, we still need to be able to wait for the msc_dtap() use count on the conn to release. (An upcoming patch will further use the RELEASING state to properly wait for Clear Complete / Release Complete messages.) 5. Add rate counters for each of the three Complete Layer 3 types. Besides LU, also count CM Service Request and Paging Response acceptance/rejections. Without these counters, only very few of the auth+ciph outcomes actually show in the counters. Related: OS#3122 Change-Id: I55feb379e176a96a831e105b86202b17a0ffe889
2018-04-11CC: intentionally release T308 on BSSMAP Clear Request from BSCNeels Hofmeyr1-0/+3
So far we hit a running T308 during CC release when caused by a BSSMAP Clear Request, and we loudly log that as error. However, now I understand that T308 is a direct cause of the dispatch of a REL IND towards MNCC, which is used to indicate teardown to MNCC. So during _gsm48_cc_trans_free(), we first clear all timers, then invoke mncc_release_ind() which starts another timer (useful for graceful CC Release, but in this code path the intention is immediate release). Simply immediately cancel the timer again and release the conn. A separate question is whether a BSSMAP Clear Request should be less aggressive in releasing the connections; i.e. instead of calling trans_free() all around, to rather ask each transaction to "please stop soon", somehow. Related: OS#3062 Change-Id: I231fdb574a086a206321148474cbdc7ca9cf39f0
2018-04-09DTAP: Ensure proper DLCI is used in MSC-originated DTAPHarald Welte1-0/+3
The DLCI field of the DTAP header indicates the SAPI as well as the data link (main DCCH or SACCH). We must make sure to use the correct DLCI when sending DTAP to the BSC. We achieve this by * storing the DLCI in the msgb->cb while parsing the DTAP header * storing the received DLCI (from msgb->cb) in the transaction for mobile-originated transactions * using the trans->dlci to sent msgb->cb when transmitting L3 * filling the DTAP DLCI value from msgb->cb when transmitting DTAP For MSC-originated transactions, we choose a DLCI value corresponding to the service (SAPI=0 for CC, SAPI=3 for SMS) and store that in trans->dlci. Closes: OS#3150 Change-Id: If511b20f52575054cab1346d99a8cb68d827fdbf
2018-04-03subscr_conn: store complete_layer3_type in conn, not FSM event argNeels Hofmeyr1-14/+8
Instead of jumping through hoops to pass the Complete Layer 3 operation that created this conn via FSM event dispatch parameters, put it right in the gsm_subscriber_connection struct, where it always belonged. Move definition of the enum complete_layer3_type to gsm_data.h, where gsm_subscriber_connection is defined. Introduce msc_subscr_conn_update_id() to set the complete_layer3_type of the conn as soon as a Complete Layer 3 message is received. In msc_subscr_conn_update_id(), already include an mi_string argument to prepare for an upcoming patch where the FSM will be allocated much earlier when the Mobile Identity is not known yet, and we'll also update the fi->id here. The odd logging change in the msc_vlr_tests output uncovers a wrong use of the osmo_fsm_inst_dispatch() data argument for SUBSCR_CONN_E_CN_CLOSE events: if a child FSM signals unsuccessful result, instead of the failure cause, it passed the complete_layer3_type, as requested upon FSM allocation, which was then misinterpreted as a failure cause. Now a child FSM failure will pass NULL instead, while other SUBSCR_CONN_E_CN_CLOSE events may still pass a valid cause value. Related: OS#3122 Change-Id: Iae30dd57a8861c4eaaf56999f872d4e635ba97fb
2018-04-03cosmetic: rename subscr_conn_from to complete_layer3_typeNeels Hofmeyr1-3/+3
'subscr_conn_from' could mean anything: from what, RAN type? BSS identifier? MM action? Clearly name it as the Complete Layer 3 kind it represents. Related: OS#3122 Change-Id: I6263a80e6db01c2ca48df6c58b05e2fd19347057
2018-04-03cosmetic: rename gsm_subscriber_connection->conn_fsm to ->fiNeels Hofmeyr1-4/+4
Match osmo-bsc's naming of the subscriber connection's FSM instance; 'conn->fi' makes more sense anyway than 'conn->conn_fsm'. BTW, an upcoming commit will do away with the legacy from libbsc/libmsc duality and firmly glue the conn allocation to the fi. Related: OS#3122 Change-Id: If442f2ba78d9722b1065ec30c9a13f372b6a8caa
2018-03-22dissolve libcommon-cs: move gsm48_* code to libmsc, drop sms_next_rp_msg_ref()Neels Hofmeyr1-0/+57
Move gsm48_* functions from common_cs.c to libmsc/gsm_04_08.c. Drop sms_next_rp_msg_ref(), it is just a bunch of bloat around "next_rp_ref++". Apply the "++" instead, in gsm_04_11.c. libcommon-cs is now empty, to be removed in subsequent commit. Change-Id: Ibc410803ce8e273b626124ab9fc934f04df3ae50
2018-03-22dissolve libcommon: drop gsm_data.c, move code to libmscNeels Hofmeyr1-0/+10
classmark_is_r99() is only used in gsm_04_08.c, move there as static. rrlp_mode_* is only used in msc_vty.c, move there as static. Move ran_type_names[] to msc_ifaces.c. Change-Id: I5381c72af6841829fbc65940fd7d6f4d5cf583df
2018-03-21cosmetic: gsm_04_08.c: drop unused struct gsm_laiNeels Hofmeyr1-6/+0
Change-Id: I3236841b1701dc902754d4a388c7806b0685a91e
2018-03-15cosmetic: remove disabled (debug) code gsm_04_08.cPhilipp Maier1-3/+0
gsm_04_08.c seems to contain some lines of old debug code that is commented out. Presumably the commented lines are a leftover from a debug session. - remove those commented code lines Change-Id: Ifb84e4b0696fef1326c3f9ebc8427581057db44f
2018-03-13restore sending of optional MM info messagesStefan Sperling1-0/+10
Since commit 2483f1b050496eda7f8707327204251c57212906 the function gsm48_tx_mm_info() was not called anymore. No MM info messages were transmitted to phones even if MM info messages were enabled via VTY. With this commit, we call gsm48_tx_mm_info() after successfully processing an IMSI ATTACH location update. Change-Id: Ice5963d84253eb8c803cd2dfa8b25a4db5382827 Related: OS#2850
2018-03-10cosmetic: gsm48_rx_mm_auth_resp(): log 'UMTS AUTH', not 'R99 AUTH'Neels Hofmeyr1-1/+1
Change-Id: Iba43c685cbe238d96175267e9cc954b2f2f3e7fc
2018-03-10gsm48_rx_mm_auth_resp(): pass is_r99 from classmark, not response sizeNeels Hofmeyr1-10/+8
Do not interpret the SRES/RES length returned in the auth response as the R99 capability bit, instead determine it from the actual Classmark information associated with the conn. This fixes the is_r99 flag passed in to vlr_subscr_rx_auth_resp(), which ends up in the struct vlr_auth_resp_par dispatched to the auth_fi and influences the authentication acceptance. Though the effect of a wrongly-set-to-false R99 flag is not harmful in this code path, let's not get this confused. Change-Id: Ib7f7d89a8b9455d2c022d53d74328fa7488577f4
2018-03-10vlr auth: gracefully reject malformed auth responseNeels Hofmeyr1-2/+6
Instead of just closing down the conn hard, actually feed invalid auth response data to vlr_subscr_rc_auth_resp() in order to trigger all the actions we want to see with a failed authentication: - a GSUP signal that the auth failed, - a LU reject. Verify this in new test_wrong_sres_length() in msc_vlr_test_gsm_authen.c. Note that in gsm48_rx_mm_auth_resp(), the is_r99 flag is falsely derived from the RES length, which upcoming commit Ib7f7d89a8b9455d2c022d53d74328fa7488577f4 will fix. Change-Id: I4179a290069ac61d0662de4ec7ca3edb76988899
2018-03-05VLR: fix potential NULL dereferenceMax1-0/+2
The vlr_subscr_get() can return NULL if its argument is NULL (which isn't checked for) so before dereferencing it's result we should check for it. Change-Id: I13632908d0b67323202effa9dd6f29732a12cc91
2018-03-02msc_vlr_tests: improve cipher mode coverageNeels Hofmeyr1-4/+5
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-02-28implement support for 3-digit MNC with leading zerosNeels Hofmeyr1-11/+9
Add 3-digit flags and use the new RAI and LAI API from libosmocore throughout the code base to be able to handle an MNC < 100 that has three digits (leading zeros). Depends: Id2240f7f518494c9df6c8bda52c0d5092f90f221 (libosmocore), Ib7176b1d65a03b76f41f94bc9d3293a8a07d24c6 (libosmocore) Change-Id: I82f0016d9512ee8722a3489a3cb4b6c704a271fc
2018-02-14remove bsc_api.h and all users - they're all dead codeHarald Welte1-1/+0
Related: OS#2528 Change-Id: I332aa8697c98a0d7b3db65f98711275da3d381d7
2018-02-12MNCC: Copy bearer_cap from MNCC to gsm_transHarald Welte1-1/+6
When we receive bearer capabilities from MNCC and encode thme into a CC message, we have to also update our "cache" inside 'struct gsm_trans'. Only that way, the BSSMAP ASSIGNMENT code is aware of the actual current/present bearer capabilities such as permitted speech codecs. This will in practise only work if the related CC/MNCC message with berer_cap IE will happen before the MSC performs the BSSMAP ASSIGNMENT procedure. Our logic still needs to change in a way that the CC/MNCC code in gsm_04_08.c detects if trans->bearer_cap != new bearer_cap, and in that case triggers a new follow-up BSSMAP ASSIGNMENT. Change-Id: I6838dc0c8c4c2c6bba385da548c92f3fc91060c1 Closes: OS#2854
2018-02-12MT Calls: Copy bearer capabilities from NNCC primitive to transHarald Welte1-1/+5
When we receive a MNCC_SETUP_REQ primitive from the external MNCC handler, we must not only encode it into the TS 04.08 CC SETUP, but also keep it around in the "trans" structure representing this voice call, as it is needed e.g. at BSSMAP ASSIGNMENT time. Change-Id: Ib6919d148ff6687112e8166dbde947be19e70a76 Related: OS#2322 Closes: OS#2929
2018-02-09Add VTY command to configure destination MSISDN for emergency callsHarald Welte1-0/+8
As in GSM/3GPP networks emergency calls carry no explicit destination number/address, add a VTY commadn to patch in some destination handler in the EMERGENCY SETUP before delivering to [internal or external] MNCC. Change-Id: I7c9f43ba312fadda2b9a9483b3cf50e4abca9599
2018-02-05mgcp: use osmo-mgw to switch rtp streamsPhilipp Maier1-13/+43
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-05Wrap osmo_strlcpy() callsMax1-5/+5
Using following semantic patch: @@ expression A, B, C; @@ - osmo_strlcpy(A, B, sizeof(A)); + OSMO_STRLCPY_ARRAY(A, B); Which was applied using following command: spatch --dir src -I src --sp-file strlcpy.spatch --in-place --recursive-includes All the calls to osmo_strlcpy() which use destination buffer obtained via sizeof() were replaced with the corresponding wrapper macro. Change-Id: I67b482dedfa11237ac21894fc5930039e12434ab Related: OS#2864
2018-02-03Implement checks for duplicate uplink UL L3 messageHarald Welte1-0/+94
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-28MSC: Intersect configured A5 algorithms with MS-supported onesHarald Welte1-1/+65
There's no point of ever asking a MS to perform ciphering using an algorithm it advertises no support for. Let's hence use CLASSMARK information to figure out the intersection between MSC policy (VTY command) and MS-reported CLASSMARK. Change-Id: Id124923ee52a357cb7d3e04d33f585214774f3a3
2018-01-28Permit a set of multiple different A5 ciphersHarald Welte1-5/+10
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 Welte1-8/+4
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-25remove dead code in auth.h / auth.cHarald Welte1-1/+0
Change-Id: I57e3b79a95a35c4783dc3775a88d15f13cbec13e Related: OS#2528
2018-01-25Massive removal of unused code/structs/headersHarald Welte1-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 unused paging.h and osmo_bsc_grace.hHarald Welte1-1/+0
Change-Id: I6af40f65f0634e49939906a3e50a41e0be246794
2018-01-24Properly reject CM Re-Establishment RequestHarald Welte1-1/+22
Even if we're not implementing CM re-establishment, we should give the MS a clear indication that we don't do and follow the related procedures of TS 24.008 by sending CM SERVICE REJECT. Closes: OS#2869 Change-Id: I1c0473647295456fd635b8df6079ee48695dcf2e
2018-01-24Reject any CM SERVICE we don't supportHarald Welte1-0/+11
When we receive a CM Service Request, OsmoMSC should eventually verify what kind of service it is the phone requests, and whether we support that service. Change-Id: I499730d760dc9ac7f599e09959c6eac4452f2eab Closes: OS#2668
2018-01-24Refuse Emergency Calls by IMEI with proper CM SERVICE REJECT CauseHarald Welte1-9/+15
OsmoMSC rejects an Emergency Call with IMEI as mobile identity with "semantically incorrect message" which is clearly wrong. According to TS 24.008 4.5.1.5 we should reject with cause 5 "IMEI not accepted" Found with TTCN-3 test case MSC_Tests.TC_emerg_call_imei Change-Id: I2f7ab0e32b914a112c0b17c523d149ccd0299099 Closes: #2866
2018-01-24Emergency Call: Set MNCC_F_EMERGENCY flagHarald Welte1-1/+3
MNCC has a MNCC_F_EMERGENCY flag to indicate that the mncc.emergency field is present. However, OsmoMSC never sets this flag. Change-Id: I0ebd8f88e483172988f4a0cb0636b4160688d8ad Closes: OS#2865
2018-01-24Log difference between SETUP and EMERGENCY_SETUPHarald Welte1-2/+2
An emergency call should be logged different from a normal call, and we also increase the log level from INFO to NOTICE in such a situation. Change-Id: I83f3b8bd0aeda70f03aa7b8d264a9008d10d5687
2017-12-31VLR: log subscriber updateMax1-1/+2
* 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()Max1-1/+0
This avoids potential licensing incompatibility and makes integration of Debian packaging patches easier. Related: OS#1694 Change-Id: I71cd631704a4dc155c6c752fee2a42cd6e2fa336