summaryrefslogtreecommitdiffstats
path: root/lib/memory.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove CONFIRM(_POSIX_REENTRANT_FUNCTIONS) -- not POSIX !Chris Hall2012-04-121-3/+8
| | | | | | | | | | | | | Turns out that _POSIX_REENTRANT_FUNCTIONS is not a POSIX feature test macro... name notwithstanding. It appears to be quite well known, but in some cases appears to be a feature request, and in others a feature test :-( So, since it adds no value -- and breaks FreeBSD -- the CONFIRM is removed. Further work in progress for Watch-Dog -- all known mutexes are held in an all known mutexes list, complete with name of mutex for diagnostic purposes.
* Further work on Watch-Dog and extend "debug bgp update"Chris Hall2012-04-111-2/+2
| | | | | | | | | | | | | | | | | For "debug bgp update out" log the dispatch of UPDATE messages by the BGP Engine -- so the logging shows what the Routing Engine decided to send, and the BGP Engine show what was actually written away. [In passing, in bgp_connection_write_action() treat a zero return from write() and an EAGAIN/EWOULDBLOCK.] Watch-Dog now tracks the CPU utilisation for each nexus, and checks that each one runs at least once between watch-do runs. The pthread_getcpuclockid() may or may not be supported, and that must be determined at run-time. So, some changes made to the qlib_init_first_stage() to capture this.
* Fix a few issues thrown up by compiling under FreeBSDChris Hall2012-03-281-2/+1
| | | | | | | | | | | | | | | | | | | | | * lib/memory.c, show_memory_summary_info() Call of mem_mt_get_stats() (under HAVE_MALLINFO skip) needed an extra parameter. * lib/vty_io.c POSIX standard header for wait stuff is <sys/wait.h> * lib/vty_io_file.c, uty_pipe_exec_prepare() F_DUPFD_CLOEXEC is POSIX-2008 (Issue 7) but FreeBSD 9.0 is not. Since this is not vital, recast slightly to avoid the need. * /lib/vty_io_vtysh.c, sock_unix_set_path() Fix complete nonsense under HAVE_STRUCT_SOCKADDR_UN_SUN_LEN skip.
* Tidy up some XMALLOC items that were not being XFREE'd.Chris Hall2012-03-221-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | * bgp_peer_index replace unused bgp_peer_index_reset() by bgp_peer_index_finish() and call same at bgp shut-down. discard unused bgp_peer_index_mutex_free() and replace bgp_peer_index_mutex_init() by bgp_peer_index_init_r(). * lib/command.c and command_parse.c add cmd_parser_finish() to discard store of "words" and arrange to call same in cmd_table_terminate(). * reset vector of files in qps_selection_ream(), so that frees the vector body -- which it should have been doing ! * add mem_mt_show_stderr() for debug (for all the use it may be). * fix qpt_mutex_destroy(), qpt_cond_destroy() and qpt_spin_destroy() so that if fail when !qpthreads_active will log the error (and not crash). Sweeps issues under the carpet, but does not hide same.
* vtysh partly restored. bgpd not crashing on over-size messages.Chris Hall2012-02-191-55/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NB: this is a partial interim version -- NOT for production. Reinstate vtysh. In bgpd: cope better with generating oversize messages. The "pipework" branch is no more. There is now "euro_ix" and "euro_ix_b", where 'b' stands for 'bleedin'. The "pipework" is currently in 'bleedin'. Version updated to: 0.99.18ex20b Major changes in this commit: * modified bgpd to avoid crashing if an oversize message is created. At present, any oversize messages are simply discarded. This may be a mistake... since it is possible that some routes that should have been withdrawn are not. TBA. The stream lib facilities have been overhauled to may this easier. * restoring vtysh. At present the vtysh is thought to work, except that it does not currently create integrated configuration files. For the time being, *only* the following compile: lib, bgpd, zebra, vtysh, tests All other daemons will fail to compile, and must be disabled.
* Fix formatting of memory region "show" when no memory_trackerChris Hall2011-09-081-9/+12
|
* Update the scaled number output and memory show commands.Chris Hall2011-09-061-513/+35
| | | | | | | | | | | Functions to output scaled decimal and binary numbers were implemented for memory show commands. Those have been generalised and placed in the qfstring.c. The memory show commands have been updated to use the newer functions, and a small test program for those has been implemeted. Other small updates to qfstring.c, qstring.c and qpath.c.
* Update pipework and improve memory reporting.Chris Hall2011-07-211-359/+3111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve error handling for all new pipework inputs and outputs. Change behaviour of ^C from VTY Terminal, so that will interrupt output and terminate all running pipes -- including running shell commands. In pipe commands, recognise "~/..." and "~user/..." home directory forms. Changed "~/" to mean the usual home for the current user. "~~/" now means the configuration file directory. Introduced "shdir DIR" command to show what is (currently) what. Changed "<|" so that if the command has a path, it is expanded using Quagga's rules (including "~~/" and "~./") and the "here" directory is set to that path. Fixed collection of stderr output from all pipes so that is separate from stdout output, and is always sent to the base output (eg VTY Terminal). Increase amount of information about the heap that "show mem" shows -- particularly if the "memory_tracker" is enabled. Tested and applied resulting fixes.
* Merge branch 'master' of /git/quagga.euro-ix into pipeworkex16pChris Hall2011-03-291-0/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | This ensures that the two branches are consistent after the merging of the old-Quagga 0.99.18 changes. Release: 0.99.18ex16p. Eliminated some whitespace differences ! Collected RESTRICTED_NODE show_bgp_ipv6_safi_route_cmd and show_bgp_ipv6_safi_prefix_cmd, and one HAVE_IPV6 skip. Also releasing filename in closezlog(). Removed strlen() from lib/qfstring.c for async-signal-safe purposes.
| * Bring "ex" version up to date with 0.99.18ex14Chris Hall2011-03-291-0/+27
| | | | | | | | | | | | | | | | Release: 0.99.18ex14 Also fixes issue with unknown attributes -- does not release them prematurely. Contains the "bgpd: New show commands for improved view and address family support", which is post 0.99.18. (But not RFC 5082 GTSM.)
* | Bring "ex" version up to date with 0.99.18ex15pChris Hall2011-03-291-2/+23
| | | | | | | | | | | | | | | | | | Release: 0.99.18ex15p -- Pipework Branch Also fixes issue with unknown attributes -- does not release them prematurely. Contains the "bgpd: New show commands for improved view and address family support", which is post 0.99.18. (But not RFC 5082 GTSM.)
* | Upgrade of "pipework" -- including piping to/from shell commandsex11pChris Hall2011-03-211-53/+55
| | | | | | | | | | | | Version 0.99.15ex11p A major overhaul.
* | Second tranche of updates for pipework branch.Chris Hall2011-02-131-13/+13
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | modified: bgpd/bgp_connection.c modified: bgpd/bgp_debug.c modified: bgpd/bgp_engine.h modified: bgpd/bgp_main.c modified: bgpd/bgp_packet.c modified: bgpd/bgp_peer.c modified: bgpd/bgp_route.c modified: bgpd/bgp_routemap.c modified: bgpd/bgp_session.c modified: bgpd/bgp_vty.c modified: bgpd/bgpd.c modified: bgpd/bgpd.h modified: configure.ac modified: isisd/dict.h modified: isisd/isis_misc.c modified: isisd/isis_routemap.c modified: isisd/isis_spf.c modified: lib/Makefile.am modified: lib/command.c modified: lib/command.h modified: lib/command_execute.h modified: lib/command_parse.c modified: lib/command_parse.h modified: lib/command_queue.c modified: lib/command_queue.h modified: lib/elstring.h modified: lib/heap.c modified: lib/if.c modified: lib/if.h modified: lib/keychain.c modified: lib/keystroke.c modified: lib/keystroke.h modified: lib/list_util.c modified: lib/list_util.h modified: lib/log.c modified: lib/log.h modified: lib/memory.c modified: lib/memory.h modified: lib/memtypes.c modified: lib/misc.h modified: lib/mqueue.c modified: lib/mqueue.h deleted: lib/node_type.h modified: lib/pthread_safe.c modified: lib/qfstring.c modified: lib/qiovec.c modified: lib/qiovec.h modified: lib/qpath.c modified: lib/qpnexus.c modified: lib/qpnexus.h modified: lib/qpselect.c modified: lib/qpthreads.h modified: lib/qstring.c modified: lib/qstring.h modified: lib/qtime.c modified: lib/qtime.h modified: lib/qtimers.c modified: lib/qtimers.h modified: lib/routemap.c modified: lib/symtab.h modified: lib/thread.h deleted: lib/uty.h modified: lib/vector.c modified: lib/vector.h modified: lib/version.h.in modified: lib/vio_fifo.c modified: lib/vio_fifo.h modified: lib/vio_lines.c modified: lib/vio_lines.h modified: lib/vty.c modified: lib/vty.h modified: lib/vty_cli.c modified: lib/vty_cli.h modified: lib/vty_io.c modified: lib/vty_io.h modified: lib/vty_io_basic.c modified: lib/vty_io_basic.h modified: lib/vty_io_file.c modified: lib/vty_io_file.h modified: lib/vty_io_shell.c modified: lib/vty_io_term.c modified: lib/vty_io_term.h modified: lib/vty_local.h modified: lib/vty_pipe.c modified: lib/workqueue.h modified: lib/zebra.h modified: ospf6d/ospf6_lsa.c modified: ripngd/ripngd.c modified: tests/test-list_util.c modified: tests/test-vector.c modified: vtysh/vtysh.c modified: vtysh/vtysh_config.c
* Introduce "rs-in" route-maproot2010-07-281-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | All peers may be configured with an "rs-in" route-map, whether they are rsclients, or not. All routes from a given peer are passed through the "rs-in" route-map before being considered for inclusion in any rsclients RIBs. Routes pass through the "rs-in" route-map once, irrespective of the number of rsclients. An "rs-in" route-map is intended to be used to ensure that routes from a given peer are kosher, before being passed to rsclients. The "in" route-map and filters may do the same, but for the main RIB. Any route-selection type actions that the "in" route-map may do for the main RIB will probably be done in the "import" route-map for an rsclient RIB. Also: * make zfree() work for NULL items, in lib/memory.c * fix clear ip bgp .... so works when pEstablished Version change to ex03.
* Trap SIGABRT so that get backtrace in the log.root2010-07-221-2/+4
| | | | | Improve handling of notification objects, and the printing of same to the logs.
* Reinstate NOTIFICATION logging and turn off Memory TrackerChris Hall2010-05-131-1/+1
| | | | | | | | | In the introduction of the BGP Engine the logging of NOTIFICATION messages fell by the wayside. This change reinstates that logging. This change also turns off the Memory Tracker, unless QDEBUG is defined.
* New functions for error numbers and addresses in messages.Chris Hall2010-04-081-1/+1
| | | | | | | | Implemented less onerous ways of including descriptions of errors and IP addresses in logging and other messages. Implemented mapping of error numbers to error names, which is generally more meaningful.
* Major updateChris Hall2010-03-161-110/+312
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bgpd/bgp_advertise.c bgpd/bgp_advertise.h The adj_in and adj_out objects are now put on a list based on the peer to whom the route belongs. The adj_in and adj_out objects also now point to the bgp_node which they are routes for. This substantially reduces the work needed to shut down a peer. bgpd/bgp_damp.c Changes to adj_in and adj_out forced small change to macros used in bgp_damp.c to manage its lists. bgpd/bgp_debug.c Replaced direct access to vty->node by the required vty_get_node(). bgpd/bgp_dump.c Changes to the names of fields in bgp_info structures. bgpd/bgp_engine.h Modified the debug and trace functions. bgpd/bgp_fsm.c Make use of sockunion2str() consistent with common usage. Improved some documentation. bgpd/bgp_main.c Use the newly extended qpn_add_hook_function() facility. bgpd/bgp_mplsvpn.c Changes to the names of fields in bgp_info structures. bgpd/bgp_msg_read.c Bug fix: correct handling of capability code length. Improvement: better casting in calculation of message length. bgpd/bgp_msg_write.c Bug fix: correct byte ordering of bgp_id in open message. bgpd/bgp_network.c Bug fix: correct handling of incoming connections. Takes advantage of improvements in sockunion.c. bgpd/bgp_nexthop.c Changes to the names of fields in bgp_info structures. bgpd/bgp_open_state.c Remove mistaken #include of memtypes.h bgpd/bgp_packet.c Improvements to handling of withdrawing routes for peers. bgpd/bgp_peer.c Tidying up the state of peers as they are enabled and disabled. Improvements to handling of withdrawing routes for peers. bgpd/bgp_peer.h Adding list bases for lists of routes originated by the peer. bgpd/bgp_peer_index.c Bug fix: correct freeing of peer indexes. bgpd/bgp_route.c Implement lists of bgp_info based in the owning peer. Adjust for name changes to bgp_info fields. Reimplemented all the clearing functions to use the lists of items that belong to the peer -- rather than searching route tables for stuff to withdraw. Changed work queue handling for added/changed routes, so that queues run through existing items, rather than having queues of auxiliary items -- lower memory overhead. bgpd/bgp_route.h Added fields to bgp_info to allow all bgp_info originated by each peer to live on lists based in the peer. And changed the name of existing fields to avoid confusion. bgpd/bgp_routemap.c Removing redundant code and fixing a memory leak. bgpd/bgp_table.h Based work queue for added/changed routes directly in the table, rather than having auxiliary structures. bgpd/bgp_vty.c Use vty_get_node() and vty_set_node() rather than direct access to the vty field. bgpd/bgpd.c Implement changes to route clearing. bgpd/bgpd.h Changes to work queue handling. lib/buffer.c Changes to allow embedded buffer structures. lib/buffer.h Moved struct buffer here so that could have embedded buffer structurs. lib/command.c Substantial tidy up and document exercise. Restructured the top level command processing and finding of descriptions and command completion. Removal of unpleasant messing around with the insides of vector structures. Movement of some command actions to vty.c. Uses uty.h to pick up the "private" functions from vty.c et al. lib/command.h Moved the "node" values to node_type.h, so that can use an enum node_type in places where cannot include command.h. lib/command_queue.c Updated to cope with the called command changing the node value. Improved handling of revoked commands, so the the command line handler does not get stuck waiting for a command to complete which has been revoked ! lib/command_queue.h Improved message format. lib/if.c Use vty_set_node(). lib/keychain.c Use vty_set_node(). new lib/keystroke.c new lib/keystroke.h New code to implement a keystroke FIFO. This moves some complexity out of the command handler. The handling of mixtures of escapes and Telnet IACs is tightened up. It would be possible to extend this to, say, UTF-8. Regularises the "stealing" of keystrokes for the "--more--" output handling... which was a bit hit and miss. new lib/list_util.c new lib/list_util.h New code to implement various forms of linked list, where the list pointers are embedded in structures. lib/log.c Changed the handling of log messages, so that all types of log output (except syslog) use the same message buffer scheme, and the message is constructed once and once only. Changes to the handling of VTY_LOCK() etc. Uses uty.h to pick up the "private" functions from vty.c et al. lib/log.h Changes to the buffering of log messages. new lib/mem_tracker.c New code to track memory allocation/deallocation, for debug purposes. lib/memory.c lib/memory.h Updated to allow the use of the mem_tracker. lib/memtypes.awk Made the memtypes into a named enum MTYPE. lib/memtypes.c Various new memory types. lib/mqueue.c lib/mqueue.h Add mqueue_finish function for close-down. lib/network.c lib/network.h Added non-blocking read_nb() and write_nb(). new lib/node_type.h As above. lib/plist.c Remove vty_puts() which wasn't a good idea. lib/qlib_init.c Added qps_init() to first stage and mqueue_finish to finish. lib/qpnexus.c lib/qpnexus.h More flexible hooks for in_thread_init and in_thread_final. lib/qpselect.c lib/qpselect.h Added qps_start_up() to build the required maps once and for all. Added qdebug to control the debug checks and validation. Improved validation and test functions. new lib/qstring.c new lib/qstring.h New code for limited flexible string handling. lib/qtimers.c Added qdebug to control the debug checks and validation. lib/routemap.c Use vty_set_node(). lib/sockunion.c lib/sockunion.h Tidied up and regularised the handling of sin_len and sin6_len. Created common function for setting port into socket. Created common function for initialisation/allocation of new sockunion. Reduced various functions by using common sub-functions. Rationalised some code. Added sockunion_listen() and sockunion_new_sockaddr(). Renamed sockunion_new() to sockunion_new_prefix(). Improved some logging messages. Added documentation. new lib/uty.h Functions etc. used only by vty/command/log/vty_io and vty_cli. lib/vector.c lib/vector.h Added vector_t type. Removed VECTOR_INDEX, vector_only_wrapper_free() and vector_only_index_free() -- following improvement of code in command.c. Added vector_set_min_length(), vector_set_new_min_length() and vector_length() functions. new lib/vio_fifo.c new lib/vio_fifo.h New code to manage simple FIFO of indefinite length. lib/vty.c lib/vty.h Reworked. Broken into vty.c, vty_io.c and vty_cli.c. new lib/vty_cli.c new lib/vty_cli.h CLI handling parts of the vty family. new lib/vty_io.c new lib/vty_io.h I/O parts of the vty family. lib/workqueue.h Introduced tyedefs for the various call-back entries. new tests/test-list_util.c Tests for the list-util stuff. vtysh/vtysh.c Small change to interface for cmd_execute_command()
* Use static mutexespaulo2009-12-171-11/+5
|
* Fix shutdown. Move cpu stats command to cli thread.paulo2009-12-171-1/+6
|
* Fix race condition when threads start. Make memory stats thread safepaulo2009-12-161-31/+83
| | | | Run memory commands in cli thread.
* Upgrade lib/vector.c & .hChris Hall (GMCH)2009-11-241-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This upgrade maintains the existing vector operations, but changes the underlying mechanisms. It then adds a number of new functions, extending the operations on vectors. The "struct vector" is redefined, which affects only some code in lib/command.c -- which pokes around inside what should be treated as a private data structure. Pro tem this is supported by a macro. The constant VECTOR_MIN_SIZE has been removed -- if there is a minimum size that should be enforced by the vector code. New functions include: vector_insert_item -- insert item, moving existing items vector_move_item -- move item from place to place in vector vector_delete_item -- delete item and close up gap vector_reverse -- reverse order of vector vector_push_item -- simple push vector_pop_item -- simple pop vector_insert -- insert 1 or more NULL items, moving existing items vector_delete -- delete 1 or more items and close up gap vector_bsearch -- perform binary search on vector vector_sort -- qsort vector vector_copy_here -- make copy of body of vector vector_move_here -- move body of vector vector_copy_append -- append copy of vector to end of another vector_move_append -- move body of vector to the end of another vector_copy_extract -- copy part of one vector to another vector_move_extract -- move part of one vector to another vector_copy_splice -- copy part of one vector to replace part of another, taking a copy of the replaced part vector_move_splice -- move part of one vector to replace part of another, taking a copy of the replaced part vector_copy_replace -- copy part of one vector to replace part of another vector_move_replace -- move part of one vector to replace part of another vector_discard -- discard body of vector vector_chop -- discard any unused memory in body of vector vector_decant -- decant vector to new body Other files affected: command.c: -- removal of VECTOR_MIN_SIZE -- use of vector_sort() -- use of VECTOR_INDEX to poke around inside vector (removing this is TODO) memtypes.c & memory.c -- updating names and comments for vectors vty.c -- removal of VECTOR_MIN_SIZE memory.h -- added SIZE(t,n) macro -- (sizeof(t) * (n))
* [bgpd] Stability fixes including bugs 397, 492Chris Caputo2009-07-191-3/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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().
* [vty] Add support for a 'restricted mode' with anonymous vty connectionsPaul Jakma2008-08-231-0/+10
| | | | | | | | | | | | | | | | | | | | * 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.
* [lib] mes_lookup string lookup table argument should be marked constStephen Hemminger2008-08-221-1/+1
| | | | | | | | | 2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com> * lib/log.{c,h}: struct message argument should point to const * */*.c: adjust to suit, Signed-off-by: Paul Jakma <paul@quagga.net>
* [lib] add mising UL qualifier to numerical constantPaul Jakma2008-01-081-1/+1
| | | | | | | | 2008-01-08 Pavol Rusnak <prusnak@suse.cz> * memory.c: (mtype_memstr) Fix accidental shift past width of type, constant should have been forced to UL, rather than being left to default to int.
* [lib] Fix typo in cpp conditional for malloc.h includePaul Jakma2006-06-301-1/+1
| | | | | | | 2006-06-28 Paul Jakma <paul.jakma@sun.com> * memory.c: Fix typo in cpp conditional around malloc.h, from comment in bug #269.
* [lib] malloc.h is deprecated, try not to include it anymorePaul Jakma2006-05-281-0/+3
| | | | | | | 2006-05-28 Paul Jakma <paul.jakma@sun.com> * memory.c: malloc.h is deprecated in favour of stdlib.h, however we still need it on GNU Libc for mallinfo().
* [lib/memory] Add mallinfo supportPaul Jakma2006-03-301-1/+116
| | | | | | | | | | | | | | | | | | | 2006-02-15 Paul Jakma <paul.jakma@sun.com> * configure.ac: Check for mallinfo, being careful to link test so we can detect things like umem being used (which doesn't provide a mallinfo). * lib/memory.c: (mtype_memstr) new helper function to return human friendly string for a byte count. (mtype_stats_alloc) new function, for users to retrieve number of objects allocated. (show_memory_mallinfo) New function, show mallinfo statistics if available. (show_memory_all_cmd) Call show_memory_mallinfo, if mallinfo is available. * lib/memory.h: Export mtype_memstr and mtype_stats_alloc. Provide a define for a reasonable buffer size for mtype_memstr.
* 2005-10-20 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-10-201-11/+23
| | | | | | | | * memory.c: (show_memory_vty) Omit zero statistics. Print separators only if some non-zero stats have been printed in between. (show_separator) New function to print a separator. (show_memory_all) Keep track of whether a separator is needed between the different memory statistics groups.
* 2005-05-06 Paul Jakma <paul@dishone.st>paul2005-05-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * (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-25 Paul Jakma <paul.jakma@sun.com>paul2005-04-251-1/+1
| | | | | * memory.c: Make the string field much wider * memtypes.c: Correct the prefix list str/entry strings
* 2005-04-15 Paul Jakma <paul@dishone.st>paul2005-04-151-196/+14
| | | | | | | | | | | | | | | | * memtypes.c: The new, unified location for memory type definitions. The memtype enum and declarations for memory_lists are built from this automatically and put into memtypes.h. * memtypes.awk: New script to generate memtypes.h from memtypes.c * memory.h: Finally, the enum can banished! * memory.c: Finally, the seperate mtype memory_list definitions can be banished! (log_memstats) Increase width of fields (show_memory_zebra_cmd) display zebra specific memory types. Increase width of fields. * Makefile.am: Add memtypes.{c,h}, add BUILT_SOURCES for memtypes.h Add a rule to build memtypes.h using memtypes.awk. Add memtypes.awk to EXTRA_DIST.
* 2004-12-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-12-081-1/+1
| | | | | | * prefix.c: (prefix_copy) Error message before abort should have severity LOG_ERR, not LOG_INFO. * memory.c: (mtype_log) Log level should be LOG_DEBUG, not LOG_INFO.
* 2004-11-26 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-11-261-2/+2
| | | | | * log.c, log.h, memory.c: Change function name from zlog_backtrace_safe to the more self-explanatory zlog_backtrace_sigsafe.
* 2004-11-26 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-11-261-0/+5
| | | | | | | | | | | * log.c: (zlog_backtrace) New function to log a backtrace. (zlog_backtrace_safe) Log a backtrace in an async-signal-safe way. Unfortunately, this function does not support syslog logging yet. (zlog_signal) Move backtrace code into separate function zlog_backtrace_safe. (_zlog_assert_failed) Call zlog_backtrace before aborting. * log.h: Declare new functions zlog_backtrace and zlog_backtrace_safe. * memory.c: (zerror) Call zlog_backtrace before aborting.
* 2004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-11-201-1/+1
| | | | | * global: Replace strerror with safe_strerror. And vtysh/vtysh.c needs to include "log.h" to pick up the declaration.
* 2004-11-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-11-161-18/+18
| | | | | | * memory.h: Fix prototype for memory_init(). * memory.c: Declare many functions and data structures static instead of global. Fix prototype for memory_init().
* 2004-11-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2004-11-151-16/+43
| | | | | | | | | * memory.c: (zerror) Use zlog_err instead of fprintf to stderr. Instead of exiting, log currenty memory usage and then abort. (log_memstats) New function to log memory statistics, called by zerror. (show_memory_all) Loop over new mlists array instead of calling show_memory_vty separately for each memory_list.
* 2004-10-10 Paul Jakma <paul@dishone.st>paul2004-10-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* First small part of lib cleanup. Mainly "constification" of arguments andhasso2004-10-041-4/+4
| | | | adding FIXME's.
* Merge isisd into the Quagga's framework:jardin2003-12-231-0/+34
| | | | | | | | | | - add privs support - use misc quagga's definitions - make it compile"able" - fix segfault cases related to hostname() - add debug isis xxx command This patch has been approved by Paul Jakma.
* Ripngd part of 6Wind patch.hasso2003-05-251-0/+27
|
* Initial revisionpaul2002-12-131-0/+493