Commit Graph

396 Commits

Author SHA1 Message Date
Paul Jakma
98954844ae [lib] Handle upgrade from SUNWzebra to Quagga for 'interface fooX:Y' commands
2006-10-14 Paul Jakma <paul.jakma@sun.com>

	* if.c: (general) Handle upgrades from SUNWzebra, which tried
	  to track each logical interface as a seperate struct
	  interface, to Quagga, which assigns only one struct interface
	  per ifindex.
	  (if_sunwzebra_get) Try decompose a logical interface name
          (fooX:Y) to the 'primary' name (fooX), for Solaris.
          (interface_cmd) Use if_sunwzebra_get on Solaris.
2006-10-15 23:33:50 +00:00
Andrew J. Schorr
965b83f9cc [snmp] Fix asn_build calls to pass correct variable sizes (fixes 64-bit issues)
2006-09-26 Pierre-Yves Ritschard <pierre-yves@spootnik.org>

	* smux.c: (smux_open,smux_trap,smux_register) Fix various
	  asn_build_* calls to pass the proper length in the final
	  argument: use sizeof(<variable>) instead of sizeof(<type>),
	  since there were several inconsistencies between the actual
	  variable type and the size that was passed.  This should
	  fix some problems on 64-bit architectures where sizeof(int)
	  != sizeof(long).
2006-09-26 15:30:43 +00:00
Paul Jakma
db9c0df934 [lib] Bug #134: threads should be more robust against backward time jumps
2006-08-25 Paul Jakma <paul.jakma@sun.com>

	* thread.c: (general) Add support for monotonic clock, it may still
	  jump forward by huge amounts, but should be immune to going
	  backwards. Fixes bug #134.
	  (quagga_gettimeofday_relative_adjust) helper, does what name
	  says - adjusts gettimeofday based relative timer.
	  (quagga_gettimeofday) helper to keep recent_time up to date.
	  (quagga_get_relative) helper, update and getch the relative
	  timer using gettimeofday(). POSIX CLOCK_MONOTONIC is also
	  supported, but the code is not enabled yet nor tested.
	  (quagga_real_stabilised) helper, retrieve absolute time but
	  stabilised so as to never decrease.
	  (quagga_gettime) Exported interface, analogous to POSIX
	  clock_gettime() in interface, supporting several clocks.
	  (quagga_time) Exported interface, analogous to traditional
	  time(), will never decrease.
	  (recent_relative_time) Convenience function to retrieve
	  relative_time timeval, similar to existing recent_time absolute
	  timeval, for when an approximately recent value will do.
	  (remainder) Update to use above helpers.
	  (thread_getrusage) Previously was a macro, but needs to be
	  a function to twiddle with thread.c private stuff.
	* thread.c: Point the GETRUSAGE macro at previous function.
	  Export quagga_gettime, quagga_time and recent_relative_time for
	  general use.
2006-08-27 06:44:02 +00:00
Paul Jakma
fbcba80514 [lib] remove autogenerated file, update .cvsignore 2006-07-27 22:52:17 +00:00
Paul Jakma
cc8b13a00b [lib] Optimise thread_call by caching pointer to thread history in the thread
2006-07-25 Paul Jakma <paul.jakma@sun.com>

	* thread.h: (struct thread) Add a cache pointer to the struct
	  cpu_thread_history, if it is known - saving hash lookup on
	  each thread_call.
	* thread.c: (thread_call) Cache the pointer to the
          cpu_thread_history, so that future thread_calls of same
          thread can avoid the hash_lookup.
2006-07-25 20:40:40 +00:00
Andrew J. Schorr
9d0a3260b2 [lib] Do not call vty_close in vty_log_out to avoid possible free memory access
2006-07-10 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* vty.c: (vty_log_out) Do not call vty_close, because this could
	  result in a parent function's accessing the freed memory.
	  Instead, set status VTY_CLOSE and call shutdown(vty->fd, SHUT_RDWR).
	  And add a comment on vty_close.
