aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc
AgeCommit message (Collapse)AuthorFilesLines
2017-02-24HACK: Don't require TRX numbers to start at 0Harald Welte2-30/+32
Change-Id: I6c5fcb06bdbe0377e2ebc46ecd73d11e834a6d99
2017-02-24unixsocket: include UNIXSOCKET into sabmAlexander Couzens1-2/+4
Change-Id: If98c037119142cc33b46ab5c1bf02d4cda81c81e
2017-02-23logging fixup: shorter names for LOGGING_FILTER_* and LOGGING_CTX_*Neels Hofmeyr2-5/+5
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 Hofmeyr3-7/+5
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-19Add support for extended SI2q parametersMax1-31/+71
* add vty command to set E-UTRAN_PRIORITY, THRESH_E-UTRAN_low and E-UTRAN_QRXLEVMIN according to 3GPP TS 44.018 Table 10.5.2.33b.1 * remove old command which does not support those parameters Change-Id: I36dcc79f7b7a02036e74720923d0df1a2a2db504 Fixes: RT#8792
2017-02-09Remove duplicating defineMax1-5/+5
Use GSM_MACBLOCK_LEN consistently throughout abis_rsl.c Change-Id: I96aec02748a0be0100dee2117f124ff32d5ee3f5
2017-02-09Expand chan allocation loggingMax3-7/+13
Log more data related to channel allocation: - channel type - number of paging attempts - timers fired Change-Id: Ib417a9c942c17b902dd80ff555cd9da5f91bff48
2017-02-08vty: remove ignored logging parametersMax1-2/+2
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-03om2000: add VTY command to delete CON groupsPhilipp Maier1-0/+26
The currently unused function abis_om2000_vty.c:con_group_del() allows deleting OM 2000 connection groups. This commit adds a matching VTY command to make use of it. Change-Id: I39a90b06e19356c536cacd1c923e195dd305ab80
2017-02-02compiler warning: bsc_vty: remove two unused varsNeels Hofmeyr1-1/+0
Added in recent commit 42def7205ba91df4bbb7e3240be0df8c26c2d63e "Implement VTY configuration to control Early Classmark Sending" Change-Id: Iaf640fa6e1f234f594fb8dc06f716d3d3e95eb2a
2017-02-01OM2000: use assoc_so *only* for TS objectsHarald Welte1-4/+4
all other objects always use the MO instance. The existing code likely is due to copy+paste mistakes. Change-Id: Ie0a31cd93993da10f31eecf530a5a05773c11eb1
2017-01-26Implement VTY configuration to control Early Classmark SendingHarald Welte2-0/+26
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-25CTRL: remove boilerplateMax1-71/+6
Use CTRL_CMD_DEFINE_RO(), CTRL_CMD_DEFINE_WO() and CTRL_CMD_DEFINE_WO_NOVRF() where appropriate to get rid of boilerplate code. Change-Id: I5bcea0b4f4b8f535bef2b423f2013b8b4a218b5b
2017-01-23SI2q: add support for multiple UARFCNsMax2-32/+75
Support multiple UARFCNs with the same Scrambler Code. Fixes: RT#7379 Change-Id: If1c32e8b547a28325180faaaddd21f80c37f7337
2017-01-23Prevent segfault in range encodingMax3-37/+54
* 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-23Improve OML failure reportMax1-6/+14
* clearly separate report parts * use textual representation for failure cause if possible Change-Id: I7a98a77011463021d0edd6ecfab1680e211f7e16 Related: OS#1615
2017-01-23cosmetic: use osmo_strlcpy() everywhereNeels Hofmeyr2-6/+4
Shorten some code and make obvious to the reader that the string copy is done in a safe way. Change-Id: I900726cf06d34128db22a3d3d911ee0d1423b1bd
2017-01-06Cosmetic fixes around SI generationMax3-7/+9
* 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-22bsc_vty: Fix missing break statements in switch()Harald Welte1-0/+2
Change-Id: Ifd48e8d56c845603d320748144b4d7c3c24022a0 Fixes: Coverity CID 135188 Fixes: Coverity CID 135190
2016-12-20Fix some typos in stdout outputRuben Undheim2-3/+3
Change-Id: I0dbb438f3bfbaf9744717cbeec31ceefdd679ee9 Related: OS#1694
2016-12-09channel_mode_from_lchan(): Add missing break statementHarald Welte1-0/+1
GSM48_CMODE_DATA_6k0 was not properly terminated and thus resulted in a bug. Change-Id: I4000f06d0b49c4afb0446beddd150521c4ba3cf0 Fixes: Coverity CID 148207
2016-12-09cfg_bts_si2quater_neigh_add(): Don't call strerror() on negative valueHarald Welte1-1/+1
Change-Id: I1300eede3f22df812b7e83902327ce4cde21aa35 Fixes: Coverity CID 135185
2016-12-09Fix TCH/F_PDCH: no need to check ts subslots for PDCHNeels Hofmeyr1-0/+7
For TCH/F_PDCH in PDCH mode, directly return the lchan to use, in order to switch it to TCH/F. To check the pchan type in chan_alloc.c, make ts_pchan() public in gsm_data_shared.h. Commit c3f72f63afde926dfc46827d6880055597515fb6 broke TCH/F_PDCH, as a fallout of setting the GSM_PCHAN_PDCH subslots number to 0. This is sane and correct, but the chan_alloc code failed to see a ts as available if it has no subslots. Explanation: _lc_find_trx() checks each timeslot. For normal, static TCH timeslots we determine the number of logical subslots contained and check whether one of them is free. For dynamic TS, we can do the same when in TCH mode, but when in PDCH mode, we already know that it is available for immediate switchover for voice and hence can return it right away. TCH/F_TCH/H_PDCH already has a special check for that. TCH/F_PDCH doesn't, but this worked for TCH/F_PDCH as long as ts_subslots() returned 1 for PDCH: the for-loop at the bottom of _lc_find_trx() checked one subslot, which succeeded on an lchan in PDCH mode, since PDCH lchans are always marked type == NONE and state == NONE. Now we more accurately acknowledge that a PDCH timeslot has zero subslots and that a dynamic timeslot in PDCH mode can always be switched to voice immediately, without checking lchan type or state. So, above mentioned commit set PDCH to zero subslots, and the for-loop to check the (zero) subslots never ran and hence never returned the lchan. This fix adds a special condition for TCH/F_PDCH in PDCH mode, same as TCH/F_TCH/H_PDCH. (Todo: ts_pchan() can probably be used in other places as well to remove some code dup. Leaving that for another patch.) Fixes: OS#1868 Change-Id: I5d555d018a5bcb8d948e54059d32ec4c9b3070d0
2016-12-09cosmetic: chan_alloc: use switch instead of if-cascadeNeels Hofmeyr1-9/+12
Preparing cosmetically for a subsequent commit which will add another pchan kind to be checked, rather use a "switch (pchan) {}". Also reverse one if() branch to "early-exit" style. Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc
2016-12-09Replace duplicated code with macro callMax1-10/+10
Use already defined GSM48_LEN2PLEN for computing SI length. Change-Id: I2020417119c844b886f89e34dbfd75e716743dc4
2016-12-09lchan release in error state: SACCH deact only for SACCH pchansNeels Hofmeyr1-1/+15
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-02abis_om2k: fix typo that declared non-existent struct gsm_bts_trx_sNeels Hofmeyr1-1/+1
The typo was recently committed in 80ccb952676cb4a068410991c5d53d19f228f695, "OM2000: Fix missing dynamic TCH initialization" Change-Id: I8e3eec8cf63494962fa31d85a0ec9db9a9e5df46
2016-12-02split subscr_con_allocate()/_free() in bsc_ and msc_Neels Hofmeyr1-6/+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 to libcommon-cs: net timezone VTY configNeels Hofmeyr1-64/+0
Leave the timezone VTY output in libbsc's config_write_net(), until the BSC/MSC separation of struct gsm_network is completed. Change-Id: I9712b2e07b4f1ab8d2e4ad40a8d771e98ed25b20
2016-12-02Move timezone settings up to network levelNeels Hofmeyr1-32/+33
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-02reinvent connection_for_subscr() and move to libmscNeels Hofmeyr1-33/+0
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-12-02bsc vty: rename show_net_cmd to bsc_show_net_cmdNeels Hofmeyr1-2/+2
Future: there will be an MSC-land show-net-cmd, so rename to something with bsc in its name. Change-Id: Ifb86698cd57a09f03b935b6d3fcea87eff4cd397
2016-12-02move to libcommon-cs: network VTY that isn't BSC-specificNeels Hofmeyr1-192/+3
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-17/+3
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-5/+9
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-02factor out gen of USSD notify and release complete to libosmocoreNeels Hofmeyr2-0/+41
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-26bsc_msc.c: Check setsockopt() return valueHarald Welte1-1/+7
Change-Id: I79a8fe9c025772e51560503504f517485b0ace34 Fixes: Coverity CID 57644
2016-11-26abis_nm: ceck fseek() return code in is_last_line()Harald Welte1-1/+3
Change-Id: I8ed4e703625c9da959e0938cd1eb3f0c73a2d4d0 Fixes: Coverity CID 57643
2016-11-26abis_nm: Fix non-null terminated bufferHarald Welte1-0/+1
Unrealistic case (filename of 4096 bytes) Change-Id: Icf7b835f9edaf66976556fce1e9e0f66aa2010bc Fixes: Coverity CID 57620
2016-11-26abis_nm: Fix possible not-null-terminated bufferHarald Welte1-0/+1
Unrealistic case with file name of 4096 bytes length. Change-Id: I503200b879b854cf2dc218d5fe3059a555732d92 Fixes: Coverity CID 57619
2016-11-24move to libcommon-cs: gsm48_create_mm_serv_rej(), gsm48_create_loc_upd_rej()Neels Hofmeyr1-33/+0
Used by libbsc, libmsc as well as osmo-bsc and osmo-bsc_nat. Moving gsm48_create* to libcommon-cs affects linking of osmo-bsc_nat, resulting in undefined references to gsm48_extract_mi() and gsm48_paging_extract_mi(); fix that by placing libfilter.a left of libbsc.a upon linker invocation. Change-Id: I212c2567b56191022b683674c1c4daf842839946
2016-11-24move to libcommon-cs: net init 3: actual moveNeels Hofmeyr1-34/+2
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 Hofmeyr1-1/+1
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 Hofmeyr2-2/+4
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 Hofmeyr2-3/+2
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-16OM2000: Fix missing dynamic TCH initializationHarald Welte1-0/+12
When OM2000 has confirmed that a TS is started, call dyn_ts_init() on the timeslot to start the processing for fully dynamic (osmocom style) TCH/F_TCH/H_PDCH. This should in turn trigger the activation of idle timeslots as PDCH until we want to allocate any of them for TCH/F or TCH/H. Change-Id: I1a1fd61d6afd85449cacad4bacfb830252dab6b1
2016-11-16OM2000: Add three IEs to TCH activation about which we have no clueHarald Welte1-0/+4
Change-Id: Ie3067606033e894c558659ddf0025d01b8198cf9
2016-11-16rsl: support for ericssons propritary SI13 formatPhilipp1-2/+11
Ericsson has introduced a propritary format to issue the S13 BCCH information. Normally the system info type field for SI13 would be encoded as 0x28. Ericsson encodes that field as 0x02 and ads a bcch mapping parameter, (IEI=F2) This patch sets the BCCH mapping to 0x00 (=BCCH Normal) statically (0xF200) The new constands are added to libosmocore, see commit: f0f9c8c29daaefbf9cff19177ade4a13ffb2e36c Change-Id: Ie0900f9b810744172b3090ce1b0ef7b7a1132946
2016-11-16OM2000: Fixup based on Coverity Scan suggestionPhilipp1-2/+2
This commit fixes Coverity Scan defect: CID 151901: Insecure data handling (TAINTED_SCALAR) Passing tainted variable "tag_len" to a tainted sink. Change-Id: Ic71ed6a3bbb228bc03e95bfc4a6f5fe09cf5a021
2016-11-16rbs2000: Add missing bts feature definitionsPhilipp1-0/+2
function bts_model_rbs2k_start() in bts_ericsson_rbs2000.c lacks the feature definition for GPRS and EGPRS. Change-Id: I777a67862084aa6cca39cfc43f5708e47608b0e6