summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2009-06-18[gcc] Add gcc printf format checksStephen Hemminger
2009-06-12[cleanup] Make command nodes staticStephen Hemminger
The cmd_nodes used to configure vty, can mostly be static so (basic data hiding 101).
2009-06-12[cleanup] functions taking no args should be declared with void argsStephen Hemminger
Use Ansi-C prototypes rather than old K&R method of declaring function without arguments
2009-06-12[cleanup] add const attribute to lib/if.c::if_dumpStephen Hemminger
2009-06-12[cleanup] Convert XMALLOC/memset to XCALLOCStephen Hemminger
Simple conversion of XMALLOC/memset to XCALLOC
2009-06-12[bgpd] Add support for the old Linux 2.4, TCP_MD5_AUTH RFC2385 patchPaul Jakma
* configure.ac: Add a --enable-linux24-tcp-md5 argument, to compile in support for the old TCP-MD5 patch for Linux 2.4 systems. This overrides auto-detection of TCP-MD5 supported by the target system. * lib/sockopt.c: (sockopt_tcp_signature) add in a variant for the old Linux 2.4, TCP_MD5_AUTH variant of TCP-MD5 support, conditional on the previous configure arg.
2009-06-02[snmp] Compiler warning fixes for when "--enable-snmp" is configured.Chris Caputo
Compiled on 32-bit and 64-bit linux gcc 4.1.2 platforms. No run-time testing on 32-bit and limited run-time testing on 64-bit.
2009-06-02[smux] 64-bit fix for lib/smux.h SNMP_INTEGER() macroChris Caputo
Macro SNMP_INTEGER() prepares data which is eventually processed by asn_build_int(). SNMP_INTEGER() was using "int32_t" whereas asn_build_int() uses "long". On 32-bit systems these are the same, both 4 bytes, but on x86 64-bit systems "long" is 8 bytes. asn_build_int()'s reaction to an improperly sized value is to return a NULL pointer. Quagga's smux.c would eventually get this NULL pointer and use it in calculations to determine how much data to send over the smux connection, resulting in garbage being sent to the SNMP agent. Corrected SNMP_INTEGER() to use "long". Tested on 32-bit and 64-bit x86 Linux 2.6.27.10 systems running Quagga 0.99.11 with bgpd smux.
2009-06-02[bgp] Fix crash on SIGHUP, deref of freed workqueuesSteve Hill
* lib/workqueue.c: free-ing workqueues had never been tested obviously, queue's thread was not being stopped * bgpd/bgpd.c: null out freed workqueues, to prevent acting on freed workqueues
2008-11-29[lib] Fix timer precision.Joakim Tjernlund
Whenever a thread adds an timer funcname_thread_add_timer_timeval() gets called to add the timer. Before adding the timer a quagga_gettimeofday() call is made to do some time house keeping. However quagga_gettimeofday() only updates recent_time, not relative_time that is used to calculate the alarm_time. Replace with quagga_get_relative (NULL)
2008-11-29[lib] Move type cast in Fletcher checksumJoakim Tjernlund
The int type cast should be on the whole expression passed to the mod operator. Otherwise it won't work when/if c0/c1 is unsigned. Making c0/c1 unsigned makes it possible to use 5802 as MODX value.
2008-11-24[lib] fix missing sockunion_normalise_mappedPaul Jakma
* lib/sockunion.c: (sockunion_accept) sockunion needs to be normalised here, as it used to before this was moved to a dedicated function..
2008-11-16[lib] Switch Fletcher checksum back to old ospfd versionPaul Jakma
* lib/checksum.c: (fletcher_checksum) Switch the second phase of the checksum back to the old ospfd logic. The isisd-derived version: a) is very hard to follow b) had some kind of subtle bug that caused it be wrong when c0=0 and c1=254 (potentially fixable by doing the mods before adjusting x and y) Additionally: - explicitely cast expressions using non-internal variables to int, to ensure the result is signed. - defensively change the length argument to 'size_t', to ensure the code works with that argument being unsigned.. Thanks to Joakim Tjernlund for the investigative work into this bug. * tests/test-checksum.c: new file to exercise the checksum code.
2008-09-09[lib] re-enable conversion of v6mapped INET6 sockunions to regular INETPaul Jakma
* lib/sockunion.c: Re-enable conversion of v6mapped INET6 sockunions to regular INET sockunions, which was disabled in 0df7c9, as it leads to failures in sockunion_cmp. (sockunion_normalise_mapped) consolidate here (sockunion_accept) remove conversion code altogether here - no sockunion is created (sockunion_get{sockname,peername}) normalise newly created sockunion.
2008-09-04Merge branch 'restricted-mode'Paul Jakma
2008-08-25Make --enable-snmp cross compile and make libcrypto optional with ↵Joakim Tjernlund
--without-crypto Autoconfig work by me, the rest was done by "Kirill K. Smirnov" <lich@math.spbu.ru>
2008-08-23[vty] Add support for a 'restricted mode' with anonymous vty connectionsPaul Jakma
* lib/command.h: Add a RESTRICTED_NODE, intended for use with anonymous, 'no login' vtys, to provide a subset of 'view' mode commands. * lib/command.c: Add RESTRICTED_NODE bits, nothing special, just following VIEW_NODE. * lib/vty.c: (vty_auth) enable authentication should fall back to restricted/view node as appropriate. (vty_create) init vty's to restricted/view node as appropriate, for the 'no login' case. (vty_{no_,}restricted_mode_cmd) config commands to enable 'anonymous restricted' in vty configuration. (vty_config_write) 'anonymous restricted' config. (vty_init) Install some commands to restricted mode, and the 'anonymous restricted' config commands into VTY_NODE. * bgpd/*.c: Install some of the safe(r) BGP commands into 'restricted mode', i.e. lookup commands of non-sensitive data. Useful with looking-glass route-servers.
2008-08-22[administrivia] Git should ignore backup files and .loT filesPaul Jakma
2008-08-22[trivia] Remove ChangeLog files, as this data is now maintained in SCMPaul Jakma
2008-08-22[warnings] Fix various SOS warningsPaul Jakma
2008-08-15 Paul Jakma <paul.jakma@sun.com> * */*: Fix various problems flagged by Sun Studio compiler. - '<qualifier> <storage>' obsolescent in declarations - empty statements (';' after ALIAS definitions) - implicit declarations (e.g printstack in lib/log.c) - "\%" in printf string instead of "%%" - loops that return on the first iteration (legitimately, but compiler can't really know), e.g. bgp_routemap.c - internal declarations which mask prototypes.
2008-08-22[lib] Fix mistake in tcp-md5sig commit which broke compile on BSDPaul Jakma
2008-08-15 Paul Jakma <paul.jakma@sun.com> * lib/sockopt.c: (sockopt_tcp_signature) ifdef'ing hid variable declaration for HAVE_DECL_TCP_MD5SIG && !GNU_LINUX, breaking compile - fix.
2008-08-22[lib] mes_lookup string lookup table argument should be marked constStephen Hemminger
2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com> * lib/log.{c,h}: struct message argument should point to const * */*.c: adjust to suit, Signed-off-by: Paul Jakma <paul@quagga.net>
2008-08-22[lib] hash compare function arguments ought to be const qualifiedStephen Hemminger
2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com> * lib/hash.h: (struct hash) Hash comparator callback really ought to treat storage behind arguments as constant - a compare function with side-effects would be evil. * */*.c: Adjust comparator functions similarly, thus fixing at least a few compiler warnings about const qualifier being dropped. Signed-off-by: Paul Jakma <paul@quagga.net>
2008-08-22[lib] Add fletcher checksum implementationJingjing Duan
2008-08-13 Jingjing Duan <Jingjing.Duan@sun.com> * lib/checksum.?: (fletcher_checksum) implementation of Fletcher checksum, as per RFC1008. Signed-off-by: Paul Jakma <paul@quagga.net>
2008-08-22[vty] Allow delete during password entryRoy
2008-08-13 roy <quagga@de.vio.us> * lib/vty.c: (vty_delete_char) move check for authentication down a bit, so we do the delete, but still not re-write of line. Signed-off-by: Paul Jakma <paul@quagga.net>
2008-08-22[administrivia] Add .gitignore files, based on .cvsignores.Paul Jakma
2008-07-21[bgpd] TCP-MD5: password vty configuration and initial Linux supportPaul Jakma
2008-07-21 Paul Jakma <paul.jakma@sun.com> * bgp_packet.c: (bgp_open_receive) fix warning in a zlog call * bgp_vty.c: (bgp_vty_return) add return code * bgpd.c: (bgp_master_init) setup the socket list. * bgp_network.c: Remove the dual IPv4/6 socket thing for now, which was implemented by Michael, until such time as its clear its required for Linux (see sockopt comments). IPv6 support, including IPv4 sessions on AF_INET6 sockets, therefore is broken, and the '-l 0.0.0.0' arguments would need to be given to bgpd to make things work here. 2008-07-21 Michael H. Warfield <mhw@wittsend.com> YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Tomohiko Kusuda <kusuda@inetcore.com> Leigh Brown <leigh@solinno.co.uk> * bgp_network.c: (bgp_md5_set_one) shim between libzebra tcp-md5 sockopt and bgpd. (bgp_md5_set_socket) Helper for bgp_connect (bgp_md5_set) setup TCP-MD5SIG for the given peer. (bgp_connect) call out to bgp_md5_set_socket for the outgoing connect socket. (bgp_socket) save references to the listen sockets, needed if TCP-MD5SIG is applied later or changed. * bgp_vty.c: (*neighbor_password_cmd) New 'neighbor ... password' commands. * bgpd.c: (peer_{new,delete) manage TCP-MD5 password (peer_group2peer_config_copy) inherit TCP-MD5 password (peer_password_{un,}set) orchestrate the whole add/remove of TCP-MD5 passwords: applying checks, stopping peers, and trying to return errors to UI, etc. (bgp_config_write_peer) save password. Fix missing newline in writeout of neighbor ... port. 2008-07-21 Paul Jakma <paul.jakma@sun.com> * sockunion.c: ifdef out various places that converted v4mapped sockets to pure v4. Doesn't seem necessary at all, presumably a workaround for now historical inet_ntop bugs (?) 2008-07-21 Michael H. Warfield <mhw@wittsend.com> YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> * sockopt.{c,h}: (sockopt_tcp_signature) Add TCP-MD5SIG support.
2008-06-07[lib] trivial: add const qualifier to stream_put/writePaul Jakma
2008-06-07 Paul Jakma <paul@jakma.org> * stream.{c,h}: (stream_{put,write}) add const qualifier to source argument. Change u_char to void *.
2008-06-02+ initial edition of meta-queue for RIB updates processing (bug #431)Denis Ovsienko
2008-05-29[zebra/linux] Use BPF to filter out responses, to try avoid netlink overrunsPaul Jakma
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-02-28[lib] Fix the struct message LOOKUP function to be more robustPaul Jakma
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[lib/linklist] Enforce "nodes must have data" invariant more rigorouslyPaul Jakma
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-26[c++] remove/rename some names in headers that clash with C++ reserved wordsPaul Jakma
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-01-11[link-detect] Improve BSD support.Andrew J. Schorr
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-10[link-detect] Try to get BSD link-detect to work properly.Andrew J. Schorr
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-08[lib] add mising UL qualifier to numerical constantPaul Jakma
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.
2007-11-12+ fixed bug #418 (changing address on an existing interface doesn't cause ↵Denis Ovsienko
existing static routes to be revalidated)
2007-10-22[snmp-smux] Fix problems if 'smux peer ...' is issued multiple timesPaul Jakma
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-04+ pidfiles are now always created with 0644 perms instead if LOGFILE_MASK (0600)Denis Ovsienko
2007-09-18[privs/Solaris] Quagga should work in zones with IP instancesPaul Jakma
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-08-21Bug #362 is fixed now.Denis Ovsienko
2007-08-13Merged own patch for the bug #391 (debugging and comments mostly).Denis Ovsienko
2007-08-06[ospfd] Fix bad SPF calculation on some topologies - incorrect sortingPaul Jakma
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[bgpd] cleanup, compact and consolidate capability parsing codePaul Jakma
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-07-06[lib] Add comments regarding setsockopt_multicast_ipv4 arguments.Andrew J. Schorr
2007-07-06 Andrew J. Schorr <ajschorr@alumni.princeton.edu> * sockopt.{c,h}: (setsockopt_multicast_ipv4) Add some comments about the arguments.
2007-06-01[linux] Fix strange compilation problem by explicitly including <linux/types.h>Andrew J. Schorr
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-05-10[autoconf] GNU_SOURCE can be defined twice, through AC_FUNC_STRNLENPaul Jakma
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[autoconf] bugs 162,303,178: Fix 'present but can not be compiled' warningsPaul Jakma
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-04[bgpd] Trim memory usage of BGP routesPaul Jakma
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-02[zebra] Routemap support on received routes, with 'set src' command (linux)Paul Jakma
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