2006-07-11 00:06:49 +00:00
Andrew J. Schorr
74542d7301 [lib] Fix infinite recursion for errors on vtys with terminal monitor enabled
2006-07-10 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* vty.c: (vty_log_out, vty_read, vty_flush, vtysh_flush, vtysh_read)
	  After an I/O error, must set vty->monitor to 0 before calling
	  zlog_warn, otherwise an infinite recursion could occur
	  (since zlog_warn triggers a message to be written to the vty,
	  and that in turn triggers another error message when it fails, etc.).
2006-07-10 18:09:42 +00:00
Andrew J. Schorr
08942da588 [debug] Debug messages to terminal vty sessions should include timestamps
2006-07-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* vty.c: (vty_log_out) Debug messages to terminal vty sessions
	  should include timestamps.
2006-07-03 20:58:29 +00:00
Paul Jakma
adf6221437 [lib] Fix merge error in ChangeLog
- entry was left in wrong order, according to date.
2006-06-30 16:55:41 +00:00
Paul Jakma
74176d220b [lib] Fix typo in cpp conditional for malloc.h include
2006-06-28 Paul Jakma <paul.jakma@sun.com>

	* memory.c: Fix typo in cpp conditional around malloc.h, from
	  comment in bug #269.
2006-06-30 16:49:02 +00:00
Paul Jakma
5f41e90e49 [lib] Remove bare routes in route_types: fix mistake in commmit
2006-06-27 Paul Jakma <paul.jakma@sun.com>

	* route_types.awk: Fix previous commit. Forgot to remove the
	  printf of the bare/numeric route-type help string (empty string)
2006-06-27 10:42:18 +00:00
Paul Jakma
95509e64e3 [lib] Remove numeric route-type argument in redistribute arg strings
2006-06-27 Paul Jakma <paul.jakma@sun.com>

	* route_types.awk: Remove setting the 'bare' numeric route type
	  in redist strings.
2006-06-27 08:26:07 +00:00
Paul Jakma
9c42a6ebbc [lib] Centralise Zserv route type information, auto-generate redist strings
2006-05-23 Paul Jakma <paul.jakma@sun.com>

	* route_types.txt: New file, table of ZEBRA_ROUTE definitions.
	* route_types.awk: New script, to parse previous and generate
	  (for now) redistribute string defines.
	* Makefile.am: build route_types.h using previous two, ala
	  memtypes.h, include the script and table file in EXTRA_DIST.
	* command.h: pull in route_types.h, add a REDIST_STR define.
2006-06-27 07:52:03 +00:00
Paul Jakma
630c97ce0f [zebra] remove internal if_flag_dump, use libzebras version.
2006-06-15 Paul Jakma <paul.jakma@sun.com>

	* lib/if.c: (if_flag_dump) remove the whitespace indentation, callers
	  should provide.
	* zebra/interface.c: (if_flag_dump_vty) redundant code, remove.
	  (if_dump_vty) use libzebra if_flag_dump.
2006-06-15 12:48:17 +00:00
Paul Jakma
c024fd0c76 [lib] list_delete shouldn't duplicate list_delete_all_node
2006-06-15 Paul Jakma <paul.jakma@sun.com>

	* linklist.c: (list_delete) call list_delete_all_node, don't
	  duplicate it.
2006-06-15 12:43:09 +00:00
Paul Jakma
8ce5cfd13e [lib] Experimental: have XFREE NULL out the freed pointer
2006-06-15 Paul Jakma <paul.jakma@sun.com>

	* memory.h: Experimental, have XFREE macro NULL out the freed
	  pointer.
2006-06-15 12:41:02 +00:00
Paul Jakma
e5cd706c1a [lib] Fix vector leak in error path in command.c, CID #38
2006-06-15 Paul Jakma <paul.jakma@sun.com>

	* command.c: (cmd_describe_command_real) Fix leak, CID #38.
2006-06-15 12:25:55 +00:00
Paul Jakma
fb66b29c67 [lib] Add support for Sun libc printstack to zlog_backtrace_sigsafe
2006-05-28 Paul Jakma <paul.jakma@sun.com>

	* configure.ac:
	  Check for Sun libc printstack(), add a general HAVE_STACK_TRACE
	  define for lib/log.c, if any supported stack symbol dumping
	  function is found (glibc backtrace/sun libc printstack).
	* log.c: (general) Add support for Sun libc printstack().
	  (hex_append) make the cpp conditional on general HAVE_STACK_TRACE
	  define.
	  (zlog_backtrace_sigsafe) Ditto. Add printstack() version of the
	  the DUMP macro in this function.
