aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include
AgeCommit message (Collapse)AuthorFilesLines
2017-03-16Introduce subscriber_connection ref-countingHarald Welte2-1/+7
This introduces a reference count for gsm_subscriber_connection. Every user of the connection needs to hold a reference until done. Once the reference count dorps to zero, the connection is cleared towards the BSC (which subsequently will clear any logical channels associated with it). Related: OS#1592 Change-Id: I8c05e6c81f246ff8b5bf91312f80410b1a85f15e
2017-03-15libbsc: add chreq type for CHREQ_T_PDCH_ONE_PHASE & CHREQ_T_PDCH_TWO_PHASEAlexander Couzens2-1/+2
When using a BSC located PCU the BSC must understand PDCH requests. Change-Id: Ie7f4ed000cf1b40d269873cf0ddf5ff9f5bbc18a
2017-03-08add struct bsc_subscr, separating libbsc from gsm_subscriberNeels Hofmeyr7-11/+75
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-07Add MS time. offset to gsm_lchanMax1-0/+6
Add MS TIMING OFFSET (3GPP TS 48.058 § 8.4.8) and P offset (3GPP TS 45.010 § 1.2) which can be used to compute MS TO from known TA. This will be used by osmo-bts (see I4dfe5c48834a083e757d5de3236a02e15a238b28) to provide MS TO as part of RSL MEASUREMENT RESULT. Change-Id: I8bda57c8d6c15bbb803eca708931556dae118a00 Related: OS#1574
2017-03-02subscriber conn: add indicator for originating RANNeels Hofmeyr1-0/+8
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/+3
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-27SGSN: Integrate support for UMTS AKANeels Hofmeyr1-1/+6
The general infrastructure for UMTS AKA is already in place: * GSUP with capability to send us auth_vectors that contain either triplets or quintuples * mm_context that holds such auth_vectors Add: * capability to send UMTS AUTN in GMM AUTH REQ * parse extended UMTS RES * on auth response, validate expected AKA with vector and received res/sres * add Auth Failure message to receive resync AUTS token and * send to HLR * clear out-of-sync auth tuple * enter new state for when we're waiting for HLR to resync and send new tuples so that the next Auth Request will be handled Original first half of this patch by: Harald Welte <laforge@gnumonks.org> Full UMTS AKA procedure including AUTS resync tested to work against OsmoHLR with R99 USIM and Milenage algorithm. The sgsn_test.c needs adjustment because we're checking the vector's auth_types now. Depends: libosmocore change-ids I277fb3d407396dffa5c07a9c5454d87a415d393f If943731a78089f0aac3d55245de80596d01314a4 Related: OS#1956 Change-Id: Ie6a0cefba5e4e7f02cc2eaf6ec006ac07d5c1816
2017-02-25add struct gprs_subscr, separating gprs from gsm_subscriberNeels Hofmeyr5-10/+44
Prepare for replacing gsm_subscriber with vlr_subscriber. vlr_subscriber will not make sense to be used in gprs, so have a dedicated GPRS subscriber struct. (Could change if the gprs code were to use libvlr; is currently independent). Related: OS#1592 Change-Id: Ia8b391ee009c8545763cba04505be3947835120e
2017-02-24cosmetic: rename struct osmo_msc_data to bsc_msc_dataNeels Hofmeyr4-13/+13
With the OsmoMSC program coming up, the name osmo_msc_data becomes even more confusing than it already is. Clearly indicate it as libbsc's data of a remote MSC by prefixing with bsc_. Also, the Osmocom community has in the meantime agreed to have the osmo_ prefix only in libosmocore, to avoid naming conflicts in case things are moved there. So while renaming anyway, also drop the osmo_ prefix. Change-Id: I0dfbcb7d1a579211180f71319982820d8700afab
2017-02-24cosmetic: rename osmo_msc_data.h to bsc_msc_data.hNeels Hofmeyr2-1/+1
With the OsmoMSC program coming up, the name osmo_msc_data becomes even more confusing than it already is. Clearly indicate it as libbsc's data of a remote MSC by prefixing with bsc_. Also, the Osmocom community has in the meantime agreed to have the osmo_ prefix only in libosmocore, to avoid naming conflicts in case things are moved there. So while renaming anyway, also drop the osmo_ prefix. Change-Id: I13554563ce9289de126ba0d4cf329bafcda35607
2017-02-24cosmetic: clarify BSC's remote MSC data vs. OsmoMSCNeels Hofmeyr1-0/+6
Change-Id: I74dd2b3f935d39b8caa718e2c8a51cc81bddf1b9
2017-02-24cosmetic: gsm_data.h, README: rename CSCN to MSCNeels Hofmeyr1-1/+1
We're discarding the name OsmoCSCN for the benefit of OsmoMSC. But "CSCN" has already crept into the master branch in two places; apply the rename. See OS#1958 Change-Id: Ib4274eb3c172ada1fe7f05746740b456370bc93d
2017-02-23cosmetic: remove unused scall_signal_data.subscrNeels Hofmeyr1-1/+0
Doesn't make sense to switch this to struct vlr_subscr when it isn't used at all. So let's remove it. Change-Id: Ifa5901f8bf1aed3981841d24d4ec8d659f3de7a9
2017-02-22debug.h/c: remove unused cruft / cosmetic tweaksNeels Hofmeyr1-11/+1
Change-Id: I9601d478763569933bcc46bf4eaaff70a9843be9
2017-02-22logging: use central filter and ctx consts from libosmocoreNeels Hofmeyr1-15/+0
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-08vty: remove ignored logging parametersMax1-1/+1
Since ce9fec3e896571835ac5bfd2980d6836f2b29f0d libosmocore ignores parameters to log_vty_command_* functions. Hence parameter of logging_vty_add_cmds() is ignored too. As we depend on much later libosmocore version anyway, we can simplify code somewhat by removing parameters which will be ignored anyway. Change-Id: I62f752fd88f1d8fefa563648f9864c7c31f87991
2017-02-07gprs/sgsn: rename sgsn_mm_ctx_alloc() -> sgsn_mm_ctx_alloc_gb()Alexander Couzens1-1/+1
Postfix the ran type to clarify the purpose. Because of the new support of the Iu ran type, there are 2 functions to allocate a mm ctx. For Iu it's sgsn_mm_ctx_alloc_iu(). For gb it should be named in the same way. Change-Id: Ic49009e8c20c12308855e1409c09004698c79b95
2017-02-07gprs/sgsn: rename gprs->mm_state -> gmm_stateAlexander Couzens1-4/+4
GMM is the right term. MM state is already occupied. Change-Id: I9cfdcf921e4ebd14a5e7ce7489ec4ce5d1f5515f
2017-02-03gsm48_tx_mm_auth_req(): support UMTS AUTNNeels Hofmeyr1-1/+2
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-02paging.h: use '<>' include, not '""'Neels Hofmeyr1-2/+3
Also separate openbsc includes from osmocom/core includes. Change-Id: I4da0cb32476202d06902531d07faed8004f689f9
2017-02-02osmo_bsc_grace.h: use '<>' include, not '""'Neels Hofmeyr1-1/+1
Change-Id: I2f22be93d1a5fd6f229b85305a1d2a2cf6a43ce2
2017-01-27rsl: Fix dropping of LAPDm UA message.Minh-Quang Nguyen1-0/+2
In some cases, when successive mobile originated calls are made, the LAPDm UA message gets lost because the channel is relased to early. Too overcome the problem we do not send release indications immediately. Instead a flag will be set and the message stored and sent on the next TCH-RTS-IND. This commit adds the required flag and the msg-buffer to struct gsm_lchan. See also coresponding change in osmo-bts.git: Change-Id Ie4f70c75f0137b4bd72d579b3a32575bac2fca38 This patch is is a slightly improved/reformatted version of: https://gitlab.com/nrw_noa/osmo-bts/commit/95d1f15ad108c1c1869c1965144acd64c1395d8c Change-Id: I15fc1ef8e9e83f009bde96de9a8e95702cffbce6
2017-01-26Implement VTY configuration to control Early Classmark SendingHarald Welte1-0/+1
The SI3 rest octests contain a flag that indicates if early classmark sending is allowed in this cell or not. So far we always set this to one, now it is configurable using the 'early-classmark-sending' command at the VTY node. Change-Id: Ia0b1cc5ab45673f3da70c59ae8917eba343f9862
2017-01-26remove unused struct members of 'struct sgsn_pdp_ctx'Harald Welte1-5/+0
There were some members that we neither set nor read, so let's shrink the struct size and remove those unused members. Change-Id: I02136e3aa91e58b2afc923c09c8693095497fdd7
2017-01-23Prevent segfault in range encodingMax1-0/+4
* Explicitly check when ARFCN array split is impossible and return gracefully instead of using negative index. * Separate range encoding into generic function and use it for all SI-related things. * Propagate the error into that function and to its callers. * Add separate test-case for the segfault previously triggered by this bug. Change-Id: I3e049ab2d7c1c4d6c791b148f37e10636a8e43e0 Related: RT#7379
2017-01-06Cosmetic fixes around SI generationMax2-4/+3
* add missing spaces after comma and minus * prevent useless recursion calls * mark static functions as such * name and explicitly use enum for ARFCN range Change-Id: If5b717445c8b24668bad0e78fd5bb51f66c4d18e
2016-12-23sndcp: Allow empty SNDCP-XID indicationsPhilipp1-6/+8
In some rare cases the modem might send a xid indication that does not contain anything except the version number field. The sgsn ignors such SNDCP-XID indications by stripping the entire field from the response. We found a modem in the wild that started to act problematic when the empty SNDCP-XID was missing in the response. This patch changes the XID negotiation behaviour in a way that if a modem should send empty SNDCP-XID indications, the reply will also contain an empty SNDCP-XID indication. Apart from that the SNDCP-XID version number is now parsed and echoed in the response. This ensures that we always reply with the version number that the modem expects. (The version was 0 in all cases we observed so far) Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Related: OS#1794
2016-12-21Improve GPRS loggingMax1-1/+3
* log xid type as string instead of int * log packet encryption status, algorithm and IOV-UI in debug mode * print encryption parameters when dumping llme via vty * log key propagation from MM to LLC Related: OS#1794 Change-Id: I30c38fdeb0b88bb39bdb9928851300bc79e6aec6
2016-12-13rename oap.h to oap_client.hNeels Hofmeyr4-3/+3
Related: OS#1592 Change-Id: I05bd65ff81b0f70f68217b2e0a9466e160bdbdec
2016-12-13oap: rename public API from oap_ to oap_client_Neels Hofmeyr3-17/+21
Mainly to differentiate the OAP messaging API (osmo_oap_ in libosmocore) from the OAP client. This is in preparation for moving the oap client to libcommon, which is in turn preparation for libvlr. Add the osmo_ prefix, as all public Osmocom API should have. We also have OAP messages code in libosmocore, so clarify by naming this osmo_oap_client, and by also renaming the oap_test to oap_client_test. This reshuffling will allow an easy move of OAP to libosmocore if we should want to do that. A number of patches will follow up on this. Related: OS#1592 Change-Id: Id447d2bebc026a375567654adafa5f82439ea7e1
2016-12-13move OAP messages implementations to libosmocoreHarald Welte2-71/+0
This corresponds to change-id If5099e60681a215e798b6675f21813f26769c253 in libosmocore, which is now required to build openbsc. Related: OS#1592 Change-Id: I2f06aaa6eb54eafa860cfed8e72e41d82ff1c4cf
2016-12-13rename gprs_gsup_client.h to gsup_client.hNeels Hofmeyr2-1/+1
This is in preparation for moving gsup to libcommon, which is in turn preparation for libvlr. Related: OS#1592 Change-Id: I9c95d00f1a9420887a44c938b1d0ee3e20586f4c
2016-12-13gprs_gsup_client*: remove the gprs_ prefixNeels Hofmeyr2-21/+22
Make sure everything is named gsup_client_ / GSUP_CLIENT_. Rename static gsup_client_send() to client_send() to avoid clash with public gprs_gsup_client_send() being renamed to gsup_client_send(). This is in preparation for moving gsup to libcommon, which is in turn preparation for libvlr. libvlr and osmo-sgsn will use the same GSUP client code. A number of patches will follow up on this, also for the the OAP client. Related: OS#1592 Change-Id: I57433973b1c4f6cc1e12e7b1c96b5f719f418b51
2016-12-13Revert "Support Deactivate PDP Context Request from network"Neels Hofmeyr1-2/+0
This reverts commit 1611df5226199da2bf2fba3d22d93cc1a6c6c777. This is due to a segfault introduced to the asan build only. See: http://lists.osmocom.org/pipermail/openbsc/2016-December/009966.html Subject: new sanitizer breakage: SIGSEGV in sgsn_create_pdp_ctx() Date: Tue Dec 13 12:08:32 UTC 2016 Change-Id: Ic926c0e6778947b516994822e3a21d4fde25bb02
2016-12-12Support Deactivate PDP Context Request from networkPravin Kumarvel1-0/+2
Enable Deactivate PDP context based on the IMSI of the subscriber. When there are PDP contexts present for a MM context, PDP context will be deactivated along with GMM Detach(MM context deletion). If there are no PDP present, MM context will be deleted to avoid further PDP context request from the MS. Test cases is added to check this functionality. Change-Id: Ia0a41aa2218ec2fda4ea17a37c8cc55cba63dd13
2016-12-09lchan release in error state: SACCH deact only for SACCH pchansNeels Hofmeyr1-0/+1
This is useful particularly in case where we deactivate PDCHs which don't have a SACCH associated. The existin code would always attempt to deactivate a SACCH even in those cases, leading to the BTS responsding with related error messages. Change-Id: Iaf46782329b38ba8f3d438e6c75c2d467b852734
2016-12-02gsm_subscriber_connection: mark BSC specific itemsNeels Hofmeyr1-6/+6
This is intended to prepare for splitting gsm_subscriber_connection into BSC and MSC specific structs, to make the splitting patch more readable. Change-Id: Ib9666225fb9bfec2cf1e364343560571869fe6a7
2016-12-02split subscr_con_allocate()/_free() in bsc_ and msc_Neels Hofmeyr1-2/+5
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 Hofmeyr2-8/+14
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-12-02move to libcommon-cs: network VTY that isn't BSC-specificNeels Hofmeyr1-1/+2
Keep only BSC specific bits of the 'network' VTY node in bsc_vty.c, move more general VTY commands to common_cs_vty.c. Add arg to common_cs_vty_init() to pass a config_write_net() function. Pass a libbsc specific config_write_net() function. Future: upcoming omso-cscn will re-use the VTY bits moved to libcommon-cs and pass a different config_write_net() function. Change-Id: I871b7b32a0c56fdce983e409cf244ec487d24e71
2016-12-02move to libcommon-cs: global vty gsm_network pointerNeels Hofmeyr1-0/+5
Move gsmnet_from_vty() and the bsc_gsmnet global to common_cs_vty.c. Rename bsc_gsmnet to vty_global_gsm_network and make it static to common_cs_vty.c, to clearly mark the global variable for VTY use only. Introduce common_cs_vty_init() to set vty_global_gsm_network. Change-Id: I26c5c47de08f899b896813d09612d5cb2f8e42d6
2016-12-02split bsc_bootstrap_network() in alloc and configNeels Hofmeyr1-1/+2
For patch clarity, keep some code dup to be removed in a subsequent patch. In the same sense don't change the fact that mncc_sock_init()'s return value is ignored. The global gsm_network instance 'bsc_gsmnet' is basically only used by the VTY, and a future patch will "hide" that global in a vty .c file. In a nutshell, I want to - first allocate a gsm_network, - then initialize the VTY passing the gsm_network pointer, - and then read the config file using the initialized VTY. So far, bsc_bootstrap_network() allocates the gsm_network and reads the config file right away, which only works by sharing the extern bsc_gsmnet pointer, which I would like to uncouple. Change-Id: I480a09a31a79766ad07b627dd5238b7e37f3be7a
2016-12-02sms_next_rp_msg_ref(): use direct pointer to next_rp_ref counterNeels Hofmeyr1-1/+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-12-02factor out & introduce struct gsm_encr, in common_cs.hNeels Hofmeyr2-6/+11
Factor out encryption info from struct gsm_lchan as struct gsm_encr, placed in common_cs.h. Change-Id: I94015fb9dd511c37c1e3058a0963c780b3f700ac Future: this will be used by libmsc's subscriber connection, for osmo-cscn.
2016-12-02factor out gen of USSD notify and release complete to libosmocoreNeels Hofmeyr1-2/+7
Both libmsc and libbsc will need distinct gsm0480_send_ussdNotify() and gsm0480_send_releaseComplete() functions, since there will be distinct subscriber connection structs. Rename to msc_send_ussd_notify() and msc_send_ussd_release_complete(), and add the same in libbsc with bsc_ prefix in new file gsm_04_80_utils.c. In preparation of this patch, the message generation part of these functions has been added to libosmocore as gsm0480_create_ussd_notify() and gsm0480_create_ussd_release_complete(). Use these. Adjust all libmsc and libbsc callers according to use the msc_* or bsc_* implementation, respectively. Change-Id: I33a84e3c28576ced91d2ea24103123431f551173
2016-11-24move to libcommon-cs: net init 3: actual moveNeels Hofmeyr1-0/+7
Reincarnate gsm_network_init() as the parts not specific to libbsc. Move from bsc_network_init() those bits that are not BSC specific (and useful for upcoming osmo-cscn). Add libcommon-cs to all linkages that use gsm_network_init(). Note: the only requirement to allow linking gsm_network_init() without libbsc is to keep the call to gsm_net_update_ctype() out of libcommon-cs. The other items are kept out of libcommon-cs because it makes sense semantically. But the separation is not strong in that the BSC specific data members are of course still omnipresent in struct gsm_network. If bsc_network_init() is not called, these are not initialized properly -- for now no users of uninitialized members exist. So this is just a first step towards a sensible split of the BSC and MSC gsm_network structs. The long term aim should be to have entirely separate structs with some common general items. Change-Id: If06316b97002390dc9a434686750cb96193ea63b
2016-11-24move to libcommon-cs: net init 2: move bsc_network_init decl to new .hNeels Hofmeyr4-5/+12
bsc_network_init() is more fit to live in a BSC specific header, move it to new common_bsc.h. It will probably also absorb the BSC-specific part of gsm_network in the future. Adjust header includes across the board. Particularly, fix abis_nm.h by explicitly including gsm_data.h: it so far relied on other headers to do that, which now is no longer always given. Change-Id: I9edfb1e748bb1cb484fadd48b0406f5b3098e89b
2016-11-24move to libcommon-cs: net init 1: rename to bsc_network_initNeels Hofmeyr1-1/+1
The gsm_network_init() function initializes a whole lot of BSC specific stuff. Aiming to move some of it to libcommon-cs, first rename it to bsc_network_init(). This will retain the BSC specific stuff when the move is done. Adjust all callers. Future: osmo-cscn will call the more generic part and not the BSC specific part. Change-Id: I4816ae19374390fc5c64972f7cad2e9ec3d8bcc3
2016-11-24define mncc_recv_cb_t to avoid code dupNeels Hofmeyr3-4/+11
Put mncc_recv_cb_t in common_cs.h to avoid header include complications: if placing right above struct gsm_network, one must include gsm_data.h to use mncc_recv_cb_t as function parameter in a header, which will include gsm_data_shared.h, which will include common_cs.h (future knowledge). Since I will need to use mncc_recv_cb_t in common_cs.h, including gsm_data.h from there would introduce an #include loop. Avoid that and define mncc_recv_cb_t in common_cs.h to begin with. Change-Id: I2e64cffa563750ce9f3172ffba6f9cf5b9280e9c
2016-11-24Add empty libcommon-csNeels Hofmeyr2-0/+2
This will gradually soak up code shared by libbsc and libmsc. Change-Id: If34e2bd38a099d0799238337468d56e0305ab8ae