Commit Graph

423 Commits

Author SHA1 Message Date
Paul Jakma
768a27ea7b [zebra/linux] Use BPF to filter out responses, to try avoid netlink overruns
2008-05-29 Stephen Hemminger <stephen.hemminger@vyatta.com>

	* rt_netlink.c: (netlink_install_filter) BPF filter to catch and
	  drop responses to zebra's own route messages.
	  (kernel_init) add BPF filter on the netlink socket.
2008-05-29 18:23:08 +00:00
Paul Jakma
11486b5265 [lib] Fix the struct message LOOKUP function to be more robust
2008-02-28 Paul Jakma <paul.jakma@sun.com>

	* log.c: (mes_lookup) Sowmini Varadhan diagnosed a problem where
	  this function can cause a NULL dereference, on lookups for unknown
	  indices, or messages with NULL strings. Can occur, e.g., debug
	  logging code when processing received messages. Fixed to accept a
	  pointer to a default string to be used if there is no match.
	* log.h: LOOKUP adjusted to match
2008-02-28 23:26:02 +00:00
Paul Jakma
5f56808431 [lib/linklist] Enforce "nodes must have data" invariant more rigorously
2008-02-28 Paul Jakma <paul.jakma@sun.com>

	* linklist.c: This implementation expects that the data pointer not
	  be null, e.g. listgetdata() asserts this. The list add methods
	  don't apply the same sanity check.

	  Noted by Jim Carlson in bug #437.
2008-02-28 00:09:04 +00:00
Paul Jakma
dea04441fb [c++] remove/rename some names in headers that clash with C++ reserved words
2008-01-30 Peter Szilagyi <sp615@hszk.bme.hu>

	* lib/stream.h: Remove named 'new' parameter in prototype
	  for c++ header compatibility.
	* ospfd/ospf_opaque.h: ditto
	* ospfd/ospfd.h: Renamed struct export to _export for c++
	  header compatibility.
	* ospf6d/ospf6_area.h: ditto
2008-02-26 09:16:09 +00:00
Andrew J. Schorr
55edb0d446 [link-detect] Improve BSD support.
2008-01-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* lib/zebra.h: Revert previous change, no need to include
	  <net/if_media.h> here.
	* zebra/ioctl.c: If HAVE_BSD_LINK_DETECT is defined, include
	  <net/if_media.h>
	  (if_get_flags) Remove debug messages about BSD link state.
	* zebra/kernel_socket.c: (bsd_linkdetect_translate) If link state
	  is unknown, we should set the IFF_RUNNING flag.
2008-01-11 15:57:13 +00:00
Andrew J. Schorr
c543a17371 [link-detect] Try to get BSD link-detect to work properly.
2008-01-10 Ingo Flaschberger <if@xip.at>

	* configure.ac: Define HAVE_BSD_LINK_DETECT if <net/if_media.h> is
	  present.
	* lib/zebra.h: If HAVE_BSD_LINK_DETECT is defined,
	  include <net/if_media.h>.
	* zebra/ioctl.c: (if_get_flags) If HAVE_BSD_LINK_DETECT, use the
	  SIOCGIFMEDIA ioctl to ascertain link state.
	* zebra/kernel_socket.c: (bsd_linkdetect_translate) New function to
	  map the ifm_data.ifi_link_state value into the IFF_RUNNING flag.
	  (ifm_read) Call bsd_linkdetect_translate to fix the IFF_RUNNING
	  flag before calling if_flags_update.
2008-01-10 15:24:32 +00:00
Paul Jakma
912df1e8ab [lib] add mising UL qualifier to numerical constant
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.
2008-01-08 13:50:11 +00:00
Denis Ovsienko
6ce80bdb25 + fixed bug #418 (changing address on an existing interface doesn't cause existing static routes to be revalidated) 2007-11-12 14:55:01 +00:00
Paul Jakma
a56ef88348 [snmp-smux] Fix problems if 'smux peer ...' is issued multiple times
2007-10-22 Lorenzo Colitti <lorenzo@colitti.com>

	* smux.c: (smux_stop) Avoid cancelling a defunct thread pointer
	  (smux_start) Stop smux before trying to start it, possibly again.