2006-05-28 08:26:15 +00:00
Paul Jakma
a4b3030383 [lib] vty_log shouldn't crash if called when vty isn't initiliased
2006-05-28 Paul Jakma <paul.jakma@sun.com>

	* vty.c: (vty_log/vty_log_fixed) dont crash if called when vty
	  hasn't been initiliased.
2006-05-28 08:18:38 +00:00
Paul Jakma
d09552d0c7 [lib] malloc.h is deprecated, try not to include it anymore
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().
2006-05-28 08:15:46 +00:00
Paul Jakma
35cfc90cce [lib] include inttypes.h rather than stdint.h, provide defines where missing
2006-05-28 Paul Jakma <paul.jakma@sun.com>

	* zebra.h: Include inttypes.h rather than stdint.h, best practice
	  according to the autoconf manual.
	  Add UINT*_MAX defines for older platforms lacking these (FBSD 4)
2006-05-28 08:08:24 +00:00
Andrew J. Schorr
9c37851eac [interface configuration] Try to avoid losing address info after shutdown.
2006-05-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* if.h: (struct connected) Document the meaning of the
	  ZEBRA_IFC_REAL and ZEBRA_IFC_CONFIGURED flags.
	* connected.c: (connected_withdraw) Do not delete the connected
	  address if the ZEBRA_IFC_CONFIGURED flag is set.
	  (connected_add_ipv4,connected_add_ipv6) Before calling
	  connected_withdraw, unset the ZEBRA_IFC_CONFIGURED flag
	  on the superseded connected structure.
2006-05-21 04:04:49 +00:00
Paul Jakma
d6d672aaf9 [lib] Add string mapping table for Zserv commands
2006-05-15 Paul Jakma <paul.jakma@sun.com>

	* log.c: (general) Generalise struct zebra_route_desc into
	  struct zebra_desc_table and, similar to route_types, add a
	  command_types table to describe Zserv protocol commands.
	  (route_types[]) use a macro to use designated initialisers
	  while avoiding tedious duplication.
	  (zserv_command_string) lookup string from zebra_desc_table,
	  similar to zebra_route_string
	* zebra.h: Add declaration for zserv_command_string, adjust the
	  comments to reflect zebra_desc_table.
2006-05-15 16:56:51 +00:00
Paul Jakma
d16e043359 [lib] CID #39, Fix the vty completion leak-fix to only free when desired
2006-05-13 Paul Jakma <paul.jakma@sun.com>

	* vty.c: (vty_describe_command) CID #39 fix was too hasty, just
	  cause it /can/ leak doesn't mean it always will have, check
	  first.
2006-05-15 10:56:46 +00:00
Paul Jakma
5fc60519ed [lib] CID #55, fix return of freed pointer, cmd_describe_command_real
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 23:24:09 +00:00
Paul Jakma
2fe8aba3a0 [lib] CID #39, fix leak in error path, vty_describe_command
2006-05-12 Paul Jakma <paul.jakma@sun.com>

	* vty.c: (vty_describe_command) fix leak of describe vector in
	  error path, CID #39.
2006-05-12 23:22:01 +00:00
Paul Jakma
d2519962b7 [lib] CID #37, fix error case leak, cmd_complete_command_real
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.
2006-05-12 23:19:37 +00:00
Paul Jakma
9376c3421a [lib] CID #3, fix forward-null errors in vty_prefix_list_uninstall
2006-05-12 Paul Jakma <paul.jakma@sun.com>

	* plist.c: (vty_prefix_list_uninstall) Fix potential NULL deref
	  of prefix and typestr strings, Coverity CID #3.
