aboutsummaryrefslogtreecommitdiffstats
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2018-03-02vlr_lu_fsm: guard against using the wrong fiNeels Hofmeyr1-34/+68
Various functions in vlr_lu_fsm.c belong to one of the four FSMs defined in that file. After the recent error was uncovered where the lu_fsm called lu_compl_fsm()'s termination function, I want to make sure it's correct. Introduce distinct inline functions to dereference the respective fi->priv pointers, each asserting that the fi indeed belongs to the proper FSM. Use those *everywhere* to dereference fi->priv. From this patch on, we are sure beyond doubt that we are not inadvertently passing an fi pointer to the wrong FSM's handling functions, though we will only catch this at runtime -- but then will immediately know the reason. vlr_lu_fsm.c is the only file defining more than one FSM, so the other FSM definitions are already reasonably safe. Change-Id: I7419a780ff2d8b02efc4195bb1702818e4df181c
2018-03-02vlr: fix post-auth LU failure handlingNeels Hofmeyr1-2/+2
From the vlr_loc_update() FSM, don't call the vlr_lu_compl_fsm_failure() function. These are two distinct FSMs with distinct priv pointers, but they are defined in the same .c file. In vlr_loc_upd_post_auth(), change two erratic calls of vlr_lu_compl_fsm_failure() to lu_fsm_failure(), so that the proper fi and priv struct are used. Fixes: OS#2947 Change-Id: I7fd2c6fa23254fffd0d526e53541f4068153929f
2018-02-28implement support for 3-digit MNC with leading zerosNeels Hofmeyr7-38/+30
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-27cosmetic: gsm_network_init(): imply default 001-01 PLMNNeels Hofmeyr2-7/+4
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-26msc_mgcp: Add FSM event namesPhilipp Maier1-0/+13
The FSM (fsm_msc_mgcp) lacks a proper definition of the FSM event names. This causes problems when inspecting the FSM using the VTY. - Add proper FSM Event names Closes: OS#2924 Change-Id: I6823756a63b08a71e5518130e49751aa073dbcd2
2018-02-26a_reset: Add FSM event namesPhilipp Maier1-0/+8
The FSM lacks a proper definition of the FSM event names. This causes problems when inspecting the FSM using the VTY. - Add proper FSM Event names Change-Id: I76d7d9e0accffd433a3f3b5e5f8ab17ecd4a348c Related: OS#2924
2018-02-22enable osmo_fsm vty commands in osmo-msc vtyStefan Sperling1-0/+2
Call osmo_fsm_vty_add_cmds() to make osmo_fsm VTY commands available in osmo-msc's VTY interface. Change-Id: Iaf970f6039c3f668f275dd8c21fb9071774a5d9e Related: OS#2967
2018-02-19drop unused libmsc/meas_feed.hNeels Hofmeyr1-12/+0
Change I0d57ac214e574e267fa9752daf76566197b9aa64 forgot to remove this file along with meas_feed.c. Note also the weirdness: that patch removes the proper include/osmocom/msc/meas_feed.h, but there's also this other one. This libmsc/meas_feed.h always existed from the start as an unused orphan, see: https://git.osmocom.org/osmo-bsc/diff/openbsc/src/libmsc/Makefile.am?id=b4771a6871efb3cf12b371aedc575912984ca528 No need to drop from Makefile.am, since it is already gone from there. (meas_feed from the old osmo-nitb (openbsc.git) has / should have moved to osmo-bsc. There are no measurement reports in the MSC. Refer to osmo-bsc.git instead from now on.) Change-Id: Ib2566013dd30b21ce2774cd4cc7dcba2408f938f
2018-02-19libmsc: Pretend MNCC requested release in handle_error()Daniel Willmann1-0/+11
Send a release request to the MS so the connection does not stay open indefinitely. Change-Id: I7669d29cf5be3e4a60a1d121edbfcf9056f6d82b
2018-02-16libmsc: bssap: Remove fixme and properly update msgb tailPau Espin Pedrol1-3/+2
Change-Id: I28073efd5cff58cd212341bceee784caf08d5ad8
2018-02-16libmsc: Add a function to return a unique ID of the subscriber connDaniel Willmann1-0/+20
The ID will include the type of connection (GERAN_A, UTRAN_IU) followed by the SCCP conn_id. This can be used for the fsm instance ID before we know the IMSI. Change-Id: I4b875772e3994ad3458ee60dbf880604486d9afd
2018-02-16iucs: Add a function to return the connection ID for the IU SCCP connDaniel Willmann2-0/+10
Change-Id: Ica4a7f463fcf1bd67fe082296cecea8d10f2fc5b
2018-02-14libmsc: bssap: Catch TLV parse failuresPau Espin Pedrol1-1/+7
Change-Id: I1d1951f4a5daf200e85c76fea14a35e952491d27
2018-02-14libmsc: bssap: Refactor rx paths to to avoid parse_tlv code duplicationPau Espin Pedrol1-67/+58
Change-Id: I6aef9a94fa5b2e0b62a9c1744b8e18e5985f788f
2018-02-14libmsc: bssap: Fix typo in log messagePau Espin Pedrol1-1/+1
Change-Id: I941cd7f4e9eec3e4f2786100a0e64770d5aee4a7
2018-02-14remove dead code (gsm_parse_reg)Harald Welte1-25/+0
Change-Id: I47b0260561a9c2bad65c50c8164873e4c23d61b7
2018-02-14remove unused "auth policy" VTY commandHarald Welte3-38/+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 Welte2-23/+0
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 unused VTY command "location updating reject cause"Harald Welte2-19/+0
OsmoMSC is using whatever reject cause is apropriate in the given situation. This user-configurable reject cause only had relevance in OsmoNITB, and hence it is an unused parameter that can be removed in OsmoMSC. Related: OS#2528 Change-Id: Ie1f39e706477aaf42051877b52d4b3ae1c5f138e
2018-02-14osmo-msc: Add talloc context introspection via VTYHarald Welte1-0/+3
This requires libosmocore with Change-Id I43fc42880b22294d83c565ae600ac65e4f38b30d or later. Change-Id: I575500bd911f9792ab5ca76eebb1d2682ee34fa3
2018-02-14remove unused dyn_ts_allow_tch_f VTY optionHarald Welte3-29/+0
This belongs into the BSC and has no relevance in the MSC, as the MSC has no clue about dynamic timeslots. Related: OS#2528 Change-Id: Iaa41d22db81120572d4cd2c0c4c75d258947a42f
2018-02-14dead code removalHarald Welte1-4/+2
Related: OS#2528 Change-Id: I89157c446d66e11adbe3cad587eb34ec40271c12
2018-02-14remove bsc_api.h and all users - they're all dead codeHarald Welte3-20/+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-12a_iface: Consistent and understandable function namesHarald Welte1-4/+4
Change-Id: I36894e68e4b1f25f266e941c39a44e0171d24689
2018-02-12a_iface: s/Abis/L3/ for speech version/preference fieldsHarald Welte1-6/+6
There is no encoding of speech version / preference on Abis, only on L3. L3 is carried on Um, Abis and A. Hence, referrin to Abis in function names and comments is irritating. Change-Id: Id226cd1414ca2a92356801bc71f43102d03ba37e
2018-02-10MGCP: Response code 250 is *not* an error for DLCXHarald Welte1-1/+2
Change-Id: I9f64996bfff09561f253115681ed63ee87b90ef3 Closes: OS#2923
2018-02-10a_iface: Fix heap-use-after-free in a_clear_all()Harald Welte1-3/+5
We cannot use conn->a.conn_id after conn has been free'd inside msc_clear_request(). Let's store conn_id before that call to ensure we avoid an use-after-free situation. A more elegant (but more intrusive) solution would be to move the SCCP connection clearing into the FSM itself. Change-Id: Ibe41aa503e9f7cbeb05dce4b1a20b3eac85e619f Closes: OS#2922
2018-02-09Add VTY command to configure destination MSISDN for emergency callsHarald Welte2-0/+33
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-09a_iface: Fix heap-use-after-free by cleaning up msgb ownershipHarald Welte2-70/+20
When we receive a msgb-wrapped primitive from the SCCP provider (stack), it transfers msgb ownership to us (the SCCP user). The existing code passed the msgb ownership down into all the various downstream functions, which each then had to take care of msgb free'ing. Not all of the paths did eventually free the msgb. And at least one path used data from the primitive *after* the free Let's restructure this in a way that no msgb ownership is transferred down the call chain. Instead, there's one common msgb_free() in sccp_sap_up(). We can do this as nobody is queueing or otherwise keeping the msgb. Change-Id: Ie65616ccb55ec58a0224bbe3c8e004e6029ef3e6 SUMMARY: AddressSanitizer: heap-use-after-free /home/laforge/projects/git/osmo-msc/src/libmsc/a_iface.c:538 in sccp_sap_up
2018-02-09Introduce new BSSAP logging category/subsystemHarald Welte3-40/+46
Having all BSSAP related logs in the "DMSC" category is overly generic, and dosn't provide useful granularity. Change-Id: Id1e52dad03840dfd026fb23f3845a8771c8cc308
2018-02-09a_iface: Add copyright statement (after recent contributions)Harald Welte2-0/+2
Change-Id: I3f5dedb045a9ae9b93b00a8388a73ed77e67f19f
2018-02-09cosmetic: a_iface: More logging harmonizationHarald Welte1-4/+4
Change-Id: I66139862c4d821fcce0334207ce84fffbd08b4e3
2018-02-09a_iface: centralize lookup of subscriber_connHarald Welte1-73/+42
There's little point in resolving the gsm_subscriber_connection in each and every function handling connection-oriented messages. We can resolve it once and dispatch the already-resolved conn into the function, instead of passing the raw sccp_user and a_conn_info. Change-Id: Iea85527ea4d4cde7b36cc28a8027362c1570518f
2018-02-09cosmetic: No need for 'break' after 'return'Harald Welte2-20/+0
This just makes the code longer with no added benefit. Change-Id: If689b8284a669021219eff0397c6e90570e2aaa4
2018-02-09cosmetic: a_iface: Harmonize log statementsHarald Welte2-13/+13
Clean up the log statements in a_iface*.c, which was very inconsistent. For example "BSC sending" is very confusing. We are receiving from the BSC, and it did already send the message, it is no longer in the process of sending it if we have already received it in the MSC. Change-Id: Id50e964d86713ae506d4e7657159797e09501d99
2018-02-09a_sccp_rx_dt(): Don't print hexdump of message multiple timesHarald Welte1-2/+0
We don't need to hexdump it in a_sccp_rx_dt() and then again in rx_bssmap() or rx_dtap(). Change-Id: I2caa8e0af236983430155f9c808de913377d5780
2018-02-09a_iface_bssap.c: Use LOGPCONN() whenever possibleHarald Welte2-26/+18
Change-Id: Ic1c9d14b892154d51165598338d23a924a772265
2018-02-09a_iface: Reduce log levelsHarald Welte2-18/+18
During normal operation, regular messages occurring during processing of a call / transaction should not be higher than LOGL_INFO. Change-Id: Ibd04ade47b249406696c7d0b660474afc4f4adee
2018-02-09cosmetic: Use msgb_hexdump*() rather than manual osmo_hexdump() on msgHarald Welte6-18/+16
This requires libosmocore Change-Id I98e85397fb541ee0fd711f2e1852f63f3bb87359 Change-Id: Ieeb97a9f1eba2fdef84294b8c8c7ac0984ae5c70
2018-02-09Don't answer to BSC-originated RESET with another RESETHarald Welte2-53/+115
If the BSC is contacting us for the first time and sending a BSSMAP RESET, then we should simply ACK that and transition into the "connected" state, where connection-oriented and connectionless procedures are permitted. This patch is a bit large for such a seemingly simple behavioural change, but the existing data model didn't permit a more straight-forward implementation. Change-Id: Ie67e7ed20a6c42afe99bafef96d85a4e083dd057 Closes: OS#2914
2018-02-09a_reset: Add additional "a_reset_alloc" argumentHarald Welte2-4/+10
Using this argument we can create the state machine in the "already connected" state, i.e. without starting an outbound RESET procedure. Change-Id: Ibf569d57300965cd47084fa0bff54aa67679e2a1
2018-02-09VTY: Add 'show connections' and 'show transactions' commandsHarald Welte1-0/+112
It is quite important to have some way of runtime state introspection about the major objects inside osmo-msc. This patch adds some basic capabilities to dump the most important information about subscriber_connections and transactions (like calls/sms). OsmoMSC> show connection --ConnId ------------Subscriber RAN --LAC Use --Tokens CSA A5 State 00000001 IMSI:26242000000006 A 23 1 00000004 --- /0 SUBSCR_CONN_S_COMMUNICATING Change-Id: I1c457c1eac20188f67b8379a36cfda3a085fcef4
2018-02-08increase RAN timeout in MGCP FSMPhilipp Maier1-3/+2
The MGCP FSM implements a timeout when waiting for the RAN to complete the call (assignment complete, alerting, connect...). This timeout is currently set to 10sec. This means if the other end did not pick up after 10sec, the MGCP connection will be lost while the phone keeps ringing. When the other end finally picks up, the call gets disconnected. This behavior is odd and requires a proper fix. For now increasing the timeout to 120sec. will decrese the probability that he problem occurs. - Increas RAN timeout to 120sec (2 min). Change-Id: I5a11d53f9701d9b11b18d7026ff2241c7c0b57f5
2018-02-08GSUP: check osmo_gsup_encode() resultMax5-27/+67
Check and handle gracefully any error which might appear in osmo_gsup_encode() - mark corresponding functions with warn_unused_result attribute to make sure this failure is always checked against. Change-Id: I4551212011fb0bd898c020a183756ed7a9afb9e5 Related: OS#2864
2018-02-07Constify msc_subscr_conn_is_accepted() parameterMax1-1/+1
Related: OS#2864 Change-Id: I8af50a8847a5b438cf2ef660399d4c8bbac86a71
2018-02-06Fix whitespace issuesMax3-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 Maier8-311/+1238
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() callsMax7-36/+34
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