path: root/openbsc/src/osmo-bsc
AgeCommit message (Collapse)AuthorFilesLines
2018-03-22backport support for 3-digit MNC with leading zerosneels/mnc3Neels Hofmeyr5-59/+47
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-11-11osmo-bsc-sccplite: Implement incoming RESET procedureHarald Welte2-1/+34
In osmo-bsc-sccplite we so far didn't implement the inbound RESET procedure. We instead ignored any RESET message from the MSC. This commit adds support for RESET: We will destrpy any SCCP connections and acknowledge the RESET to the MSC. As osmo-msc is requiring the BSC to handle an inbound RESET procedure, this commit allows osmo-msc to properly initialize the A interface towards osmo-bsc-sccplite via a translating/routing osmo-stp. While we don't anticipate any new deployments of osmo-bsc-sccplite, making it interoperate with osmo-msc enables us to do more testing of osmo-bsc-sccplite. Change-Id: Iceb8278deb36d6103662a704f489ba0d685e04d3
2017-11-11osmo-bsc: Print NOTICE message on unimplemented BSSMAP UDTHarald Welte1-0/+4
When we receive unimplemented/unhandled message types, we shouldn't simply silently discard them, but print a log message for the benefit of the user. Change-Id: I8ecb1d2134f9c6a96f29e145fa0430880e971168
2017-11-01vty: skip installing cmds now always installed by defaultNeels Hofmeyr1-2/+0
vty_install_default() and install_default() will soon be deprecated. Depends: I5021c64a787b63314e0f2f1cba0b8fc7bff4f09b Change-Id: I4951982fc78ae167d8e16a672d7af44d703721a9
2017-10-26rename osmo-bsc to osmo-bsc-sccpliteHarald Welte2-4/+4
This is to avoid naming conflicts with the new osmo-bsc, which resides in its own git repository (osmo-bsc.git) and which uses libosmo-sigtran and implements (primarily) 3GPP AoIP. Change-Id: If10d1599b62d010726336134091a4e855c380d93
2017-10-26osmo-bsc: Initialize logging before initializing rate_ctrHarald Welte1-3/+3
The library code for rate counter initialization, which is called from the descendants of bsc_network_alloc() might already want to log something (particularly after Change-Id Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56 in libosmocore), so the logging framework must be initialized before. Change-Id: I1e893c97e023e63489fe8c46539b5e507d3cec8f
2017-09-23CTRL: cleanup write-only command functionsMax1-31/+3
Remove trivial functions by using more specific defines for CTRL commands. Change-Id: I719b75b6ca1e9372ea11e7e9ff7896021f357035
2017-08-20Treat SIGTERM just like SIGINT in our programsHarald Welte1-0/+2
When somebody kills the process, it's best to handle the signal and to use the opportunity for some cleanup. We always did this in the NITB on SIGINT, but never on SIGTERM. Let's change it. Change-Id: Iea6804325a6575ceab5edfd28dd20249462f143b
2017-06-22Enable optional static buildsMax1-1/+0
* use LT_INIT instead of AC_PROG_RANLIB * remove redundant libbsc entries The default (for both manual and .deb builds) is to use shared build (as before) - the static build is entirely optional. Based on work by Sergey Kostanbaev <> and Alexander Chemeris <>. Change-Id: Ibcd1da98302413182c85e25c4cb7d69d9e38c35a
2017-06-09don't re-implement osmo_talloc_replace_string()Harald Welte2-10/+10
osmo_talloc_replace_string() was introducd into libosmocore in 2014, see commit f3c7e85d05f7b2b7bf093162b776f71b2bc6420d There's no reason for us to re-implement this as bsc_replace_string here. Change-Id: I6d2fcaabbc74730f6f491a2b2d5c784ccafc6602
2017-05-10src: use osmo_timer_setup()Pablo Neira Ayuso2-8/+4
Use new function available in libosmocore to set up timers. Compile tested only. Change-Id: Ibcfd915688e97d370a888888a83a7c95cbe16819
2017-03-08add struct bsc_subscr, separating libbsc from gsm_subscriberNeels Hofmeyr4-34/+39
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-02-24cosmetic: rename struct osmo_msc_data to bsc_msc_dataNeels Hofmeyr9-92/+92
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 Hofmeyr10-10/+10
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-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
2016-12-20Fix some typos in stdout outputRuben Undheim1-1/+1
Change-Id: I0dbb438f3bfbaf9744717cbeec31ceefdd679ee9 Related: OS#1694
2016-12-09bsc_ctrl: Ensure we don't pass NULL string into strtok_r()Harald Welte1-0/+1
Change-Id: I03bea132377c0136b55b6fdad99a5d92da12e692 Fixes: Coverity CID 135180
2016-12-02split subscr_con_allocate()/_free() in bsc_ and msc_Neels Hofmeyr3-4/+4
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-30/+24
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-02global gsm_network: move allocation further upNeels Hofmeyr1-5/+8
Now that bsc_network_alloc() is separate, move it to before the VTY init (a subsequent patch will pass the gsm_network instance as a parameter to vty_init()). bsc_hack.c: drop the comment that says about the VTY init: "This needs to precede handle_options()" -- it is not accurate. Actually move the handle_options() above both vty_init() and the bsc_network_alloc() calls, to be able to decide which mncc callback to pass to bsc_network_alloc. It would make sense to set this later on, but that would require further refactoring of the bsc_network_init() and gsm_network_init() signatures, so not in this patch. Change-Id: Ie6a7037e703b5a2d08ceeb20d35f197aaddc9d1b
2016-12-02split bsc_bootstrap_network() in alloc and configNeels Hofmeyr1-2/+6
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 Hofmeyr5-10/+10
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/+1
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-10-13msgb talloc ctx: initialize in all main() scopesNeels Hofmeyr1-0/+1
Add msgb_talloc_ctx_init() call to many main() functions still lacking a msgb talloc context. Change-Id: Ib0d6751260659cabf18a7ce80680ba2fb4228ea1
2016-09-30log CTRL bind only onceNeels Hofmeyr1-2/+0
After libosmocore 38d232ee5d2ceb045d9ad6d3a23afcb4972523f7 which outputs 'CTRL at <ip> <port>' from ctrl_interface_setup_dynip(), there's no need to log the CTRL bind here anymore. Change-Id: I1a874efe365a1ecf8ec37b058215b95b9a635ec2
2016-09-28COSMETIC: 'if' is not a function, so there is space before '('Harald Welte1-1/+1
Change-Id: Ic22623dffce998d70a3c67aa6e445de98f558ed7
2016-09-26mscsplit: bsc_vty_init(): decouple from global bsc_gsmnetNeels Hofmeyr1-1/+1
Add an explicit gsm_network pointer instead of using the bsc_gsmnet global. This allows passing a gsm_network struct from the main() scope, which helps to decouple libmsc from libbsc. Change-Id: I9e2c0d9c18d4cebb5efb71565ad84df2bc2e0251
2016-09-26mscsplit: move subscriber conns list into struct gsm_networkNeels Hofmeyr1-1/+1
Replace the global sub_connections llist with gsm_network.subscr_conns. Initialize and apply where applicable. Remove bsc_api_sub_connections(), callers now access gsm_network->subscr_conns directly. This allows using the subscr_conns from libmsc without having to link libbsc. Change-Id: Ice2a7ca04910bcfaaff22539abe68a6349e8631c
2016-09-15Consistenly format variables in */ filesAlexander Huemer1-16/+50
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-05-21drop unneccessary duplicate linking: osmo-bscNeels Hofmeyr1-1/+0
Change-Id: Ia227abcaa7b1f808646aadb9f53ee2a669699c51 Reviewed-on: Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <>
2016-03-27osmo-bsc: fix compiler warning: store struct in vty->indexNeels Hofmeyr1-2/+2
Don't store an MSC index number in the vty->index void* value. Instead, store the osmo_msc_data struct directly. Thus avoid warnings about differences in int vs void* sizes, and save some index lookups.
2016-03-15bsc_scan_msc_msg: check protocol discriminatorNeels Hofmeyr1-0/+5
The function assumed an MM protocol discriminator without verifying it.
2016-03-1504.08: apply new bitmask functions, fix bitmask useNeels Hofmeyr2-9/+9
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-02-29minor commentNeels Hofmeyr1-0/+1
2016-02-29osmo_bsc_filter.c: add fixme noteNeels Hofmeyr1-0/+3
2016-02-25enable ctrl bind config for various programsNeels Hofmeyr1-1/+9
Add ctrl_vty_init() calls and feed the ctrl_vty_get_bind_addr() return value to ctrl_interface_setup() in the following programs: osmo-bsc osmo-bsc_nat osmo-nitb osmo-sgsn For osmo-sgsn, move the control interface setup invocation below the config parsing, so that the ctrl_vty_get_bind_addr() can return the configured address.
2016-02-24osmo-bsc: fix checking wrong pointer for ctrl setup successNeels Hofmeyr1-1/+1
2016-01-30gsm0408: Provide unique strings for the gsm 04.08 messageHolger Hans Peter Freyther1-1/+1
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.
2016-01-15bsc/vty: Provide a hint of available inputHolger Hans Peter Freyther1-1/+1
2015-11-02stats: Enable stats for sgsn, gbproxy, nitb, bsc, natJacob Erlbeck1-0/+2
This commit initialises and enables the stats subsystem for the given binaries. Sponsored-by: On-Waves ehf
2015-10-02amr: Attempt to unbreak the AMR support in the BSCHolger Hans Peter Freyther1-11/+25
The signature of mr_config and the BSC implementation didn't match and the compiler was warning about it: osmo_bsc_api.c:530:2: warning: initialization from incompatible pointer type .mr_config = bsc_mr_config, ^ osmo_bsc_api.c:530:2: warning: (near initialization for ‘bsc_handler.mr_config’) Change the mr_config again and provide an implementation that will set the ms and bts data structure. It would be better to put the size outside of the IE but I am not going to change it right now. It would also be nice to either move the AMR setting into the "nitb" structure or have the msc data be used _after_ the bts settings. This needs to be cleaned up in the next step. Manually verified by placing a MO call and checking that both the channel mode modify and the mode modify request contain the multi rate config with the rate mr config (length two bytes, version 1, icmi==1, no start mode being set).
2015-09-24vty: Change the return type from enum to intHolger Hans Peter Freyther1-1/+1
clang complained that different enums are mixed with the return type and we actually want this to be an int now.
2015-08-18GSM/GPRS 04.08: Don't print numeric mobile identity typesHarald Welte1-2/+2
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-07-13bsc: Rename core_ncc to core_mncHolger Hans Peter Freyther4-8/+8
Struct osmo_msc_data contains int core_ncc, which is actually the MNC part of the PLMN, not to be confused with the Network Colour Code. The following patch renames this field for clarity and consistency with the standards.
2015-07-01bsc: Check for the rand and then generate a resHolger Hans Peter Freyther2-4/+83
Check if the NAT has sent 16 bytes of RAND and if a key has been configured in the system and then generate a result using milenage. The milenage res will be sent and noth the four byte GSM SRES derivation.
2015-07-01bsc/nat: Fix the structure of the identity request messageHolger Hans Peter Freyther1-1/+1
Unfortunately the basic structure of the response is broken. There is a two byte length followed by data. The concept of a 'tag' happens to be the first byte of the data. This means we want to write strlen of the token, then we want to write the NUL and then we need to account for the tag in front. Introduce a flag if the new or old format should be used. This will allow to have new BSCs talk to old NATs without an additional change. In the long run we can clean that up.
2015-06-19Fix build wrt. missing CFLAGS constituentsAndreas Rottmann1-1/+1
When libosmo-netif and/or libosmo-abis are installed in distinct prefixes, the build failed with non-found headers.
2015-06-15bsc: Attempt to fix crash when sending a SCCP CREF messageHolger Hans Peter Freyther1-1/+1
There was no context for the SCCP CREF message and this means that the msc_con was a plain NULL pointer that was dereferenced and the application would crash. Use the new API to pass the incoming MSC Connection which sould be used for the SCCP CREF message as context. The code has not been fed with an actual SCCP CR message.
2015-05-17Replace ad-hoc function with generic one from libosmocoreMax1-12/+2
Signed-off-by: Max <>
2015-05-03bsc: Send a LU Reject in case it has been filteredHolger Hans Peter Freyther1-8/+42
In case we filter the request and it was a Location Updating Procedure we should reject it.