2006-05-12 23:17:38 +00:00
Paul Jakma
86228fde80 [lib] command.c exports host global, add it to header.
2006-03-14 Paul Jakma <paul.jakma@sun.com>

	* privs.c: (zprivs_caps_init) Change user IDs before lowering
	  privileges, while this seems to work on Linux, on Solaris
	  it rightfully refuses due to PRIV_PROC_SETID having been
	  dropped.
	* command.h: Add the struct host global exported from command.c
2006-03-30 15:00:30 +00:00
Paul Jakma
213d8dadca [lib] Trivial: fix line lengths of a comment in workqueu.c
2006-03-30 Paul Jakma <paul.jakma@sun.com>

	* workqueue.c: (work_queue_run) fix line length of comment
2006-03-30 14:45:47 +00:00
Paul Jakma
6cf0cf0ca4 [lib] Mark most arguments in DEFUN_CMD_FUNC_TEXT as potentially unused
2006-03-30 Paul Jakma <paul.jakma@sun.com>

	* command.h: (DEFUN_CMD_FUNC_TEXT) Annotate arguments as
	  potentially being unused.
2006-03-30 14:43:17 +00:00
Paul Jakma
d4ce4f681e [lib] fix gensub call in memtypes.awk to pass "g", not g.
2006-03-27 Paul Jakma <paul.jakma@sun.com>

	* memtypes.awk: Fix gensub call, g should be a string..
2006-03-30 14:30:19 +00:00
Paul Jakma
6878453548 [lib] status field/flags no longer used in struct workqueue
2006-03-25 Paul Jakma <paul.jakma@sun.com>

	* workqueue.h: (struct work_queue) Remove status field and
	  state flag, no longer used.
2006-03-30 14:25:24 +00:00
Paul Jakma
b51f126ede [bgpd] trivial: use a distinct memtype for struct bgp_synchronize
2006-03-19 Paul Jakma <paul.jakma@sun.com>

	* memtypes.c: Add MTYPE_BGP_SYNCHRONISE.
	* bgp_advertise.c: Use a distinct memory type for struct
	  bgp_synchronize.
2006-03-30 14:09:38 +00:00
Paul Jakma
cec0c4fb1b [lib] fix libtool version argument in Makefile.am
2006-03-16 Paul Jakma <paul.jakma@sun.com>

	* Makefile.am: Fix -version-info argument.
2006-03-30 13:58:05 +00:00
Paul Jakma
41be32bfe6 [lib/memory] Add mallinfo support
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.
2006-03-30 13:53:59 +00:00
Paul Jakma
924f9d32d9 [lib/privs] Changing user IDs should be done before dropping privileges
2006-03-14 Paul Jakma <paul.jakma@sun.com>

	* privs.c: (zprivs_caps_init) Change user IDs before lowering
	  privileges, while this seems to work on Linux, on Solaris
	  it rightfully refuses due to PRIV_PROC_SETID having been
	  dropped.
2006-03-30 13:25:52 +00:00
Paul Jakma
478ccfd61b [lib] export show_address_cmd debug command in if.h
2006-03-06 Paul Jakma <paul.jakma@sun.com>

	* if.h: export show_address_cmd, for anyone who wishes to use
	  it.
2006-03-06 18:18:37 +00:00
Paul Jakma
5a54df971e [lib/sockunion] trivial: use XSTRDUP.
2006-02-21 Paul Jakma <paul.jakma@sun.com>

	* sockunion.c: (sockunion_{su2str,log}) Use XSTRDUP.
	  Particularly with _su2str, as that string gets XFREEd,
	  which can be annoying if run debug code in memory.c.
2006-02-21 01:37:14 +00:00
paul
306d889043 [lib/workqueue] remove the useless 'delay' factor.
2006-02-02 Paul Jakma <paul.jakma@sun.com>

	* workqueue.h: (struct work_queue) Remove the delay field.
	  It served no purpose and just introduced bad behaviour.
	  Should be excised before its allowed to escape into 1.0.
	  This removes need for the 'flood' and runs_since_clear
	  fields.
	* workqueue.c: (general) excise delay factor between queue
	  runs, hence the 'flood' crap too.. See above.
	* bgp_route.c: (bgp_{clear_node,process}_queue_init) delay
	  field is removed from workqueue spec.
