summaryrefslogtreecommitdiff
path: root/lib/zebra.h
AgeCommit message (Collapse)Author
2005-10-012005-10-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zebra.h: Declare new functions zebra_route_string() and zebra_route_char(). * log.c: (zroute_lookup,zebra_route_string,zebra_route_char) New functions to map zebra route numbers to strings. * zebra_vty.c: (route_type_str) Remove obsolete function: use new library function zebra_route_string() instead. Note that there are a few differences: for IPv6 routes, we now get "ripng" and "ospf6" instead of the old behavior ("rip" and "ospf"). (route_type_char) Remove obsolete function: ues new library function zebra_route_char() instead. Note that there is one difference: the old function returned 'S' for a ZEBRA_ROUTE_SYSTEM route, whereas the new one returns 'X'. (vty_show_ip_route_detail,vty_show_ipv6_route_detail) Replace route_type_str() with zebra_route_string(). (vty_show_ip_route,vty_show_ipv6_route) Replace route_type_char() with zebra_route_char(). * bgp_vty.c: (bgp_config_write_redistribute) Use new library function zebra_route_string instead of a local hard-coded table. * ospf6_asbr.c: Remove local hard-coded tables zroute_name and zroute_abname. Change the ZROUTE_NAME macro to use new library function zebra_route_string(). Remove the ZROUTE_ABNAME macro. (ospf6_asbr_external_route_show): Replace ZROUTE_ABNAME() with a call to zebra_route_char(), and be sure to fix the format string, since we now have a char instead of a char *. * ospf6_zebra.c: Remove local hard-coded tables zebra_route_name and zebra_route_abname. Note that the zebra_route_name[] table contained mixed-case strings, whereas the zebra_route_string() function returns lower-case strings. (ospf6_zebra_read_ipv6): Change debug message to use new library function zebra_route_string() instead of zebra_route_name[]. (show_zebra): Use new library function zebra_route_string() instead of zebra_route_name[]. * ospf_dump.c: Remove local hard-coded table ospf_redistributed_proto. (ospf_redist_string) New function implemented using new library function zebra_route_string(). Note that there are a few differences in the output that will result: the new function returns strings that are lower-case, whereas the old table was mixed case. Also, the old table mapped ZEBRA_ROUTE_OSPF6 to "OSPFv3", whereas the new function returns "ospf6". * ospfd.h: Remove extern struct message ospf_redistributed_proto[], and add extern const char *ospf_redist_string(u_int route_type) instead. * ospf_asbr.c: (ospf_external_info_add) In two messages, use ospf_redist_string instead of LOOKUP(ospf_redistributed_proto). * ospf_vty.c: Remove local hard-coded table distribute_str. (config_write_ospf_redistribute,config_write_ospf_distribute): Use new library function zebra_route_string() instead of distribute_str[]. * ospf_zebra.c: (ospf_redistribute_set,ospf_redistribute_unset, ospf_redistribute_default_set,ospf_redistribute_check) In debug messages, use ospf_redist_string() instead of LOOKUP(ospf_redistributed_proto). * rip_zebra.c: (config_write_rip_redistribute): Remove local hard-coded table str[]. Replace str[] with calls to new library function zebra_route_string(). * ripd.c: Remove local hard-coded table route_info[]. (show_ip_rip) Replace uses of str[] with calls to new library functions zebra_route_char and zebra_route_string. * ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded table str[]. Replace str[i] with new library function zebra_route_string(i). * ripngd.c: Remove local hard-coded table route_info[]. (show_ipv6_ripng) Use new library function zebra_route_char() instead of table route_info[].
2005-09-292005-09-29 Paul Jakma <paul.jakma@sun.com>paul
* configure.ac: Add the test for Solaris least-privileges. Set defines for whether capabilities are supported and whether of the linux or solaris variety. Add missing-prototypes, missing-declarations, char-subscripts and cast-qual warnings to default cflags, cause Hasso enjoys warnings, and we really should clean the remaining ones up. (ie isisd..). * (*/*main.c) Update the zebra_capabilities_t arrays in the various daemons to match the changes made in lib/privs.h. * zebra.h: Solaris capabilities requires priv.h to be included. * privs.{c,h}: Add support for Solaris Least-Privileges. privs.h: Reduce some of the abstract capabilities, which do not have rough equivalents on both systems. Rename the net related caps to _NET, as they should have been in first place. (zprivs_terminate) should take the zebra_privs_t as argument so that it can update change pointer. Add an additional privilege state, ZPRIVS_UNKNOWN. * privs.c: (various capability functions) Add Solaris privileges variants. (zprivs_state) Use privs.c specific generic types to represent various capability/privilege related types, so that each can be typedef'd as appropriate on each platform. (zprivs_null_state) static added, to hold the state the null method should report (should be raised by default, and LOWERED if zprivs_terminate has been called) (zprivs_state_null) Report back the zprivs_null_state. (cap_map) Make it able to map abstract capability to multiple system capabilities. (zcaps2sys) Map to abstract capabilities to multiple system privileges/capabilities. (zprivs_init) move capability related init to seperate function, zprivs_caps_init. (zprivs_terminate) ditto, moved to zprivs_caps_terminate. Set the change_state callback to the NULL state, so the user can continue to run and use the callbacks.
2005-05-062005-05-06 Paul Jakma <paul@dishone.st>paul
* (general) extern and static'ification of functions in code and header. Cleanup any definitions with unspecified arguments. Add casts for callback assignments where the callback is defined, typically, as passing void *, but the function being assigned has some other pointer type defined as its argument, as gcc complains about casts from void * to X* via function arguments. Fix some old K&R style function argument definitions. Add noreturn gcc attribute to some functions, as appropriate. Add unused gcc attribute to some functions (eg ones meant to help while debugging) Add guard defines to headers which were missing them. * command.c: (install_node) add const qualifier, still doesnt shut up the warning though, because of the double pointer. (cmp_node) ditto * keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived fromn vty.h ones to fix some of the (long) < 0 warnings. * thread.c: (various) use thread_empty (cpu_record_hash_key) should cast to uintptr_t, a stdint.h type * vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they removed from ospfd/ospf_vty.h * zebra.h: Move definition of ZEBRA_PORT to here, to remove dependence of lib on zebra/zserv.h
2005-04-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-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-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-082005-02-08 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zebra.h: Change macro definitions SET_FLAG and UNSET_FLAG to use compound assignment operators (aesthetic change).
2005-01-122005-01-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zebra.h: If not C99 and no va_copy macro available, fall back to memcpy (solves a build problem on FreeBSD 4.x).
2005-01-042005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* 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.
2004-11-252004-11-25 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zebra.h: If not C99 and there's no va_copy macro and there is a __va_copy macro, define va_copy as __va_copy.
2004-11-242004-11-24 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs
* zassert.h: New header file to declare a quagga-specific assert macro. * log.c: (_zlog_assert_failed) New function called when assert fails to log the error and abort. * zebra.h: Include "zassert.h" instead of <assert.h>. * regex.c: Include "zassert.h" instead of <assert.h>. * dict.c: Include "zassert.h" instead of <assert.h>.
2004-11-15Rationalize CMSG_SPACE usage:gdt
in lib/zebra.h, ensure that RFC3542-required CMSG_SPACE and CMSG_LEN are defined. Warn if alignment assumptions are made, since they are i386-centric. in lib/sockopt.h, declare that sockopt sizes are without CMSG_SPACE-required padding - just simple sizeof. in ospfd/ospf_packet.c, simply use CMSG_SPACE This should remove all instances of CMSG_ALIGN from the source code. This is a nonstandard, though rational, construct; quagga should use only those defines in RFC3542.
2004-10-222004-10-23 Paul Jakma <paul@dishone.st>paul
* zebra.h: reserve ZEBRA_ROUTE_HSLS
2004-10-04Every file includes it and warns about it.hasso
2004-10-03Common router id.hasso
2004-09-272004-09-27 Paul Jakma <paul@dishone.st>paul
* zebra.h: Add WANT_OSPF_WRITE_FRAGMENT for ospfd to try to fragment oversized packets. Enabled only for Linux. Add HAVE_IP_HDRINCL_BSD_ORDER to define struct ip byte order, to consolidate various ad-hoc platform defines for same thing.
2004-08-252004-08-19 Paul Jakma <paul@dishone.st>paul
* zebra.h: add MAX and MIN defines (eg for ospf6d)
2004-06-212004-06-21 Paul Jakma <paul@dishone.st>paul
* ChangeLog: fix my last update config.h -> zebra.h ;) * zebra.h: Fix gcc check.
2004-06-112004-06-11 Sowmini Varadhan <sowmini.varadhan@sun.com>paul
* filter.c: (access_list_remark_cmd) buffer_putstr doesnt need cast to u_char. (ipv6_access_list_remark_cmd) ditto. if.c: ditto * network.c: (readn/writen) pointer arg should be type u_char. * plist.c: needs to include stream.h, not declare stream functions internally. (various) Add static qualifier to internal functions. (prefix_list_type_str) extraneous breaks in switch statement. (ip_prefix_list_description_cmd) buffer_putstr doesnt need cast * stream.h: depends on plist.h and export stream_put_prefix * vty.c: (vty_<telnet option build functions>) should use unsigned char, telnet options are 0 -> 255. * zclient.c: various u_char<->char type cleanups. * zebra.h: Having to define CMSG_* can apply to more than just BSDI_NRL. * ripd.c: (rip_distribute_update_all) distribute list hook function pointer prototype requires struct prefix_list * arg. (rip_distribute_update_all_wrapper) update to pass required arg, NULL.
2004-06-092004-06-09 Paul Jakma <paul@dishone.st>paul
* config.h: __attribute__ is a gcc'ism
2004-06-042004-06-04 Paul Jakma <paul@dishone.st>paul
* type mismatch fixes
2003-12-23Merge isisd into the Quagga's framework:jardin
- 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.
2003-10-222003-10-22 Paul Jakma <paul@dishone.st>paul
* lib/zebra.h: include limits.h if its there, its a portable header and useful and not just solaris specific. net/route.h is also useful.
2003-10-132003-10-13 Jay Fenlason <fenlason@redhat.com>paul
* lib/zebra.h: define UINT32_MAX for those systems which do not provide it. * bgp_attr.h: define BGP_MED_MAX. * bgp_route.c: update defines/constants to BGP_MED_MAX. * bgp_routemap.c: ditto. clean up route_match_metric_compile slightly to avoid unneccesary XMALLOC.
2003-07-082003-07-8 Chris Andrews <chris@nodnol.org>paul
* zebra/kernel_socket.c: Update for new zebrad global struct * zebra/ipforward_solaris.c: Add missing privs.h include. Uncomment /dev/ip define. * lib/zebra.h: Add typedefs for SunOS.
2003-06-04Paul forgot probably to commit privs.[c|h] changes. Had to reorder includeshasso
in zebra.h to make it compile in debian.
2003-06-042003-06-04 Paul Jakma <paul@dishone.st>paul
* Merge of zebra privileges
2003-06-04Paul Jakma:paul
lib/debug.{c,h}: glibc backtrace printing function (from the glibc info page) configure.ac: check for glibc backtrace and set define lib/zebra.h: glibc backtrace support
2003-05-25Add back support for null0 interface blackhole routes.paul
2003-05-25Last fixes from 6Wind patch.hasso
2003-05-25Route (reject|blackhole) support from 6Wind patch.hasso
2003-05-24From: rivo nurges <rix@estpak.ee>paul
Subject: solaris compile patch types defined for SUNOS_5 were already defined in config.h
2003-05-20Undo revision 1.3, revert back to zebra_org 1.1.1.2.paul
asm/types.h is required for netlink. Later glibc's seem to have resolved the warning.
2003-05-19From: Paul Jakma <paul@clubi.ie>paul
Subject: [zebra 19097] HAVE_ASM_TYPES does anyone know why lib/zebra.h has: #ifdef HAVE_ASM_TYPES_H #include <asm/types.h> #endif /* HAVE_ASM_TYPES_H */ There's no need for it that i can see (least not on linux) and it causes compile warnings. Is it needed? If so, why?
2002-12-13Initial revisionpaul