2007-10-22 15:53:17 +00:00
Denis Ovsienko
7593fddfa1 + pidfiles are now always created with 0644 perms instead if LOGFILE_MASK (0600) 2007-10-04 15:09:19 +00:00
Paul Jakma
6b148faa29 [privs/Solaris] Quagga should work in zones with IP instances
2007-09-18  Paul Jakma <paul.jakma@sun.com>

	* privs.c: definition of ZCAP_NET_ADMIN on Solaris should
	  be PRIV_SYS_IP_CONFIG, when that's available. Thus allowing
	  Quagga to work with in Solaris zones with exclusive IP
	  instances.
2007-09-18 18:07:18 +00:00
Denis Ovsienko
b7fe414112 Bug #362 is fixed now. 2007-08-21 16:32:56 +00:00
Denis Ovsienko
dc95824ae1 Merged own patch for the bug #391 (debugging and comments mostly). 2007-08-13 16:03:06 +00:00
Paul Jakma
7591d8b862 [ospfd] Fix bad SPF calculation on some topologies - incorrect sorting
2007-08-07 Atis Elsts <atis@mikrotik.com>

	* ospf_spf.c: (ospf_spf_next) Sort heap in correct direction
	  after vertex cost is changed, thus fixing incorrect SPF
	  calculation on certain topologies.
	* lib/pqueue.{c,h}: Export trickle_up
2007-08-06 18:52:45 +00:00
Paul Jakma
6d58272b4c [bgpd] cleanup, compact and consolidate capability parsing code
2007-07-26 Paul Jakma <paul.jakma@sun.com>

	* (general) Clean up and compact capability parsing slightly.
	  Consolidate validation of length and logging of generic TLV, and
	  memcpy of capability data, thus removing such from cap specifc
	  code (not always present or correct).
	* bgp_open.h: Add structures for the generic capability TLV header
	  and for the data formats of the various specific capabilities we
	  support.  Hence remove the badly named, or else misdefined, struct
	  capability.
	* bgp_open.c: (bgp_capability_vty_out) Use struct capability_mp_data.
	  Do the length checks *before* memcpy()'ing based on that length
	  (stored capability - should have been validated anyway on input,
	  but..).
	  (bgp_afi_safi_valid_indices) new function to validate (afi,safi)
	  which is about to be used as index into arrays, consolidates
	  several instances of same, at least one of which appeared to be
	  incomplete..
	  (bgp_capability_mp) Much condensed.
	  (bgp_capability_orf_entry) New, process one ORF entry
	  (bgp_capability_orf) Condensed. Fixed to process all ORF entries.
	  (bgp_capability_restart) Condensed, and fixed to use a
	  cap-specific type, rather than abusing capability_mp.
	  (struct message capcode_str) added to aid generic logging.
	  (size_t cap_minsizes[]) added to aid generic validation of
	  capability length field.
	  (bgp_capability_parse) Generic logging and validation of TLV
	  consolidated here. Code compacted as much as possible.
	* bgp_packet.c: (bgp_open_receive) Capability parsers now use
	  streams, so no more need here to manually fudge the input stream
	  getp.
	  (bgp_capability_msg_parse) use struct capability_mp_data. Validate
	  lengths /before/ memcpy. Use bgp_afi_safi_valid_indices.
	  (bgp_capability_receive) Exported for use by test harness.
	* bgp_vty.c: (bgp_show_summary) fix conversion warning
	  (bgp_show_peer) ditto
	* bgp_debug.h: Fix storage 'extern' after type 'const'.
        * lib/log.c: (mes_lookup) warning about code not being in
          same-number array slot should be debug, not warning. E.g. BGP
          has several discontigious number spaces, allocating from
          different parts of a space is not uncommon (e.g. IANA
          assigned versus vendor-assigned code points in some number
          space).
2007-08-06 15:21:45 +00:00
Andrew J. Schorr
97cabcf760 [lib] Add comments regarding setsockopt_multicast_ipv4 arguments.
2007-07-06 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* sockopt.{c,h}: (setsockopt_multicast_ipv4) Add some comments about
	  the arguments.
