Commit Graph

1563 Commits

Author SHA1 Message Date
Jacob Erlbeck ed197fd4f9 stats: Make net config optional
To support reporters without network configuration, this commit
introduces the have_net_config flag to provide corresponding error
messages.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck 4aa1177062 stats: Add missing mtu command to 'write' output
Currently the config_write_stats_reporter function does not output
the mtu value, which is fixed by this commit.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck d01acfcc75 stats: Support statsd Multi-Metric Packets
If the MTU is given, combine several messages into a single UDP
packet until the limit is reached. Flush all reporters after the
values have been scanned.

New vty commands (node config-stats):
  mtu <100-65535>     Enable multi-metric packets and set the maximum
                      packet size (in byte)
  no mtu              Disable multi-metric packets

Note that single messages that are longer than the given MTU (minus
28 octets protocol overhead) will be dropped.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck c8f47b600f stats: Add support for osmo_counters
This commit changes the reporting code to also show all modified
osmo_counter values. Since there is no grouping of these values, the
name string just consists of the optional prefix and the counter
name.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck 80db4ec387 core: Add difference function to osmo_counter
The osmo_counter_difference returns the counter value difference
since the last call of this function with the given counter object.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck c27671c109 stats: Report stat item values
Currently only rate counter are being supported.

This commit adds support for stat items. All groups are polled for
changed values.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck b1dbfb4c41 stats: Implement timer based reporting
This calls stats_flush in regular intervals which polls the
statistical values and calls the active reporters when values have
changed.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck adc900e0e3 stats/vty: Add stats configuration
This commit provides stats configuration similar to the log
configuration.

The following vty commands are added to the config node:
  stats reporter statsd          Create/Modify a statsd reporter
  no stats reporter statsd       Remove a statsd reporter

To actually configure a reporter, the config-stats node is entered
when the "stats reporter" command has succeeded. The following new
vty commands are available there:
  local-ip ADDR          Set the IP address to which we bind locally
  no local-ip            Do not bind to a certain IP address
  remote-ip ADDR         Set the remote IP address to which we connect
  remote-port <1-65535>  Set the remote port to which we connect
  prefix PREFIX          Set the item/counter name prefix
  no prefix              Do not use a prefix
  enable                 Enable the reporter
  disable                Disable the reporter

Sponsored-by: On-Waves ehf
2015-10-29 01:10:06 +01:00
Jacob Erlbeck 95bf828003 stats: Add the reporting framework
This commit provides the stats reporting framework that can manage
several types of measurement reporters. Initially support for
rate_ctr and the statsd protocol is included.

Sponsored-by: On-Waves ehf
2015-10-29 01:10:03 +01:00
Jacob Erlbeck 45513e6040 stats/vty: Add stats_vty.c
This file will contain the VTY code related to statistics.

This commit adds a minimal file with just as single VTY command:

- show stats    This command shows all statistical values

To enable this and future commands, the main program needs to call
stats_vty_add_cmds().

Sponsored-by: On-Waves ehf
2015-10-29 00:09:04 +01:00
Jacob Erlbeck 7211fe157e stat/vty: Add vty_out_statistics_full to show all statistics
This functions shows the state of all osmo_counters, stat_item
groups, and counter groups.

Sponsored-by: On-Waves ehf
2015-10-28 23:53:46 +01:00
Jacob Erlbeck aec583f687 stat/vty: Use the iterator algorithms to show ctrg and statg
Currently the groups for stat_items and counter are iterated
manually.

This commit makes use of the new iterator functions to access the
single elements via handlers.

Sponsored-by: On-Waves ehf
2015-10-28 23:53:45 +01:00
Jacob Erlbeck e5b0fe2e3c core: Update osmo_counters_for_each doc
Fix type and add a note about the semantics of the handler's return
code.

Sponsored-by: On-Waves ehf
2015-10-28 23:53:45 +01:00
Jacob Erlbeck c6a7108828 stats: Add stat_item_for_each functions
This commit adds the following functions:

  stat_item_for_each_group     Call a handler for each group
  stat_item_for_each_item      Call a handler for each item of a
                               group

Sponsored-by: On-Waves ehf
2015-10-28 23:51:24 +01:00
Jacob Erlbeck 423c1e5a4f core: Extend rate_ctr by helper functions
For global value reporting, some additional helper functions are
needed. The statsd protocol expects differential counter values,
which are currently not provided by rate_ctr (except for s/m/h/d
intervals).

