summaryrefslogtreecommitdiff
path: root/lib/ChangeLog
AgeCommit message (Collapse)Author
2005-05-032005-05-03 Paul Jakma <paul@dishone.st>paul
* stream.h: Add comment about the special zero-ing ability of stream_put. (stream_recvmsg, stream_write) should return ssize_t and size_t respectively. Should both be extern linkage. (stream_recvfrom) Stream aware wrapper around recvfrom, in style of stream_read_try. * stream.c: (stream_recvfrom) new function, wrapper around recvfrom. (stream_recvmsg, stream_write) ssize_t and size_t return values
2005-04-282005-04-27 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
Add wall-clock timing statistics to 'show thread cpu' output. * thread.h: Define struct rusage_t to contain wall-clock time and cpu time. Change GETRUSAGE macro to collect both pieces of data. Make appropriate changes to struct cpu_thread_history to track CPU time and real time. Change proto for thread_consumed_time to return real and cpu time elapsed. And declare a new global variable 'struct timeval recent_time'. * thread.c (struct timeval recent_time): New global timestamp variable. (timeval_adjust): If timeout is negative, set to 0 (not 10 microseconds). And remove upper bound of 1,000,000 seconds, since this does not seem to make any sense (and it breaks funcname_thread_add_timer_timeval). (timeval_cmp): Should return long, not int. (vty_out_cpu_thread_history): Show CPU time and real time. (cpu_record_hash_print): Calculate totals for CPU and real time. (cpu_record_print): Change 'show thread cpu' title to show CPU and real time. (thread_timer_remain_second): Put current time in global recent_time. (funcname_thread_add_timer_timeval): Fix assert. Replace 2-case switch assignment with a ternary expression. Use global recent_time variable. Fix use of timeval_adjust (previously, the value was not actually being adjusted). (thread_cancel): Add missing "break" statement in case THREAD_BACKGROUND. (thread_timer_wait): Use global recent_time value instead of calling gettimeofday. And there's no need to check for negative timeouts, since timeval_subtract already sets these to zero. (thread_timer_process): Timers are sorted, so bail out once we encounter a timer that has not yet popped. And remove some extraneous asserts. (thread_fetch): Do not process foreground timers before calling select. Instead, add them to the ready list just after the select. Also, no need to maintain a count of the number of ready threads, since we don't care how many there are, just whether there's one at the head of the ready list (which is easily checked). Stick current time in global variable recent_time to reduce the number of calls to gettimeofday. Tighten logic for calculating the select timeout. (thread_consumed_time): Now returns real time and puts the elapsed cpu time in an additional argument. (thread_should_yield): Use real (wall-clock) time to decide whether to yield. (thread_call): Maintain CPU and real time statistics. * vty.c (vty_command): For slow commands, show real and cpu time.
2005-04-272005-04-27 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* workqueue.c (show_work_queues): Remove unused gettimeofday call.
2005-04-272005-04-27 Paul Jakma <paul.jakma@sun.com>paul
* memory.h: memtypes is built source, default includes points to top_builddir, so we should refer to lib/memtypes.h
2005-04-272005-04-27 Paul Jakma <paul.jakma@sun.com>paul
* workqueue.h: (struct work_queue_item) change retry_count to ran, its a count of number item has been run. * workqueue.c: (show_work_queues) Fix formating of slightly bugfix: fix SIGFPE if wq->runs is 0. (work_queue_run) retry logic was slightly wrong. cycles.best is 0 initialy, granularity is 1, so update best if cycles >= granularity, not just >.
2005-04-262005-04-26 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* buffer.c (buffer_write): Comment out call to buffer_flush_available. This should speed up buffering at the expense of a possible increase in latency in flushing the data if inside a long-running thread.
2005-04-25- forgot to commit changelog, belongs to previous commit.paul
2005-04-252005-04-25 Paul Jakma <paul.jakma@sun.com>paul
* thread.c: Kill unused TIMER_NO_SORT bits
2005-04-252005-04-25 Paul Jakma <paul.jakma@sun.com>paul
* memory.c: Make the string field much wider * memtypes.c: Correct the prefix list str/entry strings
2005-04-252005-04-25 Paul Jakma <paul.jakma@sun.com>paul
* Makefile.am: Refer to source files via srcdir variable, fix out-of-tree build breakage.
2005-04-222005-04-22 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* thread.h: Fix type for struct thread_master add_type: should be unsigned char. Also, add some documentation of thread_add_background args. And remove extraneous declaration of show_thread_work_queues_cmd.
2005-04-222005-04-22 Paul Jakma <paul.jakma@sun.com>paul
* memory.h: Move include of memtypes.h to after the definition of struct memory_list, gcc 4.0 doesn't like arrays of incomplete types.
2005-04-222005-04-22 Paul Jakma <paul.jakma@sun.com>paul
* thread.h: Add background thread type and thread_add_background macro and accompanying funcname_... function. export thread_should_yield, background threads can use it. Lower thread yield time to 10ms, 100ms is noticeable lag and a thread would only be /starting/ to finish sometime afterward. * thread.c: (general) Add background thread type and schedule nearly all thread types through the ready list for fairness. (timeval_adjust) static qualifier missing (vty_out_cpu_thread_history) add support for printout of background threads (show_thread_cpu) ditto. (thread_master_debug) add debug of background list (thread_master_create) fixup long line (thread_add_unuse) add asserts for required state. (thread_master_free) free background thread list (funcname_thread_add_timer_timeval) make generic, able to support arbitrary timer-like thread types. (funcname_thread_add_timer) pass thread type to .._add_timer_timeval (funcname_thread_add_timer_msec) ditto (funcname_thread_add_background) Add a background thread, with an optional millisecond delay factor, using .._add_timer_timeval. (thread_cancel) Add background thread type. Move the thread_list_delete common to all cases to bottom of function, after the switch statement.. (thread_cancel_event) indent (thread_timer_wait) Static qualifier, and make it able to cope with arbitrary timer-like thread lists, so its of use to background threads too. (thread_process_fd) static qualifier. Again, make it take a list reference rather than thread_master. Fix indentation. (thread_timer_process) Check for ready timer-like threads in the given list and move them on to the ready list - code originally embedded in thread_fetch. (thread_fetch) Schedule all threads, other than events, through the ready list, to ensure fairness. Timer readying code moved to thread_timer_process so it can be reused for background threads. Remove the unneeded quagga_sigevent_process, as pointed out by John Lin <john.ch.lin@gmail.com>. (thread_should_yield) make this available.
2005-04-162005-04-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* configure.ac: Added AC_ARG_ENABLE(time-check). By default, warning messages will now be printed for threads or commands that take longer than 5 seconds, but this configure argument can be used to disable the checks or change the threshold. * thread.h (thread_consumed_time): Declare new function to calculate elapsed microseconds. * thread.c (thread_consumed_time): Must be global not static so we can call it from lib/vty.c:vty_command. (thread_should_yield): Surround with `#if 0' to make clear that this function is not currently being used anywhere. (thread_call): If CONSUMED_TIME_CHECK is defined, print a CPU HOG warning message if the thread takes more than CONSUMED_TIME_CHECK microseconds. * vty.c (vty_command): If CONSUMED_TIME_CHECK is defined, print a CPU HOG warning message if the command takes more than CONSUMED_TIME_CHECK microseconds.
2005-04-162005-04-16 Paul Jakma <paul@dishone.st>paul
* memtypes.c: the comment about use of comments in the comments headers was causing comment within comment warnings from compiler * memtypes.awk: Add extensive comments on the file format for memtypes.c. tighten the pattern for the MTYPE matching action (suggestion from Andrew) and tighten which field we try the match on.
2005-04-152005-04-15 Paul Jakma <paul@dishone.st>paul
* Makefile.am: memtypes.awk is gawk dependent, use the GAWK automake var. * memtypes.h: New file, auto-generated, checked in for convenience.
2005-04-152005-04-15 Paul Jakma <paul@dishone.st>paul
* 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.
2005-04-112005-04-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
Implement non-blocking zclient I/O with buffering. * zclient.h (struct zclient): Add two fields to support non-blocking I/O: struct buffer *wb, and struct thread *t_write. (zclient_free): Remove function. (zebra_redistribute_send): Change 2nd arg from socket fd to struct zclient * (needed to support non-blocking I/O and buffering). (zclient_send_message): New function to send an arbitrary message with non-blocking I/O. * zclient.c (zclient_new): Create write buffer. (zclient_free): Remove unused function. (zclient_stop): Must cancel new t_write thread. Also, reset all buffers: ibuf, obuf, and wb. (zclient_failed): New helper function for typical error handling. (zclient_flush_data): New thread to flush queued data. (zclient_send_message): New function to send the message in zclient->obuf to zebra using non-blocking I/O and buffering. (zebra_message_send, zapi_ipv4_route, zapi_ipv6_route): Use new zclient_send_message function instead of calling writen. (zclient_start): Set socket non-blocking. Also, change 2nd arg to zebra_redistribute_send from zclient->sock to zclient. (zebra_redistribute_send): Change 2nd arg to struct zclient *. Can now use zclient->obuf to assemble the message instead of allocating a temporary stream. And call zclient_send_message to send the message instead of writen. (zclient_read): Convert to support non-blocking I/O by using stream_read_try instead of deprecated stream_read. (zclient_redistribute): Change 2nd arg to zebra_redistribute_send from zclient->sock to zclient. * ospf6_zebra.c (ospf6_zebra_redistribute, ospf6_zebra_no_redistribute): Change 2nd arg to zebra_redistribute_send from zclient->sock to zclient. * ospf_zebra.c (ospf_zebra_add): Call zclient_send_message instead of writen. * rip_zebra.c (rip_redistribute_set, rip_redistribute_unset, rip_redistribute_clean): Change 2nd arg to zebra_redistribute_send from zclient->sock to zclient. * ripng_zebra.c (ripng_redistribute_unset, ripng_redistribute_clean): Change 2nd arg to zebra_redistribute_send from zclient->sock to zclient. * bgp_zebra.c (bgp_redistribute_set, bgp_redistribute_unset): The 2nd arg to zebra_redistribute_send is now zclient instead of zclient->sock. * isis_zebra.h (isis_zebra_finish): Remove declaration of unused function. * isis_zebra.c (isis_zebra_route_add_ipv4): Call zclient_send_message to send the message to zebra instead of calling writen directly, since zclient_send_message understands non-blocking I/O and will manage the buffer queue appropriately. (isis_zebra_finish): Remove unused function, particularly since the zclient_free function has been removed.
2005-04-09 * routemap.c: Show description in "show route-map" output.hasso
2005-04-082005-04-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* sigevent.c: On GNU_LINUX, check whether __USE_GNU is already defined.
2005-04-082005-04-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* vty.c: (vty_log_fixed) Use casts to (void *) to try to eliminate compiler warnings when assigning a (const char *) value to struct iovec iov_base.
2005-04-082005-04-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zebra.h: If GNU_LINUX is defined, then define _GNU_SOURCE. This fixes a problem where we were not getting the declaration of strnlen in <string.h>.
2005-04-08 * routemap.[ch]: Added "description ..." command.hasso
Closes Bugzilla #167.
2005-04-08 * prefix.[hc]: Pass argument to the inet6_ntoa by value making it morehasso
inet_ntoa alike. * ripngd.[hc], ripng_interface.c, ripng_peer.c: inet6_ntoa() takes argument now by value.
2005-04-072005-04-07 Paul Jakma <paul.jakma@sun.com>paul
* (global): Fix up list loops to match changes in lib/linklist, and some basic auditing of usage. * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES * HACKING: Add notes about deprecating interfaces and commands. * lib/linklist.h: Add usage comments. Rename getdata macro to listgetdata. Rename nextnode to listnextnode and fix its odd behaviour to be less dangerous. Make listgetdata macro assert node is not null, NULL list entries should be bug condition. ALL_LIST_ELEMENTS, new macro, forward-referencing macro for use with for loop, Suggested by Jim Carlson of Sun. Add ALL_LIST_ELEMENTS_RO for cases which obviously do not need the "safety" of previous macro. LISTNODE_ADD and DELETE macros renamed to ATTACH, DETACH, to distinguish from the similarly named functions, and reflect their effect better. Add a QUAGGA_NO_DEPRECATED_INTERFACES define guarded section with the old defines which were modified above, for backwards compatibility - guarded to prevent Quagga using it.. * lib/linklist.c: fix up for linklist.h changes. * ospf6d/ospf6_abr.c: (ospf6_abr_examin_brouter) change to a single scan of the area list, rather than scanning all areas first for INTER_ROUTER and then again for INTER_NETWORK. According to 16.2, the scan should be area specific anyway, and further ospf6d does not seem to implement 16.3 anyway.
2005-04-05 * lib/prefix.[hc]: inet6_ntoa utility function copied fromhasso
ripngd/ripngd.c (inet6_ntop). * ripngd.[hc]: Remove inet6_ntop() and any usage of it. inet6_ntoa() from lib is used now. * ripng_interface.c: inet6_ntop() -> inet6_ntoa(). * ripng_peer.c: inet6_ntop() -> inet6_ntoa().
2005-04-052004-04-05 Paul Jakma <paul@dishone.st>paul
* lib/vty.c: Improve logging of failures to open vty socket(s). See bugid #163. * zebra/zserv.c: print more helpful errors when we fail to successfully bind and listen on zserv socket. Closes bugzilla #163.
2005-04-032005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* if_ioctl.c: (interface_list_ioctl) Use if_get_by_name_len. * if_proc.c: (ifaddr_proc_ipv6) Increase size of ifname buffer to avoid overflow. * kernel_socket.c: (ifan_read) Use if_get_by_name_len. * if.h: Fix comments to reflect that if_lookup_by_name and if_get_by_name now require the argument strings to be NUL-terminated. * if.c: (if_lookup_by_name) Compare using strcmp. (if_get_by_name) Pass strlen(ifname) as 2nd arg to if_create.
2005-04-022005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* if.c: (if_nametoindex) The man page is rather vague, but it seems like the argument to if_nametoindex has an implicit maximum length of IFNAMSIZ characters.
2005-04-022005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* if.h: (if_lookup_by_name_len, if_get_by_name_len) New functions. * if.c: (if_lookup_by_name_len, if_get_by_name_len) New functions. (if_get_by_name) Tighten up code. (interface) Use new function if_get_by_name_len. * zclient.c: (zebra_interface_add_read) Use new if_get_by_name_len function. (zebra_interface_state_read) Use new if_lookup_by_name_len function. * kernel_socket.c: (ifm_read) Use new if_lookup_by_name_len function to save a memcpy. * if_ioctl_solaris.c: (interface_list_ioctl) Fix subtle bug with new if_get_by_name_len function. * ospf_interface.c: (ospf_vl_new) Use strnlen to fix call to if_create.
2005-04-022005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* str.c: Replace strlcpy and strlcat with actual working versions copied from rsync-2.6.2/lib/compat.c.
2005-04-022005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
Fix problems when netlink interfaces are renamed (same ifindex used for a new interface). Start cleaning up some problems with the way interface names are handled. * interface.c: (if_new_intern_ifindex) Remove obsolete function. (if_delete_update) After distributing the interface deletion message, set ifp->ifindex to IFINDEX_INTERNAL. (if_dump_vty) Detect pseudo interface by checking if ifp->ifindex is IFINDEX_INTERNAL. (zebra_interface) Check return code from interface_cmd.func. Do not set internal ifindex values to if_new_intern_ifindex(), since we now use IFINDEX_INTERNAL for all pseudo interfaces. * kernel_socket.c: (ifm_read) Fix code and comments to reflect that all internal interfaces now have ifp->ifindex set to IFINDEX_INTERNAL. * rt_netlink.c: (set_ifindex) New function used to update ifp->ifindex. Detects interface rename events by checking if that ifindex is already being used. If it is, delete the old interface before assigning the ifindex to the new interface. (netlink_interface, netlink_link_change) Call set_ifindex to update the ifindex. * if.h: Remove define for IFINDEX_INTERNBASE and add define IFINDEX_INTERNAL 0, since all internal (i.e. non-kernel) pseudo- interfaces should have ifindex set to 0. (if_new) Remove function. (if_delete_retain) New function to delete an interface without removing from iflist and freeing the structure. (ifname2ifindex) New function. * if.c: (if_new) Remove function (absorb into if_create). (if_create) Replace function if_new with call to calloc. Set ifp->ifindex to IFINDEX_INTERNAL. Fix off-by-one error in assert to check length of interface name. Add error message if interface with this name already exists. (if_delete_retain) New function to delete an interface without removing from iflist and freeing the structure. (if_delete) Implement with help of if_delete_retain. (ifindex2ifname) Reimplement using if_lookup_by_index. (ifname2ifindex) New function to complement ifindex2ifname. (interface) The interface command should check the name length and fail with a warning message if it is too long. (no_interface) Fix spelling in warning message. (if_nametoindex) Reimplement using if_lookup_by_name. (if_indextoname, ifaddr_ipv4_lookup) Reimplement using if_lookup_by_index. * bgp_zebra.c: (bgp_interface_delete) After deleting, set ifp->ifindex to IFINDEX_INTERNAL. * isis_zebra.c: (isis_zebra_if_del) Call if_delete_retain instead of if_delete, since it is generally not safe to remove interface structures. After deleting, set ifp->ifindex to IFINDEX_INTERNAL. (zebra_interface_if_lookup) Tighten up code. * ospf6_zebra.c: (ospf6_zebra_if_del) Previously, this whole function was commented out. But this is not safe: we should at least update the ifindex when the interface is deleted. So the new version updates the interface status and sets ifp->ifindex to IFINDEX_INTERNAL. (ospf6_zebra_route_update) Use if_indextoname properly. * ospf_vty.c: (show_ip_ospf_interface_sub) Show ifindex and interface flags to help with debugging. * ospf_zebra.c: (ospf_interface_delete) After deleting, set ifp->ifindex to IFINDEX_INTERNAL. (zebra_interface_if_lookup) Make function static. Tighten up code. * rip_interface.c: (rip_interface_delete) After deleting, set ifp->ifindex to IFINDEX_INTERNAL. * ripng_interface.c: (ripng_interface_delete) After deleting, set ifp->ifindex to IFINDEX_INTERNAL.
2005-04-022005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* configure.ac: Add strnlen to AC_CHECK_FUNCS. * zebra.h: Should include str.h to pick up missing functions. * str.h: Declare strnlen if needed. * str.c: Do not include str.h since zebra.h now includes it. (strnlen) New function.
2005-03-162005-03-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zebra.h: Must check whether __attribute__ should be defined before including zassert.h. [backport candidate]
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-02-242005-02-24 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* stream.c: (stream_read_try) Log a warning message if a fatal I/O error occurs. (stream_fifo_new) Fix prototype. * stream.h: Fix prototype for stream_fifo_new (need void arg).
2005-02-232005-02-23 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* {vty.h,vty.c}: Remove vty_finish (duplicate of vty_reset). * isis_main.c: (reload) Call vty_reset instead of vty_finish (both functions were exactly the same).
2005-02-232005-02-23 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* buffer.h: Make the struct buffer and struct buffer_data structures private by moving them inside buffer.c. Add comments for all functions. Rename buffer_write as buffer_put (to be more consistent with the buffer_putc and buffer_putstr functions). Declare a new buffer_write function that is used to write data to a file descriptor and/or add it to the buffer queue. Remove unused function buffer_flush_vty_all. Create a new enum typedef buffer_status_t to be used as the return code for all buffer_flush* functions and buffer_write. * buffer.c: The struct buffer and struct buffer_data declarations are now private to this file. In conjunction with that, remove some unnecessary fields: struct buffer (alloc, unused_head, unused_tail, length), struct buffer_data (prev). (buffer_data_new) Removed: functionality incorporated into buffer_add. (buffer_data_free) Removed: use a macro BUFFER_DATA_FREE instead. (buffer_new) Use calloc instead of malloc + memset(zero). Supply an appropriate default size if the specified size is 0. (buffer_free) Eliminate code duplication by calling buffer_reset to free the contents of the buffer (and remove unused code related to unused_head). (buffer_empty,buffer_putc,buffer_putstr) Aesthetic change (make more compact). (buffer_reset) Use macro BUFFER_DATA_FREE. No need to set alloc and length to 0 (these fields have been removed). (buffer_add) Fix scope to be static. Call XMALLOC directly instead of calling removed buffer_data_new function. Simplify the logic (since it's now a singly-linked list instead of doubly-linked). (buffer_write) Renamed to buffer_put. Change to void, since return code of 1 was meaningless. No need to adjust length field, since it has been removed. (buffer_putw,buffer_flush,buffer_flush_vty_all,buffer_flush_vty) Remove unused functions. (buffer_flush_all) Rewrite using buffer_flush_available to eliminate a possible failure mode if IOV_MAX is less than the number of buffers on the queue. (buffer_flush_window) Incorporate logic from buffer_flush_vty. Log an error message if there is a writev error. (buffer_flush_available) Be more paranoid: check for case where buffer is already empty. Use new ERRNO_IO_RETRY macro, and use new enum for return codes. Simplify deletion logic (since it's now a singly-linked list). (buffer_write) New function for use with non-blocking I/O. * vty.h: Replace the struct vty sb_buffer field with a fixed-size (5-character) sb_buf field and an sb_len field, since using a struct buffer was inappropriate for this task. Add some useful comments about telnet window size negotiation. * vty.c: Include <arpa/telnet.h> (no longer included by zebra.h). Remove VTY_OBUF_SIZE (instead use buffer_new default size). Make telnet_backward_char and telnet_space_char static const. (vty_out) Replace buffer_write with buffer_put. (vty_log_out) Check for I/O errors. If fatal, close the vty session. Consolidate 3 separate writes into a single write call. (vty_will_echo,vty_command,vty_next_line,vty_previous_line, vty_end_config,vty_describe_fold,vty_clear_buf,vty_serv_sock_addrinfo, vty_serv_sock_family,vty_serv_un,vty_use_backup_config,exec_timeout, vty_config_write,vty_save_cwd) Fix scope to static. (vty_new) Let buffer_new use its default buffer size. (vty_write) Fix signature: 2nd arg should be const char *. Replaced buffer_write with buffer_put. (vty_telnet_option) Fix minor bug (window height or width greater than 255 was broken). Use sb_buf and sb_len instead of removed sb_buffer (which was being used improperly). (vty_read) On error, use ERRNO_IO_RETRY to decide whether it's fatal. If the error is fatal, call buffer_reset so vty_close does not attempt to flush the data. Use new sb_buf and sb_len instead of sb_buffer to store the SB negotiation string. (vty_flush) When vty->lines is 0, call buffer_flush_available instead of buffer_flush_window. Look at the return code from buffer_flush to detect I/O errors (and in that case, log an error message and close the vty). (vty_create) Fix scope to static. Initialize sb_len to 0 instead of creating sb_buffer. (vty_accept) Set socket nonblocking. (vtysh_accept) Use new set_nonblocking function instead of calling fcntl directly. (vtysh_flush) New function called from vtysh_read (after command execution) and from vtysh_write. This flushes the buffer and reacts appropriately to the return code (by closing the vty or scheduling further flushes). (vtysh_read) Check whether error is fatal using ERRNO_IO_RETRY. If not, just try again later. Otherwise, call buffer_reset before calling vty_close (to avoid trying to flush the buffer in vty_close). Fix logic to allow case where a command does not arrive atomically in a single read call by checking for the terminating NUL char. (vtysh_write) Use new vtysh_flush helper function. (vty_close) No need to call buffer_empty, just call buffer_flush_all in any case (it will check whether the buffer is empty). Do not free sb_buffer (since it has been removed). (vty_log_fixed) Use writev instead of write. * zebra.h: Do not include <arpa/telnet.h>, since this is used only by lib/vty.c.
2005-02-21 * pqueue.[ch]: Introduce "update" function to meet ospf spf needs. Ithasso
will allow to update node when: i) a node is inserted into the priority queue; ii) a node position is modified in the priority queue; * pqueue.h: Export trickle_down() function.
2005-02-192005-02-19 Paul Jakma <paul.jakma@sun.com>paul
* stream.c: (stream_new) fix dumb mistake.
2005-02-172005-02-17 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* stream.c: (stream_read_try) Use new ERRNO_IO_RETRY macro.