Age | Commit message (Collapse) | Author |
|
* vty.c: Fix fd leak.
[backport candidate]
|
|
* 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).
|
|
* {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).
|
|
* 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.
|
|
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.
|
|
* stream.c: (stream_new) fix dumb mistake.
|
|
* stream.c: (stream_read_try) Use new ERRNO_IO_RETRY macro.
|
|
* network.h: Define a new ERRNO_IO_RETRY macro to test whether an I/O
operation should be retried. This eliminates the need to duplicate
the same logic testing for EAGAIN or EINTR in multiple places.
|
|
* stream.h: Declare new function stream_read_try suitable for use
with non-blocking file descriptors. Indicate that stream_read
and stream_read_unblock are deprecated.
* stream.c: (stream_read_try) New function for use with non-blocking
I/O.
(stream_recvmsg) Should return -1 if the stream is too small to
contain the data.
|
|
* network.c: (set_nonblocking) Should check return code from
fcntl(F_GETFL).
|
|
* network.h: Declare new function set_nonblocking. Indicate that
readn and writen are deprecated.
* network.c: (set_nonblocking) New function to make a file descriptor
non-blocking, since it seems silly to have fcntl calls sprinkled
throughout the code.
|
|
|
|
* stream.h: Unsigned long updated to size_t
* stream.c: ditto
* stream.h: Add stream_copy, stream_dup, stream_recvmsg.
Add comment describing struct stream abstraction, and various
other comments.
Deprecate several unsafe/ambigious macros.
Add STREAM_WRITEABLE and STREAM_READABLE.
Add (stream_getl_from) for symmetry.
Update stream_forward_{endp,getp} to use size_t offset.
Make stream data a 0 length array, rather than a seperate malloc.
* stream.c: Add consistency checks. Update to follow stream.h
changes.
(stream_new) Alloc stream+data in one go.
(stream_copy) new function, copy a stream.
(stream_dup) new function, dup a stream.
(stream_recvmsg) new function, recvmsg data into a stream.
(stream_empty) no need to check getp == 0.
|
|
* stream.h: Unsigned long updated to size_t
* stream.c: ditto
|
|
* (global) Update code to match stream.h changes.
stream_get_putp effectively replaced with stream_get_endp.
stream_forward renamed to stream_forward_getp.
stream_forward_endp introduced to replace some previous
setting/manual twiddling of putp by daemons.
* lib/stream.h: Remove putp. Update reference to putp with endp.
Add stream_forward_endp, which daemons were doing manually.
Rename stream_forward to stream_forward_getp.
lib/stream.c: Remove/update references to putp.
introduce stream_forward_endp.
|
|
* zebra.h: Change macro definitions SET_FLAG and UNSET_FLAG
to use compound assignment operators (aesthetic change).
|
|
* log.c: (zlog_signal,zlog_backtrace_sigsafe) Eliminate use of fileno()
since it is not async-signal-safe.
(_zlog_assert_failed) Rewrite crashlog logic more compactly.
(zlog_set_file,zlog_reset_file,zlog_rotate) Update logfile_fd
for use in signal handler.
|
|
* log.c: (syslog_sigsafe) Reduce scope of syslog_fd: it is accessed
inside this function only.
(open_crashlog) New function to open /var/tmp/quagga.<daemon>.crashlog
with flags O_WRONLY|O_CREAT|O_EXCL to save some crash info.
(zlog_signal,_zlog_assert_failed) Increase logging priority from
LOG_ERR to LOG_CRIT. If no file logging is configured, try to use
open_crashlog to create a crash logfile.
(zlog_backtrace_sigsafe) If a crashlog file descriptor is open,
dump a backtrace to that file.
|
|
* ospf_packet.c: (ospf_read) Fix bug: must check for state ISM_Down,
not for event ISM_InterfaceDown. And improve the message by
adding the interface flags.
* if.h: Declare if_flag_dump.
[backport candidate]
|
|
* daemon.c: (daemon) Replace perror with zlog_err.
* vty.c: (vty_serv_un) Replace perror with zlog_err.
* ripd.c: (rip_create_socket) Replace perror with zlog_err.
* ioctl.c: (if_ioctl,if_ioctl_ipv6,if_get_flags) Replace perror with
zlog_err.
* ioctl_solaris.c: (if_ioctl,if_ioctl_ipv6) Replace perror with
zlog_err.
|
|
* buffer.h: Fix comment on buffer_getstr to reflect that it now
uses XMALLOC.
* buffer.c: (buffer_getstr) Use XMALLOC(MTYPE_TMP) instead of malloc.
* filter.c: (access_list_remark,ipv6_access_list_remark) Use
argv_concat instead of buffer_getstr.
* if.c: (interface_desc) Use argv_concat instead of buffer_getstr.
* plist.c: (ip_prefix_list_description,ipv6_prefix_list_description)
Use argv_concat instead of buffer_getstr.
* bgp_filter.c: (ip_as_path,no_ip_as_path) Use argv_concat instead
of buffer_getstr.
* bgp_route.c: (bgp_show_regexp) Fix memory leak: need to free string
returned by buffer_getstr.
(bgp_show_community) Must use XFREE instead of free on string
returned by buffer_getstr.
* bgp_routemap.c: (set_community) Must use XFREE instead of free
on string returned by buffer_getstr.
* bgp_vty.c: (neighbor_description) Use argv_concat instead of
buffer_getstr.
|
|
* lib/buffer.h: Document behavior of buffer_getstr function.
* lib/buffer.c: (buffer_getstr) Fix bug: must handle case where
the string extends beyond the head struct buffer_data.
|
|
* 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.
|
|
use it as well.
* vtysh/vtysh.c: Implement walkup in node tree for vtysh as it already
works in vty.
|
|
* log.h: Test for SA_SIGINFO to see whether zlog_signal takes final
two args (siginfo and program_counter).
* log.c: (hex_append) Include this function only if SA_SIGINFO or
HAVE_GLIBC_BACKTRACE is defined.
(zlog_signal) Final two args (siginfo and program_counter) now
depend on whether SA_SIGINFO is defined on this platform.
* sigevent.c: (program_counter) Do not include this function if
SA_SIGINFO is not defined on this platform.
(exit_handler,core_handler) Test for SA_SIGINFO to decide whether
2nd & 3rd arguments are present and to decide how to invoke
zlog_signal.
(trap_default_signals) Test for SA_SIGINFO and invoke sigaction
appropriately.
|
|
* log.h: Change prototype for zlog_backtrace_sigsafe to take additional
program_counter argument.
* log.c: (zlog_backtrace_sigsafe) Add additional program_counter
argument. If it is non-NULL, use backtrace_symbols_fd to resolve
the address.
(zlog_signal) Call zlog_backtrace_sigsafe with additional
program_counter argument.
[pullup candidate]
|
|
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]
|
|
* command.c (print_version): Do not bother even to examine host.name,
since it is always NULL when this function is called from main.
|
|
* 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)
|
|
* configure.ac: Test for header file <ucontext.h> (for use in
signal processing).
* sigevent.c: (trap_default_signals) Use the SA_SIGINFO flag to
pass additional siginfo_t and ucontext_t arguments to core_handler
and exit_handler.
(core_handler,exit_handler) Now invoked with 3 arguments (using
SA_SIGINFO). Pass additional info to zlog_signal.
(program_counter) New function to find program counter in ucontext_t,
needs to be enhanced to support more platforms (currently works only
on Linux/x86).
* log.h: Change the zlog_signal prototype to add new arguments
siginfo_t * and program_counter.
* log.c: (zlog_signal) Add new arguments siginfo and program_counter.
Include si_addr and program counter (if non-NULL) in message.
And remove #ifdef HAVE_GLIBC_BACKTRACE around hex_append, since
that is now used to render the si_addr and PC pointers.
|
|
* zebra.h: If not C99 and no va_copy macro available, fall back to
memcpy (solves a build problem on FreeBSD 4.x).
|
|
* configure.ac: Added test for broken CMSG_FIRSTHDR macro
(relevant for Solaris 8 and unpatched Solaris 9, don't know
whether other platforms are affected).
* zebra.h: Define ZCMSG_FIRSTHDR appropriately based on whether
config.h indicates HAVE_BROKEN_CMSG_FIRSTHDR (as determined
by the configure test program).
* sockopt.c: (getsockopt_cmsg_data) Use ZCMSG_FIRSTHDR instead
of CMSG_FIRSTHDR.
* rtadv.c: (rtadv_recv_packet,rtadv_send_packet) Use ZCMSG_FIRSTHDR
instead of CMSG_FIRSTHDR.
* ripd.c: (rip_recvmsg) Use ZCMSG_FIRSTHDR instead of CMSG_FIRSTHDR.
* ripngd.c: (ripng_recv_packet) Use ZCMSG_FIRSTHDR instead of
CMSG_FIRSTHDR.
|
|
described in [quagga-dev 2292].
|
|
|
|
* sockopt.c (getsockopt_ipv4_ifindex): Document calling
convention. Beef up comments. Handle the case where the cmsghdr
has a zero controllen, or more specifically when the wanted option
is not present. This is needed for Solaris 8, and in general for
any platform for which configure finds a method and it can fail.
Mark some changes with XXX to be cleaned up post 0.98.
|
|
* sockopt.c (getsockopt_ipv4_ifindex): Return 0 when passed a NULL
cmsghdr pointer.
I believe this will avoid ospfd crashing on Solaris 8, which seems to
define IP_RECVIF but not actually implement it.
|
|
* sockopt.c: (setsockopt_ipv4_ifindex) Improve error message.
When neither IP_PKTINFO nor IP_RECVIF is defined, make return value
deterministic (-1).
|
|
* thread.c: (funcname_thread_add_timer_msec) Reduce overflow risk.
|
|
* stream.c: Dont allocate streams with 0 sized data buffers
|
|
* if.h: Add more 'non-generic' IFF_ flags.
* if.c: IFF_NOXMIT/IFF_VIRTUAL interfaces are 'loopback like'
|
|
* command.c: (do_echo) Added new "echo" command, useful for
watchdog pinging to make sure the daemon is responsive.
|
|
* pid_output.c: (pid_output_lock) Eliminate static function, and just
use the #ifdef to decide which version of the function to include.
This eliminates a compilation problem with gcc4. And fix the
non-fcntl version so that it actually compiles. Exit with
status 1 instead of -1 on error.
|
|
* sigevent.c: (trap_default_signals) Ignore SIGPIPE instead of exiting.
|
|
* log.c: (zlog_signal,_zlog_assert_failed) Change logging level back to
LOG_ERR instead of LOG_EMERG.
|
|
* log.c: (hex_append) No need to include this function if
HAVE_GLIBC_BACKTRACE is not defined.
|
|
(only used if HAVE_GLIBC_BACKTRACE, so perhaps ifdef it?)
|
|
* 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.
|
|
* {smux.c,zclient.c}: Change level of debug messages to LOG_DEBUG.
|
|
* command.c: (config_write_host) Note that "log trap" is deprecated
when writing out the config.
|
|
* 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.
|