This commit adds several helper functions to rate_ctr:

- rate_ctr_difference  returns the counter delta since the last
                       call to this function for a given counter
- rate_ctr_for_each_counter
                       iterates through each counter of a group
- rate_ctr_for_each_group
                       iterates through all globally registered
                       counter groups

Note that the rate_ctr_difference function can only be used by a
single backend, since it modifies the 'previous' field in the
rate_ctr obj.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:24 +01:00
Jacob Erlbeck b27b352e93 stats: Use a global index for stat item values
Currently each stat item has a separate index value which basically
counts each single value added to the item and which can be used by
a reporter to get all new values that have not been reported yet.
The drawback is, that such an index must be stored for each stat
item.

This commit introduces a global index which is incremented for each
new stat item value. This index is then stored together with the item
value. So a single stored index per reporter is sufficient to make
sure that only new values are reported.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:24 +01:00
Jacob Erlbeck 0a1400fc83 ns: Add statistics for some events
The following counters are added to the ns.nsvc counter group:
  lost.alive             The number of missing ALIVE ACK messages
  lost.reset             The number of missing RESET ACK messages

The following items are added to the ns.nsvc stat item group:
  alive.delay            The time in ms between sending ALIVE and
                         receiving the next ALIVE ACK

Sponsored-by: On-Waves ehf
2015-10-28 23:51:24 +01:00
Jacob Erlbeck 738d9e2210 stats: Add vty_out_stat_item_group
This functions dumps a whole stat item group to the VTY.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:12 +01:00
Jacob Erlbeck 9732cb4a92 stats: Add stat_item for value monitoring
This commit adds instrumentation function to gather measurement
and statistical values similar to counter groups.

Multiple values can be stored per item, which can be retrieved in
FIFO order. Getting values from the item does not modify its state to
allow for multiple independant backends (e.g. VTY and statd).

When a new value is set, the oldest value gets silently overwritten.
Lost values are skipped when getting values from the item.

Sponsored-by: On-Waves ehf
2015-10-28 23:51:04 +01:00
Neels Hofmeyr c84851bccc comments 2015-10-09 00:01:06 +02:00
Neels Hofmeyr 5eeb17a017 ipaccess: add OAP proto_ext (in design). 2015-09-23 23:18:15 +02:00
Neels Hofmeyr 3de7b05d85 utils: add 'returns' doc to osmo_hexparse(). 2015-09-23 23:16:53 +02:00
Jan Engelhardt c2ddc4f555 build: have a disable-static build succeed
When using configure --disable-static, no libosmogsm.a will be
created, and the tests fail to link because symbols like _a5_3 and
_a5_4 are not exported through the only remaining libosmogsm.so.

A method to overcome this is an intermediate private non-distributed
library, examples of which are present in e.g. libabc, kmod and
systemd.

With this, disable-static can now be the default and practical compile
time be halved.
2015-09-16 18:08:48 +02:00
Holger Hans Peter Freyther d452a48ac6 Prepare new upstream release 2015-08-23 17:39:14 +02:00
Sylvain Munaut 69b1b8bea6 build: Enable subdir-objects
This fixes warning (and even build on some newer automake).
This should now work in the CI as well thanks to the fix for tests.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-08-19 11:15:14 +02:00
Sylvain Munaut 0d72785568 tests: Don't reference file in src/ to test hidden func. Use static link.
Taken from:
https://qiaomuf.wordpress.com/2011/03/27/handling-unit-test-with-c-visibilityhidden/

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2015-08-19 11:14:23 +02:00
Harald Welte 1a8c4e05fb Introduce gsm48_mi_type_name() function 2015-08-18 19:32:33 +02:00
Harald Welte 1f6aad1c04 Add G-RNTI derived TLLI types defined in 23.003 2015-08-18 19:32:33 +02:00
Holger Hans Peter Freyther 538ff49837 Revert "configure.ac: Add subdir-objects"
This reverts commit 7c942ba147.
With automake 1.14 and using the above option the distclean
will fail with:

