aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2015-12-21logging: Remember the target we foundsysmocom/shared/log-speedHolger Hans Peter Freyther3-29/+48
log_check_level and osmo_vlogp share the responsibility for the output of a log message. Once check_level has identified the first target that might have an output osmo_vlogp will continue from this place. In practice we have one (stderr/syslog) or two (stderr+VTY) log outputs so avoiding to re-iterate is not that important but as we have found the right place we can just use it.
2015-12-21logging: Remove some code duplicationHolger Hans Peter Freyther1-37/+37
Extract the mapping of the subsystem number and the checking for the loglevel to a inline method that is shared between the new and old.
2015-12-21log/test: Extend test case for log_check_levelJacob Erlbeck2-1/+11
This commit adds OSMO_ASSERTs for mandatory conditions related to log_check_level, and fprintfs for optional conditions, since it is always safe for log_check_level to return != 0. Sponsored-by: On-Waves ehf
2015-12-21log: Add conditional logging based on log_check_levelJacob Erlbeck1-4/+20
Currently the LOGP/DEBUGP arguments are always evaluated even if no logging will happen at all. This can be expensive, for instance if hexdumps or pretty printed object names are generated. This causes high base load especially on embedded devices and is a major part of CPU usage e.g. of the osmo-pcu. This commit uses the log_check_level function to avoid the evaluation of the parameters if it is known in advance, that no logging entry will be generated. Sponsored-by: On-Waves ehf
2015-12-21log: Add log_check_level functionJacob Erlbeck2-0/+40
This commit adds this predicate function which can be used to avoid the execution of code if a certain log level is not enabled. The function will only return 0 (false), if it is sure that a logging call for the same facility and level will not produce any output. This safety criterion shall ensure, that no logging output is lost due to the use of this predicate as a guard. On the other hand, even if the predicate returns != 0 (true), no logging output might get generated by a similar logging command. Note that the current implementation is not focussed on performance, which could be improved by using a lookup table instead of iterating through every target. Sponsored-by: On-Waves ehf
2015-12-21some comments / fixed typosNeels Hofmeyr5-3/+7
2015-12-19LaPDm: Refuse SUSPEND/RESUME/RECONNECT in BTS modeHarald Welte1-0/+17
The primitives for SUSPEND, RESUME and RECONNECT are only permitted on the MS side of the LAPDm link, not on the BTS side. So we should check for this and reject, accordingly.
2015-12-17ns: Force a defined state when sending NS RESETJacob Erlbeck3-0/+108
Currently the state is assumed to remain the same while the reset procedure is active. While this works correctly in general, a single unexpected BLOCK_ACK or UNBLOCK_ACK can change the state but will not stop the reset procedure. The leads to repeated RESET messages, where the corresponding RESET_ACK is ignored. This is a stable state which can only be left by manual intervention or by reception of a RESET message from the peer. This commit changes the RESET timeout handler to set the state to BLOCKED/RESET when sending the new NS RESET message. Note that this should ensure a clean restart even if the state has been screwed up. It does not fix the handling of BLOCK_ACK or UNBLOCK_ACK in abnormal cases. Addresses: gprs_ns.c:349 NSEI=8895 Tx NS RESET (NSVCI=8895, cause=O&M intervention) gprs_ns.c:878 NSVCI=8895 Rx NS RESET ACK (NSEI=8895, NSVCI=8895) gprs_ns.c:887 NS RESET ACK Discarding unexpected message for NS-VCI 8895 from SGSN NSEI=8895 Ticket: OW#1551 Sponsored-by: On-Waves ehf
2015-12-17stats: Fix compiler warning about losing constHolger Hans Peter Freyther1-1/+1
stats_statsd.c: In function ‘osmo_stats_reporter_statsd_send_item’: stats_statsd.c:154:15: warning: initialization discards ‘const’ qualifier from pointer target type char *unit = desc->unit; ^
2015-12-17ns/stats: Add missing osmo_stat_item_group_free to gprs_nsvc_deleteJacob Erlbeck1-0/+1
The stat item group is not removed by gprs_nsvc_delete which will corrupt the group list. Addresses: valgrind tests/gbproxy/gbproxy_test [...] ==4541== Invalid write of size 4 ==4541== at 0x4071ACA: __llist_add (linuxlist.h:65) ==4541== by 0x4071ACA: llist_add (linuxlist.h:81) ==4541== by 0x4071ACA: osmo_stat_item_group_alloc (stat_item.c:112) ==4541== by 0x407EDFD: gprs_nsvc_create (gprs_ns.c:244) ==4541== by 0x408109D: gprs_ns_instantiate (gprs_ns.c:1388) ==4541== by 0x804CFD3: test_gbproxy_ident_changes (gbproxy_test.c:1501) ==4541== by 0x805FBD3: main (gbproxy_test.c:5803) Sponsored-by: On-Waves ehf
2015-12-14talloc: Depend on libtalloc-dev being present as wellHolger Hans Peter Freyther1-1/+1
2015-12-13RSL: Add enum + TLV definitions for ip.access style embedded IEsHarald Welte4-0/+58
2015-12-10talloc: Untested change to unbreak buildHolger Hans Peter Freyther1-1/+1
In case talloc is not installed in the default search path we need to place @TALLOC_CFLAGS@ into the include directory as well.
2015-12-09gsm_03_41: Fix structure definitions for big-endian machinesRuben Undheim1-0/+31
this was detected by debian packaging, as the associated gsm_03_41 test case fails on big endian machines like ppc.
2015-12-08update debian packaging from libosmocore6 to libosmocore7Harald Welte2-2/+2
2015-12-08utils: add TALLOC_CFLAGS to buildHarald Welte1-1/+1
this is an attempt to fix the FreeBSD build
2015-12-08stats: Add OSMO prefix to STAT_ITEM_NOVALUE_IDJacob Erlbeck2-4/+4
This symbol is globally visible and therefore should have an OSMO prefix like the other identifiers exported by stat_item.h. Sponsored-by: On-Waves ehf
2015-12-08stat: Explicitly support stat_items without unitJacob Erlbeck3-2/+16
Add OSMO_STAT_ITEM_NO_UNIT for stat items without an unit. The statsd reporter uses gauges ("g") to report them. Sponsored-by: On-Waves ehf
2015-12-05remove our internal copy of talloc, use system libtallocHarald Welte17-2089/+28
Shipping our own private copy of talloc was a good idea in 2008, when it was not readily available on most target platforms. Today, the situation is quite different, as it is a standard library on major Linux distributions.
2015-11-26stats: Add TODO comment to rate_ctrJacob Erlbeck1-0/+3
Currently the counters are scanned twice, once for interval computation and once for reporting. This adds a reminder to move the interval computation code to a special stats reporter which just shall update the fields. Sponsored-by: On-Waves ehf
2015-11-26stats/test: Add memory leak checkJacob Erlbeck1-4/+9
Adds a rudimentary leak check for the counters and stat items. Sponsored-by: On-Waves ehf
2015-11-26stats/test: Add test for reportingJacob Erlbeck2-17/+369
This tests uses a dedicated test reported to check several aspects of the value reporting. - addition/removal of stats reporter - addition/removal of counters/items - setting of max_class - initial value flush - updating single counters/items - reporter retrieval - enable/disable Sponsored-by: On-Waves ehf
2015-11-26stats: Reorder functions in stats.cJacob Erlbeck1-59/+61
Due to prior refactoring, the functions do not have an sensible order in the file. This commit tries to improve that a little bit. Sponsored-by: On-Waves ehf
2015-11-26stats: Move statsd related code into a separate fileJacob Erlbeck4-144/+180
This commit moves the stats specific code parts into stats_statsd.c while keeping the generic parts in stats.c. The code in stats.c no longer contains references to statsd symbols. Note that the VTY code still needs to know about every stats reporter backend. Sponsored-by: On-Waves ehf
2015-11-21configure: It should be --with-system-talloc, not --enable-system-tallocHarald Welte1-8/+8
As we are making a decision whether we should use an existing system library, we call it --with-system-talloc, rather than --enable-system-talloc.
2015-11-21configure.ac: Use AS_IF() instead of shell-if for PKG_CONFIGHarald Welte1-4/+4
https://autotools.io/pkgconfig/pkg_check_modules.html > If you have the first call to PKG_CHECK_MODULES inside a bash > conditional block, the expansion of PKG_PROG_PKG_CONFIG will also be > conditional > You can solve this problem in two ways; you can either explicitly call > PKG_PROG_PKG_CONFIG outside of any conditional, forcing checking for > pkg-config as soon as possible; or you can rewrite your conditionals > to use the proper syntax
2015-11-21use system-wide libtalloc with --enable-system-tallocHarald Welte4-3/+59
This introduces a new configure flag by which the libosmocore-internal talloc code is not compiled, but rather a system-wide libtalloc is used. When we started openbsc/libosmocore in 2008, libtalloc was not widely present on systems yet. This has changed meanwhile, and we should simply use the system-wide library
2015-11-20stat_item.c: Fix compiler warningsHarald Welte1-2/+2
CC stat_item.lo stat_item.c: In function 'osmo_stat_item_group_alloc': stat_item.c:84:28: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] group->items[item_idx] = (void *)items_size; ^ stat_item.c:98:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] ((uint8_t *)items + (int)group->items[item_idx]); ^
2015-11-12vty: Don't call exit() but rather use OSMO_ASSERT()Harald Welte1-15/+4
This was pointed out by Jaroslav Skarvada during fedora packaging, and he has a valid point...
2015-11-12fix FSF address in sources/headersJaroslav Škarvada9-15/+18
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
2015-11-09debian: Make a new minor release0.9.3Holger Hans Peter Freyther1-0/+8
2015-11-09stats: Fix not reported stat item valuesJacob Erlbeck1-1/+3
Currently the global stat item index is being advanced in osmo_stat_item_group_handler, so that the second and further groups in the list will skip new item values. This commit moves the call to osmo_stat_item_discard_all into osmo_stats_report to a place where all groups have been processed already. Sponsored-by: On-Waves ehf
2015-11-09stats: Fix handling of multiple resportersJacob Erlbeck1-2/+2
Currently the reporter loop is aborted, if the event would be ignored due to an insufficient max_level. Thus the reporters that happen to be stored afterwards would be skipped even if their level were sufficient. This commit replaces the conditional 'return' statement by a considtional 'continue' statement to ensure the processing of the list tail. Sponsored-by: On-Waves ehf
2015-11-09stats: Send all values on reporter updateJacob Erlbeck2-8/+26
Currently only counter changes and new item values are being reported. This makes it cumbersome to configure reporting clients, since there is nothing like a list of all parameters. This commit changes this behaviour such that all currently existing counters and items that would be reported eventually, are passed to the reporter when it has been reconfigured or enabled. If a counter has not been incremented, 0 is sent. If a stat item value has not been added, the last item value (or the default value if there is none) is resent again. Note that this will not catch transient counters/items that will be created later on, e.g. triggered by new peers or subscribers. To just force this kind of dump on a running reporter, it is sufficient to invoke the 'enable' command in its configuration node. Sponsored-by: On-Waves ehf
2015-11-09stats: Fix name prefix handlingJacob Erlbeck1-11/+23
Currently the having an unset prefix leads to an abort() in the statsd reporter due to an fprintf format string error. In addition the prefix cannot be reset to its initial state (NULL) by using 'no prefix', which just sets the prefix to the empty string, causing a single leading dot to appear in front of the name. This commit changes the implemenation to consistly use NULL for the unset name prefix ('no prefix') and to handle this case correctly in the statsd reporter. Sponsored-by: On-Waves ehf
2015-11-07stats: Document the level in show stats level optionsHolger Hans Peter Freyther1-0/+1
Potentially Fixes: <command id='show stats level (global|peer|subscriber)'> <param name='subscriber' doc='(null)' />
2015-11-07osmo-sim-test: add missing includeAlexander Huemer1-0/+1
2015-11-04debian: Roll a new release with the GPRS NS counter fixHolger Hans Peter Freyther1-0/+6
2015-11-04gprs-ns/stats: When the NSVCI is updated, update the stats counterHolger Hans Peter Freyther3-0/+13
The NS object is created with an unknown identity and only after the reset procedure has progressed (completed?) we know the real ID for this peer. Before nobody has looked at the idx values (this could have been seen with the CTRL interface) but with statsd the wrong NSVCI becomes obvious. Add routines to update the idx and I don't know if the change of idx is causing any issues but we will find that out soon.
2015-11-04debian: Make new minor release with the NS bugfixHolger Hans Peter Freyther1-0/+6
2015-08-22stats/vty: Add selective show stats commandJacob Erlbeck3-2/+33
Currently there is only the 'show stats' command which shows all counter and stat_item values. This can lead to many lines of output if there are per-subscriber rate counters. The new command added by this commit allows it to only show groups of a certain level (class_id), similar to the 'level' configuration command for stats reporter. The new command is show stats level (global|peer|subscriber) Sponsored-by: On-Waves ehf
2015-08-22ns/stats: Fix class_id of "NSVC Peer Statistics" rate_ctr groupJacob Erlbeck1-0/+1
Currently the class_id is not set which effectively puts these groups into the 'subscriber' class. This commit adds the missing initialisation value. Sponsored-by: On-Waves ehf
2015-08-22stats/test: Add tests to check VTY configurationJacob Erlbeck2-0/+194
This commit adds tests to verify the stats related VTY configuration commands. Sponsored-by: On-Waves ehf
2015-08-22vty/test: Refactor vty creation/deletion into separate functionsJacob Erlbeck1-29/+46
Currently this is part of the only test function that uses the vty directly. In preperation for more such test cases, this commit moves this code into separate functions. Sponsored-by: On-Waves ehf
2015-08-22test: Remove unneeded linking to libosmovty.laJacob Erlbeck1-4/+4
The addition of libosmovty.la to several test cases as done in commit 738d9e22108a8e47245 (stats: Add vty_out_stat_item_group) is not needed. This commit removes them. Sponsored-by: On-Waves ehf
2015-11-03debian: Install libosmoctrl0 too when installing the dev packageHolger Hans Peter Freyther1-1/+1
2015-11-03misc: Prepare the release of libosmocore 0.9.00.9.0Holger Hans Peter Freyther6-6/+11
Bump the ABI version of libosmovty and we need to do this recursively to force rebuilds of our software.
2015-08-21stats: Fix build on FreeBSDHolger Hans Peter Freyther2-1/+4
include stdint.h for int64_t and use netinet/in.h and not netinet/ip.h for getting sockaddr_in and such.
2015-08-21timer: Fix compiler warning about timevalHolger Hans Peter Freyther1-3/+4
timer.c:27:23: warning: tentative definition of variable with internal linkage has incomplete non-array type 'struct timeval' [-Wtentative-definition-incomplete-type] static struct timeval nearest; ^ timer.c:27:15: note: forward declaration of 'struct timeval' static struct timeval nearest;
2015-11-02gtphub: add OSMO_VTY_PORT_GTPHUB.Neels Hofmeyr1-0/+1
This is for gtphub, being developed in openbsc.git. Sponsored-by: On-Waves ehi