2006-02-02 17:50:19 +00:00
paul
581a02a9f7 [lib/stream] small compile fix, use uint64_t, not u_int64_t.
2006-01-19 Paul Jakma <paul.jakma@sun.com>

	* stream.c: (stream_getq_from) should use POSIX uint64_t
	  not u_int64_t. Latter is neither a traditional BSD type, nor
	  a POSIX type.
2006-01-19 20:22:16 +00:00
vincent
eac314c7c4 2006-01-17 Vincent Jardin <vincent.jardin@6wind.com>
* md5.c: Don't forget to keep const.
        * regex.c: Cleanup code and remove warnings.
2006-01-17 23:39:04 +00:00
paul
d211086aef [lib/zclient] Export zclient_create_header
2006-01-17 Paul Jakma <paul.jakma@sun.com>

	* zclient.{c,h}: (zclient_create_header) export this, seems others
	  could use it (in lieu of more complete zserv helpers).
2006-01-17 17:43:18 +00:00
paul
789f78ac5a [lib/vty] Add 'no terminal monitor' alias
2006-01-17 Paul Jakma <paul.jakma@sun.com>

	* vty.c: (no_terminal_monitor_cmd) New ALIAS for
	  terminal_no_monitor, in the more normal negating format,
	  to be kind to my fingers.
	  (vty_init) install new ALIAS.
2006-01-17 17:42:03 +00:00
paul
7d0b0c4b7f [lib/md5] md5_loop should take void pointer for more useful caller warnings.
2006-01-17 Paul Jakma <paul.jakma@sun.com>

	* md5.{c,h}: (md5_loop) Is better off taking a void * and doing
	  cast to byte wise type internally, avoids needs for casts
	  in users.
2006-01-17 17:40:45 +00:00
paul
c1b9800a60 [zserv] Extend Zserv header with version information and marker field
2006-01-16 Paul Jakma <paul.jakma@sun.com>

	* lib/zclient.h: Update the Zserv protocol header with a version
	  field.  Define the old command field to be a 'marker', to
	  allow old Zserv and updated Zserv to be differentiated.
	  Future updates will bump the version field obviously. New
	  command field is made wider.  Try to stop using the
	  'zebra_size_t' typedef in the callbacks.
	* lib/zclient.c: Update to read/write new format header.
	* zebra/zserv.c: Ditto
2006-01-16 01:54:02 +00:00
paul
c77d454661 [zserv] Update interface flags to 8 bytes wide.
2006-01-11 Paul Jakma <paul.jakma@sun.com>

	* if.h: (struct interface) expand flags to 8 bytes.
	* zclient.c: (zebra_interface_{add,state}_read) stream read of
	  interface flags now need to use stream_getq.
	  (zebra_interface_if_set_value) ditto

2006-01-11 Paul Jakma <paul.jakma@sun.com>

	* zserv.c: (zsend_interface_{add,delete,update}) if flags are
	  8 bytes now, update to write out with stream_putq.
2006-01-11 01:59:04 +00:00
paul
4b201d4634 [stream] Add quad-word support and stream_resize
2006-01-10 Paul Jakma <paul.jakma@sun.com>

	* stream.c: (stream_new) Allocate stream data as seperate object.
	  (stream_free) free the data.
	  (stream_resize) new function, resize stream to new size.
	  (stream_{get,put}q*) new functions to get/put quad word size
	  types.
	* stream.h: (struct stream) make data seperate from the stream.
	  Export new stream_resize and quad-word get/put functions.
2006-01-10 14:35:19 +00:00
gdt
f80a016fbd 2005-12-29 Greg Troxel <gdt@fnord.ir.bbn.com>
* vty.c (vty_hello): add cast to quiet lint (from David Young)

(patch-lint)
2005-12-29 16:03:32 +00:00
paul
00c290e02e [c99] change gcc zero-length array to C99 flexible array declaration
2005-11-26 Paul Jakma <paul.jakma@sun.com>

	* buffer.c: (struct buffer_data) change gcc zero array
	  declaration to C99 incomplete array.
	* stream.h: (struct stream) same
	* ospf_api.c: (struct opaque_lsa) same
2005-11-26 09:21:43 +00:00