Making distclean in tests
gmake[2]: Entering directory '/home/builder/source/workspace/libosmocore/label/FreeBSD_amd64/libosmocore-0.8.0.47-7c94/_build/tests'
Makefile:848: ../src/gsm/.deps/a5.Po: No such file or directory
Makefile:849: ../src/gsm/.deps/kasumi.Po: No such file or directory
gmake[2]: *** No rule to make target '../src/gsm/.deps/kasumi.Po'.  Stop.
gmake[2]: Leaving directory '/home/builder/source/workspace/libosmocore/label/FreeBSD_amd64/libosmocore-0.8.0.47-7c94/_build/tests'
Makefile:506: recipe for target 'distclean-recursive' failed
gmake[1]: *** [distclean-recursive] Error 1
gmake[1]: Leaving directory '/home/builder/source/workspace/libosmocore/label/FreeBSD_amd64/libosmocore-0.8.0.47-7c94/_build'
Makefile:714: recipe for target 'distcheck' failed

As we are not required to use the option, let's fix the build
2015-08-18 13:17:53 +02:00
Harald Welte 7c942ba147 configure.ac: Add subdir-objects
Apparently this is required under latest autotools versions.
2015-08-15 10:49:46 +02:00
Holger Hans Peter Freyther a9e5252128 vty: Change API to have node installation be done by int
We are mixing enums and hope that no short-enums are used. This
is leading to a lot compiler warnings generated by clang. Change
the API to work with integers.

Porting:
The go_parent_cb implementations in the applications need to be
fixed. The API change leads to a compile time warning.

Fixes:
abis_om2000_vty.c:46:2: warning: implicit conversion from enumeration type 'enum bsc_vty_node' to
      different enumeration type 'enum node_type' [-Wenum-conversion]
        OM2K_NODE,
        ^~~~~~~~~
2015-08-05 04:22:56 +00:00
Holger Hans Peter Freyther c136da587f release: Prepare the 0.8.2 release
I have kind of used 0.8.1 by accident already so let us move
to 0.8.2 now.
2015-08-01 20:20:24 +02:00
Jacob Erlbeck c1cb75eff5 bssgp: Fix IMSI buffer size (Coverity)
Currently the size of the IMSI pointer is used instead of the size of
the talloc'ed buffer.

This commit changes the call to gsm48_mi_to_string to use the same
value that has been used with talloc_zero_size(). The length is
changed to 17 since that value is used for GSM_IMSI_LENGTH in
openbsc.

Fixes: Coverity CID 1040663
Sponsored-by: On-Waves ehf
2015-06-19 20:54:28 +02:00
Jacob Erlbeck 2c58197e5d bssgp/test: Add missing START/END printfs
Sponsored-by: On-Waves ehf
2015-06-19 20:53:31 +02:00
Jacob Erlbeck 7f31c90b80 ipa: Add libosmogsm.map entry for ipa_ccm_idtag_parse_off
Addresses:
  CCLD     utils/utils_test
  utils_test.o: In function `test_idtag_parsing':
  git/libosmocore/tests/utils/utils_test.c:64: undefined reference to `ipa_ccm_idtag_parse_off'

Sponsored-by: On-Waves ehf
2015-06-04 08:52:36 +02:00
Holger Hans Peter Freyther f558ed4bb9 ipa: Properly parse LV stream of a ID_GET request
For some reason the structure is closer to be a LV (length
and value). The value is actually a tag but it is counted
inside the length. Introduce an overload of the parse function
to provide an offset for the length. This will be taken from
the returned length.
2015-06-02 15:52:06 +02:00
Holger Hans Peter Freyther 91ff17c9ef osmo-auc-gen: '-a' is already the algorithm. Fix the help 2015-05-26 00:11:37 +08:00
Holger Hans Peter Freyther a6ea50c4ff debian: New development release with APN changes for the SGSN 2015-05-25 14:17:29 +02:00
Harald Welte 908085ccbc Add APN utility function to libosmogsm
The current functions are used to 'qualify' an APN from the
user-supplied APN name (name identifier) towards the fully-qualified
APN name which is used in the .grps DNS zone.
2015-05-25 11:12:16 +08:00
Holger Hans Peter Freyther 0d86c21f6a build: Fix the building of tests as well
In file included from ../../include/osmocom/core/msgb.h:25:0,
                 from ../../tests/sms/sms_test.c:31:
../../include/osmocom/core/bits.h:6:35: fatal error: osmocom/core/bit16gen.h: No such file or directory
 #include <osmocom/core/bit16gen.h>
