aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc
AgeCommit message (Collapse)AuthorFilesLines
2016-11-12Iu auth wipNeels Hofmeyr2-10/+73
Change-Id: I44effcca80dc6850178174dc957bcd5608b0ae14
2016-11-12cosmetic prep: change int -> bool authorize_subscriber()Neels Hofmeyr1-6/+6
Upcoming function subscr_authorized() will flip this to bool, so separate this change cosmetically. Change-Id: Iba0184a71afa01141ef06c474cb554e79ad8f5d5
2016-11-12subscr_request_channel() -> subscr_request_conn()Neels Hofmeyr2-3/+5
Change-Id: Ife8e10b240693a8d369139881774f1892044aa65
2016-11-12move subscr_request to gsm_subscriber.hNeels Hofmeyr1-14/+0
Change-Id: Idbbd39b0e068da17aafa97e315143509c69c50ea
2016-11-12msc_release_connection(): don't call gsm0808_clear()Neels Hofmeyr1-1/+0
gsm0808_clear() is all about clearing lchans. To be able to link libmsc without libbsc, don't call it directly. Change-Id: I149146fc3cb99ef4a21ee2a798231bb070f398cd
2016-11-12cut off libbsc paging, pending paging in libmscNeels Hofmeyr3-1/+21
Temporarily disable all paging to be able to link libmsc without libbsc. Skip the paging part of channel_test because the paging is now disabled. In osmo-nitb, paging is done on BSC level and MSC level "at the same time". When the new CSCN is fully operational, paging will be controlled separately on the MSC level, and the BSC (RNC) level will be instructed over an IuCS or A-interface to negotiate paging with the MS (UE). This MSC level paging does not yet exist and will be added in subsequent commits. Change-Id: I8b6920ddc54fc3f2876a59664e6722666d8a8a4a
2016-11-12libmsc: duplicate gsm0808 / gsm48 functions (towards BSC)Neels Hofmeyr3-13/+61
In osmo-nitb, libmsc would directly call the functions on the BSC level, not always via the bsc_api. When separating libmsc from libbsc, some functions are missing from the linkage. Hence duplicate these functions to libmsc, add an msc_ prefix for clarity, also add a _tx to gsm0808_cipher_mode(): * add msc_gsm0808_tx_cipher_mode() (dummy/stub) * add msc_gsm48_tx_mm_serv_ack() * add msc_gsm48_tx_mm_serv_rej() Call these from libmsc instead of * gsm0808_cipher_mode() * gsm48_tx_mm_serv_ack() * gsm48_tx_mm_serv_rej() Also add a comment relatd to msc_gsm0808_tx_cipher_mode() in two places. Change-Id: I5b276853d3af71f5e3f0a031fd17b4fff0580020
2016-11-12Use new msc_tx_dtap() instead of gsm0808_submit_dtap()Neels Hofmeyr3-8/+8
Aim: msc_tx_dtap() shall redirect to IuCS or A interfaces depending on subscr conn. Change-Id: I30d961f16eb7b9c0ab9cc3f43198098d3f1a909f
2016-11-12msc_compl_l3(): publish in .h, tweak return valueNeels Hofmeyr1-6/+9
Use new libmsc enum values for return val, to avoid dependency on libbsc headers. Make callable from other scopes: publish in osmo_msc.h and remove 'static' in osmo_msc.c Change-Id: If24007445899e9c75553a0dbf843ada3566b3380
2016-11-12add cscn vty, remove nitb vtyNeels Hofmeyr3-104/+175
Change-Id: I8f8980d6cfbf26f1b0e0197939833e55dbe521fb
2016-11-12add iucs.[hc]Neels Hofmeyr2-0/+174
Change-Id: I88e981f4c31393a98ae8d61176c65c9251a6f28b
2016-11-12gsm0408_loc_upd_rej(): remove bts use (used only for debug log)Neels Hofmeyr1-5/+3
Change-Id: I3ac38f4b701ad8308470573260fa91a4b04c2f18
2016-11-12gsm_04_08, gsm_subscriber: decouple lac from btsNeels Hofmeyr2-10/+9
The idea is to not have a direct pointer to a bts struct (into BSC land), but a LAC to resolve the BSC or RNC depending on the appropriate A or IuCS interface. subscr_update(): remove bts arg, add lac arg. Pass conn->lac to gsm48_generate_lai() instead of bts->location_area_code. Change-Id: I9f2b298a785bf4b2a1b3fcdd91b8256106b2d9de
2016-11-12subscr_update_expire_lu(): remove bts argNeels Hofmeyr2-4/+4
Change-Id: I26cafd9389aac65e53dc4280a1687c6b8bce3106
2016-11-12move t3212 to network level (periodic lu)Neels Hofmeyr1-3/+3
Set the T3212 default value in struct gsm_network and take that value when creating a BTS. Adjust VTY accordingly. Change-Id: Ifb730f9d0106fe195adc30459a39290a07313b50
2016-11-12libmsc: iucs dev: disable large parts of the codeNeels Hofmeyr5-1/+91
Change-Id: I3ef6ca26150b6102a0fa22a88a60d9a442d640b4
2016-11-12Prepare entry/exit point for MSC -> BSC and MSC -> RNC communication.Neels Hofmeyr3-0/+86
Add msc_ifaces.[hc], a_iface.c, with a general msc_tx_dtap() to redirect to different interfaces depending on the actual subscriber connection. While iu_tx() is going to be functional fairly soon, the a_tx() is going to be just a dummy for some time (see comment). Add via_iface marker to gsm_subscriber_connection with enum values IFACE_A and IFACE_IU so far. Add Iu specific fields in a sub-struct: the UE connection pointer and an indicator for the Integrity Protection status on Iu (to be fully implemented in later commits). Add lac member to gsm_subscriber_connection, to allow decoupling from bts->location_area_code. The conn->lac will actually be set in iu.c in an upcoming commit ("add iucs.[hc]"). Change-Id: Idf8020a30562426e8f939706bf5c2188d5a09798
2016-11-12don't use lchan in libmscNeels Hofmeyr3-14/+12
Change-Id: Ic7ed7faa2bcc7aae799f41ed4abc2c001bfb61b7
2016-11-12gsm_04_08.c: Don't set msg->lchan nor msg->dstHarald Welte1-34/+0
the BSC-side of the API behind gsm0808_submit_dtap() is doing this resolving again anyway. So let's avoid doing it twice, and avoid having more dependency of the MSC down into the lchan details. Conflicts: openbsc/src/libmsc/gsm_04_08.c Change-Id: I14254be68ee1a48e9f1ce968233414d86c6ba9d5
2016-11-12split subscr_con_allocate()/_free() in bsc_ and msc_Neels Hofmeyr2-1/+28
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-11-12Move 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 libxsc in subsequent commit). Adjust time zone Ctrl Interface code. Change-Id: I69848887d92990f3d6f969be80f6ef91f6bdbbe8
2016-11-12reinvent connection_for_subscr() and move to libmscNeels Hofmeyr1-0/+14
Implement connection_for_subscr() from a completely different angle: instead of looking up lchans in bts structs, look up the subscriber in the global list of gsm_subscriber_connection. static lchan_find() is thus obsoleted. All callers of connection_for_subscr() live in libmsc, so move to libmsc. The move and edit are done in a single commit since the old and new implementation have nothing in common. Future: osmo-cscn will use this, without bts being present. Remove implementation of connection_for_subscr() from channel_test.c -- it is possible that the abort() in there was intended for a regression test, but actually it seems the implementation was merely added for linking reasons, and the abort() added to guard against the NULL return value: no comment nor the commit log indicate that the abort() is test critical; the addition was the only change in channel_test.c for that commit; at the same time a connection_for_subscr() call was added in libmsc. Change-Id: I5e0ba0ecf1726ebd540800f4e98fdfc937c904ff
2016-11-12sms_next_rp_msg_ref(): use direct pointer to next_rp_ref counterNeels Hofmeyr3-39/+1
libbsc and libmsc will have separate subscriber connection structs. Hence don't rely on gsm_subscriber_connection, but work on a direct pointer to the counter for the next RP reference. The only very thin function in gsm_04_11_helper.c thus becomes obsolete: drop the entire file. Change-Id: I2a2e9ba6a981a385d1f8f07acbe03536ffed0072
2016-11-12move to libxsc: factor out gen of USSD notify and release completeNeels Hofmeyr2-26/+6
Both libmsc and libbsc will need distinct gsm0480_send_ussdNotify() and gsm0480_send_releaseComplete() functions, since there will be distinct subscriber connection structs. The current functions live in libmsc, so add the same in libbsc in new file gsm_04_80_utils.c. To avoid too much code dup, move the message generation part of gsm0480_send_ussdNotify() and gsm0480_send_releaseComplete() to new functions gsm0480_gen_ussdNotify() and gsm0480_gen_releaseComplete(), placed in libxsc. Change-Id: I33a84e3c28576ced91d2ea24103123431f551173
2016-11-02mncc_builtin: Properly reject DTMFlynxis/masterHarald Welte1-0/+2
As per TS 23.014, a GSM MSC must implement mobile-originated DTMF generation. We gate the DTMF signalling messages to MNCC, and expect the external MNCC handler to deal with it. However, the internal MNCC handler simply ignored such singalling messages, rather than rejecting DTMF altogether. It turns out failure to respond to START DTMF will cause some phones to behave in interesting ways, particularly with modem firmware v6.01.00, see https://osmocom.org/issues/1817). In this case the phone is not able to release the call as the pending response to the START DTMF is probably keping a reference or lock of some sort. Change-Id: I336f0cd0a6396b522d228479a417fd4d606157ac
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 Couzens2-16/+16
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 Hofmeyr4-54/+47
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-18debug log for sms: fix/addNeels Hofmeyr3-2/+14
One logged the wrong function name. Add others. Change-Id: Ied5d8e84d5d192c826bc131be8907eaa55190479
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-09-18vty l3 help: fix typo 'comamnds'; fix english s/his//Neels Hofmeyr1-5/+5
Change-Id: I6be52bbb69de8aa0a6d57a3a320661ad85fc2cc4
2016-09-17sms: change rp err cause of smpp_try_deliver errorsAlexander Couzens1-4/+13
smpp_try_deliver could fail with rc < 0. In such cases don't send the MS the rp error sms rejected (cause 21). A rejected message should not be sent again. The spec 04 11 recommends sending cause 41 Temporary failure in unknown cases. Add also a log message and rate counter for such cases. Tweaked-By: Neels Hofmeyr <nhofmeyr@sysmocom.de> Change-Id: Ia03e50ce2bd9a7d1054cc5a6000fd73bd3497c03
2016-09-15Consistenly format variables in */Makefile.am filesAlexander Huemer1-21/+53
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-08-29libmsc/bsc: split rate counters into bsc and msc groupAlexander Couzens3-37/+37
Tweaked-By: Neels Hofmeyr <nhofmeyr@sysmocom.de> Change-Id: I7361033cd1eb919ec3c2ea2652f40ab8c75b2f99
2016-08-27libmsc: add missing count of sms no receiver when using smpp_firstAlexander Couzens1-1/+3
Change-Id: I20ecb3299d67dbaa7b016620685997db49970ffb
2016-08-27libbsc/libmsc: convert old osmo counter into rate_ctrgsAlexander Couzens3-36/+44
rate counters support the export to statsd and can have a delta value. Change-Id: Ie749cebd53a0bb618d0e23d375885712078bf8dd
2016-07-23mncc_sock: use osmo_sock_unix_init() from libosmocoreVadim Yanitskiy1-52/+5
Since the osmo_unixsock_listen() was moved to libosmocore it would be better to use the library's implementation instead of reinventing the wheel again. Change-Id: Iacfc39b6214c24084438f8fe04d03952cdc9ebc2
2016-07-09Make random MSISDN assignment optionalMax5-39/+48
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 configurableMax5-9/+44
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 IMSIMax2-7/+39
* 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-27tweak db debug log: log TMSI as hexNeels Hofmeyr1-1/+1
Change-Id: I4564c99c145a35fb592c228c1fa84c61ec425fd3 Reviewed-on: https://gerrit.osmocom.org/94 Reviewed-by: Harald Welte <laforge@gnumonks.org> Tested-by: Jenkins Builder
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 easierMax2-10/+16
* 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-05-15db.c: implemented incremental migrationVadim Yanitskiy1-18/+35
In the past, normal migration was possible only if the actual schema version differed from the version used in DB by 1. For example, if DB uses an old version 3 and you need to use it with the code written for version 5, the check_db_revision() will convert it to 4 and DB will still use incompatible schema version during Osmo-NITB running time. After next run it will be converted to version 5. This patch replaces a set of 'else-if' checks by a 'switch' without 'break' statements between 'case' labels (waterfall). It makes you able to migrate from current version to the latest despite any difference between them. Change-Id: Ia9c2aa86f96b88ad8a710d0a23879ce219bc82dc Reviewed-on: https://gerrit.osmocom.org/62 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-04-29use new libosmocore gsm_23_003.h for IMEI/IMSI lengthHarald Welte2-4/+5
... rather than our private definitions everwhere. As an added benefit, gprs_gsup_messages.h is now free of any header dependencies within openbsc.
2016-04-29Start to use struct osmo_auth_vector from gsm_auth_tupleHarald Welte4-21/+21
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