path: root/src/vty
AgeCommit message (Collapse)AuthorFilesLines
2016-02-25vty: add bind command for telnet vty lineNeels Hofmeyr1-0/+28
Add VTY command line vty bind A.B.C.D The command merely stores the configured IP-address, which can then be used by the calling main program to set the telnet port of the VTY line. (Commits in openbsc and osmo-iuh will follow up on this.) Add function vty_get_bind_addr() to publish the address in the vty.h API. Add static vty_bind_addr to store. For allocation/freeing reasons, a NULL address defaults to BTW, I decided against allowing keywords 'any' and 'localhost' in place of an actual IP address to make sure a written config is always identical to the parsed config.
2015-11-09vty: Use NULL to have a null pointer instead of '\0'Holger Hans Peter Freyther1-3/+3
'\0' gets translated to zero but the argument to vector_set is a pointer and it gets converted to a pointer. vty.c:985:21: warning: expression which evaluates to zero treated as a null pointer constant of type 'void *' [-Wnon-literal-null-conversion] vector_set(vline, '\0'); ^~~~ vty.c:1095:21: warning: expression which evaluates to zero treated as a null pointer constant of type 'void *' [-Wnon-literal-null-conversion] vector_set(vline, '\0'); ^~~~ vty.c:1097:21: warning: expression which evaluates to zero treated as a null pointer constant of type 'void *' [-Wnon-literal-null-conversion] vector_set(vline, '\0'); ^~~~
2015-12-08stat: Explicitly support stat_items without unitJacob Erlbeck1-1/+4
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 Welte1-2/+2
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-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 Škarvada3-6/+6
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
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-08-22stats/vty: Add selective show stats commandJacob Erlbeck2-2/+31
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-11-03misc: Prepare the release of libosmocore Hans Peter Freyther1-1/+1
Bump the ABI version of libosmovty and we need to do this recursively to force rebuilds of our software.
2015-11-02stats: Fix handling of the no mtu commandHolger Hans Peter Freyther1-1/+1
For the atoi we need to pass the val as a string. This means we need to write "0" which then gets parsed to 0. [src/vty/stats_vty.c:90]: (error) Possible null pointer dereference: val
2015-11-02stats: Limit reporting by class idJacob Erlbeck1-0/+37
This commit adds class_id fields to the rate_ctr and stat_item group descriptions. The stats reporter code is extended to only process groups whose class_id does not exceed a per reporter max_class level. If the class_id is not set, the code assumes 'global' for groups with idx == 0 and 'subscriber' otherwise. The following vty command is added to config-stats: level (global|peer|subscriber) Set the maximum group level Sponsored-by: On-Waves ehf
2015-11-02stats: Add osmo_ name prefix to identifiersJacob Erlbeck2-48/+48
Since the the stat_item and stats functions and data types are meant to be exported, they get an osmo_ prefix. Sponsored-by: On-Waves ehf [hfreyther: Prepended the enum values too. This was requested by Jacob]
2015-10-29stats: Add log reporterJacob Erlbeck1-0/+49
This reporter passes the measurement values to the logging subsystem as DSTATS (which is currently DLGLOBAL) level INFO messages. Sponsored-by: On-Waves ehf
2015-10-29stats: Make net config optionalJacob Erlbeck1-12/+15
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-29stats: Add missing mtu command to 'write' outputJacob Erlbeck1-0/+3
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-29stats: Support statsd Multi-Metric PacketsJacob Erlbeck1-0/+19
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-29stats: Implement timer based reportingJacob Erlbeck1-13/+21
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-29stats/vty: Add stats configurationJacob Erlbeck1-1/+260
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-29stats/vty: Add stats_vty.cJacob Erlbeck2-1/+53
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-28stat/vty: Add vty_out_statistics_full to show all statisticsJacob Erlbeck1-0/+58
This functions shows the state of all osmo_counters, stat_item groups, and counter groups. Sponsored-by: On-Waves ehf
2015-10-28stat/vty: Use the iterator algorithms to show ctrg and statgJacob Erlbeck1-20/+43
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-28stats: Add vty_out_stat_item_groupJacob Erlbeck1-0/+22
This functions dumps a whole stat item group to the VTY. Sponsored-by: On-Waves ehf
2015-08-23Prepare new upstream release0.8.3Holger Hans Peter Freyther1-1/+1
2015-08-05vty: Change API to have node installation be done by intHolger Hans Peter Freyther1-4/+4
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-03-20vty: Fix writing the logging of categoryMichael McTernan1-1/+1
Fix copy and paste issue introduced by Holger in 2d6ad13d8daf860595e6d4025861e122ce574871.
2015-01-27vty: Fix typo in the state creationHolger Hans Peter Freyther1-1/+1
This got introduced in 2d6ad13d8daf860595e6d4025861e122ce574871 and I thought that our vty tests would have caught such mistakes.
2015-01-18Prepare a new libosmocore release0.8.0Holger Hans Peter Freyther1-1/+1
2014-12-05logging: Make it possible to print category/subsys and timestampsHolger Hans Peter Freyther1-3/+46
We want to see from which category/subsystem a certain log message is coming from and use a different timestamp format as well. Add two new bitfields. This doesn't change the size of the structure and on 32bit we still have 27bits left. The extended timestamp will take preference over the current and default timestamp format. Fixes: SYS#602
2014-12-04vty: Check with the application before writing the configHolger Hans Peter Freyther1-0/+9
For the BSC/NITB application we see that people modify the band without modifying the ARFCN. This creates an unbootable config. Using the new hook the BSC/NITB can check if the config is consistent and prevent the config file being written. Related: SYS#739
2014-11-14vty/vector.c: Use string.h, not memory.hHarald Welte1-1/+1
2014-11-14remove references to u_long type, use 'unsigned long' insteadHarald Welte2-3/+3
.. Nuttx doesn't know u_long
2014-11-14remove references to u_char type, use 'unsigned char' insteadHarald Welte2-2/+2
... u_char not being defined on Nuttx.
2014-10-03build: remove unused all_includes and use AM_CPPFLAGSJan Engelhardt1-1/+2
Preprocessor flags are best placed in AM_CPPFLAGS. Remove use of the unused all_includes variable, which is never set.
2014-09-25misc: Look into the build directory for generated filesHolger Hans Peter Freyther1-1/+1
the bits/crc files are not inside the sourcedirectory but will end in the build directory. Go and look there as well. This somehow doesn't fail with make distcheck but when building for Yocto Dizzy.
2014-08-25logging: Add ability to save/print current log filtersHarald Welte1-2/+6
This enables the persistent configuration of let's say 'log filter imsi 012345678' for a given log file in the config file.
2014-08-21prepare for 0.7.0 release0.7.0Harald Welte1-1/+1
2014-07-01write_queue: Use EBADF instead of EBABDFD for portabilityHolger Hans Peter Freyther2-2/+2
EBADFD is linux specific while EBADF is POSIX. Fix the build on FreeBSD and use EBADF throughout the file.
2014-06-22vty: Avoid use-after-free in VTY telnet interfaceDaniel Willmann2-4/+4
If the read callback closes the connection conn is already freed so we can't derefernce it. Instead return -EBADFD in the read function if it closed the connection and check for that.
2013-10-10vty: Make vty_event dispatch signals and use it in the testcaseHolger Hans Peter Freyther1-1/+13
The testcase didn't work on Ubuntu 12.04 because vty_create will directly call vty_event (e.g. not through the plt). This means that the approach to override vty_event in the testcase failed. Use the signal interface of libosmocore and make the testcase use it. The signals can be generally useful as well.
2013-09-11vty: Allow vty_go_parent() in all nodes.Jacob Erlbeck1-5/+25
This patch removes an assertion of node > CONFIG_NODE and changes the function to handle all nodes properly. For the sake of completeness, the generic 'exit' command implementation is extended to work properly with all nodes, too.
2013-09-10vty: Replace 'enum node_type' by 'int' for last_nodeJacob Erlbeck1-1/+1
In this case the last_node variable may hold values that are not in enum node_type, so int is used instead.
2013-09-08vty: Add vty_install_default() and use for the vty nodesJacob Erlbeck3-7/+16
This adds the vty_install_default() function that is basically the install_default() function plus the registration of the commands 'exit' and 'end'. The latter is only provided in subnodes of ENABLED_NODE and CONFIG_NONE. The VTY test program is extended to check these commands. Ticket: OW#952
2013-09-08vty: Refactored vty_go_parent(), 'end' and 'exit'Jacob Erlbeck1-22/+35
Put all 'exit' logic into vty_go_parent() and replace the implementations of 'exit' and 'end' by generic ones that use vty_go_parent().
2013-09-08vty: Rename is_config() to is_config_child()Jacob Erlbeck1-3/+3
The function is_config() returns 0 for CONFIG_NODE. Since that node is a config node, the function is renamed to resolve this.
2013-08-06vty: Support multi-char separators and end stringsJacob Erlbeck1-4/+5
In vty_cmd_string_from_valstr() include the real string lengths of the sep and end arguments into the buffer size calculation.
2013-08-06vty: Fix misusage of snprintf in vty/utils.cJacob Erlbeck1-2/+2
Compiled with ubuntu 1204 (precise), where -Wformat-security is enabled by -Wall. Test yields ok, but the current implementation doesn't properly support multi-character separators and end strings. So the test output is truncated. Addresses: utils.c: In function 'vty_cmd_string_from_valstr': utils.c:84:2: warning: format not a string literal and no format arguments [-Wformat-security] utils.c:84:2: warning: format not a string literal and no format arguments [-Wformat-security] utils.c:108:2: warning: format not a string literal and no format arguments [-Wformat-security] utils.c:108:2: warning: format not a string literal and no format arguments [-Wformat-security]
2013-07-14vty: Fix logically dead code in the description handlingHolger Hans Peter Freyther1-1/+1
The code most likely wanted to check the result of argv_concat. To do this we need to dereference the dptr. Logically dead code (DEADCODE) dead_error_line: Execution cannot reach this statement "return 1; Fixes: Coverity CID 1040675
2013-07-03vty: Attempt to fix various meam leaks in the VTY lookup codeHolger Hans Peter Freyther1-0/+3
These routines were not freeing vectors used for the lookup. On review it is fixing another path not detected by coverity. The danger is a double free in tab completion now. It is difficult to test this. Fixes: Coverity CID 23037, CID 23038
2013-03-19logging_vty: Fix segfault un unused entries in log_info_cat array of appHarald Welte1-0/+4
2013-03-13logging_vty: Print 'log filter all' info in 'show logging vty'Harald Welte1-0/+6
When we print information about the current logging configuration, it makes sense to also print information about the log filters.