2007-07-06 17:00:24 +00:00
Andrew J. Schorr
0dc0b70802 [linux] Fix strange compilation problem by explicitly including <linux/types.h>
2007-06-01 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* zebra.h: On linux, we seem to need to include <linux/types.h> before
	  <sys/sysctl.h>, otherwise we get isisd compilation errors about
	  __be16 not being defined.
2007-06-01 13:21:20 +00:00
Paul Jakma
d46d2a24e9 [autoconf] GNU_SOURCE can be defined twice, through AC_FUNC_STRNLEN
2007-05-10 Paul Jakma <paul.jakma@sun.com>

	* configure.ac: Use AC_GNU_SOURCE to define _GNU_SOURCE, rather
	  than having lib/zebra.h do it.
	  AC_FUNC_STRNLEN has side-effects with latest autoconf, use
	  AC_CHECK_FUNC on strnlen instead.
	* lib/zebra.h: Don't try define _GNU_SOURCE, autoconf should do it.
2007-05-10 16:53:04 +00:00
Paul Jakma
6f0e3f6e17 [autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warnings
2007-05-09 Paul Jakma <paul.jakma@sun.com>

	* configure.ac: sys/conf.h depends on sys/param.h, at least on
	  FBSD 6.2.
	  (bug #363) Should check for in_pktinfo for IRDP

2006-05-27 Paul Jakma <paul.jakma@sun.com>

	* configure.ac: General cleanup of header and type checks, introducing
	  an internal define, QUAGGA_INCLUDES, to build up a list of
	  stuff to include so as to avoid 'present but cant be compiled'
	  warnings.
	  Misc additional checks of things missing according to autoscan.
	  Add LIBM, for bgpd's use of libm, so as to avoid burdening
	  LIBS, and all the binaries, with libm linkage.
	  Remove the bad practice of using m4 changequote(), just
	  quote the []'s in the case statements properly.
	  This should fix bugs 162, 303 and 178.
	* */*.{c,h}: Update all HAVE_* to the standard autoconf namespaced
	  HAVE_* defines. I.e. HAVE_SA_LEN -> HAVE_STRUCT_SOCKADDR_SA_LEN,
	* bgpd/Makefile.am: Add LIBM to bgpd's LDADD, for pow().
2007-05-10 02:38:51 +00:00
Paul Jakma
fb982c25aa [bgpd] Trim memory usage of BGP routes
2007-05-03 Paul Jakma <paul.jakma@sun.com>

	* bgp_route.h: (struct info) Move less frequently used
	  fields to a lazily allocated struct info_extra.
	  Export bgp_info_extra_get
	* bgp_route.c: (bgp_info_extra_new) allocate extra
	  (bgp_info_extra_free) Free damp info and the info_extra.
	  (bgp_info_extra_get) Retrieve the info_extra of a struct
	  info, allocating as required.
	  (generally) adjust to use info->extra
	* bgp_damp.c: (generally) use bgp_info_extra_get to access
	  dampinfo
	* bgp_attr.h: Move rarely allocated attributes from struct attr
	  to a struct attr_extra, for a substantial saving in size of
	  struct attr.
	* bgp_attr.c: (bgp_attr_extra_{new,free}), new, self-explanatory.
	  (bgp_attr_extra_get) Get the attr_extra for a given struct
	  attr, allocating it if needs be.
	  (bgp_attr_dup) Shallow copy the struct attr and its attr_extra.
	  (generally) adjust to know about attr->extra.
	* bgp_debug.c: (bgp_dump_attr) ditto
	* bgp_vty.c: (show_bgp_memory) print attr and info extra sizes.
	* bgp_nexthop.c: (generally) adjust to know about attr->extra
	  and info->extra.
	* bgp_{packet,routemap,snmp,zebra}.c: ditto
	* lib/memtypes.c: Add MTYPE_ATTR_EXTRA and MTYPE_BGP_ROUTE_EXTRA
2007-05-04 20:15:47 +00:00
Paul Jakma
7514fb7739 [zebra] Routemap support on received routes, with 'set src' command (linux)
2007-05-01 David L Stevens <dlstevens@us.ibm.com>

	* (general) These changes collectively add route-map and
	  prefix-list support to zebra and fix a bug in "show
	  route-map" (with no argument).
	* doc/main.texi: added route-map, prefix-list, ip protocol
	  and set src documentation
	* lib/command.h: added PROTOCOL_NODE type
	* lib/log.c: (proto_name2num) new function, protocol name to
	  number translation.
	* lib/routemap.c: (vty_show_route_map) fixed "show route-map"
	  without route-map name
	* lib/routemap.h: added RMAP_ZEBRA type
	* lib/zebra.h: added proto_name2num() prototype
	* vtysh/extract.pl.in: added VTYSH_ZEBRA flag for route-map and
	  plist
	* vtysh/Makefile.am: added zebra_routemap.c
	* vtysh/vtysh.h: added VTYSH_ZEBRA flag to VTYSH_RMAP
	* zebra/connected.c: (connected_up_ipv4) added src preference argument
	  to rib_add_ipv4()
	* zebra/kernel_socket.c: (rtm_read) ditto
	* zebra/main.c: added prefix list initialization
	* zebra/Makefile.am: added zebra_routemap.c source file
	* zebra/rib.h: added generic address union "g_addr" and use in
	  existing places that had an explicit union.
	  Added "src" to struct nexthop.
	  Added preferred src arg to nexthop_ipv4_add and rib_add_ipv4.
	* zebra/rt_netlink.c: (netlink_routing_table) set preferred source on
	  netlink messages.
	  (netlink_route_change) ditto
	  (netlink_route_multipath) ditto.
	* zebra/rtread_getmsg.c: (handle_route_entry) added (NULL) src to
	  rib_add_ipv4() call.
	* zebra/rtread_proc.c: (proc_route_read) ditto
	* zebra/zebra_rib.c: (nexthop_ipv4_add) add src argument.
	  (nexthop_ipv4_ifindex_add) ditto
	  (rib_add_ipv4) ditto
	  (nexthop_active_check) Add route-map processing.
	* zebra/zebra_routemap.c: new file for zebra route-map commands.
	* zebra/zebra_vty.c: (ip_protocol_cmd) Apply route-map to protocol
	  (vty_show_ip_route_detail) added "src" printing
	  (vty_show_ip_route) ditto
	  (show_ip_protocol_cmd) new command, list routemaps.
	  (config_write_protocol) write out routemap protocl config.
	  (zebra_vty_init) Install the new routemap protocol commands.
	* zebra/zserv.c: (zread_ipv4_add) added (NULL) src arg
	  (zebra_init) init zebra route-maps.
	* zebra/zserv.h: add zebra_route_map_init
2007-05-02 16:05:35 +00:00
Andrew J. Schorr
bcdda30bae [logging] Minor performance tweak
2007-04-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* log.c: (quagga_timestamp) Optimize the subsecond timestamp generation.
2007-04-29 15:48:22 +00:00
Andrew J. Schorr
1ed72e0b3a [logging] Add new "log timestamp precision" command for subsecond timestamps
2007-04-28 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* command.c: (config_write_host) Save "log timestamp precision"
	  if not default value.
	  (show_logging) Show configured timestamp precision.
	  (config_log_timestamp_precision) Enable configuration of timestamp
	  precision.
	  (no_config_log_timestamp_precision) Restore default timestamp
	  precision.
	  (cmd_init) Install new timestamp precision commands.
	* log.h: (struct zlog) New timestamp_precision field.
	  (quagga_timestamp) New function to generate a timestamp with the
	  desired precision.
	  (struct timestamp_control) Declare a structure for use in avoiding
	  repeated duplicate calls to quagga_timestamp.
	* log.c: (quagga_timestamp) New function to generate a timestamp
	  of the desired precision.
	  (time_print) Call quagga_timestamp if the time hasn't already been
	  calculated.
	  (vzlog) Initialize a timestamp_control structure and pass it to
	  time_print and vty_log.
	  (zlog_backtrace) Fix 64-bit problem: cannot print size_t with %u.
	* vty.h: Must now include "log.h".
	  (vty_log) Takes an additional struct timestamp_control argument.
	* vty.c: (vty_log_out) Use new struct timestamp_control and new
	  quagga_timestamp function to print timestamps of the desired
	  precision.
	  (vty_time_print) Use new quagga_timestamp function.
	  (vty_log) Accept new struct timestamp_control argument and pass it
	  down to vty_log_out.
2007-04-28 22:14:10 +00:00
Andrew J. Schorr
eda9ba743c [64-bit] Fix 4 problems with printf formats and 64-bit size_t
2007-04-27 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* lib/smux.c: (smux_trap) Fix printf format to work with 64-bit size_t.
	* ospf6d/ospf6_snmp.c: (ospfv3AreaEntry, ospfv3AreaLsdbEntry) Fix some
	  zlog_debug printf formats to work with 64-bit size_t.
2007-04-27 18:13:15 +00:00
Paul Jakma
6dc686a29e [zebra] Bug #351: Don't redistribute routes to ipv4 link-local prefixes
2007-04-07 Paul Jakma <paul.jakma@sun.com>

	* lib/prefix.h: Add define to match IPv4 Link-Local addresses
	* zebra/redistribute.c: (zebra_check_addr) Don't redistribute routes
	  to IPv4 link-local prefixes, fixes bug #351.
	* zebra/redistribute.h: Export zebra_check_addr.
	* zebra/router-id.c: (router_id_bad_address) re-use zebra_check_addr
	  rather than implementing similar logic.
2007-04-10 19:24:45 +00:00
Andrew J. Schorr
afb88a6691 [lib] Make message lookup function more robust.
2007-03-20 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* log.c: (mes_lookup) Make the function more robust: check for
	  cases where the index does not match the key value at that position.
	  If so, give a warning and fall back to a linear search.
	  And improve the error message in cases where even that fails.
2007-03-20 20:48:27 +00:00
Andrew J. Schorr
e4529636b7 [PtP over ethernet] New peer flag allows much more addressing flexibility
2006-12-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

	* if.h: (struct connected) Add new ZEBRA_IFA_PEER flag indicating
	  whether a peer address has been configured.  Comment now shows
	  the new interpretation of the destination addr: if ZEBRA_IFA_PEER
	  is set, then it must contain the destination address, otherwise
	  it may contain the broadcast address or be NULL.
	  (CONNECTED_DEST_HOST,CONNECTED_POINTOPOINT_HOST) Remove obsolete
	  macros that were specific to IPv4 and not fully general.
	  (CONNECTED_PEER) New macro to check ZEBRA_IFA_PEER flag.
	  (CONNECTED_PREFIX) New macro giving the prefix to insert into
	  the RIB: if CONNECTED_PEER, then use the destination (peer) address,
	  else use the address field.
	  (CONNECTED_ID) New macro to come up with an identifying address
	  for the struct connected.
	* if.c: (if_lookup_address, connected_lookup_address) Streamline
	  logic with new CONNECTED_PREFIX macro.
	* prefix.h: (PREFIX_COPY_IPV4, PREFIX_COPY_IPV6) New macros
	  for better performance than the general prefix_copy function.
	* zclient.c: (zebra_interface_address_read) For non-null destination
	  addresses, set prefixlen to equal the address prefixlen.  This
	  is needed to get the new CONNECTED_PREFIX macro to work properly.
	* connected.c: (connected_up_ipv4, connected_down_ipv4,
	  connected_up_ipv6, connected_down_ipv6) Simplify logic using the
	  new CONNECTED_PREFIX macro.
	  (connected_add_ipv4) Set prefixlen in destination addresses (required
	  by the CONNECTED_PREFIX macro).  Use CONNECTED_PEER macro instead
	  of testing for IFF_POINTOPOINT.  Delete invalid warning message.
	  Warn about cases where the ZEBRA_IFA_PEER is set but no
	  destination address has been supplied (and turn off the flag).
	  (connected_add_ipv6) Add new flags argument so callers may set
	  the ZEBRA_IFA_PEER flag.  If peer/broadcast address satisfies
	  IN6_IS_ADDR_UNSPECIFIED, then reject it with a warning.
	  Set prefixlen in destination address so CONNECTED_PREFIX will work.
	* connected.h: (connected_add_ipv6) Add new flags argument so
	  callers may set the ZEBRA_IFA_PEER flag.
	* interface.c: (connected_dump_vty) Use CONNECTED_PEER macro
	  to decide whether the destination address is a peer or broadcast
	  address (instead of checking IFF_BROADCAST and IFF_POINTOPOINT).
	* if_ioctl.c: (if_getaddrs) Instead of setting a peer address
	  only when the IFF_POINTOPOINT is set, we now accept a peer
	  address whenever it is available and not the same as the local
	  address.  Otherwise (no peer address assigned), we check
	  for a broadcast address (regardless of the IFF_BROADCAST flag).
	  And must now pass a flags value of ZEBRA_IFA_PEER to
	  connected_add_ipv4 when a peer address is assigned.
	  The same new logic is used with the IPv6 code as well (and we
	  pass the new flags argument to connected_add_ipv6).
	  (if_get_addr) Do not bother to check IFF_POINTOPOINT: just
	  issue the SIOCGIFDSTADDR ioctl and see if we get back
	  a peer address not matching the local address (and set
	  the ZEBRA_IFA_PEER in that case).  If there's no peer address,
	  try to grab SIOCGIFBRDADDR regardless of whether IFF_BROADCAST is set.
	* if_ioctl_solaris.c: (if_get_addr) Just try the SIOCGLIFDSTADDR ioctl
	  without bothering to check the IFF_POINTOPOINT flag.  And if
	  no peer address was found, just try the SIOCGLIFBRDADDR ioctl
	  without checking the IFF_BROADCAST flag.  Call connected_add_ipv4
	  and connected_add_ipv6 with appropriate flags.
	* if_proc.c: (ifaddr_proc_ipv6) Must pass new flags argument to
	  connected_add_ipv6.
	* kernel_socket.c: (ifam_read) Must pass new flags argument to
	  connected_add_ipv6.
	* rt_netlink.c: (netlink_interface_addr) Copy logic from iproute2
	  to determine local and possible peer address (so there's no longer
	  a test for IFF_POINTOPOINT).  Set ZEBRA_IFA_PEER flag appropriately.
	  Pass new flags argument to connected_add_ipv6.
	  (netlink_address) Test !CONNECTED_PEER instead of if_is_broadcast
	  to determine whether the connected destination address is a
	  broadcast address.
	* bgp_nexthop.c: (bgp_connected_add, bgp_connected_delete)
	  Simplify logic by using new CONNECTED_PREFIX macro.
	* ospf_interface.c: (ospf_if_is_configured, ospf_if_lookup_by_prefix,
	  ospf_if_lookup_recv_if) Simplify logic using new CONNECTED_PREFIX
	  macro.
	* ospf_lsa.c: (lsa_link_ptop_set) Using the new CONNECTED_PREFIX
	  macro, both options collapse into the same code.
	* ospf_snmp.c: (ospf_snmp_if_update) Simplify logic using new
	  CONNECTED_ID macro.
	  (ospf_snmp_is_if_have_addr) Simplify logic using new CONNECTED_PREFIX
	  macro.
	* ospf_vty.c: (show_ip_ospf_interface_sub) Use new CONNECTED_PEER macro
	  instead of testing the IFF_POINTOPOINT flag.
	* ospfd.c: (ospf_network_match_iface) Use new CONNECTED_PEER macro
	  instead of testing with if_is_pointopoint.  And add commented-out
	  code to implement alternative (in my opinion) more elegant behavior
	  that has no special-case treatment for PtP addresses.
	  (ospf_network_run) Use new CONNECTED_ID macro to simplify logic.
	* rip_interface.c: (rip_interface_multicast_set) Use new CONNECTED_ID
	  macro to simplify logic.
	  (rip_request_interface_send) Fix minor bug: ipv4_broadcast_addr does
	  not give a useful result if prefixlen is 32 (we require a peer
	  address in such cases).
	* ripd.c: (rip_update_interface) Fix same bug as above.
2006-12-12 19:18:21 +00:00
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