2015-05-17 19:55:53 +02:00
Andreas Rottmann 9eb1c80020 build: Fix out-of-tree builds
Fixes:
In file included from ../../../include/osmocom/core/msgb.h:25:0,
                 from ../../../include/osmocom/sim/sim.h:4,
                 from ../../../src/sim/reader_pcsc.c:30:
../../../include/osmocom/core/bits.h:6:35: fatal error: osmocom/core/bit16gen.h: No such file or directory
 #include <osmocom/core/bit16gen.h>

In file included from ../../include/osmocom/core/msgb.h:25:0,
                 from ../../utils/osmo-sim-test.c:26:
../../include/osmocom/core/bits.h:6:35: fatal error: osmocom/core/bit16gen.h: No such file or directory
 #include <osmocom/core/bit16gen.h>
2015-05-17 19:19:09 +02:00
Holger Hans Peter Freyther 16082fd3cd debian: Bump version for new local packages 2015-05-06 17:58:45 +02:00
Jacob Erlbeck 9385d1e01b bssgp: Fix bssgp_tx_fc_bvc parameter type
Currently large values for Bmax default MS get sliced since a uint16_t is
used as the type of the corresponding parameter of bssgp_tx_fc_bvc.
GSM 48.018, 11.3.2 which in turn refers to 11.3.5 specifies a maximum
of 6MB (0xffff * 100).

This commit changes the type to uint32_t to cover the full value
range.

Sponsored-by: On-Waves ehf
2015-05-06 17:55:55 +02:00
Jacob Erlbeck 455d34f476 bssgp/test: Fix bssgp-fc test
The fix in the commit "bssgp: Fix call to llist_entry in
fc_queue_timer_cfg" prevents the flow control code from generating
certain logging messages ("-BSSGP-FC: fc_timer_cb() but still not
able to send PDU of 10 bytes") during the tests. This breaks the test
suite, since the update of the correseponding stderr output file
misses.

This commit updates the bssgp_fc_tests.err file accordingly.

Sponsored-by: On-Waves ehf
2015-05-04 07:44:43 +02:00
Holger Hans Peter Freyther 780bba625d linuxlist: Remove casting of ptr from container_of macro
The cast is not present in the original macro and was added
in OpenBSC with commit (be68f6fc6cde1367a4481d2e774a64e2cd657267)
to help using the header with C++. Due the recent issue in
the bssgp flow control code, let's remove the cast to see
wrong pointer usage. In case C++ code doesn't compile anymore
we can see how to add a cast back to it.

Change was proposed by Michael McTernan
2015-05-02 07:59:00 +02:00
Jacob Erlbeck 9731935984 bssgp: Fix call to llist_entry in fc_queue_timer_cfg
Currently the DL sometimes hangs and sometimes a lot of messages
(still not able to send PDU) are logged. This is caused by an invalid
timer delay computation, setting msecs either to 0 or to some big value.

This is due to an '&' operator at the wrong place, accessing some
parts in fc instead of the first element of the list.

This commit fixes that issue.

Sponsored-by: On-Waves ehf
2015-04-30 20:02:09 +02:00
Jacob Erlbeck 580af4be00 bssgp: Fix encoding of BVC_FLOW_CONTROL
Currently all 2 byte IE of the message are transmitted in the little
endian byte ordering.

This commit adds htons to the encoding expressions.

Sponsored-by: On-Waves ehf
2015-04-29 15:48:09 +02:00
Jacob Erlbeck 1bda44213e bssgp: Fix output of the VTY 'show bssgp stats' command
The output is terminated by a '\n' instead of VTY_NEWLINE.

This is fixed by the commit.

Sponsored-by: On-Waves ehf
2015-04-29 15:47:25 +02:00
Holger Hans Peter Freyther ad69f89b52 debian: Build new version 2015-04-16 21:23:49 +02:00
Holger Hans Peter Freyther 0f40ae12c8 osmo_static_assert: Put back the typedef in the code
In OSX the int declares linkage and for libosmo-abis we have
two static asserts with the same name in two different compilation
units. When adding the "unused" attribute I removed the typedef.
I verified with a gcc 4.9.2 that no new warnings will be shown
when compiling libosmo-abis.
2015-04-13 09:21:05 +02:00