aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/gsm_04_08.c
AgeCommit message (Collapse)AuthorFilesLines
2018-06-15gsm0408_dispatch: Fix uninitialized var warningPau Espin Pedrol1-1/+1
Got this warning since my upgrade to gcc 8.1.0. Quick check tells me it's probably a false positive, but let's fix the warning anyway. openbsc/openbsc/src/libmsc/gsm_04_08.c: In function ‘gsm0408_dispatch’: openbsc/openbsc/src/libmsc/gsm_04_08.c:1260:5: error: ‘res_len’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (res_len != 4) { ^ openbsc/openbsc/src/libmsc/gsm_04_08.c:1223:10: note: ‘res_len’ was declared here uint8_t res_len; ^~~~~~~ Change-Id: Ifa45f73645c9ab022c18a012abe03214aa21526f
2018-03-22backport support for 3-digit MNC with leading zerosneels/mnc3Neels Hofmeyr1-9/+1
Backport the patches with the following change-ids: osmo-bsc.git: I5b097dbb6329f284e3b4914a744d5c3ad628f715 I8e722103344186fde118b26d8353db95a4581daa I78f30aef7aa224b2e9db54c3a844d8f520b3aee0 I38ac98a4d25159cfd4f686efbfbaf8f00625a6d8 osmo-iuh.git: I29ebcddd45fe3079f8883589a83cc7216a535475 Also apply change of ipac_bcch_info.cgi to struct osmo_cell_global_id in src/ipaccess/network_listen.c, a change that appears to not have been necessary in the new split repositories. Related: OS#3010 Change-Id: Ibf50fd7e1ca5472d0a38fcb87c68227d6de44f42
2017-07-10Support for TS 04.14 conformance test commandsHarald Welte1-0/+4
Change-Id: Ib27edbfc8ccdedf00589ec715ced7bed435fa94c
2017-07-1004.08: find a portable way to obtain the timezone offsetBenoit Bolsee1-3/+10
Portable GMT offset calculation to display correct time on GSM. Change-Id: I673f17af2550c9708c4771e4ea4eafbbfafbb824
2017-05-10src: use osmo_timer_setup()Pablo Neira Ayuso1-6/+4
Use new function available in libosmocore to set up timers. Compile tested only. Change-Id: Ibcfd915688e97d370a888888a83a7c95cbe16819
2017-04-10gsm_bts: add version and variant detailsMax1-3/+3
* add version string to gsm_bts * add PCU version string to gsm_bts * rename GSM_BTS_TYPE_OSMO_SYSMO -> GSM_BTS_OSMOBTS to avoid confusion between BTS model and variant * add variant enum to gsm_bts_model using enum with variants for each hw vendor of OsmoBTS * show connected PCU version (if available) in vty via 'show bts' This will come in handy when logging details regarding particular BTS reported via OML, see: Related: OS#1614 Change-Id: I6710d53115f34634a7b70969cc05fd5c72ff8ab2
2017-03-31LU counters: count completion and failure, not messages sentNeels Hofmeyr1-13/+31
From a human admin viewpoint it doesn't make sense to count the messages sent: When we use TMSIs, we first send a LU Accept with a new TMSI, and then expect the MS to respond with a TMSI Realloc Complete message. When that fails to come through, the LU actually ends in failure, even though a LU Accept was sent. If a conn breaks/vanishes during LU, we cancel the LU without sending any reply at all, so the failed LU would not be counted. Instead, count Location Updating results, i.e. completion and failures. (With the new VLR developments, LU counters need to be triggered in completely different places, and this patch prepares for that by providing sensible counters.) Change-Id: I03f14c6a2f7ec5e1d3ba401e32082476fc7b0cc6
2017-03-08add struct bsc_subscr, separating libbsc from gsm_subscriberNeels Hofmeyr1-3/+26
In a future commit, gsm_subscriber will be replaced by vlr_subscr, and it will not make sense to use vlr_subscr in libbsc. Thus we need a dedicated BSC subscriber: struct bsc_subscr. Add rf_policy arg to bsc_grace_paging_request() because the bsc_subscr will no longer have a backpointer to gsm_network (used to be via subscr->group). Create a separate logging filter for the new BSC subscriber. The implementation of adjusting the filter context is added in libbsc to not introduce bsc_subscr_get/_put() dependencies to libcommon. During Paging Response, fetch a bsc_subscr from the mobile identity, like we do for the gsm_subscriber. It looks like a duplication now, but will make sense for the VLR as well as for future MSC split patches. Naming: it was requested to not name the new struct bsc_sub, because 'sub' is too ambiguous. At the same time it would be fine to have 'bsc_sub_' as function prefix. Instead of struct bsc_subscriber and bsc_sub_ prefix, I decided to match both up as struct bsc_subscr and bsc_subscr_ function prefix. It's fast to type, relatively short, unambiguous, and the naming is consistent. Add bsc_subscr unit test. Related: OS#1592, OS#1594 Change-Id: Ia61cc00e8bb186b976939a4fc8f7cf9ce6aa3d8e
2017-03-02subscriber conn: add indicator for originating RANNeels Hofmeyr1-1/+1
Add via_ran to gsm_subscriber_connection to indicate whether a conn is coming in via 2G/GERAN/A-Interface or 3G/UTRAN/Iu-Interface. Prepares for Iu, but also for libvlr to decide between GSM or UMTS Auth. Until actual Iu support is merged to master, this indicator will aid VLR unit testing. At some point we may also add RAN_GERAN_IU; it's not on the agenda yet, but to clearly distinguish the names if we want to add it, explicitly name the ones we have RAN_GERAN_A and RAN_UTRAN_IU. Change-Id: I93b870522f725170e4265a5543f6b680383d7465
2017-02-28silent_call: remove unfinished fuzzer interfacePhilipp Maier1-0/+2
Remove the fuzzer interface that was partially implemented in gsm_04_08.c and silent_call.c is causing problems when an SMS is sent during an active silent call. The reason for this is that gsm0408_dispatch() in gsm_04_08.c would decide to rout all uplink traffic to silent_call_rx() in silent_call.c. silent_call_rx() is a stub function that discards the data. This patch removes the fuzzer interface code by placing ifdefs around it, so that it can be re-activated by experimentators. Change-Id: Id500197d58663b3f4b1756136343670388b0a4bc
2017-02-23logging fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr1-8/+8
In libosmocore, my patch was merged to master a bit too soon. To accomodate the request for naming that matches the general "LOG" prefix instead of "LOGGING", a fixup was committed to libosmocore. Adjust for that. Original patch: change-id I5c343630020f4b108099696fd96c2111614c8067 The fixup: change-id I424fe3f12ea620338902b2bb8230544bde3f1a93 Change-Id: Ib2ec5e4884aa90f48051ee2f832af557aa525991
2017-02-22logging: use central filter and ctx consts from libosmocoreNeels Hofmeyr1-8/+8
The LCHAN and BTS filter contexts are actually never used, so drop them until someone adds them properly. For now use only LOGGING_{FILTER,CTX}_VLR_SUBSCR. Some of these will change to _BSC_SUBSCR once struct bsc_subscriber is introduced, and later on, struct gsm_subscriber will be replaced by vlr_subscriber so that the names will match. Depends: libosmocore change-id I5c343630020f4b108099696fd96c2111614c8067 Change-Id: Ifa82f6a461ad4c0eeddb8a38fb3833460432d16b
2017-02-09Expand chan allocation loggingMax1-1/+1
Log more data related to channel allocation: - channel type - number of paging attempts - timers fired Change-Id: Ib417a9c942c17b902dd80ff555cd9da5f91bff48
2017-02-06gsm_04_08: implement parsing of UMTS Auth responsesNeels Hofmeyr1-5/+221
Parse the longer UMTS res from the extended Auth Response Parameter IE. Parse the R99 Authentication Failure and AUTS in case of cause GSM_REJECT_SYNCH_FAILURE which indicates a SQN re-sync request. Both still end in 'not implemented' error logs, which are the places where the upcoming VLR that supports UMTS AKA will integrate. Depends on recently added constants in libosmocore in commit 55a43b801385e07a484217925ecf2379b9f54fcf aka change-id I745061ce8eb88aa23080dadcdbfe2d703c362a30 Change-Id: I4868bbeedc32fa7b8d03b9e3c66db618543d38ec
2017-02-03gsm48_tx_mm_auth_req(): support UMTS AUTNNeels Hofmeyr1-3/+20
To be able to do R99 UMTS authentication, we need to send along AUTN bytes in the Authentication Request. Add autn parameter to gsm48_tx_mm_auth_req() and conditionally append the R99 AUTN TLV to the Authentication Request message. Change-Id: I0d644559088706aa06b42b9bfe1f8c21ca6fa4da
2017-02-03gsm0408_rcv_cc: guard against NULL subscriberNeels Hofmeyr1-0/+5
Check conn->subscr against NULL. gsm0408_rcv_cc() dereferences many conn members without checking presence: the bts and lchan members may be expected to be NULL in the ongoing MSC split and 3G developments. But the conn->subscr is initially NULL, so an MS sending a CC message before something like a LU or CM Service Request will result in a segfault. Prevent that. Note: the upcoming VLR will be more restrictive on what messages are processed, this is a "backport" to the situation on current master. Change-Id: If067db7cc0dd3210d9eb1da15be6b637795a3ecf
2017-01-26various comment / whitespace tweaks (libmsc, gprs, libcommon-cs)Neels Hofmeyr1-1/+1
cosmetic ws in common_cs_vty.c, osmo_msc.c comment: tiny typo fix in gsm_04_08.c In comments, drop some unbalanced braces, because simplistic C file harvesters will break at a single opening brace even if it is in a comment. This is aimed at the fsm-to-dot.py script in libosmocore/contrib. Change-Id: I3c1fa53195a1e57d6fe0a6791c346d30ceff1251
2017-01-23cosmetic: use osmo_strlcpy() everywhereNeels Hofmeyr1-10/+9
Shorten some code and make obvious to the reader that the string copy is done in a safe way. Change-Id: I900726cf06d34128db22a3d3d911ee0d1423b1bd
2016-12-02split subscr_con_allocate()/_free() in bsc_ and msc_Neels Hofmeyr1-0/+27
Rename current subscr_con_allocate() and subscr_con_free to bsc_*, and add two separate msc_subscr_con_allocate() and _free(). The msc_subscr_con_free() ignores all lchan members. In libbsc use bsc_*, in libmsc use msc_*. Change-Id: I3cf7c7cafdf4672ec7b26058bba8a77159855257 Future: there will be distinct subscr conns for libbsc and libmsc.
2016-12-02Move timezone settings up to network levelNeels Hofmeyr1-9/+8
Time zone used to be configurable per-BTS. In the upcoming MSC-split, no BTS structures will be available on the MSC level. To simplify, drop the ability to manage several time zones in a core network and place the time zone config on the network VTY level, i.e. in gsm_network. If we are going to re-add fine grained time zone settings, it should probably be tied to the LAC. Adjust time zone VTY config code (to be moved to libcommon-cs in subsequent commit). Adjust time zone Ctrl Interface code. Change-Id: I69848887d92990f3d6f969be80f6ef91f6bdbbe8
2016-11-01gsm0408: Adding log output for 3g specific RR messagesPhilipp1-2/+2
GSM 04.18, which is the successor of GSM 04.08, describes additional RR 3g specific message types. This commit adds log output for those messages. The behaviour is not changed all affected message types are still forwared to the MSC as they were before. See also 3GPP TS 04.18, section 10.4, table 10.4.1 The change requires to update libosmocore as well, see also commit f48fdb3a108da0dc23d7af4ac021e98e11f07152 in libosmocore.git for details. Change-Id: I41f2242fdf59c3eb4b3f8f7f003c17f7e0df01aa
2016-10-14fix mistypes, spaces and tabsAlexander Couzens1-15/+15
Change-Id: I651473f638365bbd333c4c80d223cdd023dd2c51
2016-10-04msc: add counters to track call attempts/active/success/failedAlexander Couzens1-0/+34
active_calls describe all calls in active state. call.complete Call got terminated by disconnect requested either by MS or MSC. call.incomplete Call got terminated by any other reason. call.active Calls reached active state. Change-Id: I49b93af2e6a0ba16c2fb00b7b83974e8a6a16df3
2016-09-26mscsplit: directly access gsm_network backpointer from gsm_subscriber_connectionNeels Hofmeyr1-40/+33
The previous commit added a network backpointer to gsm_subscriber_connection. Use it wherever it makes sense, to skip the step through the bts structure. In some places, remove local variables that become unused. Change-Id: I34537025986713291e14c8212a81539b497befd4
2016-09-18Sanity fixes for gsm0408_dispatch(): rc, assertionsNeels Hofmeyr1-0/+5
gsm0408_dispatch() is the main entry point for receiving data from the BSC/RNC level, so make sure callers pass valid pointers before using them all the way down the code path (related to CID#93769, a fix before this was refactored). For unknown/unimplemented packet discriminators, make sure to return error codes. Change-Id: Ieec39c74a53ef4dfa971dd935c8c9aa60fef58c1
2016-09-18cosmetic: various comment, whitespace tweaksNeels Hofmeyr1-2/+2
Change-Id: I131939cfba4d67d7e2c935341deeb14d09523fee
2016-08-29libmsc/bsc: split rate counters into bsc and msc groupAlexander Couzens1-10/+10
Tweaked-By: Neels Hofmeyr <nhofmeyr@sysmocom.de> Change-Id: I7361033cd1eb919ec3c2ea2652f40ab8c75b2f99
2016-08-27libbsc/libmsc: convert old osmo counter into rate_ctrgsAlexander Couzens1-10/+10
rate counters support the export to statsd and can have a delta value. Change-Id: Ie749cebd53a0bb618d0e23d375885712078bf8dd
2016-07-09Make random MSISDN assignment optionalMax1-6/+4
Previously if subscriber was automatically created it got assigned random MSISDN number. Make it optional (defaulting to previous behavior) by adding following: * new optional no-extension argument for subscriber-create-on-demand vty command * db unit tests * vty test Note: using the db made with new code might result in subscribers with empty extension. Such subscribers cannot be deleted using old code. Make sure not to mix db versions or manually fix it by editing sqlite with external program. Fixes: OS#1658 Change-Id: Ibbc2e88e4722b08854ebc631485f19ed56443cbb
2016-06-14Make random extension range configurableMax1-1/+2
Previously if subscriber was automatically created it got assigned random MSISDN number between 20000 and 49999. Make it configurable with new vty command "subscriber-create-on-demand random" and expand vty tests to check it. Change-Id: I040a1d227b0c7a1601dc7c33eccb0007941408a6 Related: OS#1658
2016-06-05Add regexp authorization policy for IMSIMax1-3/+28
* extend "auth policy" vty command with new option "regexp" * add vty command "authorized-regexp" for setting arbitrary POSIX regular expression * add basic vty test * add optional "regexp" argument to subscriber-create-on-demand vty command With those in place we can now set the regexp against which MS's IMSI will be matched. If IMSI match the regexp than MS is allowed to access the network. If subscriber is already marked as authorized in HLR than it'll be allowed regardless of IMSI matching. The same way we can decide whether to create subscribers on-demand basesd on IMSI regexp match. Similar to authorization this restriction can be overridden by manually creating subscriber via vty, ctrl interface or directly in HLR. Change-Id: I525f4b80676de47d1d422686da2ca012301b0129 Fixes: OS#1647
2016-05-23gsm04_08_clear_request(): release loc with arg release=0Neels Hofmeyr1-1/+1
In gsm04_08_clear_request(), in_release == 1 anyway and msc_release_connection() would exit immediately without any effect. Don't confuse the reader by passing release=1 arg. Change-Id: I5bf9eb4889d32ad5e42ac7d096bf62fa3a493e20 Reviewed-on: https://gerrit.osmocom.org/93 Reviewed-by: Holger Freyther <holger@freyther.de> Tested-by: Jenkins Builder
2016-05-22subscr_name(): Handle case for subscr == NULLHarald Welte1-5/+2
subscr_name() was called from several places: * either without a check for subscr being NULL, which for example was causing a segfault if we hand-over a channel before identifying the subscriber * or with an explicit NULL check and the ternary operator (?). We now simplify the code by checking for the NULL Subscriber in subscr_name() itself. Change-Id: Ide09f4a515222eb2ec6c25e7a6a8c5f6cc2ffd4b Reviewed-on: https://gerrit.osmocom.org/92 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-05-20Make extending subscriber creation easierMax1-7/+13
* rename variable controlling subscriber creation * use enum for subscriber creation policy * move check for subscriber creation policy into separate static function Related: OS#1658, OS#1647 Change-Id: I3b10a9a764fd3a7bb96717a990e52caae16266da Reviewed-on: https://gerrit.osmocom.org/42 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-04-29Start to use struct osmo_auth_vector from gsm_auth_tupleHarald Welte1-5/+5
Rather than having a 'private' structure for kc, sres and rand, we now finally (with 4 years delay) use osmo_auth_vector from libosmogsm, which encapsulates authentication vectors that can be either GSM triplets or UMTS quintuples or a combination of both. gsm_auth_tuple becomes a wrapper around osmo_auth_vector, adding use_count and key_seq to it. key_seq is no longer initialized inside gprs_gsup_messages.c, as there is no CKSN / key_seq inside the message anyway. If a usre of the code needs key_seq, they need to manage it themselves.
2016-04-29Disconnect calls with incompatible channel types / modesMax1-1/+45
In case both TCH/H and TCH/F or different codecs are configured and internal MNCC handler is used we might end up in a situation where call legs with incompatible channel types or codecs would be connected resulting in a broken audio. Disconnect such calls with appropriate error message. Fixes: OS#1663
2016-04-22Add extra debug output with channel mode and typeMax1-5/+18
This provides helpful information for debugging internal MNCC handler.
2016-03-17fix confusing typo in constant (THAN -> THEN)Neels Hofmeyr1-1/+1
2016-03-1504.08: apply new transaction id inline functionsNeels Hofmeyr1-1/+1
libosmocore recently added inline functions to relieve callers from applying bitmasks and bit shifts to access the transaction id of a GSM 04.08 header. Apply these functions.
2016-03-1504.08: apply new bitmask functions, fix bitmask useNeels Hofmeyr1-6/+5
Replace hardcoded protocol discriminator and message type bitmasks with function calls recently introduced in libosmocore. Note that the release 98 bitmasks slightly differ from the release 99 bitmasks. This patch uses the "default" gsm48_hdr_msg_type invocation, thus it depends on libosmocore whether 98 or 99 bitmasks are used. In some places, use of the bitmask was erratic. Fix these implicitly by employing the bitmask functions: * silent_call.c: silent_call_reroute(): add missing bitmask for MM. * bsc_msg_filter.c: bsc_msg_filter_initial(): RR vs. MM messages. * osmo_bsc_filter.c: bsc_find_msc() and bsc_scan_bts_msg(): RR vs. MM messages. * bsc_nat_rewrite.c: bsc_nat_rewrite_msg(): SMS vs. CC messages. * bsc_ussd.c: no bitmask is applicable for the message types used here. * gb_proxy.c: gbproxy_imsi_acquisition(): missing bit mask for pdisc. In gprs_gb_parse.c: gprs_gb_parse_dtap(), add a log notice for unexpected message types.
2016-01-30gsm0408: Provide unique strings for the gsm 04.08 messageHolger Hans Peter Freyther1-29/+29
At Rhizomatica we see that some GSM 04.08 messages are leaked and have no other indication if that is Call Control, SMS or something else.
2015-12-12mncc: introduce 'struct gsm_mncc_bridge' for MNCC_BRIDGEHarald Welte1-3/+3
When a MNCC handler wants to issue the MNCC_BRIDGE primitive overt the MNCC interface, this was not possible so far via the MNCC socket. This primitive was so far only available from the internal MNCC handler, more or less by accident I suppose. The reason for this is in the way the array of two call references had been passed into mncc_tx_to_cc().
2015-09-14mncc: Use the default codec from the built-in mncc modezecke/features/rtp-bridgeHolger Hans Peter Freyther1-4/+5
In case of the RTP bridge mode we need to select the codec ourselves. Rely on the same (incomplete) codec selection that can be done using the mncc-int configuration node. This might gain bearer capabilities support. In case of a SDCCH a TCH/F will be attempted to be assigned. This is an open issue for both modes and there should be a preference for full or half-rate channels somewhere.
2015-09-14mncc: Implement CRCX->MDCX for handover for direct rtp modeHolger Hans Peter Freyther1-6/+28
Implement sending MDCX on the newly allocated channel and send the data to the same destination as the currently connected one. This way the receiver can implement RTP RFC Appendix A.1 and deal with the new source.
2015-09-14mncc: Implement the direct RTP mode for ip based systemsHolger Hans Peter Freyther1-0/+213
For the LCR rtp-bridge audio should directly flow to the remote system. In contrast to the original patch audio will now flow directly from the BTS to the remote system. This assumes that BTS and the remote system are in the same network segment and can directly communicate. There are various limitations in the first iteration of the implementation: We could (and in the future) should delay the assignment but currently we are forced to pick the channel and move it to the audio state. In case we are located on a SDCCH we always need to change but if we are on a TCH we could send the ipa.CRCX and change the audio state a lot later. The net effect is that the audio codec selection needs to be done in the NITB code and not in the system connected to it. This only works with ip based systems. For E1 systems one could still use the RTP socket or even try to move this out of the process. There is no code for handover handling and it relies on the remote system dealing with the SSRC change of the system.
2015-08-18GSM/GPRS 04.08: Don't print numeric mobile identity typesHarald Welte1-25/+20
I guess none of our users knows what a mi_type=0x02 is, but most would know what an IMSI or a TMSI is. So let's use the newly introduced gsm48_mi_type_name() function to fix this.
2015-08-17Add check for non existing lchan at tch_frame_down()Andreas Eversberg1-0/+4
Traffic cannot sent to BTS, if there is (currently) no logical channel associated with the transaction. This happens, if TCH traffic is received from upper layer, but there is no lchan available before completing immediate assignment, handover or assignment process. [hfreyther: The code has not been moved to tch_frame_down but the issue looks similiar]
2015-08-01nitb: Add a mode to not use TMSI for normal operationHolger Hans Peter Freyther1-31/+63
In case foreign simcards are used we can not do authentication and ciphering. In case a TMSI is re-used too early and we do page using TMSI we can't know which of the two MS is responding to us. We could change the "secure channel" routine to ask for the IMSI and only then stop the paging. As we don't have ciphering there is not much use in using the TMSI. Add a mode "no assign-tmsi" that will not assign the TMSI during LU. Now CM Service Request and Paging Response will work using the IMSI. There can't be a clash with that. [ciaby fixed the vty write to use the right name]
2015-08-01nitb: Be less strict about the reject causeHolger Hans Peter Freyther1-1/+1
When we can't find the TMSI then the subscriber is not in our VLR. We have not consulted with the HLR and it is better to not use such a severe error code.
2015-05-29gsm_04_08: Use osmo_assert for transt->conn and conn only in case of paging ↵Ivan Kluchnikov1-1/+1
succeeded setup_trig_pag_evt function can receive parameter conn = NULL, if T3113 expires.