summaryrefslogtreecommitdiff
path: root/lib/command.c
AgeCommit message (Collapse)Author
2012-12-12build: include git infoDavid Lamparter
If enabled with --with-pkg-gitversion on ./configure, this will append git version strings and branch information at the following places: - overall version number: 0.99.21-g0123456 - login motd and show version: tag information + git id + branches Sample output: Hello, this is Quagga (version 0.99.21-g14b49ad-dirty). Copyright 1996-2005 Kunihiro Ishiguro, et al. This is a git build of quagga_0_99_21_release-106-g14b49ad-dirty Associated branch(es): local:master [v2]: fix build without gitinfo (add "else" branch) [v2]: fix for repos without any tags (different git describe output) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-07-19lib: make IPv6 prefix parser slightly more strictDavid Lamparter
This makes it possible to have both "show babel route A.B.C.D/M" and "show babel route X:X::X:X/M" commands at the same time without the parser complaining about ambiguity. * lib/command.c: only accept STATE_DOT after : was seen. Reported-by: Juliusz Chroboczek <jch@pps.jussieu.fr> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-05-21lib: drop heuristic IPv6 address recognitionRoman Hoog Antink
* command.c: (cmd_ipv6_match) Drop IPv6 address recognition heuristics and solely rely on inet_pton, because strings like "abcd" were mistaken for IPv6 addresses. This affects e.g. the command "neighbour WORD peer-group", which won't work with words consisting of up to 4 characters between 'a' and 'f' and digits. From: Roman Hoog Antink <rha@open.ch> [full delete instead of #if 0] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2012-03-25babeld: Initial import, for Babel routing protocol.Paul Jakma
* Initial import of the Babel routing protocol, ported to Quagga. * LICENCE: Update the original LICENCE file to include all known potentially applicable copyright claims. Ask that any future contributors to babeld/ grant MIT/X11 licence to their work. * *.{c,h}: Add GPL headers, in according with the SFLC guidance on dealing with potentially mixed GPL/other licensed work, at: https://www.softwarefreedom.org/resources/2007/gpl-non-gpl-collaboration.html
2011-09-27delete CVS keywordsDenis Ovsienko
2011-03-23lib: fix more format warnings (#637)Christian Hammers
The following patch was also neccessary to compile. * command.c: (config_logmsg_cmd) use "%s" format spec * if.c: (connected_log) ditto
2010-12-08lib: Add a command to clear the thread CPU history dataPaul Jakma
* (general) this can be useful when investigating thread latency problems, when you don't want to have to restart a daemon between tests. * thread.c: (cpu_record_(hash_)clear) wipe the stored thread cpu history data, according to the filter, similar to the vty print code. (clear_thread_cpu_cmd) new command to clear data. * thread.h: export new command * command.c: install it
2009-12-21lib: make some structures constantStephen Hemminger
* isisd/isis_pdu.c * maskbit: this pre-initialized array is not modified * lib/prefix.c * maskbit: idem * lib/command.c * facility_map: idem * itoa64: idem * default_motd: make local var static * facility_name(): update local var accordingly * facility_match(): idem
2009-07-19[bgpd] Stability fixes including bugs 397, 492Chris Caputo
I've spent the last several weeks working on stability fixes to bgpd. These patches fix all of the numerous crashes, assertion failures, memory leaks and memory stomping I could find. Valgrind was used extensively. Added new function bgp_exit() to help catch problems. If "debug bgp" is configured and bgpd exits with status of 0, statistics on remaining lib/memory.c allocations are printed to stderr. It is my hope that other developers will use this to stay on top of memory issues. Example questionable exit: bgpd: memstats: Current memory utilization in module LIB: bgpd: memstats: Link List : 6 bgpd: memstats: Link Node : 5 bgpd: memstats: Hash : 8 bgpd: memstats: Hash Bucket : 2 bgpd: memstats: Hash Index : 8 bgpd: memstats: Work queue : 3 bgpd: memstats: Work queue item : 2 bgpd: memstats: Work queue name string : 3 bgpd: memstats: Current memory utilization in module BGP: bgpd: memstats: BGP instance : 1 bgpd: memstats: BGP peer : 1 bgpd: memstats: BGP peer hostname : 1 bgpd: memstats: BGP attribute : 1 bgpd: memstats: BGP extra attributes : 1 bgpd: memstats: BGP aspath : 1 bgpd: memstats: BGP aspath str : 1 bgpd: memstats: BGP table : 24 bgpd: memstats: BGP node : 1 bgpd: memstats: BGP route : 1 bgpd: memstats: BGP synchronise : 8 bgpd: memstats: BGP Process queue : 1 bgpd: memstats: BGP node clear queue : 1 bgpd: memstats: NOTE: If configuration exists, utilization may be expected. Example clean exit: bgpd: memstats: No remaining tracked memory utilization. This patch fixes bug #397: "Invalid free in bgp_announce_check()". This patch fixes bug #492: "SIGBUS in bgpd/bgp_route.c: bgp_clear_route_node()". My apologies for not separating out these changes into individual patches. The complexity of doing so boggled what is left of my brain. I hope this is all still useful to the community. This code has been production tested, in non-route-server-client mode, on a linux 32-bit box and a 64-bit box. Release/reset functions, used by bgp_exit(), added to: bgpd/bgp_attr.c,h bgpd/bgp_community.c,h bgpd/bgp_dump.c,h bgpd/bgp_ecommunity.c,h bgpd/bgp_filter.c,h bgpd/bgp_nexthop.c,h bgpd/bgp_route.c,h lib/routemap.c,h File by file analysis: * bgpd/bgp_aspath.c: Prevent re-use of ashash after it is released. * bgpd/bgp_attr.c: #if removed uncalled cluster_dup(). * bgpd/bgp_clist.c,h: Allow community_list_terminate() to be called from bgp_exit(). * bgpd/bgp_filter.c: Fix aslist->name use without allocation check, and also fix memory leak. * bgpd/bgp_main.c: Created bgp_exit() exit routine. This function frees allocations made as part of bgpd initialization and, to some extent, configuration. If "debug bgp" is configured, memory stats are printed as described above. * bgpd/bgp_nexthop.c: zclient_new() already allocates stream for ibuf/obuf, so bgp_scan_init() shouldn't do it too. Also, made it so zlookup is global so bgp_exit() can use it. * bgpd/bgp_packet.c: bgp_capability_msg_parse() call to bgp_clear_route() adjusted to use new BGP_CLEAR_ROUTE_NORMAL flag. * bgpd/bgp_route.h: Correct reference counter "lock" to be signed. bgp_clear_route() now accepts a bgp_clear_route_type of either BGP_CLEAR_ROUTE_NORMAL or BGP_CLEAR_ROUTE_MY_RSCLIENT. * bgpd/bgp_route.c: - bgp_process_rsclient(): attr was being zero'ed and then bgp_attr_extra_free() was being called with it, even though it was never filled with valid data. - bgp_process_rsclient(): Make sure rsclient->group is not NULL before use. - bgp_processq_del(): Add call to bgp_table_unlock(). - bgp_process(): Add call to bgp_table_lock(). - bgp_update_rsclient(): memset clearing of new_attr not needed since declarationw with "= { 0 }" does it. memset was already commented out. - bgp_update_rsclient(): Fix screwed up misleading indentation. - bgp_withdraw_rsclient(): Fix screwed up misleading indentation. - bgp_clear_route_node(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT. - bgp_clear_node_queue_del(): Add call to bgp_table_unlock() and also free struct bgp_clear_node_queue used for work item. - bgp_clear_node_complete(): Do peer_unlock() after BGP_EVENT_ADD() in case peer is released by peer_unlock() call. - bgp_clear_route_table(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT. Use struct bgp_clear_node_queue to supply data to worker. Add call to bgp_table_lock(). - bgp_clear_route(): Add support for BGP_CLEAR_ROUTE_NORMAL or BGP_CLEAR_ROUTE_MY_RSCLIENT. - bgp_clear_route_all(): Use BGP_CLEAR_ROUTE_NORMAL. Bug 397 fixes: - bgp_default_originate() - bgp_announce_table() * bgpd/bgp_table.h: - struct bgp_table: Added reference count. Changed type of owner to be "struct peer *" rather than "void *". - struct bgp_node: Correct reference counter "lock" to be signed. * bgpd/bgp_table.c: - Added bgp_table reference counting. - bgp_table_free(): Fixed cleanup code. Call peer_unlock() on owner if set. - bgp_unlock_node(): Added assertion. - bgp_node_get(): Added call to bgp_lock_node() to code path that it was missing from. * bgpd/bgp_vty.c: - peer_rsclient_set_vty(): Call peer_lock() as part of peer assignment to owner. Handle failure gracefully. - peer_rsclient_unset_vty(): Add call to bgp_clear_route() with BGP_CLEAR_ROUTE_MY_RSCLIENT purpose. * bgpd/bgp_zebra.c: Made it so zclient is global so bgp_exit() can use it. * bgpd/bgpd.c: - peer_lock(): Allow to be called when status is "Deleted". - peer_deactivate(): Supply BGP_CLEAR_ROUTE_NORMAL purpose to bgp_clear_route() call. - peer_delete(): Common variable listnode pn. Fix bug in which rsclient was only dealt with if not part of a peer group. Call bgp_clear_route() for rsclient, if appropriate, and do so with BGP_CLEAR_ROUTE_MY_RSCLIENT purpose. - peer_group_get(): Use XSTRDUP() instead of strdup() for conf->host. - peer_group_bind(): Call bgp_clear_route() for rsclient, and do so with BGP_CLEAR_ROUTE_MY_RSCLIENT purpose. - bgp_create(): Use XSTRDUP() instead of strdup() for peer_self->host. - bgp_delete(): Delete peers before groups, rather than after. And then rather than deleting rsclients, verify that there are none at this point. - bgp_unlock(): Add assertion. - bgp_free(): Call bgp_table_finish() rather than doing XFREE() itself. * lib/command.c,h: Compiler warning fixes. Add cmd_terminate(). Fixed massive leak in install_element() in which cmd_make_descvec() was being called more than once for the same cmd->strvec/string/doc. * lib/log.c: Make closezlog() check fp before calling fclose(). * lib/memory.c: Catch when alloc count goes negative by using signed counts. Correct #endif comment. Add log_memstats_stderr(). * lib/memory.h: Add log_memstats_stderr(). * lib/thread.c: thread->funcname was being accessed in thread_call() after it had been freed. Rearranged things so that thread_call() frees funcname. Also made it so thread_master_free() cleans up cpu_record. * lib/vty.c,h: Use global command_cr. Add vty_terminate(). * lib/zclient.c,h: Re-enable zclient_free().
2009-06-12[cleanup] Make command nodes staticStephen Hemminger
The cmd_nodes used to configure vty, can mostly be static so (basic data hiding 101).
2008-08-23[vty] Add support for a 'restricted mode' with anonymous vty connectionsPaul Jakma
* lib/command.h: Add a RESTRICTED_NODE, intended for use with anonymous, 'no login' vtys, to provide a subset of 'view' mode commands. * lib/command.c: Add RESTRICTED_NODE bits, nothing special, just following VIEW_NODE. * lib/vty.c: (vty_auth) enable authentication should fall back to restricted/view node as appropriate. (vty_create) init vty's to restricted/view node as appropriate, for the 'no login' case. (vty_{no_,}restricted_mode_cmd) config commands to enable 'anonymous restricted' in vty configuration. (vty_config_write) 'anonymous restricted' config. (vty_init) Install some commands to restricted mode, and the 'anonymous restricted' config commands into VTY_NODE. * bgpd/*.c: Install some of the safe(r) BGP commands into 'restricted mode', i.e. lookup commands of non-sensitive data. Useful with looking-glass route-servers.
2007-04-28[logging] Add new "log timestamp precision" command for subsecond timestampsAndrew J. Schorr
2007-04-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * command.c: (config_write_host) Save "log timestamp precision" if not default value. (show_logging) Show configured timestamp precision. (config_log_timestamp_precision) Enable configuration of timestamp precision. (no_config_log_timestamp_precision) Restore default timestamp precision. (cmd_init) Install new timestamp precision commands. * log.h: (struct zlog) New timestamp_precision field. (quagga_timestamp) New function to generate a timestamp with the desired precision. (struct timestamp_control) Declare a structure for use in avoiding repeated duplicate calls to quagga_timestamp. * log.c: (quagga_timestamp) New function to generate a timestamp of the desired precision. (time_print) Call quagga_timestamp if the time hasn't already been calculated. (vzlog) Initialize a timestamp_control structure and pass it to time_print and vty_log. (zlog_backtrace) Fix 64-bit problem: cannot print size_t with %u. * vty.h: Must now include "log.h". (vty_log) Takes an additional struct timestamp_control argument. * vty.c: (vty_log_out) Use new struct timestamp_control and new quagga_timestamp function to print timestamps of the desired precision. (vty_time_print) Use new quagga_timestamp function. (vty_log) Accept new struct timestamp_control argument and pass it down to vty_log_out.
2006-06-15[lib] Fix vector leak in error path in command.c, CID #38Paul Jakma
2006-06-15 Paul Jakma <paul.jakma@sun.com> * command.c: (cmd_describe_command_real) Fix leak, CID #38.
2006-05-12[lib] CID #55, fix return of freed pointer, cmd_describe_command_realPaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * command.c: (cmd_describe_command_real) Fix return of freed pointer when no-match, CID #55.
2006-05-12[lib] CID #37, fix error case leak, cmd_complete_command_realPaul Jakma
2006-05-12 Paul Jakma <paul.jakma@sun.com> * command.c: (cmd_complete_command_real) Fix leak of cmd_vector in error case, Coverity CID #37.
2005-10-262005-10-26 Paul Jakma <paul.jakma@sun.com>paul
* command.c: Use MTYPE_HOST, MTYPE_STRVEC. Some other fixups, including fixing some likely leaks in config_write_file. * vty.c: memory macro usage fixes. (vty_read_config) fix leak where relative config file is specified.
2005-09-052005-09-05 Paul Jakma <paul.jakma@sun.com>paul
* command.c: (install_element) be more robust. Eg, cmd_init need not have been called, some applications may use other library subsystems, which call install_element, without the application wanting commands and hence not calling cmd_init.
2005-08-222005-08-22 Hugo Santos <hsantos@av.it.pt>paul
* command.h: (enum node_type) Add BGP_IPV6M_NODE * command.c: (node_parent) Handle BGP_IPV6M_NODE node (config_exit, config_end) ditto * vty.c: (vty_end_config) Handle BGP_IPV6M_NODE node
2005-05-062005-05-06 Paul Jakma <paul@dishone.st>paul
* (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
2005-04-252005-04-25 Paul Jakma <paul.jakma@sun.com>paul
* workqueue.{c,h}: Helper API for setting up and running queues via background threads. * command.c: install the 'show workqueues' command * memtypes.c: Add work queue mtypes, and a rib-queue type for a zebra rib work queue. * memtypes.h: Updated to match memtypes.c * Makefile.am: Add new workqueue files to build.
2005-03-142005-03-14 Paul Jakma <paul.jakma@sun.com>paul
* (global) update all c files to match the lib/vector.h rename of (struct vector).active to max, and vector_max macro to vector_active. * lib/vector.h: Rename to (struct vector).max to slightly less confusing active, for the number of active slots, distinct from allocated or active-and-not-empty. Rename vector_max to vector_active for same reason.
2005-03-142005-03-14 Paul Jakma <paul.jakma@sun.com>paul
* command.c: (various) Fix indentation and other whitespace.
2005-03-142005-03-14 Paul Jakma <paul.jakma@sun.com>paul
* command.c: (sort_node) use vector_max instead of referencing (struct vector *)->max directly. Test that vector_max is > 0 before using it to calculate an index. Fixup vector loop to make main body conditional on vector slot not being empty. (cmd_cmdsize) Fixup vector loop to make main body conditional on vector slot not being empty. (cmd_filter_by_completion) ditto (cmd_filter_by_string) ditto (is_cmd_ambiguous) ditto (cmd_describe_command_real) Change index integers to unsigned. Test that vector_max is > 0 before using it to calculate an index. Return immediately with CMD_ERR_NO_MATCH if vline has no active slots. Fixup vector loop to make main body conditional on vector slot not being empty. (cmd_complete_command_real) ditto. (cmd_execute_command_strict) Fixup vector loop to be conditional on non-null slot.
2005-03-092005-03-09 Paul Jakma <paul.jakma@sun.com>paul
* command.c: (config_list_cmd) Don't list hidden or deprecated commands, hiding these from tab completion is still to be done.
2005-03-092005-03-09 Paul Jakma <paul.jakma@sun.com>paul
* command.c: Undo commit of sign warning fix and hidden command in list_cmd. Sign warning is more subtle. list_cmd on its own will be committed after.
2005-03-082005-03-08 Paul Jakma <paul.jakma@sun.com>paul
* command.c: (no_banner_motd_cmd) use XFREE. * vty.c: (vty_hello) fix the indentation and comment.
2005-03-082005-03-08 Paul Jakma <paul.jakma@sun.com>paul
* command.c: (cmd_describe_command_real) sign compile warning fix (cmd_complete_command_real) ditto. (config_list_cmd) Don't list hidden or deprecated commands, hiding these from tab completion is still to be done. * command.h: cmd attr enum should start at 1.
2005-03-082005-03-08 Paul Jakma <paul.jakma@sun.com>paul
* command.c: (banner_motd_file_cmd) use XSTRDUP/XFREE * vty.c: (vty_hello) suggestions from Andrew, read by line and stub out trailling non-printable characters on each line thus allowing us to specify VTY_NEWLINE to vty_out.
2005-03-082005-03-08 Jeroen Massar <jeroen@unfix.org>paul
* vty.c: (vty_hello) display motd file, if set * command.h: add char *motdfile to struct host * command.c: (config_write_host) write out motdfile config (banner_motd_file_cmd) new command, allow motd to be read from file. (no_banner_motd_cmd) free motdfile string, if needs be. (cmd_init) init (struct host).motdfile. Add new motd file commands.
2005-03-07 * command.c: host.name might be NULL.hasso
* vty.c: Fix fd leak. [backport candidate]
2005-01-282005-01-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* lib/command.h: Document behavior of argv_concat function. * lib/command.c: (argv_concat) Calculate total string length first so we can call malloc just once (instead of realloc'ing to add each string element). (do_echo,config_logmsg) Allow for possible NULL return value from argv_concat.
2005-01-23 * lib/command.[ch]: Make node_parent() function nonstatic. vtyh.c willhasso
use it as well. * vtysh/vtysh.c: Implement walkup in node tree for vtysh as it already works in vty.
2005-01-16 * command.[ch], vty.c: cmd_execute_command() function must not attempthasso
to walk up in the node tree if called from vtysh. Different daemons might have commands with same syntax in different nodes (for example "router-id x.x.x.x" commands in zebra/ospfd/ospf6d daemons). * vtysh.c: Reflect changes in lib. cmd_execute_command() should know now that it's called from vtysh and must not attempt to walk up in the node tree. [pullup candidate]
2005-01-142005-01-14 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* command.c (print_version): Do not bother even to examine host.name, since it is always NULL when this function is called from main.
2005-01-142005-01-14 Greg Troxel <gdt@fnord.ir.bbn.com>gdt
* command.c (print_version): Don't print host.name if it is NULL. Fixes segfault on Solaris reported by Goetz von Escher <goetz@open.ch> (pullup candidate)
2005-01-02Reverting some int -> unsigned int fixes in command.c for now. Fixes crashhasso
described in [quagga-dev 2292].
2004-12-172004-12-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* command.c: (do_echo) Added new "echo" command, useful for watchdog pinging to make sure the daemon is responsive.
2004-12-072004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* command.c: (config_write_host) Note that "log trap" is deprecated when writing out the config.
2004-12-072004-12-07 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* bgp_main.c: (main) The 2nd argument to openzlog has been removed. * isis_main.c: (main) The 2nd argument to openzlog has been removed. * ospf6_main.c: (main) The 2nd argument to openzlog has been removed. Note that stdout logging will no longer be enabled by default when not running as a daemon. * ospf_main.c: (main) The 2nd argument to openzlog has been removed. * rip_main.c: (main) The 2nd argument to openzlog has been removed. * ripng_main.c: (main) The 2nd argument to openzlog has been removed. * main.c: (main) The 2nd argument to openzlog has been removed. So stdout logging will no longer be enabled by default. * irdp_main.c: (irdp_finish) Reduce severity of shutdown message from LOG_WARNING to LOG_INFO. * vtysh.c: Make several functions static instead of global. Added several commands to support destination-specific logging levels. (vtysh_completion) This function is unused, so comment it out. * basic.texi: Document new logging features. Separate basic config commands from basic VTY commands. * log.h: Replace struct zlog flags and maskpri fields with maxlvl array to support individual logging levels for each destination. Remove the 2nd argument to openzlog since the default logging config should be standardized inside the library. Replaced the zlog_set_flag and zlog_reset_flag functions with zlog_set_level. And zlog_set_file now requires an additional log_level argument. Declare zlog_proto_names for use inside command.c in the "show logging" command. Added defines useful for command construction. * log.c: (vzlog) Decide where to send the message based on the individual logging levels configured for each destination. Remove support for ZLOG_STDERR since it was never actually used. Support record-priority for terminal monitors. (zlog_signal,zlog_backtrace_sigsafe) Support destination-specific logging levels. Remove stderr support (was never used). Added support for terminal monitor logging. (_zlog_assert_failed) Increase message severity to LOG_EMERG. (openzlog) Remove 2nd argument since default config should be standardized in library. By default, terminal monitoring is set to debug, and all other logging is disabled. (zlog_set_flag,zlog_reset_flag) Removed. (zlog_set_level) New function to replace zlog_set_flag and zlog_reset_flag. Supports destination-specific logging levels. (zlog_set_file,zlog_reset_file) Support file-specific logging level. (zlog_rotate) Log an error message if fopen fails, and support new file-specific logging level. * command.h: Change DEFUN_CMD_FUNC_DECL and DEFUN_CMD_FUNC_TEXT so that command functions will be static instead of global. Remove declarations for config_exit and config_help. Define new macros DEFUNSH_ATTR, DEFUNSH_HIDDEN, and DEFUNSH_DEPRECATED so we can have deprecated commands in vtysh. Similarly, for completeness, define macros ALIAS_SH, ALIAS_SH_HIDDEN, and ALIAS_SH_DEPRECATED. Also, fix bug in ALIAS_ATTR macro (didn't matter because it was never used). * command.c: Make many functions static instead of global. (facility_name,facility_match,level_match) New functions to support enhanced destination-specific logging levels. (config_write_host) Support new destination-specific logging levels. (config_logmsg) Added new "logmsg" command to help test logging system. (show_logging) Added "show logging" command to show the current configuration of the logging system. (config_log_stdout_level) Support explicit stdout logging level. (no_config_log_stdout) Now takes optional LEVEL arg. (config_log_monitor,config_log_monitor_level,no_config_log_monitor) New commands creating new "log monitor" commands to set terminal monitoring log level. (config_log_file_level) Support explicit file logging level. (config_log_syslog_level) Support explicit syslog logging level. (config_log_facility,no_config_log_facility) Implement new "log facility" command. (cmd_init) Add hooks for new commands: "show logging", "logmsg", "log stdout <level>", "log monitor", "log monitor <level>", "no log monitor", "log file <filename> <level>", "no log file <filename> <level>", "log syslog <level>", "log facility", and "no log facility". * vty.h: Added a "level" argument to vty_log so it can support "log record-priority". Declare new function vty_log_fixed for use in signal handlers. * vty.c: (vty_log,vty_log_out) Added a "level" argument to support "log record-priority" for vty terminal monitors. (vty_down_level) Use config_exit_cmd.func instead of calling config_exit directly (since command functions will now be static instead of global). (vty_log_fixed) New function to send terminal monitor messages from inside a signal handler.
2004-12-032004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* command.h: Remove fields log_stdout and log_syslog from struct host, since they are just trying to duplicate information in the zlog_default structure. Note that this fixes a bug since those fields were not registering any logging that was established in the initial call to openzlog (this affects only the zebra and ospf6d daemons). It is probably a bug to turn on any logging by default in the call to openzlog. * command.c: (config_write_host) Get logging info from zlog_default instead of now-removed fields host.log_stdout and host.log_syslog. (config_log_stdout,no_config_log_stdout) Do not set now-removed field host.log_stdout, since this info is recorded in zlog_default. (config_log_file) Use XSTRDUP (instead of strdup) to set host.logfile. (config_log_syslog,config_log_syslog_facility,no_config_log_syslog) Do not set now-removed field host.log_syslog, since this info is recorded in zlog_default.
2004-11-232004-11-23 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* log.c: (vzlog) Take a single va_list argument and use va_copy as necessary for multiple traversals. (zlog) Pass only one va_list to vzlog. (zlog_*,plog_*) Use a macro for boilerplate code; pass only one va_list to vzlog. (zlog_set_file) Remove unused 2nd argument (flags). (zlog_save_cwd,zlog_get_cwd,zlog_free_cwd) Remove unused functions. * log.h: Remove ZLOG_*_INDEX defines (no longer used). Remove unused 2nd argument from zlog_set_file prototype. Fix prototype for zlog_rotate. * command.c: (config_log_file) Remove unused 2nd arg to zlog_set_file. * vty.c: (vty_out) Fix stdarg usage to perform multiple traversals properly. (vty_log) Must use va_copy for multiple traversals of va_list arg.
2004-11-202004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* global: Replace strerror with safe_strerror. And vtysh/vtysh.c needs to include "log.h" to pick up the declaration.
2004-10-19Small copyright string and hostname related cleanup.hasso
2004-10-13Fix critical bugzilla #113. Make CMD_ERR_NOTHING_TODO nonfatal.hasso
2004-10-132004-10-13 Paul Jakma <paul@dishone.st>paul
* (global) more const'ification. * sockunion.c: (sockunion_su2str) buffer should be sized SU_ADDRSTRLEN. (sockunion_log) do not return stack variables, strdup buf before return. * vty.h: Fix up the VTY_GET_INTEGER macros. Testing caller supplied values against ULONG_MAX is daft, when caller probably has passed a type that can not hold ULONG_MAX. use a temporary long instead. Add VTY_GET_LONG, make VTY_GET_INTEGER_RANGE use it, make VTY_GET_INTEGER a define for VTY_GET_INTEGER_RANGE.
2004-10-102004-10-10 Paul Jakma <paul@dishone.st>paul
* version.h.in: (pid_output*) add const qualifier. * command.h: Change DEFUN func to take const char *[] rather than char **, to begin process of fixing compile warnings in lib/. Nearly all other changes in this commit follow from this change. * buffer.{c,h}: (buffer_write) pointer-arithmetic is gccism, take const void * and cast an automatic const char *p to it. (buffer_putstr) add const * command.c: (zencrypt) const qualifier (cmd_execute_command_real) ditto (cmd_execute_command_strict) ditto (config_log_file) ditto. Fix leak of getcwd() returned string. * memory.{c,h}: Add MTYPE_DISTRIBUTE_IFNAME for struct dist ifname. * distribute.{c,h}: Update with const qualifier. (distribute_free) use MTYPE_DISTRIBUTE_IFNAME (distribute_lookup) Cast to char *, note that it's ok. (distribute_hash_alloc) use MTYPE_DISTRIBUTE_IFNAME. (distribute_get) Cast to char *, note that it's ok. * filter.c: Update with const qualifier. * if.{c,h}: ditto. * if_rmap.{c,h}: ditto. (if_rmap_lookup) Cast to char *, note that it's ok. (if_rmap_get) ditto. * log.{c,h}: Update with const qualifier. * plist.{c,h}: ditto. * routemap.{c,h}: ditto. * smux.{c,h}: ditto. Fix some signed/unsigned comparisons. * sockopt.c: (getsockopt_cmsg_data) add return for error case. * vty.c: Update with const qualifier.
2004-10-07Even more const strings and fix to bugfix.hasso
2004-10-07Make more strings const.hasso
2004-10-05Number of warnings is down to 3 again in lib directory. A lot of const'shasso
added to strings and a lot of int -> unsigned int changes.
2004-10-03Big vtysh cleanup. See changelogs for details.hasso