aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/osmo-nitb
AgeCommit message (Collapse)AuthorFilesLines
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-08-18NITB: remove 'help' output about '-a' option that is removed for agesHarald Welte1-2/+0
This option was present in very early versions of the NITB, but at least since 2011 it is no longer supported. It's still listed in --help output, which is wrong. Change-Id: I1d2cceb588ec5fb34ec5e2c05a7d8c93310bee88
2017-05-10src: use osmo_timer_setup()Pablo Neira Ayuso1-4/+3
Use new function available in libosmocore to set up timers. Compile tested only. Change-Id: Ibcfd915688e97d370a888888a83a7c95cbe16819
2017-04-03VTY: add the dyn_ts_allow_tch_f optionVadim Yanitskiy1-13/+14
This option allows to enable or disable TCH/F allocation on the TCH/F_TCH/H_PDCH timeslots. Until now, source code modification was required to enable this feature. Related: OS#1778 Change-Id: Id18cab25844dc854a66b4e2713e90c3f43afa712
2017-02-24cosmetic: rename osmo_msc_data.h to bsc_msc_data.hNeels Hofmeyr1-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-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-31fix 'osmo-nitb --version' segfaultNeels Hofmeyr1-1/+1
Call vty_init() before handle_options() to make sure the host.app_info is populated before --version potentially tries to print it. The segfault was introduced by 2c05f75bbf3d9a69eee1fe78eb5552acf1d7671d in a recent MSC-split merge. Change-Id: Ice91256d72b9eabd52709352ba6cc6a42af2921b
2016-12-21build: remove obsolete $LIBCRYPT in two placesNeels Hofmeyr1-1/+0
It should be $LIBCRYPTO_LIBS if at all. Change-Id: I191dfe0901a10a25dffa3bbfdb9ea319fcebe254
2016-12-21build: osmo-nitb: fix missing LIBCRYPTO_FLAGSNeels Hofmeyr1-0/+1
Change-Id: I6268d0b8782ee03b42ab8bbda7aa9650c26e11ad
2016-12-02osmo-nitb: exit when MNCC socket init failedNeels Hofmeyr1-3/+7
Change-Id: Icef97bb5da9840b810fe6f4b4da6abd4baa66915
2016-12-02global gsm_network: move allocation further upNeels Hofmeyr1-18/+17
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-5/+16
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-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-11-01Cosmetic: Add missing switch to usage helpPhilipp1-0/+1
Adds the -p --pcap option to the help text. Change-Id: I3e763c30ca13bc51c8b72af8a94558c92439f109
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-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: talloc_ctx_init(): decouple from global tall_bsc_ctxNeels Hofmeyr1-3/+1
Decouple the talloc context allocations from global tall_bsc_ctx pointer. It appears that talloc_ctx_init() was intended for general use, since it is located in libcommon. It is currently used only by osmo-nitb; but the upcoming osmo-cscn will use it as well. Instead of defining in osmo-nitb main file, add definition in gsm_data.h. Change-Id: I168106599b788f586be0ff0af4699b9746c1b103
2016-09-15Consistenly format variables in */Makefile.am filesAlexander Huemer1-14/+40
Change-Id: Ifa21513c007072314097b7bec188579972dc1694
2016-08-31osmo-nitb: generate backtrace on SIGABRTHarald Welte1-0/+1
As the NITB has an internal SIGABRT handler that prints a talloc report, let's also print a stack backtrace at the same point. Change-Id: Ia63aa5c39b26e27c3ee220d755c17d2c1ef636c5
2016-07-28dyn TS: OS#1778 workaround: disable TCH/F on dyn TS for nitbNeels Hofmeyr1-0/+13
To avoid two phones picking mismatching TCH pchans, never pick TCH/F on dynamic TS in osmo-nitb. Add gsm_network flag dyn_ts_allow_tch_f, set to true by default in gsm_network_init(). Set this flag to false in osmo-nitb's main(). See http://osmocom.org/issues/1778 Reasoning about ways to solve this: * a compile time switch doesn't work because libbsc is first compiled and then linked to both osmo-nitb and osmo-bsc. * we could test net->bsc_api == msc_bsc_api(), but I have the so-called MSC split waiting on branch sysmocom/cscn, which will result in msc_bsc_api() not being linked in the osmo-bsc binary. * have a function am_i_nitb() with different implementations in osmo-nitb and osmo-bsc, but then we'd need to add implementations to all tests and other binaries linking lchan_alloc(). * have a flag in struct bsc_api, but so far there are only function pointers there. Having a "global" flag in gsm_network allows to add a VTY command in case we decide to keep this feature (#1781), has no linking implications and is nicely explicit. Tested that osmo-bsc still picks TCH/F on dyn TS indirectly, since I have no standalone MSC available: when compiling osmo-nitb with the line that sets dyn_ts_allow_tch_f = false commented out, TCH/F is picked as described in OS#1778; and by printf-verifying that dyn_ts_allow_tch_f == true in osmo-bsc main(), only osmo-nitb should have TCH/F disabled. Related: OS#1778, OS#1781 Change-Id: If7e4797a72815fc6e2bbef27756ea5df69f4bde7
2016-05-21drop unneccessary duplicate linking: osmo-nitbNeels Hofmeyr1-1/+0
Change-Id: I430adbb1e0c6382317da282bcf5ef73cf9496f80 Reviewed-on: https://gerrit.osmocom.org/89 Tested-by: Jenkins Builder Reviewed-by: Holger Freyther <holger@freyther.de>
2016-04-22Add extra debug output with channel mode and typeMax1-1/+3
This provides helpful information for debugging internal MNCC handler.
2016-02-25smpp: refactor initialization, add bind addressNeels Hofmeyr1-2/+2
Make the SMPP bind address configurable (used to be harcoded as "0.0.0.0"). Add VTY command smpp local-tcp A.B.C.D <1-65535> while keeping the old command 'local-tcp-port <1-65535>'. Both the old and the new command immediately change the SMPP listening address and port. Add a LOGL_NOTICE log when the SMPP listening address and/or port change. However, to be useful, this patch has to go somewhat further: refactor the initialization procedure, because it was impossible to run the VTY commands without an already established connection. The SMPP initialization procedure was weird. It would first open a connection on the default port, and a subsequent VTY port reconfiguration while reading the config file would try to re-establish a connection on a different port. If that failed, smpp would switch back to the default port instead of failing the program launch as the user would expect. If anything else ran on port 2775, SMPP would thus refuse to launch despite the config file having a different port: the first bind would always happen on 0.0.0.0:2775. Change that. In the VTY commands, merely store address and port if no fd is established yet. Introduce several SMPP initialization stages: * allocate struct and initialize pointers, * then read config file without immediately starting to listen, * and once the main program is ready, start listening. After that, the VTY command behaves as before: try to re-establish the old connection if the newly supplied address and port don't work out. I'm not actually sure why this switch-back behavior is needed, but fair enough. In detail, replace the function smpp_smsc_init() with the various steps smpp_smsc_alloc_init() -- prepare struct for VTY commands smpp_smsc_conf() -- set addr an port only, for reading the config file smpp_smsc_start() -- establish a first connection, for main() smpp_smsc_restart() -- switch running connection, for telnet VTY smpp_smsc_stop() -- tear down connection, used by _start() twice And replace smpp_openbsc_init() smpp_openbsc_set_net() with smpp_openbsc_alloc_init() smpp_openbsc_start() I'd have picked function names like "_bind"/"_unbind", but in the SMPP protocol there is also a bind/unbind process, so instead I chose the names "_start", "_restart" and "_stop". The smsc struct used to be talloc'd outside of smpp_smsc_init(). Since the smsc code internally uses talloc anyway and employs the smsc struct as talloc context, I decided to enforce talloc allocation within smpp_smsc_alloc_init(). Be stricter about osmo_signal_register_handler() return codes.
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-25osmo-nitb: be strict about cmdline argsNeels Hofmeyr1-1/+3
Abort upon unknown options and missing option arguments. This came to my attention while rewiring the -m and -M options: passing -M without argument would launch nitb with wrong configuration. So, rather exit immediately. If there are legacy options that should be ignored, they deserve an own 'case:' in the option switch. There are none that I'm aware of though.
2016-02-25osmo-nitb: cosmetic: rename to rf_ctrl_path, following mncc_sock_pathNeels Hofmeyr1-4/+4
Strictly speaking, the unix domain socket location is not a name but a path. The MNCC socket is called path, so it is confusing to call the ctrl socket a 'name'.
2016-02-25osmo-nitb: add -M to pass specific MNCC socket pathNeels Hofmeyr1-6/+11
The old -m option without argument is still available and marked deprecated, to not make users' lives more difficult than necessary.
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-12libmsc: Use RAND_bytes when choosing a tmsiDaniel Willmann1-1/+1
Require openssl version to be >= 0.9.5 because we rely on the RAND_bytes return value. [hfreyther: Add cast to uint8_t*]
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-09-15osmo-nitb: obsess about --help formatting.Neels Hofmeyr1-13/+13
Make every line use same punctuation style ('.' at the end and start in caps). Insert spaces to have all help texts in a column.
2015-01-01Fix most compiler warnings with gcc-4.9.2Harald Welte1-0/+1
2014-12-05msc: Add and use gsm_subscriber_groupJacob Erlbeck1-1/+1
Currently every subcriber object directly refers to the gsm_network which contains a flag shared by every related subscriber (keep_subscr). This adds a dependency on gsm_network even if only the function defined in gsm_subscriber_base.c are used. This patch adds a new struct gsm_subscriber_group which contains the keep_subscr flag and a back reference to the network object. The latter is not dereferenced in gsm_subscriber_base.c, so it can safely be set to NULL when only that part of the gsm_subscriber API is being used. It also changes that API to use gsm_subscriber_group instead of gsm_network parameters. Since there are some places where a pointer to the gsm_network is needed but where only a gsm_subscriber is available, a 'net' back pointer is added to the group struct, too. Nevertheless subscr group and network could be separated completely, but this is not the topic of this commit. Sponsored-by: On-Waves ehf
2014-09-16nitb: Don't mention the broken PCAP generation optionHolger Hans Peter Freyther1-1/+0
The PCAP option doesn't seem to work for TCP/IP based BTS. Don't mention it to not confuse people that search for a way.
2014-08-24Use port number #defines for VTY and CTRL portsHarald Welte1-1/+2
.. as defined in libosmocore
2014-08-21move libctrl from openbsc to libosmoctrl (libosmocore.git)Harald Welte2-4/+4
2014-05-22bsc_hack: Don't strdup the string argumentsDaniel Willmann1-2/+2
Fixes CIDs #1206577, #1206578
2014-03-23ctrl: Move the lookup into a separate file in preparation for GPRSHolger Hans Peter Freyther1-1/+1
For GPRS the look-up via bts/trx does not make any sense and would introduce bad depdencies for the SGSN. Move the look-up code to a new file and introduce new setup methods.
2014-03-23nitb/ctrl: Add command to add/modify a subscriber to the databaseHolger Hans Peter Freyther1-1/+6
The test has been manually verified. Executing the select for the subscribers showed: sqlite> select * from Subscriber; 1|2014-03-23 12:12:46|2014-03-23 12:19:09|2620345||445567|1||0| This created a subscriber with the right IMSI, MSISDN and has it authorized. Fixes: SYS#275
2014-03-06nitb: Add a test for "show network" in the python testsuite.Ciaby1-3/+3
Make sure that bsc_gsmnet->bsc_data->rf_ctrl is initialized for NITB. In commit a9fae1ae66df57f76a0aedbd0b56228959d37d56 the conditions for the rf_ctrl was removed but it was still needed for the NITB. Fixes regression from: a9fae1ae66df57f76a0aedbd0b56228959d37d56 bsc: rf_ctrl will always be created, remove the NULL checks
2014-03-04libbsc: Add ctrl command for MNC, MCC, short-name and long-nameHolger Hans Peter Freyther1-0/+5
Add the framework for adding more setting commands.
2014-02-08libbsc: Create the RF interface all the timeHolger Hans Peter Freyther1-6/+4
The interface can be accessed through CTRL and a socket. But currently it is only available when the socket interface has been configured. Create the interface all the time but only listen on the socket when a path has been specified.
2013-12-13build: osmo-nitb does not use dlopen/dlsym remove LIBRARY_DLHolger Hans Peter Freyther1-1/+1
osmo-nitb does not use dlopen/dlsym so we can remove the depedency to LIBRARY_DL.
2013-12-13freebsd: dlopen/dlsym/dlerror is part of libc, use LIBRARY_DL for linkingNikola1-1/+1
In FreeBSD there is no spearate library for dlopen, dlsym and dlerror. Use LIBRARY_DL to check for this condition.
2013-11-27osmo-nitb: don't print 'bac_hack' in usage/help outputHarald Welte1-1/+1
2013-06-12Makefile.am: Use AM_CPPFLAGSAlexander Huemer1-1/+1
Since automake 1.13 INCLUDES is depricates and causes a warning
2013-03-13Fix osmo-nitb build without libsmppHarald Welte1-0/+2
2013-03-13SMPP: Fix crash on delivery of incoming SUBMIT-SMHarald Welte1-1/+2
As bsc_gsmnet is NULL at the time we call smpp_openbsc_init(), we later run into segfaults with subscribers that don't have a subscr->net set. However, we cannot delay smpp_openbsc_init() until after bsc_bootstrap_network(), as we then fail to parse the SMPP specific VTY/config file options...
2013-01-01osmo-nitb: Add a timer to regularly expireJan Luebbe1-0/+12
2012-11-24SMPP: VTY configuration of SMPP code, authentication supportHarald Welte1-4/+6