diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-07-31 10:39:54 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-07-31 10:39:54 -0700 |
commit | 2f30d8d38448c7ecde96304e3a94dbb5667b8dcc (patch) | |
tree | 99831498d4e7cc680592a54d3959894eba173067 | |
parent | f9ca20da1a62324d1ee9c11dd13c71f8986f4909 (diff) | |
parent | d0cee3d3d7267f8f5c1d1ffd5c5fd8802a9db987 (diff) | |
download | quagga-2f30d8d38448c7ecde96304e3a94dbb5667b8dcc.tar.bz2 quagga-2f30d8d38448c7ecde96304e3a94dbb5667b8dcc.tar.xz |
Merge branch 'upstream' into islavista
Conflicts:
ChangeLog
NEWS
bgpd/ChangeLog
bgpd/bgp_attr.c
bgpd/bgp_network.c
bgpd/bgp_packet.c
bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/bgpd.h
lib/sockopt.c
lib/sockopt.h
lib/zebra.h
mkinstalldirs
zebra/rib.h
zebra/rt_netlink.c
82 files changed, 4085 insertions, 715 deletions
diff --git a/ChangeLog b/ChangeLog index d526672c..cf5c774d 120000..100644 --- a/ChangeLog +++ b/ChangeLog @@ -1 +1,1990 @@ -debian/changelog
\ No newline at end of file +2008-07-22 Paul Jakma <paul.jakma@sun.com> + + * HACKING: Document preference for compiler conditional code, over + cpp conditional. + * configure.ac: DISABLE_BGP_ANNOUNCE always should be defined. + +2008-06-10 Paul Jakma <paul@jakma.org> + + * configure.ac: Bump version to 0.99.10 + +2008-05-29 Martin Nagy <mnagy@redhat.com> + + * */*main.c: Sanity check port numbers before using. + +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 Ingo Flaschberger <if@xip.at> + + * configure.ac: Improve HAVE_BSD_LINK_DETECT test. + +2008-01-10 Ingo Flaschberger <if@xip.at> + + * configure.ac: Define HAVE_BSD_LINK_DETECT if <net/if_media.h> is + present. + +2007-10-14 Paul Jakma <paul.jakma@sun.com> + + * NEWS: Note that MRT dumps are now version 2 + +2007-09-07 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Bump version to 0.99.9 + +2007-08-07 James Carlson <james.d.carlson@sun.com> + + * configure.ac: Added support for separate link-layer access + mechanisms in isisd. + +2007-07-27 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Bump version to 0.99.8 + +2007-06-25 Hasso Tepper <hasso@quagga.net> + + * configure.ac: Fix typo so it compiles again on BSD systems. + +2007-06-22 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: IRDP also depends on struct icmphdr, enabling + only on in_pktinfo breaks when an OS acquires pktinfo, as + Solaris NV has. Reported by Jim Carlson. + +2007-05-10 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Add back check for inet_aton, which got dropped + somehow in previous jumbo patch. + 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. + +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-04-30 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * configure.ac: Change gcc CFLAGS from '-std=c99' to '-std=gnu99' + to improve portability. + +2007-04-29 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Bump to 0.99.7 + +2007-04-16 David Young <dyoung@pobox.com> + + * connected.c (zebra): Only suppress adding a connected + route to the kernel if it is already marked "real" + (ZEBRA_IFC_REAL), i.e., "in kernel." According to Paul + Jakma, this probably fixes Quagga bug #202. + +2007-02-06 Greg Troxel <Greg Troxel <gdt@ir.bbn.com>> + + * configure.ac: Use generic sed test, since autoconf 2.59 lacks + AC_PROG_SED and while 2.59 is somewhat crufty, it isn't officially + crufty. + +2007-02-06 Greg Troxel <Greg Troxel <gdt@ir.bbn.com> + + * bootstrap.sh: use -i to install missing files + +2007-02-03 Greg Troxel <Greg Troxel <gdt@ir.bbn.com> + + * configure.ac: add AC_PROG_SED + +2007-02-02 Greg Troxel <Greg Troxel <gdt@ir.bbn.com> + + * README.NetBSD: use bootstrap.sh instead of autoreconf + + * bootstrap.sh: new file with just 'autoreconf' + + * update-autotools: print out tool name before invoking to aid debugging + +2006-12-08 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Bump to 0.99.6 + +2006-10-04 Oliver Hookins <ohookins@gmail.com> + + * bgpd/bgp_main.c: Add configuration check option, with + '-C' rather than '-c' for consistency between daemons. + * isisd/isis_main.c: ditto + * ospf6d/ospf6_main.c: ditto + * ospfd/ospf_main.c: ditto + * ripngd/ripng_main.c: ditto + * vtysh/vtysh_main.c: ditto + * ripd/rip_main.c: Change the config check option to + '-C' and tidy up the code. + * zebra/main.c: ditto + +2006-10-04 Stergiakis Alexandros <astergiakis@antcor.com> + + * ripd/rip_main.c: This trivial patch introduces a new + command-line option '-c', which instructs zebra/ripd + to check its configuration file for validity, print + any error message, and then exit. This is useful when + the configuration file is edited by hand or otherwise, + and you simply want to validate it without any other + effect. + * zebra/main.c: ditto + +2006-08-27 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Bump to 0.99.5 + +2006-06-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/quagga.spec.in: Get default distro automatically + by using rpm to query the fedora-release version. + And fix a typo (should be default_dist, not dist_default). + +2006-05-28 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Update SOS CFLAGS, Xt shouldn't be used and + enable debug options. + Add a check for GNU Make and warn the user if it does not appear + to be the make used. + 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). + +2006-05-10 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Bump to 0.99.4 + +2006-03-30 Paul Jakma <paul.jakma@sun.com> + + * TODO: Add reminder for useful MED functionality we should + implement. + +2006-02-15 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Check for mallinfo, being careful to link test + so we can detect things like umem being used (which doesn't + provide a mallinfo). + +2006-01-31 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Cleanup the hideous {net,ucd}-snmp section + by removing ucd-snmp. Hence fixing detection where + net-snmp is installed in /usr/local (Boris Kovalenko reported + the problem). + +2006-01-19 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Bump to 0.99.3 + +2005-11-26 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Collect together CFLAGS based on compiler + detected a bit. Recognise and set default CFLAGS for SunPro / + SOS10. + +2005-11-14 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Tell gcc we like C99. + [bug #231] Check and test for stdint.h. + +2005-11-11 Paul Jakma <paul.jakma@sun.com> + + * NEWS: Update. + * configure.ac: Bump to 0.99.2 + +2005-11-10 Paul Jakma <paul.jakma@sun.com> + + * HACKING: Add recommendation to provide a single Subject + style description to the commit message. + Add some recommendations for ChangeLog. + +2005-09-29 Paul Jakma <paul.jakma@sun.com> + + * 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. + +2005-09-19 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Test existance of strndup. + +2005-08-25 Paul Jakma <paul@jakma.org> + + * configure.ac: Add -fno-omit-frame-pointer after -Os in default + cflags, just to be sure. + Fedora's readline library does not itself link to termcap, hence + we must pass the result of termcap tests in via OTHER-LIBRARIES + argument, otherwise the test of main in readline will fail due to + missing termcap systems. On systems like Debian, -ltermcap + is not needed for the readline test, because libreadline already + links to it. + +2005-08-25 Hasso Tepper <hasso at quagga.net> + + * configure.ac, vtysh/Makefile.am: Only vtysh needs to be linked + against libreadline and friends. + +2005-08-13 Paul Jakma <paul@jakma.org> + + * Makefile.am: (EXTRA_DIST) Add the trailing slash back in which + greg left out - tools bits weren't being included in dist, + which broke rpm builds :). + +2005-08-10 Greg Troxel <gdt@fnord.ir.bbn.com> + + * Makefile.am (EXTRA_DIST): add INSTALL.quagga.txt, because people + that patch releases need to know about autoconf required versions. + +2005-06-30 Louis Lagendijk <louis.lagendijk@gmail.com> + + * configure.ac: Actually test whether libc has IPv6 support. + +2005-06-28 Paul Jakma <paul.jakma@sun.com> + + * INSTALL.quagga.txt: GNU make is required now, because of manual + automatic rules in solaris/Makefile.am. (If someone knows how + to do these in a better way..). + GNU AWK is required for CVS checkout builds. + +2005-06-01 Paul Jakma <paul.jakma@sun.com> + + * NEWS: bgpd work queues and ripd auth-mode change + +2005-05-07 Yar Tikhiy <yar@comp.chem.msu.su> + + * configure.ac: Check for OSes which support passing ifindex in + struct ip_mreq. + +2005-04-29 Paul Jakma <paul.jakma@sun.com> + + * NEWS: Added some more 0.99 news. + * configure.ac: bump to 0.99.1 (0.99.0 was never released except + via CVS snapshots) + +2005-04-25 Paul Jakma <paul.jakma@sun.com> + + * HACKING: Add some notes about build system changes, to + document common oversights (common for me anyway). + Seperate sections with two newlines, easier to read. + +2005-04-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * configure.ac: Added AC_ARG_ENABLE(time-check). By default, + warning messages will now be printed for threads or commands that take + longer than 5 seconds, but this configure argument can be used + to disable the checks or change the threshold. + +2005-04-16 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: check for gawk, needed to build memtypes.h + +2005-04-11 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * configure.ac: Move AC_CANONICAL_* stuff before AM_INIT_AUTOMAKE to + eliminate warning message about AC_ARG_PROGRAM being called + before AC_CANONICAL_TARGET. + +2005-04-11 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Call AC_CANONICAL_{BUILD,TARGET} macros. Target isnt + set otherwise, afaict. AC_SUBST enable_{user,group,vty_group} and + quagga_statedir - the Solaris package bits for one need this. + configure the solaris/ Makefile. + * Makefile.am: solaris is a subdir - unconditional or else it wont + be included in non-solaris made dists. + +2005-04-10 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Fix host string recognition for Solaris Nevada aka + solaris2.10.1, and hopefully future such strings. + +2005-04-07 Paul Jakma <paul.jakma@sun.com> + + * (global): Fix up list loops to match changes in lib/linklist, + and some basic auditing of usage. + * configure.ac: define QUAGGA_NO_DEPRECATED_INTERFACES + * HACKING: Add notes about deprecating interfaces and commands. + +2005-04-05 Paul Jakma <paul@dishone.st> + + * HACKING: remove the 'manually patch redhat/quagga.spec' bit + from RELEASE section. Let the rpm revision be CONFDATE, will work + fine. Expand on the importance of supplying good ChangeLog's in + the PATCH SUBMISSION section. + +2005-04-04 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Fix AC_LANG_SOURCE usage. It needs double square + brackets around source. Single ones broke square brackets in the + code (arrays). + +2005-04-03 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Use AC_RUN_IFELSE instead of obsolete AC_TRY_RUN macro + and define action for cross-compiling. + +2005-04-02 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Add --enable-isis-topology to enable isisd topology + generator code. + +2005-04-02 Paul Jakma <paul@dishone.st> + + * INSTALL.quagga.txt: Add note about additional CVS build + requirements, if one wishes to build ps/pdf docs. + +2005-04-02 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * configure.ac: Add strnlen to AC_CHECK_FUNCS. + +2005-03-28 Hasso Tepper <hasso at quagga.net> + + * configure.ac, */Makefile.am: Fix previous commit. SNMP includes + must be after lib/ includes in some systems. Introduce SNMP_INCLUDES + for that. + +2005-03-28 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Fix most of "Presents But Cannot Compiled" warnings + about various headers. CFLAGS is not correct place to specify + includes, INCLUDES is for that. + +2005-03-27 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Add Intel compiler (icc) support. Although Intel + tries really hard to make icc look like gcc, there are some + differences. It's very verbose with -Wall and it doesn't support + the individual -W options. We are going to ignore some of these + warnings. + +2005-03-26 Hasso Tepper <hasso at quagga.net> + + * doc/defines.texi.in, lib/version.h.in: Update copyright string to + include year 2005. + +2005-03-25 Jean-Mickael Guerin <jean-mickael.guerin@6wind.com> + * configure.ac: add struct nd_opt_interval and struct + nd_opt_homeagent_info detection. + +2005-03-14 Paul Jakma <paul.jakma@sun.com> + + * (global) update all c files to match the lib/vector.h rename of + (struct vector).active to max, and vector_max macro to + vector_active. + +2005-03-12 Paul Jakma <paul.jakma@sun.com> + + * configure.ac: Solaris 8 can use the newer lifreq based methods + too, allows IPv6. + +2005-02-19 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Fix Linux detection. Host types like i686-pc-linux + didn't match the pattern. + +2005-02-09 Paul Jakma <paul.jakma@sun.com> + + * (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. + +2005-01-24 Paul Jakma <paul@dishone.st> + + * configure.ac: Bump version to 0.99.0 + +2005-01-15 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/quagga.spec.in: Fix postun script to avoid misleading error + message saying the postun scriptlet failed when watchquagga + is not running. + +2005-01-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * configure.ac: Test for header file <ucontext.h> (for use in + signal processing). + +2005-01-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * configure.ac: If configure is invoked with --enable-snmp, but + the configure script is unable to find SNMP support on the platform, + then configure should give an error message and exit. + +2005-01-12 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/quagga.spec.in: Pass --enable-gcc-rdynamic to configure + to get gcc to link with -rdynamic for better backtraces. + When the rpm is upgraded, the restart logic now works as follows: + 1. stop watchquagga; 2. stop all routing daemons; 3. restart zebra + if it was running; 4. start all routing daemons that were running; + and 5. start watchquagga if it was running. + +2005-01-07 Paul Jakma <paul@dishone.st> + + * configure.ac: Bump version to 0.98.0 + +2005-01-05 Paul Jakma <paul@dishone.st> + + * configure.ac: Bump version to 0.97.5 + +2005-01-04 Greg Troxel <gdt@fnord.ir.bbn.com> + + * configure.ac: Use AC_MSG_CHECKING/AC_MSG_RESULT around + CMSG_FIRSTHDR check, so it shows up in the output of configure. + Tested on NetBSD, which doesn't define HAVE_BROKEN_CMSG_FIRSTHDR. + +2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * 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). + +2005-01-04 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * NEWS: Note improved logging facilities. + +2004-12-29 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * configure.ac: Add new option --enable-gcc-rdynamic to link + with -rdynamic. + +2004-12-23 Paul Jakma <paul@dishone.st> + + configure.ac: Bump version to 0.97.4 + +2004-12-22 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/quagga.spec.in: daemonv6_list should contain only IPv6 daemons. + +2004-12-22 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/quagga.spec.in: Add watchquagga, and fix some other + logic to make sure that all daemons are restarted on upgrades + and stopped on package removal. + +2004-12-22 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/quagga.sysconfig: Define some variables to support watchquagga. + +2004-12-22 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * configure.ac: Add a define for DAEMON_VTY_DIR in config.h. + +2004-12-22 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * {configure.ac,Makefile.am}: Build watchquagga by default. + +2004-12-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * NEWS: Note addition of watchquagga. + * HACKING: Note that watchquagga is in testing phase. + +2004-12-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * watchquagga: New watchquagga daemon. + +2004-12-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/Makefile.am: Added watchquagga.init to EXTRA_DIST. + +2004-12-21 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/watchquagga.init: New file, init script for watchquagga. + +2004-12-03 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * HACKING: Indicate that header files should be consulted for + documentation, particularly logging levels in lib/log.h. + +2004-11-24 Paul Jakma <paul@dishone.st> + + * TODO: Add source routing, zebra filtering and lib/ documenting. + +2004-11-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * global: Replace strerror with safe_strerror. And vtysh/vtysh.c + needs to include "log.h" to pick up the declaration. + +2004-11-19 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Avoid regeneration of doc/quagga.info for now. + +2004-11-17 Paul Jakma <paul@dishone.st> + + * INSTALL.quagga.txt: texinfo version corrected, so section on + that 4.7-x being unknown is not needed. + +2004-11-12 Paul Jakma <paul@dishone.st> + + * configure.ac: Fix AC_CONFIG_FILES, the chmod seems to run for + every input file, should be only be for vtysh/extract.pl, so that + should be a seperate AC_CONFIG_FILES. + * INSTALL: update-autotools, autoreconf -i will install this, remove + the file so it always matches the autoconf which created + configure (ie the quagga snapshot producing host). + * INSTALL.quagga.txt: Some quagga specific INSTALL notes. + * README: s/GNU Zebra/Quagga/ and refer to IS-IS support. + +2004-11-10 Andrew J. Schorr <ajschorr@alumni.princeton.edu> + + * redhat/quagga.spec.in: add comments showing how to get gcc verbosity + +2004-11-08 Paul Jakma <paul@dishone.st> + + * configure.ac: bump version to 0.97.3, release imminent. + +2004-11-06 Paul Jakma <paul@dishone.st> + + * configure.ac: Arguments to AC_OUTPUT is deprecated, use + AC_CONFIG_FILES instead. Rearrange the order slightly to put the + Makefiles first (silly aesthetic thing, dont know why I had to do + this ;) ). Add doc/defines.texi to the list. + * NEWS: bgp route-server support added, refer to docs. + * update-autotools: call automake with --add-missing and --copy, + former is important for obvious reasons, latter for dist files, + and --gnu to enable whatever extra goodness checks. + * {depcomp, install-sh, missing}: removed, auto-generated files. + +2004-11-05 Paul Jakma <paul@dishone.st> + + * HACKING: Expand on ChangeLogs, eg current practice for certain + directories and certain other meta-data is not to maintain a + ChangeLog. Expand on the commit message, IMHO, commit message + should always be ChangeLog for files where ChangeLog is kept. + Solaris is supported on any platform (with, at moment, an + additional patch). + +2004-10-23 Paul Jakma <paul@dishone.st> + + * configure.ac: bump version to 0.97.2, release imminent. + +2004-10-22 Paul Jakma <paul@dishone.st> + + * configure.ac: fix up enable help alignment slightly + Add --enable-gcc-ultra-verbose to set various gcc warnings which + should one day be fixed but are not serious problems or which + could be false-positives. + +2004-10-19 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * lib, zebra, ripd, ospfd, bgpd: Support NULL connected destination + pointers properly everywhere. Fix point-to-point logic to + support links where a dedicated subnet has been assigned. + PtP links with /31 subnets should now work where supported by O/S. + +2004-10-11 Paul Jakma <paul@dishone.st> + + * bump version to 0.97.1, release imminent. + +2004-10-07 Paul Jakma <paul@dishone.st> + + * bump version to 0.97.0, release imminent. + +2004-10-07 Greg Troxel <gdt@sunpal7.mit.edu> + + * configure.ac: remove -Wpacked; 2.95.3 doesn't support it. + +2004-10-05 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Removed -Wpadded. I don't have sooo much time that I + could care about padding ;). + +2004-09-30 Paul Jakma <paul@dishone.st> + + * Update default CFLAGS for gcc to keep Hasso busy. + +2004-09-27 Paul Jakma <paul@dishone.st> + + * update-autotools: libtoolize should copy files, rather than link. + the whole idea is that dist files should not need auto*, etc. + installed to be able to compile. + +2004-09-13 Hasso Tepper <hasso at quagga.net> + + * configure.ac: Disable isisd compiling by default. + +2004-09-13 Paul Jakma <paul@dishone.st> + + * configure.ac: capitalise the package name. autoconf lowercases + it for PACKAGE_TARNAME. + +2004-09-13 Jose Luis Rubio <jrubio@dit.upm.es> + (at Technical University of Madrid as part of Euro6ix Project) + + Enhanced Route Server functionality and Route-Maps: + + * bgpd/bgpd.h: Modified 'struct peer' and 'struct bgp_filter' to + support rs-clients. A 'struct bgp_table *rib' has been added to the + first (to mantain a separated RIB for each rs-client) and two new + route-maps have been added to the last (for import/export policies). + Added the following #defines: RMAP_{IN|OUT|IMPORT|EXPORT|MAX}, + PEER_RMAP_TYPE_{IMPORT|EXPORT} and BGP_CLEAR_SOFT_RSCLIENT. + + * bgpd/bgpd.c: Modified the functions that create/delete/etc peers in + order to consider the new fields included in 'struct peer' for + supporting rs-clients, i.e. the import/export route-maps and the + 'struct bgp_table'. + + * bgpd/bgp_route.{ch}: Modified several functions related with + receiving/sending announces in order to support the new Route Server + capabilities. + Function 'bgp_process' has been reorganized, creating an auxiliar + function for best path selection ('bgp_best_selection'). + Modified 'bgp_show' and 'bgp_show_route' for displaying information + about any RIB (and not only the main bgp RIB). + Added commands for displaying information about RS-clients RIBs: + 'show bgp rsclient (A.B.C.D|X:X::X:X)', 'show bgp rsclient + (A.B.C.D|X:X::X:X) X:X::X:X/M', etc + + * bgpd/bgp_table.{ch}: The structure 'struct bgp_table' now has two + new fields: type (which can take the values BGP_TABLE_{MAIN|RSCLIENT}) + and 'void *owner' which points to 'struct bgp' or 'struct peer' which + owns the table. + When creating a new bgp_table by default 'type=BGP_TABLE_MAIN' is set. + + * bgpd/bgp_vty.c: The commands 'neighbor ... route-server-client' and + 'no neighbor ... route-server-client' now not only set/unset the flag + PEER_FLAG_RSERVER_CLIENT, but they create/destroy the 'struct + bgp_table' of the peer. Special actions are taken for peer_groups. + Command 'neighbor ... route-map WORD (in|out)' now also supports two + new kinds of route-map: 'import' and 'export'. + Added commands 'clear bgp * rsclient', etc. These commands allow a new + kind of soft_reconfig which affects only the RIB of the specified + RS-client. + Added commands 'show bgp rsclient summary', etc which display a + summary of the rs-clients configured for the corresponding address + family. + + * bgpd/bgp_routemap.c: A new match statement is available, + 'match peer (A.B.C.D|X:X::X:X)'. This statement can only be used in + import/export route-maps, and it matches when the peer who announces + (when used in an import route-map) or is going to receive (when used + in an export route-map) the route is the same than the one specified + in the statement. + For peer-groups the statement matches if the specified peer is member + of the peer-group. + A special version of the command, 'match peer local', matches with + routes originated by the Route Server (defined with 'network ...', + redistributed routes and default-originate). + + * lib/routemap.{ch}: Added a new clause 'call NAME' for use in + route-maps. It jumps into the specified route-map and when it returns + the first route-map ends if the called RM returns DENY_MATCH, or + continues in other case. + +2004-08-31 Greg Troxel <gdt@poblano.ir.bbn.com> + + * Makefile.am: make m4 as subdir, rather the EXTRA_DISTing it + + * configure.ac: add m4/Makefile to output list + +2004-08-31 Greg Troxel <gdt@poblano.ir.bbn.com> + + * Makefile.am: Only put pkgsrc dir in SUBDIRS if we should install + rc.d files. (Note that pkgsrc is always in DIST_SUBDIRS.) + + * configure.ac (pkgsrcdir): add new --enable-pkgsrcrcdir to give a + directory into which www.pkgsrc.org-style rc.d files are + installed. + +2004-08-19 Paul Jakma <paul@dishone.st> + + * Makefile.am: add m4 directory to EXTRA_DIST, and define + ACLOCAL_AMFLAGS to have aclocal pull in m4/ + * configure.ac: AM_PROG_LIBTOOL should be AC_... + * update-autotools: print a warning that this script is deprecated + +2004-08-17 Greg Troxel <gdt@fnord.ir.bbn.com> + + * update-autotools: print tools versions to aid people in sending + bug reports. + +2004-07-23 Greg Troxel <gdt@poblano.ir.bbn.com> + + * */Makefile.am: Use ../dir/libfoo.la, rather than "-L../dir + -lfoo", to avoid linking against installed libraries from a + previous version. + + * {lib,ospfd,ospfclient}/Makefile.am: explicitly define the shared + library version number to be 0.0 + + * configure.ac: remove spurious , so extract.pl is chmod'd +x. + + * HACKING: explain shared library versioning rules + +2004-07-22 Paul Jakma <paul@dishone.st> + + * configure.ac: modify default CFLAGS to be compiler agnostic + build Makefile for tests/ subdir. + +2004-07-14 Greg Troxel <gdt@poblano.ir.bbn.com> + + * Makefile.am (EXTRA_DIST): Add missing \, so tools stuff is + really in distfile. + +2004-06-30 Greg Troxel <gdt@poblano.ir.bbn.com> + + * */Makefile.am: use -L../lib -lzebra, so we pick up the shlib + version of libzebra when available. + + * configure.ac, update-autotools: Add libtool. + +2004-06-30 Greg Troxel <gdt@poblano.ir.bbn.com> + + * Makefile.am: add files to EXTRA_DIST rather than copying, and + omit the kludgy cleaning steps, which were failing when the list + to clean was empty. + +2004-06-30 Greg Troxel <gdt@poblano.ir.bbn.com> + + * configure.ac: Look for perl, and substitute into vtysh/extract.pl. + Search for termcap functions more expansively (fixes vtysh compile + on NetBSD). Clean up --enable-vtysh definition. + +2004-06-30 Greg Troxel <gdt@poblano.ir.bbn.com> + + * update-autotools: Use -rf on autom4te.cache. + +2004-06-20 Hasso Tepper <hasso@estpak.ee> + + * lib/vty.c: Don't attempt to load configuration file from current + directory. + * Update vty_read_config() calls in bgpd/bgp_main.c, isisd/isis_main.c, + ospf6d/ospf6_main.c, ospfd/ospf_main.c, ripd/rip_main.c, + ripngd/ripng_main.c and zebra/main.c. + +2004-05-11 Paul Jakma <paul@dishone.st> + + * configure.ac: Add solaris support for the zebra/*_solaris + method's, based on Sowmini's patches. + +2004-04-08 Paul Jakma <paul@dishone.st> + + * ospf_spf.h: Add backlink field to struct vertex + * ospf_spf.h: (ospf_vertex_new) initialise backlink + (ospf_lsa_has_link) return index of link back to + vertex V from candidate vertex W, or -1 if no link exists. + (ospf_spf_next) save backlink index for candidate vertex + * ospf_interface.c: (ospf_vl_set_params) Use the backlink index + to determine correct address for virtual-link peers. Fall back + to older "pick first link" method if no backlink index exists. + +2004-04-06 Hasso Tepper <hasso@estpak.ee> + + * zebra/ipforward_proc.c: Fixed lowering privileges. + * zebra/zserv.c: Fixed "(no) ipv6 forwarding" command logic. + * configure.ac: Added --disable-capabilities switch to configure. + +2004-03-22 Hasso Tepper <hasso@estpak.ee> + + * Readded SIGTERM handling so daemons can clean up their stuff if they + are killed (not murdered). + +2004-03-20 Michael Bruening <mike@vailsys.com> + + * ospfd/ospf_vty.c: Completed array distribute_str of route types with + addition of "isis". This array must be indexed by + ZEBRA_ROUTE_(SYSTEM|KERNEL|...) defines in zebra.h, and should + be updated with every route type addition. This fix allows + commands redistributing routes from (bgp|isis), like "router ospf + redistribute bgp ...", to be written to terminal, memory, file, + which would otherwise result in a seg fault or, possibly, config + file corruption. Overlooked in import of isisd. + * Similar fixes to bgpd/bgp_vty.c ospf6d/ospf6_asbr.c ripd/rip_zebra.c + and ripngd/ripng_zebra.c. + +2004-03-17 Jean-Yves Simon <lethalwp@tiscali.be> + + * zebra/main.c, ripd/rip_main.c: Fix typos sigusr1 -> sigint, + bugzilla #82. + +2004-03-16 David Young <dyoung@pobox.com> + + * (many) reference <lib/version.h> rather than "version.h", + because version.h is a generated file and not present in the + source tree when using objdir builds. + +2004-03-03 PC Drew <pc@superiorcomm.net> + + * lib/keychain.c: typecast time_t function to long, fixes compile + warning. + * lib/debug.c: wrapped function with ifdef HAVE_GLIBC_BACKTRACE fixes + compile warning when backtrace doesn't exist for that system. + * zebra/rtadv.c: for OpenBSD, added include statement for + netinet/icmp6.h + * zebra/zserv.c: added default case to switch statements, fixes compile + warning about certain NEXTHOP_TYPE enumeration values not being + handled. + * zebra/rt_socket.c: set *mask = NULL by default, fixes compile + warning, about mask possibly being used uninitialized. + * bgpd/bgp_nexthop.c: added default case to switch statements, fixes + compile warning about certain NEXTHOP_TYPE enumeration values not + being handled. + * ospfd/ospf_spf.c: typecast time_t to long, fixes compile warning. + * ospfd/ospf_route.c: typecast route_node->prefix to prefix_ipv4, fixes + compile warning. + * ospfd/ospf_route.c: typecast prefix_ipv4 to prefix, fixes compile + warning. + * ospfd/ospf_abr.c: typecast prefix to prefix_ipv4 in two instances, + fixes compile warning. + * vtysh/vtysh.c: fixed null pointer sentinel value when doing execl and + friends, fixes compile warning. + * ospf6d/ospf6_damp.c: typecast time_t to long in 4 instances, fixes + compile warning. + * ospf6d/ospf6_main.c: use MAXPATHLEN (if set) instead of 64 for the + _cwd array, fixes compile warning. + +2004-01-19 Paul Jakma <paul@dishone.st> + + * tests/test-sig.c: New file, regression test for sigevents. + * lib/Makefile.am: add sigevent.{c,h} + * (isis|rip|ripng|ospf|ospf6|bgp)d/\1_main.c: modify for sigevents. + * zebra/main.c: ditto. + +2004-01-10 Paul Jakma <paul@dishone.st> + + * Makefile.am: redhat/ is a dist subdir too. + +2004-01-10 Vincent Jardin <jardin@6wind.com> + + * configure.ac: add the redhat/Makefile as a AC_OUTPUT() argument. + It fixes build on FreeBSD 5.1 and FreeBSD 4.7 + +2004-01-08 Paul Jakma <paul@dishone.st> + + * Makefile.am: as per gdt, specify the redhat dir as a DIST_SUBDIR, + remove the redhat/... dist targets - instead these now go in.. + redhat/Makefile.am: (new) proper place to describe redhat/ dist + files, as well as allow quagga.spec to be regenerated properly. + redhat/quagga.sysconfig: specify conf file location. + redhat/quagga.spec.in: Add 2 patches to RPM build. + +2003-12-30 Paul Jakma <paul@dishone.st> + + * redhat/isisd.init: new file, init script for isisd. + redhat/quagga.sysconfig: new file, sysconfig file for quagga + initscripts. + redhat/quagga.spec.in: various cleanups, including sysconfig patch + from RH, fixed UID/GID as per RH EL, shell changed to + /sbin/nologin, daemon vty's listen to 127.1 only per default and + isisd packaged. + redhat/*.init: sysconfig support and runlevels specified. + +2003-12-30 Paul Jakma <paul@dishone.st> + + * Makefile.am: put the redhat/ stuff into EXTRA_DIST rather than + copying via dist-hook. Remove ~ files backup cruft from dists. + isisd/Makefile.am: sysconf example should go via + dist_examples_DATA. The include-netbsd/ headers werent mentioned + as sources and werent being copied into dists. + +2003-12-23 Vincent Jardin <jardin@6wind.com> + + * isisd: Import isisd from Sampo Saaristo's source code. + +2003-12-22 Christian Hammers <ch@lathspell.de> + + * configure.ac (and everywhere a regular file is opened for + writing): use file permissions from configure rather than + compiled-in umask. + +2003-12-22 Hasso Tepper <hasso@estpak.ee> + + * lib/linklist.c: Revert microfix I commited while reverting + [quagga-dev 227]. Caused by misreading code. + +2003-12-21 Hasso Tepper <hasso@estpak.ee> + + * lib/linklist.c: Revert patch [quagga-dev 227]. listnode_add_sort() + function should not drop nodes in any case. But fix behavior where + nodes were added to the end of list when cmp returned 0. + * lib/if.c: Check for duplicates before calling listnode_add_sort(). + +2003-12-08 Greg Troxel <gdt@fnord.ir.bbn.com> + + * {lib,ospfd,ospfapi}/Makefile.am: Use pkginclude_HEADERS rather + than include_HEADERS to place includes in + ${prefix}/include/quaggainstead of polluting ${prefix}/include. + +2003-12-04 Greg Troxel <gdt@poblano.ir.bbn.com> + + * configure.ac: When setting exampledir to sysconfdir as a + default, don't quote ${sysconfdir}. (Bug reported by Vincent + Jardin.) + +2003-12-03 Greg Troxel <gdt@poblano.ir.bbn.com> + + * configure.ac: Compile in Router Advertisement support by + default. Note that this does not default to sending RAs; it just + makes 'ipv6 nd send-ra' and 'ipv6 nd prefix-advertisement' + available. While others may prefer other tools, no argument has + been made that router advertisement support is such bloat that it + should be compiled out by default (it 9556 bytes on NetBSD/i386 vs + 8 bytes with the support compiled out). This reversion of a + previous change was done in consultation with Paul. + +2003-12-03 Greg Troxel <gdt@poblano.ir.bbn.com> + + * configure.ac: Move tests for v6 header files to after the check + for v6 code version, and conditionalize on the right variable. + (Fixes problem where v6 header files are not included when v6 is + enabled implicitly.) + +2003-12-03 Greg Troxel <gdt@poblano.ir.bbn.com> + + * configure.ac: Add --enable-exampledir to specify where example + config files should go, defaulting to sysconfdir. + + * */Makefile.am: use exampledir instead of sysconfdif for examples + +2003-11-02 Paul Jakma <paul@dishone.st> + + * bgpd/bgp_routemap.c: Fix up 'set ip next-hop A.B.C.D|peer-address' + route map command so that vtysh can use it. Modified version of + Hasso Tepper's patch. Fixes bug #52. + * configure.ac: FreeBSD has net-snmp in /usr/local. + * redhat/quagga.spec.in: Install libzebra headers with -devel + package. + +2003-11-02 Krzysztof Oledzki <oleq@ans.pl> + + * zebra/zebra_rib.c: Revert patch (dating from zebra.org) which + caused zebra to read all routes in all tables, rather than just + the main table. See [quagga-dev 280]. + +2003-10-30 Paul Jakma <paul@dishone.st> + + * configure.ac: netinet/in_systm.h is yet another well-known + header file we really should be checking for + +2003-10-27 kamatchi soundaram <kamatchi@tdd.sj.nec.com> + + * ospfd/ospfd.c: Do not increment act_int for an area, as it is done + by ospf_ism.c::ism_change_state() - results in incorrect figure + for active interfaces in an area. + +2003-10-27 Paul Jakma <paul@dishone.st> + + * lib/if.{ch}: remove ifc_pointtopoint() - left over from the + reverted RFC3021 patch. + +2003-10-27 Simon <lists@routemeister.net> + + * ospfd/ospfd.c: if_is_pointopoint() takes (struct interface *), was + being called with struct connected. Change to co->ifp. + +2003-10-27 Gilad Arnold <gilad.arnold@terayon.com> + + * zebra/zebra_rib.c: (nexthop_active_update) Check for multipath + limit when setting changed flag to avoid spurious changes. + (static_install_ipv{4,6}) dont uninstall by default, might not be + required - avoid spurious uninstalls. + (static_uninstall_ipv{4,6}) only uninstall the route if its + actually FIB route. + +2003-10-24 sowmini.varadhan@sun.com + + * ospfd/ospf_network.c: (ospf_sock_init) Exit if socket can not be + created. + +2003-10-24 Jose Luis Rubio Guivernau <jrubio@dit.upm.es> + + * Better 'show bgp' support for views (eg ipv6), see [quagga-dev 238] + * bgpd/bgp_route.c: (bgp_show) Take a struct bgp argument instead of + view string. + (bgp_show_neighbor_route) Take a struct peer argument instead of + ip string. + (peer_adj_routes) ditto + (show_adj_routes) ditto + (peer_lookup_in_view) new function to return appropriate struct + peer for a given view string. + (misc) Fixup all calls to above to reflect new calling arguments, + and use peer_lookup_in_view as needed. Additional commands + installed to use expanded functionality above, existing commands + modified to suit as well. + * bgpd/bgp_vty.c: 2 new aliases. + +2003-10-24 Paul Jakma <paul@dishone.st> + + * configure.ac: Check for fcntl() + * {bgpd,ospf,ospf6d,ripd,ripngd}/Makefile.am: Install conf file via + regular automake means, not magic install incantations, see + bug #38. + * lib/Makefile.am: install the headers, needed to link libzebra.a + (and hence libospf.a, OSPF-API, etc.) + +2003-10-24 waldi@debian.org + + * vtysh/Makefile.am: vtysh_cmd.c rebuild was broken because it + depended against source files without specification, i.e. it + used ../zebra instead of $(top_srcdir)/zebra. + +2003-10-23 Paul Jakma <paul@dishone.st> + + * configure.ac: IRIX configure.ac support. Sort of works. + sysctl() crashes though (ipforward), there's some kind of odd + padding in the PF_ROUTE socket messages and setsockopt() on + SOCK_RAW does not work (so ospfd doesnt work). + +2003-10-22 Paul Jakma <paul@dishone.st> + + * vtysh/Makefile.am: do not include vtysh_cmd.c in dists, its + configure dependent. (still need to find a way to make building of + it dependent on configure options or include all commands.) + +2003-10-22 Paul Jakma <paul@dishone.st> + + * 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-22 Paul Jakma <paul@dishone.st> + + * lib/regex.c: bzero -> memset + * zebra/ioctl.c: ditto. bzero is not portable. + +2003-10-22 Paul Jakma <paul@dishone.st> + + * zebra/kernel_socket.c: HAVE_IPV6 conditional for WRAPUP when + HAVE_SA_LEN is not defined. bcopy -> memcpy, bcopy is not + portable. + +2003-10-22 Paul Jakma <paul@dishone.st> + + * configure.ac: Split up header checks into non-net, net and ipv6 + related. Checking of IPv6 is conditional. Add some more output + text for the end of the configure run. + +2003-10-18 Lorenzo Colitti <lorenzo@ripe.net> + + * bgpd/bgp_attr.c: (bgp_dump_routes_attr) Dont dump IPv4 nexthop + for IP. Dump MP_NLRI attr with IPv6 next-hop for AF_INET6 address + family prefixes. Accept prefix as argument. + * bgpd/bgp_attr.c: modify bgp_dump_routes_attr declaration. + * bgpd/bgp_dump.c: (bgp_dump_routes_entry) Modify calls to + bgp_dump_routes_attr. + (bgp_dump_common) Go by the family of the peering socket, not + configured address family when dumping peering information. + Add HAVE_IPV6 conditionals, eg missing from previous bgp interval + patch. + +2003-10-18 Lorenzo Colitti <lorenzo@ripe.net> + + * bgpd/bgp_dump.{c,h}: (bgp_dump_interval_add) Dump at discrete + fixed intervals rather than fixed intervals from startup time. + (bgp_dump_interval_func) Dont return immediately if file cant be + openeded, but reschedule interval dumps, even - admin might + fix problem in meantime. Close the dump file in between intervals. + (bgp_dump_init) account for MSG header when initialising stream + size. + +2003-10-15 Paul Jakma <paul@dishone.st> + + * ospfd/ospf_interface: (ospf_if_lookup_table) new function to + lookup oi for a given prefix in a given interfaces table of oi's. + (ospf_if_new) use ospf_if_lookup_table to deal with zebra + reporting new interface multiple times. + NB: This patch is a complete plaster-band of a hack. First, why is + zebra reporting interface events multiple times? Second, why does + ospfd maintain so many damn lists and tables relating to oi's - + these should be reconciled into one or two tables. + +2003-10-15 sowmini.varadhan@sun.com + + * ripd/ripd.c: (rip_send_packet) use rip->sock for mcast sends, + instead of creating one socket per send. send source addr to + rip_update_interface. + (rip_update_process) should send an update on every connected + network for each interface. + (rip_request_send) should send a request on every connected + network for each interface. + * ripd/ripd.h: update prototype for rip_interface_multicast_set + * ripd/rip_interface.c: (rip_interface_multicast_set) reorganized + so that it can be called repeatedly for aliased interfaces (on + multiple networks). + +2003-10-15 Jay Fenlason <fenlason@redhat.com> + + * lib/vty.c: (vty_telnet_option) Remote DoS exists if a telnet + end-sub-negotation is sent when no sub-negotation data has been + sent. Return immediately if no sub-negotation is in progress. + (vty_read) do not attempt to process options if no sub-negotation + is in progress. + +2003-10-15 Paul Jakma <paul@dishone.st> + + * lib/vty.c: (vty_save_cwd) dont crash if getcwd fails. try fallback + to SYSCONFDIR. Allocate cwd from the stack rather than relying on + (non-portable) getcwd() allocation (which we didnt seem to be + freeing). + +2003-10-13 Jay Fenlason <fenlason@redhat.com> + + * 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-10-13 sowmini.varadhan@sun.com + + * ospf_lsa.h: Add OSPF_LSA_PREMATURE_AGE flag. + * ospf_lsa.c: added better debug comments. check sequence number in + ospf_lsa_install. ospf_maxage_lsa_remover() checks for + OSPF_LSA_PREMATURE_AGE and re-originates the lsa after ls_acks are + received. + * ospf_flood.c: improve debug statement- print ls_seqnum. + +2003-10-13 Douglas Fraser <doug+quagga@idmf.net> + + * zebra/connected.c: PtP revert fixup. Zebra was not creating + connected route for PtP peer. + +2003-10-07 Tarhon-Onu Victor <mituc@iasi.rdsnet.ro> + + * zebra/ipforward_proc.c: (ipforward) Close the fd for + /proc/net/snmp. See [quagga-dev 284] + +2003-09-29 Gilad Arnold <gilad.arnold@terayon.com> + + * zebra/zebra_rib.c: Fix possible dangling reference to rib + route_nodes - unlock it the appropriate number of times. (twice, + because of the implicit lock). see [quagga-dev 251]. + +2003-09-29 Paul Jakma <paul@dishone.st> + + * zebra/connected.c: revert the 'generic PtP' patch as it causes + far too many problems. People who use FreeSWAN should investigate + native linux ipsec. + * zebra/rt_netlink.c: ditto + * lib/if.c: ditto + * ripd/ripd.h: ditto + * ripd/ripd.c: ditto + * ripd/rip_interface.c: ditto + * ospfd/ospfd.c: ditto + * ospfd/ospf_snmp.c: ditto + * bgpd/bgp_nexthop.c: ditto + * ospfd/ospf_packet.c: Add debug output for some of the previously + completely silent drops of 'bad' packets. + * configure.ac: bump version + +2003-08-27 Jay Fenlason <fenlason@redhat.com> + + * lib/Makefile.am: Do not use a lib (libcap) as a dependency + * zebra/Makefile.am: Link in libcap + * bgpd/bgp_routemap.c: attr->med is type u_in32_t, should be + compared with UINT32_MAX + * ospfd/ospfd.c: remove redundant assert + * zebra/rtadv.c: add missing include for zebra/rib.h + +2003-09-24 Paul Jakma <paul@dishone.st> + + * lib/version.h: moved to version.h.in + * lib/version.h.in: New file, from version.h. Change hardcoded + package name and version to use the autoconf defined substition + variables. + * configure.ac: Fix up AC/AM_INIT* to new style. Remove the sed'ing + through lib/version.h for VERSION. Add lib/version.h to the + AC_OUTPUT list. Update the text output of quagga version at end + of configure run to use PACKAGE_VERSION. + * doc/.cvsignore: ignore quagga.pdf + * doc/.cvsignore: ignore version.h, its now autogenerated. + +2003-09-24 sowmini.varadhan@sun.com + + * lib/if.c: (if_cmp_func) fix infinite loop if + ifp1->name == ifp2->name + * lib/linklist.c: (if_cmp_func) Fix handling of case where + list->cmp returns 0. + * rip_interface.c: (rip_interface_address_add) call + rip_enable_apply(), or the interface is never considered up. + see [quagga-dev 225]. + * zebra/kernel_socket.c: Fix up WRAPUP macro to deal with multiple + address families in the absence of sa_len element in struct + sockaddr. + (ifm_read): Handle solaris 9 if_msghdr_t. + Deal with interfaces which are incomplete, lookup on name rather + than the placeholder interface index of -1. + +2003-09-24 Thomas Giger TGC <thomas.giger@tgc.de> + + * ospf_packet.c (ospf_associate_packet_vl): pass NULL struct + interface to ospf_if_lookup_by_local_addr() rather than the + receiving interface ifp, packets for VL's could come in any + interface. See quagga-dev 250. + +2003-04-13 Paul Jakma <paul@dishone.st> + + * Amir: Opaque LSA bug fix for deletion of Type11's + * configure.ac: use --localstatedir for Unix sockets + * Hasso Tepper: When flushing as-ext LSAs flush associated NSSA + LSAs. + +2003-04-04 Paul Jakma <paul@dishone.st> + + * Sync to Zebra CVS + * Fix lib/thread.h leak + * Fix small Opaque LSA leak + * Do not configure OSPF interfaces for secondary addresses + * vtysh fixes from Hasso + * Dave Watson's missing ntohs fix + +2003-03-25 Paul Jakma <paul@dishone.st> + + * Sync to Zebra CVS + +2003-03-17 Amir Guindehi <amir@datacore.ch> + + * Extended SNMP checks in configure.ac so that net-snmp works + +2003-03-17 Amir Guindehi <amir@datacore.ch> + Ralph Keller <keller@tik.ee.ethz.ch> + * merge OSPF-API + +2003-02-07 Paul Jakma <paul@dishone.st> + + * Sync to zebra CVS + +2003-02-03 Paul Jakma <paul@dishone.st> + + * Sync to zebra CVS + +2003-01-19 Paul Jakma <paul@dishone.st> + + * Temporary fix for Generic PtP wrt to IPv6 + +2003-01-17 Paul Jakma <paul@dishone.st> + + * Sync up to latest zebra.org CVS + * [zebra 16823] Bugfix and new feature in Opaque-LSA handling + Masahiko Endo <endo@suri.co.jp> + * [zebra 16824] [PATCH] nsm_kill_neighbor + Masahiko Endo <endo@suri.co.jp> + * [zebra 17217] [PATCH] show thread CPU + Yon Uriarte <havanna_moon@gmx.net> + * [zebra 17218] Re: [PATCH] CLI extensions. + Yon Uriarte <havanna_moon@gmx.net> + +2002-12-13 Paul Jakma <paul@dishone.st> + + * added support for vtysh 'write file' command to + write either per-daamon and/or integrated file + * ospfd md5 buffer copying fix (Greg Troxel) + * ospfd md5 sequence number derived from time() + * RIPv1 fixes and improvements (John Hay) + * link state detection (linux) ([zebra 12269]) + * Generic PtP and RFC3021 interface addressing support + (Frank van Maarseveen) + * Michal Ludvig <michal@logix.cz>: + [zebra 16525] PATCH: Bugfixes for KAME systems + * Kevin C Miller <kevinm@andrew.cmu.edu> + [zebra 16681] OSPF NSSA Patches + * Yon Uriarte <havanna_moon@gmx.net> + [zebra 16671] [PATCH] CLI extensions + * Masahiko Endo: [zebra 15475] - MPLS-TE docs + +2002-07-07 Kunihiro Ishiguro <kunihiro@ipinfusion.com> + + * zebra-0.93 released. + +2002-06-28 Kunihiro Ishiguro <kunihiro@ipinfusion.com> + + * update-autotools: Change file name from update-auto-tools.sh. + +2002-06-21 Kunihiro Ishiguro <kunihiro@ipinfusion.com> + + * update-auto-tools.sh: Add a new script to clean up build + environment. + +2002-06-18 Kunihiro Ishiguro <kunihiro@ipinfusion.com> + + * Shift to the latest build environment autoconf-2.53 and + automake-1.6.2. + +2001-10-22 Kunihiro Ishiguro <kunihiro@ipinfusion.com> + + * Integrate Glen Turner <glen.turner@aarnet.edu.au>'s pid option. + +2001-08-19 Kunihiro Ishiguro <kunihiro@ipinfusion.com> + + * zebra-0.92a released. + +2001-08-19 "Peter Galbavy" <peter.galbavy@knowtion.net> + + * configure.in: SNMP library check problem fix when the library is + installed under /usr/local/lib. + +2001-08-15 Kunihiro Ishiguro <kunihiro@ipinfusion.com> + + * zebra-0.92 released. + +2001-04-22 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (LIBPAM): Use ZEBRA_AC_C_BIGENDIAN to avoid a + warning. + (IF_METHOD): Use test -r instead of AC_CHECK_FILE to avoid + warnings. + + * config.guess: Update to 2000-11-10 version. + +2001-04-11 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Use AC_TRY_COMPILE instead of AC_EGREP_HEADER to + detect in_pktinfo structure. Suggested by: Vlad Lungu + <vlad@rls.roknet.ro>. + +2001-03-07 Michael Rozhavsky <mrozhavsky@opticalaccess.com> + + * configure.in: Add check for structure in_pktinfo. + +2001-02-07 "Bjoern A. Zeeb" <bzeeb+zebra@zabbadoz.net> + + * configure.in (USE_PAM): Fix PAM library detection code. + +2001-02-01 Kunihiro Ishiguro <kunihiro@zebra.org> + + * zebra-0.91 is released. + +2001-01-12 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Remove guile related definition. + +2001-01-11 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (ac_cv_htonl_works): HAVE_REPAIRABLE_HTONL is + removed. htonl should work fine on any platform. + +2001-01-10 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Remove --enable-oldrib option. + + * acconfig.h: OLD_RIB definition is removed. + + * zebra-0.90 is released. + + * configure.in (LIBS): Add check for sun_len field in struct + sun_len. + +2001-01-09 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Makefile.am: Include init/redhat files to distribution. + +2001-01-07 Yasuhiro Ohara <yasu@sfc.wide.ad.jp> + + * configure.in: check libm.a for BGPd compile error. + AC_CHECK_LIB(m, main) was added. + +2000-12-29 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: --enable-unixdomain becomes default. Add + --enable-tcp-zebra for TCP/IP communication between protocol + daemon and zebra. + + * COPYING.LIB: Added for lib/getopt.c, lib/getopt.h, + lib/getopt1.c, lib/md5-gnu.h, lib/md5.c, lib/regex-gnu.h, + lib/regex.c. + + * Makefile.am (dist-hook): Include tools/*.cgi to distribution. + +2000-12-26 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (MULTIPATH_NUM): --enable-multipath=ARG specify + multipath number. ARG must be digit. + +2000-12-11 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add --enable-newrib for test new RIB code. + +2000-11-25 Yasuhiro Ohara <yasu@sfc.wide.ad.jp> + + * configure.in, config.h.in: Add check for libutil.h and + setproctitle(). + +2000-10-26 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add --enable-nssa for OSPF NSSA option. + + * acconfig.h: Define HAVE_NSSA. + +2000-10-25 "Bjoern A. Zeeb" <bzeeb+zebra@zabbadoz.net> + + * configure.in: pam_misc is only linked when the platform is + GNU/Linux. + +2000-10-24 Arkadiusz Miskiewicz <misiek@pld.org.pl> + + * configure.in (LIBS): Add check for crypto library. test x`ls + ${ac_snmp}` is replaced with sipmle test -f. + +2000-10-23 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add --enable-unixdomain option. This will be + default behavior in zebra-0.90. + +2000-10-02 Kunihiro Ishiguro <kunihiro@zebra.org> + + * zebra-0.89 is released. + +2000-09-27 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add check for Intel CPU for Solaris on x86 check. + +2000-09-21 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add check for getifaddrs(). + Set AM_INIT_AUTOMAKE version to 0.89. + +2000-09-14 Kunihiro Ishiguro <kunihiro@zebra.org> + + * config.guess: Update to the latest version. + + * config.sub: Likewise + +2000-09-14 David Lipovkov <dlipovkov@OpticalAccess.com> + + * REPORTING-BUGS: New file is added. + +2000-08-27 itojun@iijlab.net + + * configure.in: Add ncurses library check when --enable-vtysh is + specified. + +2000-08-22 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add check for readline/history.h. + + * acconfig.h: Remove pthread related variables. + + * configure.in: Add --with-libpam option for vtysh PAM + authentication. Remove --disable-pthread because we don't support + pthread. + +2000-08-17 Kunihiro Ishiguro <kunihiro@zebra.org> + + * zebra-0.88 is released. + + * configure.in: Add Solaris -lcurses for vtysh. + +2000-08-02 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add check for ncurses for compiling on Solaris. + +2000-07-27 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add check for libreadline when --enable-vtysh is + specified. + +2000-07-23 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add AC_DEFINE(OPEN_BSD). When OS is OpenBSD + interface method is if_ioctl.o + +2000-07-09 Chris Dunlop <chris@onthe.net.au> + + * acconfig.h: Add HAVE_BROKEN_ALIASES. + + * configure.in: Add --enable-broken-aliases. + +2000-06-12 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to zebra-0.87. + +2000-06-05 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Remove --enable-mpls-vpn. Now MPLS-VPN support is + default. + + * Set version to zebra-0.87-pre + + * Makefile.am: Likewise. + +2000-04-27 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.86. + +2000-03-21 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.85b for ospfd test. + +2000-03-20 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.85a for ospfd test. + +2000-03-08 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.85. + +2000-01-26 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Makefile.in: Regenerated by patched automake for fixing "make + clean" problem on FreeBSD. + +1999-12-08 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.83a. This is for *BSD static route lookup + problem. + +1999-12-06 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.83. + +1999-11-29 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.82. + +1999-11-23 Kunihiro Ishiguro <kunihiro@zebra.org> + + * aczebra.m4: New file added. + +1999-11-21 Michael Handler <handler@sub-rosa.com> + + * configure.in (LIBS): Add sa_len check of sockaddr. + + * acconfig.h: Add HAVE_SA_LEN. + +1999-11-12 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: Update version to zebra-0.81b for bgpd test. + +1999-11-09 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add --enable-mbgp. + +1999-11-05 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Makefile.am (EXTRA_DIST): Add TODO to the distribution. + +1999-11-04 Kunihiro Ishiguro <kunihiro@zebra.org> + + * TODO: New file is added. + +1999-11-03 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: Update version to zebra-0.81a for ospfd test. + +1999-10-28 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: New option --enable-snmp is added. + +1999-10-24 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: Update version to zebra-0.80. + +1999-10-21 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: Update version to zebra-0.80-pre3 + +1999-10-18 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (LIBS): SNMP check is done by ucd-snmp/asn1.h. + +1999-10-10 Peter Galbavy <Peter.Galbavy@knowledge.com> + + * configure.in: Add support of OpenBSD. + +1999-10-04 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: Update version to zebra-0.80-pre2. + +1999-09-27 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: Update version to zebra-0.80-pre. From this version, + access-list and prefix-list's name space is divided into IPv4 and + IPv6. + +1999-09-17 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: For test recent fixes Set version to zebra-0.79a. + +1999-09-14 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: zebra-0.79 is out. + +1999-09-08 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: For ospfd's virtual link test. Set version to 0.78h. + +1999-09-07 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: For ospfd test. Set version to 0.78g. + +1999-09-05 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: For internal test of ospfd. Set version to 0.78f. + +1999-09-02 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: To test ospfd's fix, set version to 0.78e. + +1999-09-01 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: To test ospfd's area related bug fix, set version + to 0.78d. + +1999-09-01 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: To test ospfd, set version to 0.78c. + +1999-08-31 Janos Farkas <chexum@shadow.banki.hu> + + * Many misspelling correction. + +1999-08-31 Kunihiro Ishiguro <kunihiro@zebra.org> + + * version.h: To test ospfd, set version to 0.78b. + +1999-08-31 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (LIBS): Add UCD-SNMP include path check. + +1999-08-31 Lars Fenneberg <lf@elemental.net> + + * configure.in: The logic which detects the UCD-SNMP library + should first check in the default system locations for the library + and then in /usr/local. + +1999-08-27 itojun@iijlab.net + + * configure.in (LIBS): Fix problem about libsnmp.a check. + +1999-08-26 kay <kay@v6.access.co.jp> + + * configure.in (CFLAGS): Add <sys/socket.h> to check socklen_t. + +1999-08-24 VOP <vop@unity.net> + + * filter.c: Include "sockunion.h". + plist.c: Likewise. + table.c: Likewise. + +1999-08-24 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add netinet6/in6.h check. + +1999-08-21 Masaki Minami <masaki@minami.org> + + * BSD/OS 4.0 porting. + +1999-08-15 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add --enable-netlink option to force to use Linux + netlink interface. + (CFLAGS): Add ucd-snmp library check. + + * acconfig.h: If socklen_t is not defined, typedef int to + socklen_t. + +1999-08-15 Arkadiusz Miskiewicz <misiek@misiek.eu.org> + + * configure.in: When --enable-ipv6 specified, then only kernel + version is checked. + +1999-08-14 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add GNU libc 2.1 check. + +1999-08-02 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Fix privious Linux IPv6 check changes. + +1999-08-02 Arkadiusz Miskiewicz <misiek@misiek.eu.org> + + * configure.in: Improve Linux IPv6 feature check. + +1999-07-29 Rick Payne <rickp@rossfell.co.uk> + + * Changed route-maps to behave in a more cisco-like fashion + +1999-07-27 Gerhard Poul <gpoul@gnu.org> + + * SERVICES: New file added. + +1999-07-12 itojun@iijlab.net + + * configure.in: Add check for getaddrinfo. Improve Kame related + library check. + +1999-07-07 Yasuhiro Ohara <yasu@sfc.wide.ad.jp> + + * configure.in, acconfig.h: Add check for FreeBSD 3.2. + +1999-07-07 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Delete check for netinet/ip6.h. + +1999-06-30 Gerhard Poul <gpoul@gnu.org> + + * README: remixed the old files and added some new parts. + moved some INSTALL stuff into INSTALL file. + moved some other stuff to doc/zebra.texi + +1999-06-29 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (LIBS): Add libresolv check. + Change --enabe-all-in-one option to --enable-one-vty. + +1999-06-20 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add --enabe-all-in-one option. + +1999-06-16 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add socklen_t check. + +1999-06-16 Gerhard Poul <gpoul@gnu.org> + + * Many compile warnings fixed. + +1999-05-31 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Change message from Linux 2.2.X IPv6 to Linux IPv6. + OpenBSD (NRL) check is enabled. + +1999-05-30 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (LIBS): Add crypt library check. + +1999-05-08 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add sin6_scope_id in struct sockaddr_in6 check. + +1999-04-30 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.63 for first beta package. + +1999-04-15 Kunihiro Ishiguro <kunihiro@zebra.org> + + * guile.m4: Added from guile package. + +1999-04-14 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Set version to 0.60 for beta package preparation. + +1999-04-12 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Makefile.am: Add noninst_LIBRARIES each directory's Makefile.am. + This change is for linking these libraries to guile. + +1999-04-08 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (LIBS): Add struct rt_addrinfo check. + +1999-04-07 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: AC_STDC_HEADERS added. + +1999-03-29 Kunihiro Ishiguro <kunihiro@zebra.org> + + * Add dependencies to each directory's Makefile.am. + +1999-03-02 Peter Galbavy <Peter.Galbavy@knowledge.com> + + * reworked include file structure, and configure so that all + source files get all system-dependent include files by including + <zebra.h> which is really lib/zebra.h. This means that the + different programs include files are now available as #include + "zebra/zebra.h" - note the use of quotes, not <> as delimiters. + + In practical terms, if I haven't really screwed up, the main file + that maintainers for other OSes have to change is lib/zebra.h for + all the conditional includes etc. + + * added --disable-pthread for those systems that seem to have + POSIX threads, but do not work. OpenBSD 2.4+ is like that just + now. Changed all occurance of #ifdef PTHREAD to use HAVE_PTHREAD + instead. + +1999-02-24 <kunihiro@zebra.org> + + * configure.in: update to AC_PREREQ(1.13). + Change message from Linux 2.1.x to Linux 2.2.x. + * Added ospf6d directory support. + +1999-02-22 Peter Galbavy <Peter.Galbavy@knowledge.com> + + * added a "log" element to the BGPd peer structure, enabling us to + start thinging about a log stream per peer. This is currently + ignored by the wrapper code, but developers should try to use the + "appropriate" ZLOG stream. Documentation will follow, when the + real routines start to exist. + + The current plan is to use a copy of the BSD syslog() routines and + replace the syslog library function with our own. I will need + feedback from users of other platforms as this work is done to see + if all is well elsewhere. + + * preliminary work on zlog() library. directly replaces syslog() + currently with zlog(ZLOG *, ...) where the new first argument + is a pointer to a ZLOG structure (defined in lib/log.h) and will + encapsulate all the information necessary to maintain multiple + logging streams. + +1999-02-19 Peter Galbavy <Peter.Galbavy@knowledge.com> + + * added vsnprintf() macro to lib/str.h if required and removed + #ifdef SUNOS_5 dependency on it + +1999-02-18 Peter Galbavy <Peter.Galbavy@knowledge.com> + + * syslog support added + +1999-02-18 Peter Galbavy <Peter.Galbavy@knowledge.com> + + * configure.in: Add daemon function check. + +1999-01-21 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Add --disable-ipv6, --disable-zebra, + --disable-bgpd, --disable-ripd, --disable-ripngd, --disable-ospfd + options to configure. + +1998-12-07 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Check /usr/inet6/lib/libinet6.a exists or not. + +1998-10-14 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Comment out FreeBSD's libc_r detect section. At + this moment it doesn't work correctly with zebra. + + Netlink interface is only enabled when Linux kernel version is + upper than 2.1.0. + +1998-09-15 HEO SeonMeyong <seirios@matrix.iri.co.jp> + + * Hydrangea is now called KAME, so change all defines. + +1998-08-16 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: ifaliasreq check added. + +1998-08-12 Katsuhiro Kondou <kondou@nec.co.jp> + + * Patch is applied for compile under EWS4800 + +1998-06-09 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: delete old mtu_method check. + + * doc/zebra.texi (Kernel interface): chapter `Kernel interface' added + +1998-06-08 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: add new netlink check for GNU/Linux + +1998-06-07 Kunihiro Ishiguro <kunihiro@zebra.org> + + * doc/zebra.texi: Update Linux netlink chapter. + +1998-05-18 Yamashita TAKAO <jargon@lares.dti.ne.jp> + + * config.h.in: define PTHREAD if work on Solaris 2.6 + why delete the definition? I miss? + +1998-05-08 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: add net/if.h header check. + +1998-05-02 SeonMeyong HEO <seirios@Matrix.iri.co.jp> + + * zebra.tex,archfig.tex,zebra.sty: Manual file is added. + * zebra.texi: Modify Introduction text. + * RIPngd.c: Patch Hydrangea code. + +1998-05-01 Kunihiro Ishiguro <kunihiro@zebra.org> + + * .cvsignore: added. + + * Makerule.in: is gone. + * Makefile.am: Now we use automake to generate Makefile.in + +1998-03-19 Yamashita TAKAO <jargon@lares.dti.ne.jp> + + * lib/vty.c: modified the definition of *master + * lib/sockunion.c (inet_aton): add, but don't work. uum... + + +1998-03-15 Yamashita TAKAO <jargon@lares.dti.ne.jp> + + * configure.in: define PTHREAD if work on Solaris 2.6 + * config.h.in: likewise + * lib/thread.c: likewise + * lib/vty.c: likewise + +1998-03-15 SeonMeyong HEO <seirios@Matrix.iri.co.jp> + + * config.h.in: define INET6 if defined HAVE_IPV6 & HYDRANGEA + * bgpd/: remove include <netinet6/in6.h> line. + * lib/: remove include <netinet6/in6.h> line. + * ripbgd/: remove include <netinet6/in6.h> line. + * zebra/: remove include <netinet6/in6.h> line. + * ripd/*.c: remove include <netinet6/in6.h> line. + undefine IPV6 difinitions because RIPd is not worked for + IPv6 protocol. + + +1998-01-30 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: Change routing socket check method from + AC_TRY_COMPILE to AC_TRY_RUN because GNU libc version 2 has + AF_ROUTE but over linux it's meenigless. + +1998-01-06 Kunihiro Ishiguro <kunihiro@zebra.org> + + * config.h.in: remove err_t define. + +1997-11-18 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in (canonical): add check of IF_METHOD + +1997-09-27 Kunihiro Ishiguro <kunihiro@note.digital-magic.co.jp> + + * configure.in: add INRIA check + +1997-09-25 Kunihiro Ishiguro <kunihiro@note.digital-magic.co.jp> + + * configure.in (canonical): change ipforward_snmp.o to ipforward_proc.o + +1997-09-12 Kunihiro Ishiguro <kunihiro@zebra.org> + + * configure.in: change IRDPD to NDPD + +1997-08-18 Kunihiro Ishiguro <kunihiro@zebra.org> + + * INSTALL: new file + +1997-08-14 Kunihiro Ishiguro <kunihiro@zebra.org> + + * config.h: add XCALLOC() + @@ -1,5 +1,5 @@ -*- mode: text; -*- -$Id$ +$Id: HACKING,v 1.22 2008/07/22 21:11:48 paul Exp $ GUIDELINES FOR HACKING ON QUAGGA @@ -75,6 +75,28 @@ release. See also below regarding SHARED LIBRARY VERSIONING. +COMPILE-TIME CONDITIONAL CODE + +Please think very carefully before making code conditional at compile time, +as it increases maintenance burdens and user confusion. In particular, +please avoid gratuitious --enable-.... switches to the configure script - +typically code should be good enough to be in Quagga, or it shouldn't be +there at all. + +When code must be compile-time conditional, try have the compiler make it +conditional rather than the C pre-processor. I.e. this: + + if (SOME_SYMBOL) + frobnicate(); + +rather than: + + #ifdef SOME_SYMBOL + frobnicate (); + #endif /* SOME_SYMBOL */ + +Note that the former approach requires ensuring that SOME_SYMBOL will be +defined (watch your AC_DEFINEs). CHANGELOG diff --git a/INSTALL.quagga.txt b/INSTALL.quagga.txt index f627c922..4a5d2961 100644 --- a/INSTALL.quagga.txt +++ b/INSTALL.quagga.txt @@ -1,4 +1,4 @@ -# $Id$ +# $Id: INSTALL.quagga.txt,v 1.13 2007/02/06 19:56:31 gdt Exp $ -------------------------------------------------------------------------- Building and Installing Quagga from releases or snapshots: @@ -4,6 +4,8 @@ - [bgpd] MRT format changes to version 2. Those relying on bgpd MRT table dumps may need to update their tools. - [bgpd] Added new route-map set statement: "as-path exclude" +- Zebra RIB updates queue has evolved into a multi-level + structure to address RIB consistency issues. * Changes in Quagga 0.99.2 diff --git a/README.NetBSD b/README.NetBSD index 55e54af8..23bc886c 100755 --- a/README.NetBSD +++ b/README.NetBSD @@ -1,6 +1,6 @@ #!/bin/sh -$Id$ +$Id: README.NetBSD,v 1.5 2007/08/02 13:38:38 gdt Exp $ # This file is helpful for building quagga from cvs on NetBSD, and # probably on any system using pkgsrc. diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index 7f94565c..6fe2b0f5 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -1,4 +1,90 @@ +2008-07-22 Paul Jakma <paul.jakma@sun.com> + + * bgp_{packet,route,advertise}.c: change to compiler testing of + DISABLE_BGP_ANNOUNCE, rather than cpp. + +2008-07-22 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp> + + * bgp_packet.c: (bgp_update_packet_eor) Fix crash triggerable + if a bgpd was compiled with --disable-bgp-announce and if GR is + advertised by peer. + +2008-07-22 Paul Jakma <paul.jakma@sun.com> + + * bgp_community.c: (community_str2com) assigns defaults to local + vars + * bgp_attr.c: (bgp_attr_parse) match format specifier to arg + * bgp_table.{c,h}: (bgp_table_top) can take a * to a const, quelling + warning in bgp_route.c + +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-02 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp> + + * *.c: CMD_AS_RANGE was being used inside command strings, and thus + not being expanded, fix by dequoting. + +2008-07-02 Stephen Hemminger <stephen.hemminger@vyatta.com> + + * bgp_table.{c,h}: (bgp_table_finish) Take a double pointer and + scrub pointer in caller, so fixing double-free crashes seen + with route-server-client configuration. + * *.c: Adjust all callers of bgp_table_finish + +2008-07-02 Paul Jakma <paul.jakma@sun.com> + + * bgp_table.{c,h}: (bgp_node_delete, bgp_table_free) shouldn't be + exported. + +2008-06-07 Paul Jakma <paul@jakma.org> + + * bgp_attr.{c,h}: (bgp_mp_{un,}reach_parse) export, for unit tests. + * bgp_attr.c: (bgp_mp_reach_parse) Add logging. Tighten length test + to bounds check against the attribute length rather than the + stream length.. + +2008-06-01 jfletche@gmail.com + + * bgp_attr.c: (bgp_attr_aspathlimit) fix silly bug in flags check + that was causing BGP to drop sessions if it received a + aspath-limit with partial set. Fixes bug #419. + 2008-04-10 Denis Ovsienko + * bgp_aspath.[ch]: (aspath_filter_exclude) New function allows filtering out arbitrary ASns from AS_PATH attribute. * bgp_aspath.[ch]: (aspath_print_vty) Accept suffix to let calling diff --git a/bgpd/IMPLEMENTATION.txt b/bgpd/IMPLEMENTATION.txt index ac087a38..fff360ab 100644 --- a/bgpd/IMPLEMENTATION.txt +++ b/bgpd/IMPLEMENTATION.txt @@ -1,4 +1,4 @@ -$Id$ +$Id: IMPLEMENTATION.txt,v 1.2 2005/02/15 17:10:03 gdt Exp $ This file contains notes about the internals of the BGP implementation. The initial impetus is understanding the memory usage diff --git a/bgpd/bgp_advertise.c b/bgpd/bgp_advertise.c index 73b868a8..870aab13 100644 --- a/bgpd/bgp_advertise.c +++ b/bgpd/bgp_advertise.c @@ -220,9 +220,8 @@ bgp_adj_out_set (struct bgp_node *rn, struct peer *peer, struct prefix *p, struct bgp_adj_out *adj = NULL; struct bgp_advertise *adv; -#ifdef DISABLE_BGP_ANNOUNCE - return; -#endif /* DISABLE_BGP_ANNOUNCE */ + if (DISABLE_BGP_ANNOUNCE) + return; /* Look for adjacency information. */ if (rn) @@ -274,9 +273,8 @@ bgp_adj_out_unset (struct bgp_node *rn, struct peer *peer, struct prefix *p, struct bgp_adj_out *adj; struct bgp_advertise *adv; -#ifdef DISABLE_BGP_ANNOUNCE - return; -#endif /* DISABLE_BGP_ANNOUNCE */ + if (DISABLE_BGP_ANNOUNCE) + return; /* Lookup existing adjacency, if it is not there return immediately. */ for (adj = rn->adj_out; adj; adj = adj->next) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index b27267c0..b20386e5 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -695,7 +695,8 @@ bgp_attr_aspathlimit (struct peer *peer, bgp_size_t length, total = length + (CHECK_FLAG (flag, BGP_ATTR_FLAG_EXTLEN) ? 4 : 3); - if (flag != (BGP_ATTR_FLAG_TRANS|BGP_ATTR_FLAG_OPTIONAL)) + if (!CHECK_FLAG(flag, BGP_ATTR_FLAG_TRANS) + || !CHECK_FLAG(flag, BGP_ATTR_FLAG_OPTIONAL)) { zlog (peer->log, LOG_ERR, "AS-Pathlimit attribute flag isn't transitive %d", flag); @@ -804,7 +805,7 @@ bgp_attr_aspath (struct peer *peer, bgp_size_t length, || ! CHECK_FLAG (flag, BGP_ATTR_FLAG_TRANS)) { zlog (peer->log, LOG_ERR, - "Origin attribute flag isn't transitive %d", flag); + "As-Path attribute flag isn't transitive %d", flag); bgp_notify_send_with_data (peer, BGP_NOTIFY_UPDATE_ERR, BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR, @@ -1258,7 +1259,7 @@ bgp_attr_cluster_list (struct peer *peer, bgp_size_t length, } /* Multiprotocol reachability information parse. */ -static int +int bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, struct bgp_nlri *mp_update) { @@ -1276,8 +1277,13 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, /* safe to read statically sized header? */ #define BGP_MP_REACH_MIN_SIZE 5 +#define LEN_LEFT (length - (stream_get_getp(s) - start)) if ((length > STREAM_READABLE(s)) || (length < BGP_MP_REACH_MIN_SIZE)) - return -1; + { + zlog_info ("%s: %s sent invalid length, %lu", + __func__, peer->host, (unsigned long)length); + return -1; + } /* Load AFI, SAFI. */ afi = stream_getw (s); @@ -1286,8 +1292,12 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, /* Get nexthop length. */ attre->mp_nexthop_len = stream_getc (s); - if (STREAM_READABLE(s) < attre->mp_nexthop_len) - return -1; + if (LEN_LEFT < attre->mp_nexthop_len) + { + zlog_info ("%s: %s, MP nexthop length, %u, goes past end of attribute", + __func__, peer->host, attre->mp_nexthop_len); + return -1; + } /* Nexthop length check. */ switch (attre->mp_nexthop_len) @@ -1329,13 +1339,17 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, break; #endif /* HAVE_IPV6 */ default: - zlog_info ("Wrong multiprotocol next hop length: %d", - attre->mp_nexthop_len); + zlog_info ("%s: (%s) Wrong multiprotocol next hop length: %d", + __func__, peer->host, attre->mp_nexthop_len); return -1; } - if (!STREAM_READABLE(s)) - return -1; + if (!LEN_LEFT) + { + zlog_info ("%s: (%s) Failed to read SNPA and NLRI(s)", + __func__, peer->host); + return -1; + } { u_char val; @@ -1345,15 +1359,23 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, } /* must have nrli_len, what is left of the attribute */ - nlri_len = length - (stream_get_getp(s) - start); + nlri_len = LEN_LEFT; if ((!nlri_len) || (nlri_len > STREAM_READABLE(s))) - return -1; + { + zlog_info ("%s: (%s) Failed to read NLRI", + __func__, peer->host); + return -1; + } if (safi != BGP_SAFI_VPNV4) { ret = bgp_nlri_sanity_check (peer, afi, stream_pnt (s), nlri_len); - if (ret < 0) - return -1; + if (ret < 0) + { + zlog_info ("%s: (%s) NLRI doesn't pass sanity check", + __func__, peer->host); + return -1; + } } mp_update->afi = afi; @@ -1364,10 +1386,11 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, stream_forward_getp (s, nlri_len); return 0; +#undef LEN_LEFT } /* Multiprotocol unreachable parse */ -static int +int bgp_mp_unreach_parse (struct peer *peer, bgp_size_t length, struct bgp_nlri *mp_withdraw) { @@ -1548,7 +1571,7 @@ bgp_attr_parse (struct peer *peer, struct attr *attr, bgp_size_t size, && ((endp - startp) < (BGP_ATTR_MIN_LEN + 1))) { zlog (peer->log, LOG_WARNING, - "%s Extended length set, but just %tu bytes of attr header", + "%s Extended length set, but just %lu bytes of attr header", peer->host, endp - STREAM_PNT (BGP_INPUT (peer))); diff --git a/bgpd/bgp_attr.h b/bgpd/bgp_attr.h index e152b9f4..9647ccf8 100644 --- a/bgpd/bgp_attr.h +++ b/bgpd/bgp_attr.h @@ -176,4 +176,9 @@ extern void cluster_unintern (struct cluster_list *); /* Transit attribute prototypes. */ void transit_unintern (struct transit *); +/* Exported for unit-test purposes only */ +extern int bgp_mp_reach_parse (struct peer *, bgp_size_t, struct attr *, + struct bgp_nlri *); +extern int bgp_mp_unreach_parse (struct peer *, bgp_size_t, struct bgp_nlri *); + #endif /* _QUAGGA_BGP_ATTR_H */ diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index d5e9821b..592b810d 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -581,8 +581,8 @@ community_str2com (const char *str) { struct community *com = NULL; struct community *com_sort = NULL; - u_int32_t val; - enum community_token token; + u_int32_t val = 0; + enum community_token token = community_token_unknown; do { diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index e6d34afc..2089c6b5 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -203,6 +203,7 @@ main (int argc, char **argv) int dryrun = 0; char *progname; struct thread thread; + int tmp_port; /* Set umask before anything for security */ umask (0027); @@ -238,7 +239,11 @@ main (int argc, char **argv) pid_file = optarg; break; case 'p': - bm->port = atoi (optarg); + tmp_port = atoi (optarg); + if (tmp_port <= 0 || tmp_port > 0xffff) + bm->port = BGP_PORT_DEFAULT; + else + bm->port = tmp_port; break; case 'A': vty_addr = optarg; @@ -252,7 +257,8 @@ main (int argc, char **argv) break; } vty_port = atoi (optarg); - vty_port = (vty_port ? vty_port : BGP_VTY_PORT); + if (vty_port <= 0 || vty_port > 0xffff) + vty_port = BGP_VTY_PORT; break; case 'r': retain_mode = 1; diff --git a/bgpd/bgp_network.c b/bgpd/bgp_network.c index e981e718..71f3ec7d 100644 --- a/bgpd/bgp_network.c +++ b/bgpd/bgp_network.c @@ -29,6 +29,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "prefix.h" #include "command.h" #include "privs.h" +#include "linklist.h" #include "bgpd/bgpd.h" #include "bgpd/bgp_fsm.h" @@ -39,33 +40,79 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA extern struct zebra_privs_t bgpd_privs; -#if defined(HAVE_TCP_MD5SIG) /* * Set MD5 key for the socket, for the given IPv4 peer address. * If the password is NULL or zero-length, the option will be disabled. */ -int -bgp_md5_set (int sock, struct sockaddr_in *sin, const char *password) +static int +bgp_md5_set_socket (int socket, union sockunion *su, const char *password) { - int ret, en; - - if ( bgpd_privs.change (ZPRIVS_RAISE) ) - zlog_err ("bgp_md5_set: could not raise privs"); - - ret = sockopt_tcp_signature (sock, sin, password); + int ret = -1; + int en = ENOSYS; + + assert (socket >= 0); + +#if HAVE_DECL_TCP_MD5SIG + ret = sockopt_tcp_signature (socket, su, password); en = errno; - - if (bgpd_privs.change (ZPRIVS_LOWER) ) - zlog_err ("bgp_md5_set: could not lower privs"); - +#endif /* HAVE_TCP_MD5SIG */ + if (ret < 0) zlog (NULL, LOG_WARNING, "can't set TCP_MD5SIG option on socket %d: %s", - sock, safe_strerror (en)); + socket, safe_strerror (en)); return ret; } +/* Helper for bgp_connect */ +static int +bgp_md5_set_connect (int socket, union sockunion *su, const char *password) +{ + int ret = -1; + +#if HAVE_DECL_TCP_MD5SIG + if ( bgpd_privs.change (ZPRIVS_RAISE) ) + { + zlog_err ("%s: could not raise privs", __func__); + return ret; + } + + ret = bgp_md5_set_socket (socket, su, password); + + if (bgpd_privs.change (ZPRIVS_LOWER) ) + zlog_err ("%s: could not lower privs", __func__); #endif /* HAVE_TCP_MD5SIG */ + + return ret; +} + +int +bgp_md5_set (struct peer *peer) +{ + struct listnode *node; + int fret = 0, ret; + int *socket; + + if ( bgpd_privs.change (ZPRIVS_RAISE) ) + { + zlog_err ("%s: could not raise privs", __func__); + return -1; + } + + /* Just set the password on the listen socket(s). Outbound connections + * are taken care of in bgp_connect() below. + */ + for (ALL_LIST_ELEMENTS_RO(bm->listen_sockets, node, socket)) + { + ret = bgp_md5_set_socket ((int )socket, &peer->su, peer->password); + if (ret < 0) + fret = ret; + } + if (bgpd_privs.change (ZPRIVS_LOWER) ) + zlog_err ("%s: could not lower privs", __func__); + + return fret; +} /* Accept bgp connection. */ static int @@ -266,17 +313,9 @@ bgp_connect (struct peer *peer) sockopt_reuseaddr (peer->fd); sockopt_reuseport (peer->fd); - -#ifdef IPTOS_PREC_INTERNETCONTROL - if (sockunion_family (&peer->su) == AF_INET) - setsockopt_ipv4_tos (peer->fd, IPTOS_PREC_INTERNETCONTROL); -#endif - -#ifdef HAVE_TCP_MD5SIG - if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSWORD)) - if (sockunion_family (&peer->su) == AF_INET) - bgp_md5_set (peer->fd, &peer->su.sin, peer->password); -#endif /* HAVE_TCP_MD5SIG */ + + if (peer->password) + bgp_md5_set_connect (peer->fd, &peer->su, peer->password); /* Bind socket. */ bgp_bind (peer); @@ -328,10 +367,6 @@ bgp_socket (struct bgp *bgp, unsigned short port, char *address) struct addrinfo req; struct addrinfo *ainfo; struct addrinfo *ainfo_save; -#if defined(HAVE_TCP_MD5SIG) && defined(IPV6_V6ONLY) - struct sockaddr_in sin; - int socklen, on = 1; -#endif int sock = 0; char port_str[BUFSIZ]; @@ -367,26 +402,6 @@ bgp_socket (struct bgp *bgp, unsigned short port, char *address) sockopt_reuseaddr (sock); sockopt_reuseport (sock); -#ifdef IPTOS_PREC_INTERNETCONTROL - if (ainfo->ai_family == AF_INET) - setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL); -#endif - -#if defined(HAVE_TCP_MD5SIG) && defined(IPV6_V6ONLY) -/* We can not apply MD5SIG to an IPv6 socket. If this is an AF_INET6 - socket, we'll have to create another socket for IPv4*/ - - if (ainfo->ai_family == AF_INET6) { -/* Mark this one for IPv6 only */ - ret = setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, - (void *) &on, sizeof (on)); - if( ret < 0 ) { - en = errno; - zlog_err ("setsockopt V6ONLY: %s", safe_strerror (en)); - } - } -#endif - if (bgpd_privs.change (ZPRIVS_RAISE) ) zlog_err ("bgp_socket: could not raise privs"); @@ -409,67 +424,9 @@ bgp_socket (struct bgp *bgp, unsigned short port, char *address) close (sock); continue; } - -#if defined(HAVE_TCP_MD5SIG) && defined(IPV6_V6ONLY) - thread_add_read (master, bgp_accept, bgp, sock); - - if (ainfo->ai_family != AF_INET6) - continue; - - /* If first socket was an IPv6 socket, we need to create an IPv4 - socket for use by the TCP_MD5SIG logic. This code is blatently - copied and modified from the alternate IPv4 only code from below... */ - - sock = socket (AF_INET, SOCK_STREAM, 0); - if (sock < 0) - { - zlog_err ("socket: %s", safe_strerror (errno)); - continue; - } - - sockopt_reuseaddr (sock); - sockopt_reuseport (sock); - setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL); - - memset (&sin, 0, sizeof (struct sockaddr_in)); - - sin.sin_family = AF_INET; - sin.sin_port = htons (port); - socklen = sizeof (struct sockaddr_in); -#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN - sin.sin_len = socklen; -#endif /* HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ - - if ( bgpd_privs.change (ZPRIVS_RAISE) ) - zlog_err ("bgp_socket: could not raise privs"); - - ret = bind (sock, (struct sockaddr *) &sin, socklen); - en = errno; - if (bgpd_privs.change (ZPRIVS_LOWER) ) - zlog_err ("bgp_bind_address: could not lower privs"); - - if (ret < 0) - { - zlog_err ("bind: %s", safe_strerror (en)); - close(sock); - continue; - } - - ret = listen (sock, 3); - if (ret < 0) - { - zlog_err ("listen: %s", safe_strerror (errno)); - close (sock); - continue; - } -#endif - -#ifdef HAVE_TCP_MD5SIG - bm->sock = sock; -#endif /* HAVE_TCP_MD5SIG */ - + + listnode_add (bm->listen_sockets, (void *)sock); thread_add_read (master, bgp_accept, bgp, sock); - } while ((ainfo = ainfo->ai_next) != NULL); @@ -497,10 +454,6 @@ bgp_socket (struct bgp *bgp, unsigned short port, char *address) sockopt_reuseaddr (sock); sockopt_reuseport (sock); -#ifdef IPTOS_PREC_INTERNETCONTROL - setsockopt_ipv4_tos (sock, IPTOS_PREC_INTERNETCONTROL); -#endif - memset (&sin, 0, sizeof (struct sockaddr_in)); sin.sin_family = AF_INET; @@ -540,9 +493,6 @@ bgp_socket (struct bgp *bgp, unsigned short port, char *address) close (sock); return ret; } -#ifdef HAVE_TCP_MD5SIG - bm->sock = sock; -#endif /* HAVE_TCP_MD5SIG */ thread_add_read (bm->master, bgp_accept, bgp, sock); diff --git a/bgpd/bgp_network.h b/bgpd/bgp_network.h index e7119414..3cbf647b 100644 --- a/bgpd/bgp_network.h +++ b/bgpd/bgp_network.h @@ -29,4 +29,6 @@ extern int bgp_socket (struct bgp *, unsigned short, char *); extern int bgp_connect (struct peer *); extern void bgp_getsockname (struct peer *); +extern int bgp_md5_set (struct peer *); + #endif /* _QUAGGA_BGP_NETWORK_H */ diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index f92a88ad..4d7f32de 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -235,9 +235,8 @@ bgp_update_packet_eor (struct peer *peer, afi_t afi, safi_t safi) struct stream *s; struct stream *packet; -#ifdef DISABLE_BGP_ANNOUNCE - return; -#endif /* DISABLE_BGP_ANNOUNCE */ + if (DISABLE_BGP_ANNOUNCE) + return NULL; if (BGP_DEBUG (normal, NORMAL)) zlog_debug ("send End-of-RIB for %s to %s", afi_safi_print (afi, safi), peer->host); @@ -369,9 +368,8 @@ bgp_default_update_send (struct peer *peer, struct attr *attr, char attrstr[BUFSIZ]; char buf[BUFSIZ]; -#ifdef DISABLE_BGP_ANNOUNCE - return; -#endif /* DISABLE_BGP_ANNOUNCE */ + if (DISABLE_BGP_ANNOUNCE) + return; if (afi == AFI_IP) str2prefix ("0.0.0.0/0", &p); @@ -438,9 +436,8 @@ bgp_default_withdraw_send (struct peer *peer, afi_t afi, safi_t safi) bgp_size_t total_attr_len; char buf[BUFSIZ]; -#ifdef DISABLE_BGP_ANNOUNCE - return; -#endif /* DISABLE_BGP_ANNOUNCE */ + if (DISABLE_BGP_ANNOUNCE) + return; if (afi == AFI_IP) str2prefix ("0.0.0.0/0", &p); @@ -923,7 +920,6 @@ bgp_notify_send (struct peer *peer, u_char code, u_char sub_code) bgp_notify_send_with_data (peer, code, sub_code, NULL, 0); } -#if 0 static const char * afi2str (afi_t afi) { @@ -947,7 +943,6 @@ safi2str (safi_t safi) else return "Unknown SAFI"; } -#endif /* Send route refresh message to the peer. */ void @@ -960,9 +955,8 @@ bgp_route_refresh_send (struct peer *peer, afi_t afi, safi_t safi, struct bgp_filter *filter; int orf_refresh = 0; -#ifdef DISABLE_BGP_ANNOUNCE - return; -#endif /* DISABLE_BGP_ANNOUNCE */ + if (DISABLE_BGP_ANNOUNCE) + return; filter = &peer->filter[afi][safi]; @@ -1190,9 +1184,9 @@ bgp_open_receive (struct peer *peer, bgp_size_t size) /* Receive OPEN message log */ if (BGP_DEBUG (normal, NORMAL)) - zlog_debug ("%s rcv OPEN, version %d, remote-as (in open) %u," + zlog_debug ("%s rcv OPEN, version %d, remote-as (in open) %d," " holdtime %d, id %s", - peer->host, version, (unsigned)remote_as, holdtime, + peer->host, version, remote_as, holdtime, inet_ntoa (remote_id)); /* BEGIN to read the capability here, but dont do it yet */ @@ -1237,7 +1231,7 @@ bgp_open_receive (struct peer *peer, bgp_size_t size) zlog_debug ("%s [AS4] OPEN remote_as is AS_TRANS, but no AS4." " Odd, but proceeding.", peer->host); else if (as4 < BGP_AS_MAX && BGP_DEBUG (as4, AS4)) - zlog_debug ("%s [AS4] OPEN remote_as is AS_TRANS, but AS4 %u fits " + zlog_debug ("%s [AS4] OPEN remote_as is AS_TRANS, but AS4 (%u) fits " "in 2-bytes, very odd peer.", peer->host, as4); if (as4) remote_as = as4; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 7a14ac18..f39c669f 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -709,9 +709,8 @@ bgp_announce_check (struct bgp_info *ri, struct peer *peer, struct prefix *p, filter = &peer->filter[afi][safi]; bgp = peer->bgp; -#ifdef DISABLE_BGP_ANNOUNCE - return 0; -#endif + if (DISABLE_BGP_ANNOUNCE) + return 0; /* Do not send announces to RS-clients from the 'normal' bgp_table. */ if (CHECK_FLAG(peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)) @@ -1062,9 +1061,8 @@ bgp_announce_check_rsclient (struct bgp_info *ri, struct peer *rsclient, filter = &rsclient->filter[afi][safi]; bgp = rsclient->bgp; -#ifdef DISABLE_BGP_ANNOUNCE - return 0; -#endif + if (DISABLE_BGP_ANNOUNCE) + return 0; /* Do not send back route to sender. */ if (from == rsclient) diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index b93b2682..78ad3f08 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -47,6 +47,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_filter.h" #include "bgpd/bgp_mplsvpn.h" #include "bgpd/bgp_ecommunity.h" +#include "bgpd/bgp_vty.h" /* Memo of route-map commands. @@ -3451,7 +3452,7 @@ DEFUN (no_set_atomic_aggregate, DEFUN (set_aggregator_as, set_aggregator_as_cmd, - "set aggregator as CMD_AS_RANGE A.B.C.D", + "set aggregator as " CMD_AS_RANGE " A.B.C.D", SET_STR "BGP aggregator attribute\n" "AS number of aggregator\n" @@ -3523,7 +3524,7 @@ DEFUN (no_set_aggregator_as, ALIAS (no_set_aggregator_as, no_set_aggregator_as_val_cmd, - "no set aggregator as CMD_AS_RANGE A.B.C.D", + "no set aggregator as " CMD_AS_RANGE " A.B.C.D", NO_STR SET_STR "BGP aggregator attribute\n" diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c index 5faf5856..50cf8e8f 100644 --- a/bgpd/bgp_table.c +++ b/bgpd/bgp_table.c @@ -28,8 +28,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgpd.h" #include "bgpd/bgp_table.h" -void bgp_node_delete (struct bgp_node *); -void bgp_table_free (struct bgp_table *); +static void bgp_node_delete (struct bgp_node *); +static void bgp_table_free (struct bgp_table *); struct bgp_table * bgp_table_init (afi_t afi, safi_t safi) @@ -47,9 +47,10 @@ bgp_table_init (afi_t afi, safi_t safi) } void -bgp_table_finish (struct bgp_table *rt) +bgp_table_finish (struct bgp_table **rt) { - bgp_table_free (rt); + bgp_table_free (*rt); + *rt = NULL; } static struct bgp_node * @@ -84,7 +85,7 @@ bgp_node_free (struct bgp_node *node) } /* Free route table. */ -void +static void bgp_table_free (struct bgp_table *rt) { struct bgp_node *tmp_node; @@ -229,7 +230,7 @@ bgp_unlock_node (struct bgp_node *node) /* Find matched prefix. */ struct bgp_node * -bgp_node_match (struct bgp_table *table, struct prefix *p) +bgp_node_match (const struct bgp_table *table, struct prefix *p) { struct bgp_node *node; struct bgp_node *matched; @@ -255,7 +256,7 @@ bgp_node_match (struct bgp_table *table, struct prefix *p) } struct bgp_node * -bgp_node_match_ipv4 (struct bgp_table *table, struct in_addr *addr) +bgp_node_match_ipv4 (const struct bgp_table *table, struct in_addr *addr) { struct prefix_ipv4 p; @@ -269,7 +270,7 @@ bgp_node_match_ipv4 (struct bgp_table *table, struct in_addr *addr) #ifdef HAVE_IPV6 struct bgp_node * -bgp_node_match_ipv6 (struct bgp_table *table, struct in6_addr *addr) +bgp_node_match_ipv6 (const struct bgp_table *table, struct in6_addr *addr) { struct prefix_ipv6 p; @@ -284,7 +285,7 @@ bgp_node_match_ipv6 (struct bgp_table *table, struct in6_addr *addr) /* Lookup same prefix node. Return NULL when we can't find route. */ struct bgp_node * -bgp_node_lookup (struct bgp_table *table, struct prefix *p) +bgp_node_lookup (const struct bgp_table *table, struct prefix *p) { struct bgp_node *node; @@ -304,7 +305,7 @@ bgp_node_lookup (struct bgp_table *table, struct prefix *p) /* Add node to routing table. */ struct bgp_node * -bgp_node_get (struct bgp_table *table, struct prefix *p) +bgp_node_get (struct bgp_table *const table, struct prefix *p) { struct bgp_node *new; struct bgp_node *node; @@ -360,7 +361,7 @@ bgp_node_get (struct bgp_table *table, struct prefix *p) } /* Delete node from the routing table. */ -void +static void bgp_node_delete (struct bgp_node *node) { struct bgp_node *child; @@ -405,7 +406,7 @@ bgp_node_delete (struct bgp_node *node) /* Get fist node and lock it. This function is useful when one want to lookup all the node exist in the routing table. */ struct bgp_node * -bgp_table_top (struct bgp_table *table) +bgp_table_top (const struct bgp_table *const table) { /* If there is no node in the routing table return NULL. */ if (table->top == NULL) @@ -499,7 +500,7 @@ bgp_route_next_until (struct bgp_node *node, struct bgp_node *limit) } unsigned long -bgp_table_count (struct bgp_table *table) +bgp_table_count (const struct bgp_table *table) { return table->count; } diff --git a/bgpd/bgp_table.h b/bgpd/bgp_table.h index 62421e71..dfa7e1f3 100644 --- a/bgpd/bgp_table.h +++ b/bgpd/bgp_table.h @@ -68,21 +68,20 @@ struct bgp_node }; extern struct bgp_table *bgp_table_init (afi_t, safi_t); -extern void bgp_table_finish (struct bgp_table *); +extern void bgp_table_finish (struct bgp_table **); extern void bgp_unlock_node (struct bgp_node *node); -extern void bgp_node_delete (struct bgp_node *node); -extern struct bgp_node *bgp_table_top (struct bgp_table *); +extern struct bgp_node *bgp_table_top (const struct bgp_table *const); extern struct bgp_node *bgp_route_next (struct bgp_node *); extern struct bgp_node *bgp_route_next_until (struct bgp_node *, struct bgp_node *); -extern struct bgp_node *bgp_node_get (struct bgp_table *, struct prefix *); -extern struct bgp_node *bgp_node_lookup (struct bgp_table *, struct prefix *); +extern struct bgp_node *bgp_node_get (struct bgp_table *const, struct prefix *); +extern struct bgp_node *bgp_node_lookup (const struct bgp_table *const, struct prefix *); extern struct bgp_node *bgp_lock_node (struct bgp_node *node); -extern struct bgp_node *bgp_node_match (struct bgp_table *, struct prefix *); -extern struct bgp_node *bgp_node_match_ipv4 (struct bgp_table *, +extern struct bgp_node *bgp_node_match (const struct bgp_table *, struct prefix *); +extern struct bgp_node *bgp_node_match_ipv4 (const struct bgp_table *, struct in_addr *); #ifdef HAVE_IPV6 -extern struct bgp_node *bgp_node_match_ipv6 (struct bgp_table *, +extern struct bgp_node *bgp_node_match_ipv6 (const struct bgp_table *, struct in6_addr *); #endif /* HAVE_IPV6 */ -extern unsigned long bgp_table_count (struct bgp_table *); +extern unsigned long bgp_table_count (const struct bgp_table *const); #endif /* _QUAGGA_BGP_TABLE_H */ diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 0e689359..54f11701 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -210,6 +210,9 @@ bgp_vty_return (struct vty *vty, int ret) case BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS: str = "Cannot have local-as same as BGP AS number"; break; + case BGP_ERR_TCPSIG_FAILED: + str = "Error while applying TCP-Sig to session(s)"; + break; } if (str) { @@ -308,7 +311,7 @@ DEFUN_DEPRECATED (neighbor_version, /* "router bgp" commands. */ DEFUN (router_bgp, router_bgp_cmd, - "router bgp CMD_AS_RANGE", + "router bgp " CMD_AS_RANGE, ROUTER_STR BGP_STR AS_STR) @@ -331,12 +334,12 @@ DEFUN (router_bgp, VTY_NEWLINE); return CMD_WARNING; case BGP_ERR_AS_MISMATCH: - vty_out (vty, "BGP is already running; AS is %u%s", (unsigned)as, VTY_NEWLINE); + vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE); return CMD_WARNING; case BGP_ERR_INSTANCE_MISMATCH: vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); - vty_out (vty, "BGP instance is already running; AS is %u%s", - (unsigned)as, VTY_NEWLINE); + vty_out (vty, "BGP instance is already running; AS is %d%s", + as, VTY_NEWLINE); return CMD_WARNING; } @@ -348,7 +351,7 @@ DEFUN (router_bgp, ALIAS (router_bgp, router_bgp_view_cmd, - "router bgp CMD_AS_RANGE view WORD", + "router bgp " CMD_AS_RANGE " view WORD", ROUTER_STR BGP_STR AS_STR @@ -358,7 +361,7 @@ ALIAS (router_bgp, /* "no router bgp" commands. */ DEFUN (no_router_bgp, no_router_bgp_cmd, - "no router bgp CMD_AS_RANGE", + "no router bgp " CMD_AS_RANGE, NO_STR ROUTER_STR BGP_STR @@ -388,7 +391,7 @@ DEFUN (no_router_bgp, ALIAS (no_router_bgp, no_router_bgp_view_cmd, - "no router bgp CMD_AS_RANGE view WORD", + "no router bgp " CMD_AS_RANGE " view WORD", NO_STR ROUTER_STR BGP_STR @@ -539,7 +542,7 @@ ALIAS (no_bgp_cluster_id, DEFUN (bgp_confederation_identifier, bgp_confederation_identifier_cmd, - "bgp confederation identifier CMD_AS_RANGE", + "bgp confederation identifier " CMD_AS_RANGE, "BGP specific commands\n" "AS confederation parameters\n" "AS number\n" @@ -580,7 +583,7 @@ DEFUN (no_bgp_confederation_identifier, ALIAS (no_bgp_confederation_identifier, no_bgp_confederation_identifier_arg_cmd, - "no bgp confederation identifier CMD_AS_RANGE", + "no bgp confederation identifier " CMD_AS_RANGE, NO_STR "BGP specific commands\n" "AS confederation parameters\n" @@ -589,7 +592,7 @@ ALIAS (no_bgp_confederation_identifier, DEFUN (bgp_confederation_peers, bgp_confederation_peers_cmd, - "bgp confederation peers .CMD_AS_RANGE", + "bgp confederation peers ." CMD_AS_RANGE, "BGP specific commands\n" "AS confederation parameters\n" "Peer ASs in BGP confederation\n" @@ -619,7 +622,7 @@ DEFUN (bgp_confederation_peers, DEFUN (no_bgp_confederation_peers, no_bgp_confederation_peers_cmd, - "no bgp confederation peers .CMD_AS_RANGE", + "no bgp confederation peers ." CMD_AS_RANGE, NO_STR "BGP specific commands\n" "AS confederation parameters\n" @@ -1277,10 +1280,10 @@ peer_remote_as_vty (struct vty *vty, const char *peer_str, switch (ret) { case BGP_ERR_PEER_GROUP_MEMBER: - vty_out (vty, "%% Peer-group AS %u. Cannot configure remote-as for member%s", (unsigned)as, VTY_NEWLINE); + vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); return CMD_WARNING; case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: - vty_out (vty, "%% The AS# can not be changed from %u to %s, peer-group members must be all internal or all external%s", (unsigned)as, as_str, VTY_NEWLINE); + vty_out (vty, "%% The AS# can not be changed from %d to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE); return CMD_WARNING; } return bgp_vty_return (vty, ret); @@ -1288,7 +1291,7 @@ peer_remote_as_vty (struct vty *vty, const char *peer_str, DEFUN (neighbor_remote_as, neighbor_remote_as_cmd, - NEIGHBOR_CMD2 "remote-as CMD_AS_RANGE", + NEIGHBOR_CMD2 "remote-as " CMD_AS_RANGE, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a BGP neighbor\n" @@ -1352,7 +1355,7 @@ DEFUN (no_neighbor, ALIAS (no_neighbor, no_neighbor_remote_as_cmd, - NO_NEIGHBOR_CMD "remote-as CMD_AS_RANGE", + NO_NEIGHBOR_CMD "remote-as " CMD_AS_RANGE, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR @@ -1382,7 +1385,7 @@ DEFUN (no_neighbor_peer_group, DEFUN (no_neighbor_peer_group_remote_as, no_neighbor_peer_group_remote_as_cmd, - "no neighbor WORD remote-as CMD_AS_RANGE", + "no neighbor WORD remote-as " CMD_AS_RANGE, NO_STR NEIGHBOR_STR "Neighbor tag\n" @@ -1404,7 +1407,7 @@ DEFUN (no_neighbor_peer_group_remote_as, DEFUN (neighbor_local_as, neighbor_local_as_cmd, - NEIGHBOR_CMD2 "local-as CMD_AS_RANGE", + NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a local-as number\n" @@ -1423,7 +1426,7 @@ DEFUN (neighbor_local_as, DEFUN (neighbor_local_as_no_prepend, neighbor_local_as_no_prepend_cmd, - NEIGHBOR_CMD2 "local-as CMD_AS_RANGE no-prepend", + NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Specify a local-as number\n" @@ -1462,7 +1465,7 @@ DEFUN (no_neighbor_local_as, ALIAS (no_neighbor_local_as, no_neighbor_local_as_val_cmd, - NO_NEIGHBOR_CMD2 "local-as CMD_AS_RANGE", + NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -1471,7 +1474,7 @@ ALIAS (no_neighbor_local_as, ALIAS (no_neighbor_local_as, no_neighbor_local_as_val2_cmd, - NO_NEIGHBOR_CMD2 "local-as CMD_AS_RANGE no-prepend", + NO_NEIGHBOR_CMD2 "local-as " CMD_AS_RANGE " no-prepend", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -1479,7 +1482,6 @@ ALIAS (no_neighbor_local_as, "AS number used as local AS\n" "Do not prepend local-as to updates from ebgp peers\n") -#ifdef HAVE_TCP_MD5SIG DEFUN (neighbor_password, neighbor_password_cmd, NEIGHBOR_CMD2 "password LINE", @@ -1517,7 +1519,6 @@ DEFUN (no_neighbor_password, ret = peer_password_unset (peer); return bgp_vty_return (vty, ret); } -#endif /* HAVE_TCP_MD5SIG */ DEFUN (neighbor_activate, neighbor_activate_cmd, @@ -1600,7 +1601,7 @@ DEFUN (neighbor_set_peer_group, if (ret == BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT) { - vty_out (vty, "%% Peer with AS %u cannot be in this peer-group, members must be all internal or all external%s", (unsigned)as, VTY_NEWLINE); + vty_out (vty, "%% Peer with AS %d cannot be in this peer-group, members must be all internal or all external%s", as, VTY_NEWLINE); return CMD_WARNING; } @@ -2193,8 +2194,7 @@ peer_rsclient_unset_vty (struct vty *vty, const char *peer_str, listnode_delete (bgp->rsclient, peer); } - bgp_table_finish (peer->rib[afi][safi]); - peer->rib[afi][safi] = NULL; + bgp_table_finish (&peer->rib[bgp_node_afi(vty)][bgp_node_safi(vty)]); return CMD_SUCCESS; } @@ -4363,7 +4363,7 @@ ALIAS (clear_ip_bgp_external, DEFUN (clear_ip_bgp_as, clear_ip_bgp_as_cmd, - "clear ip bgp CMD_AS_RANGE", + "clear ip bgp " CMD_AS_RANGE, CLEAR_STR IP_STR BGP_STR @@ -4374,14 +4374,14 @@ DEFUN (clear_ip_bgp_as, ALIAS (clear_ip_bgp_as, clear_bgp_as_cmd, - "clear bgp CMD_AS_RANGE", + "clear bgp " CMD_AS_RANGE, CLEAR_STR BGP_STR "Clear peers with the AS number\n") ALIAS (clear_ip_bgp_as, clear_bgp_ipv6_as_cmd, - "clear bgp ipv6 CMD_AS_RANGE", + "clear bgp ipv6 " CMD_AS_RANGE, CLEAR_STR BGP_STR "Address family\n" @@ -4893,7 +4893,7 @@ ALIAS (clear_bgp_external_soft_out, DEFUN (clear_ip_bgp_as_soft_out, clear_ip_bgp_as_soft_out_cmd, - "clear ip bgp CMD_AS_RANGE soft out", + "clear ip bgp " CMD_AS_RANGE " soft out", CLEAR_STR IP_STR BGP_STR @@ -4907,7 +4907,7 @@ DEFUN (clear_ip_bgp_as_soft_out, ALIAS (clear_ip_bgp_as_soft_out, clear_ip_bgp_as_out_cmd, - "clear ip bgp CMD_AS_RANGE out", + "clear ip bgp " CMD_AS_RANGE " out", CLEAR_STR IP_STR BGP_STR @@ -4916,7 +4916,7 @@ ALIAS (clear_ip_bgp_as_soft_out, DEFUN (clear_ip_bgp_as_ipv4_soft_out, clear_ip_bgp_as_ipv4_soft_out_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) soft out", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft out", CLEAR_STR IP_STR BGP_STR @@ -4937,7 +4937,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_out, ALIAS (clear_ip_bgp_as_ipv4_soft_out, clear_ip_bgp_as_ipv4_out_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) out", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) out", CLEAR_STR IP_STR BGP_STR @@ -4949,7 +4949,7 @@ ALIAS (clear_ip_bgp_as_ipv4_soft_out, DEFUN (clear_ip_bgp_as_vpnv4_soft_out, clear_ip_bgp_as_vpnv4_soft_out_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast soft out", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft out", CLEAR_STR IP_STR BGP_STR @@ -4965,7 +4965,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_out, ALIAS (clear_ip_bgp_as_vpnv4_soft_out, clear_ip_bgp_as_vpnv4_out_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast out", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast out", CLEAR_STR IP_STR BGP_STR @@ -4976,7 +4976,7 @@ ALIAS (clear_ip_bgp_as_vpnv4_soft_out, DEFUN (clear_bgp_as_soft_out, clear_bgp_as_soft_out_cmd, - "clear bgp CMD_AS_RANGE soft out", + "clear bgp " CMD_AS_RANGE " soft out", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -4989,7 +4989,7 @@ DEFUN (clear_bgp_as_soft_out, ALIAS (clear_bgp_as_soft_out, clear_bgp_ipv6_as_soft_out_cmd, - "clear bgp ipv6 CMD_AS_RANGE soft out", + "clear bgp ipv6 " CMD_AS_RANGE " soft out", CLEAR_STR BGP_STR "Address family\n" @@ -4999,7 +4999,7 @@ ALIAS (clear_bgp_as_soft_out, ALIAS (clear_bgp_as_soft_out, clear_bgp_as_out_cmd, - "clear bgp CMD_AS_RANGE out", + "clear bgp " CMD_AS_RANGE " out", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -5007,7 +5007,7 @@ ALIAS (clear_bgp_as_soft_out, ALIAS (clear_bgp_as_soft_out, clear_bgp_ipv6_as_out_cmd, - "clear bgp ipv6 CMD_AS_RANGE out", + "clear bgp ipv6 " CMD_AS_RANGE " out", CLEAR_STR BGP_STR "Address family\n" @@ -5797,7 +5797,7 @@ ALIAS (clear_bgp_external_in_prefix_filter, DEFUN (clear_ip_bgp_as_soft_in, clear_ip_bgp_as_soft_in_cmd, - "clear ip bgp CMD_AS_RANGE soft in", + "clear ip bgp " CMD_AS_RANGE " soft in", CLEAR_STR IP_STR BGP_STR @@ -5811,7 +5811,7 @@ DEFUN (clear_ip_bgp_as_soft_in, ALIAS (clear_ip_bgp_as_soft_in, clear_ip_bgp_as_in_cmd, - "clear ip bgp CMD_AS_RANGE in", + "clear ip bgp " CMD_AS_RANGE " in", CLEAR_STR IP_STR BGP_STR @@ -5820,7 +5820,7 @@ ALIAS (clear_ip_bgp_as_soft_in, DEFUN (clear_ip_bgp_as_in_prefix_filter, clear_ip_bgp_as_in_prefix_filter_cmd, - "clear ip bgp CMD_AS_RANGE in prefix-filter", + "clear ip bgp " CMD_AS_RANGE " in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -5834,7 +5834,7 @@ DEFUN (clear_ip_bgp_as_in_prefix_filter, DEFUN (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_soft_in_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) soft in", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft in", CLEAR_STR IP_STR BGP_STR @@ -5855,7 +5855,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft_in, ALIAS (clear_ip_bgp_as_ipv4_soft_in, clear_ip_bgp_as_ipv4_in_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) in", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in", CLEAR_STR IP_STR BGP_STR @@ -5867,7 +5867,7 @@ ALIAS (clear_ip_bgp_as_ipv4_soft_in, DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, clear_ip_bgp_as_ipv4_in_prefix_filter_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) in prefix-filter", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) in prefix-filter", CLEAR_STR IP_STR BGP_STR @@ -5888,7 +5888,7 @@ DEFUN (clear_ip_bgp_as_ipv4_in_prefix_filter, DEFUN (clear_ip_bgp_as_vpnv4_soft_in, clear_ip_bgp_as_vpnv4_soft_in_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast soft in", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft in", CLEAR_STR IP_STR BGP_STR @@ -5904,7 +5904,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft_in, ALIAS (clear_ip_bgp_as_vpnv4_soft_in, clear_ip_bgp_as_vpnv4_in_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast in", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast in", CLEAR_STR IP_STR BGP_STR @@ -5915,7 +5915,7 @@ ALIAS (clear_ip_bgp_as_vpnv4_soft_in, DEFUN (clear_bgp_as_soft_in, clear_bgp_as_soft_in_cmd, - "clear bgp CMD_AS_RANGE soft in", + "clear bgp " CMD_AS_RANGE " soft in", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -5928,7 +5928,7 @@ DEFUN (clear_bgp_as_soft_in, ALIAS (clear_bgp_as_soft_in, clear_bgp_ipv6_as_soft_in_cmd, - "clear bgp ipv6 CMD_AS_RANGE soft in", + "clear bgp ipv6 " CMD_AS_RANGE " soft in", CLEAR_STR BGP_STR "Address family\n" @@ -5938,7 +5938,7 @@ ALIAS (clear_bgp_as_soft_in, ALIAS (clear_bgp_as_soft_in, clear_bgp_as_in_cmd, - "clear bgp CMD_AS_RANGE in", + "clear bgp " CMD_AS_RANGE " in", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -5946,7 +5946,7 @@ ALIAS (clear_bgp_as_soft_in, ALIAS (clear_bgp_as_soft_in, clear_bgp_ipv6_as_in_cmd, - "clear bgp ipv6 CMD_AS_RANGE in", + "clear bgp ipv6 " CMD_AS_RANGE " in", CLEAR_STR BGP_STR "Address family\n" @@ -5955,7 +5955,7 @@ ALIAS (clear_bgp_as_soft_in, DEFUN (clear_bgp_as_in_prefix_filter, clear_bgp_as_in_prefix_filter_cmd, - "clear bgp CMD_AS_RANGE in prefix-filter", + "clear bgp " CMD_AS_RANGE " in prefix-filter", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -5968,7 +5968,7 @@ DEFUN (clear_bgp_as_in_prefix_filter, ALIAS (clear_bgp_as_in_prefix_filter, clear_bgp_ipv6_as_in_prefix_filter_cmd, - "clear bgp ipv6 CMD_AS_RANGE in prefix-filter", + "clear bgp ipv6 " CMD_AS_RANGE " in prefix-filter", CLEAR_STR BGP_STR "Address family\n" @@ -6283,7 +6283,7 @@ ALIAS (clear_bgp_external_soft, DEFUN (clear_ip_bgp_as_soft, clear_ip_bgp_as_soft_cmd, - "clear ip bgp CMD_AS_RANGE soft", + "clear ip bgp " CMD_AS_RANGE " soft", CLEAR_STR IP_STR BGP_STR @@ -6296,7 +6296,7 @@ DEFUN (clear_ip_bgp_as_soft, DEFUN (clear_ip_bgp_as_ipv4_soft, clear_ip_bgp_as_ipv4_soft_cmd, - "clear ip bgp CMD_AS_RANGE ipv4 (unicast|multicast) soft", + "clear ip bgp " CMD_AS_RANGE " ipv4 (unicast|multicast) soft", CLEAR_STR IP_STR BGP_STR @@ -6316,7 +6316,7 @@ DEFUN (clear_ip_bgp_as_ipv4_soft, DEFUN (clear_ip_bgp_as_vpnv4_soft, clear_ip_bgp_as_vpnv4_soft_cmd, - "clear ip bgp CMD_AS_RANGE vpnv4 unicast soft", + "clear ip bgp " CMD_AS_RANGE " vpnv4 unicast soft", CLEAR_STR IP_STR BGP_STR @@ -6331,7 +6331,7 @@ DEFUN (clear_ip_bgp_as_vpnv4_soft, DEFUN (clear_bgp_as_soft, clear_bgp_as_soft_cmd, - "clear bgp CMD_AS_RANGE soft", + "clear bgp " CMD_AS_RANGE " soft", CLEAR_STR BGP_STR "Clear peers with the AS number\n" @@ -6343,7 +6343,7 @@ DEFUN (clear_bgp_as_soft, ALIAS (clear_bgp_as_soft, clear_bgp_ipv6_as_soft_cmd, - "clear bgp ipv6 CMD_AS_RANGE soft", + "clear bgp ipv6 " CMD_AS_RANGE " soft", CLEAR_STR BGP_STR "Address family\n" @@ -6669,8 +6669,8 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) /* Usage summary and header */ vty_out (vty, - "BGP router identifier %s, local AS number %u%s", - inet_ntoa (bgp->router_id), (unsigned)bgp->as, VTY_NEWLINE); + "BGP router identifier %s, local AS number %d%s", + inet_ntoa (bgp->router_id), bgp->as, VTY_NEWLINE); ents = bgp_table_count (bgp->rib[afi][safi]); vty_out (vty, "RIB entries %ld, using %s of memory%s", ents, @@ -6716,8 +6716,8 @@ bgp_show_summary (struct vty *vty, struct bgp *bgp, int afi, int safi) vty_out (vty, "4 "); - vty_out (vty, "%5u %7d %7d %8d %4d %4lu ", - (unsigned)peer->as, + vty_out (vty, "%5d %7d %7d %8d %4d %4lu ", + peer->as, peer->open_in + peer->update_in + peer->keepalive_in + peer->notify_in + peer->refresh_in + peer->dynamic_cap_in, peer->open_out + peer->update_out + peer->keepalive_out @@ -7226,9 +7226,9 @@ bgp_show_peer (struct vty *vty, struct peer *p) /* Configured IP address. */ vty_out (vty, "BGP neighbor is %s, ", p->host); - vty_out (vty, "remote AS %u, ", (unsigned)p->as); - vty_out (vty, "local AS %u%s, ", - p->change_local_as ? (unsigned)p->change_local_as : (unsigned)p->local_as, + vty_out (vty, "remote AS %d, ", p->as); + vty_out (vty, "local AS %d%s, ", + p->change_local_as ? p->change_local_as : p->local_as, CHECK_FLAG (p->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND) ? " no-prepend" : ""); vty_out (vty, "%s link%s", @@ -8009,7 +8009,7 @@ bgp_show_rsclient_summary (struct vty *vty, struct bgp *bgp, "Route Server's BGP router identifier %s%s", inet_ntoa (bgp->router_id), VTY_NEWLINE); vty_out (vty, - "Route Server's local AS number %u%s", (unsigned)bgp->as, + "Route Server's local AS number %d%s", bgp->as, VTY_NEWLINE); vty_out (vty, "%s", VTY_NEWLINE); @@ -8938,11 +8938,9 @@ bgp_vty_init (void) install_element (BGP_NODE, &no_neighbor_local_as_val_cmd); install_element (BGP_NODE, &no_neighbor_local_as_val2_cmd); -#ifdef HAVE_TCP_MD5SIG /* "neighbor password" commands. */ install_element (BGP_NODE, &neighbor_password_cmd); install_element (BGP_NODE, &no_neighbor_password_cmd); -#endif /* HAVE_TCP_MD5SIG */ /* "neighbor activate" commands. */ install_element (BGP_NODE, &neighbor_activate_cmd); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 539996f8..8eb0d2e4 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -684,7 +684,7 @@ peer_sort (struct peer *peer) } } -void +static inline void peer_free (struct peer *peer) { assert (peer->status == Deleted); @@ -697,8 +697,6 @@ peer_free (struct peer *peer) BGP_WRITE_OFF (peer->t_write); BGP_EVENT_FLUSH (peer); - bgp_unlock (peer->bgp); - if (peer->desc) XFREE (MTYPE_PEER_DESC, peer->desc); @@ -722,6 +720,48 @@ peer_free (struct peer *peer) XFREE (MTYPE_BGP_PEER, peer); } +/* increase reference count on a struct peer */ +struct peer * +peer_lock (struct peer *peer) +{ + assert (peer && (peer->lock >= 0)); + assert (peer->status != Deleted); + + peer->lock++; + + return peer; +} + +/* decrease reference count on a struct peer + * struct peer is freed and NULL returned if last reference + */ +struct peer * +peer_unlock (struct peer *peer) +{ + assert (peer && (peer->lock > 0)); + + peer->lock--; + + if (peer->lock == 0) + { +#if 0 + zlog_debug ("unlocked and freeing"); + zlog_backtrace (LOG_DEBUG); +#endif + peer_free (peer); + return NULL; + } + +#if 0 + if (peer->lock == 1) + { + zlog_debug ("unlocked to 1"); + zlog_backtrace (LOG_DEBUG); + } +#endif + + return peer; +} /* Allocate new peer object, implicitely locked. */ static struct peer * @@ -749,7 +789,7 @@ peer_new (struct bgp *bgp) peer->ostatus = Idle; peer->weight = 0; peer->password = NULL; - peer->bgp = bgp_lock (bgp); + peer->bgp = bgp; peer = peer_lock (peer); /* initial reference */ /* Set default flags. */ @@ -1150,7 +1190,7 @@ peer_delete (struct peer *peer) if ((pn = listnode_lookup (peer->group->peer, peer))) { - peer_unlock (peer); /* group->peer list reference */ + peer = peer_unlock (peer); /* group->peer list reference */ list_delete_node (peer->group->peer, pn); } peer->group = NULL; @@ -1164,19 +1204,16 @@ peer_delete (struct peer *peer) bgp_stop (peer); bgp_fsm_change_status (peer, Deleted); -#ifdef HAVE_TCP_MD5SIG /* Password configuration */ if (peer->password) { - free (peer->password); + XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = NULL; - if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP) - && sockunion_family (&peer->su) == AF_INET) - bgp_md5_set (bm->sock, &peer->su.sin, NULL); + if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) + bgp_md5_set (peer); } -#endif /* HAVE_TCP_MD5SIG */ - + bgp_timer_set (peer); /* stops all timers for Deleted */ /* Delete from all peer list. */ @@ -1203,10 +1240,7 @@ peer_delete (struct peer *peer) for (afi = AFI_IP; afi < AFI_MAX; afi++) for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) if (peer->rib[afi][safi] && ! peer->af_group[afi][safi]) - { - bgp_table_finish (peer->rib[afi][safi]); - peer->rib[afi][safi] = NULL; - } + bgp_table_finish (&peer->rib[afi][safi]); /* Buffers. */ if (peer->ibuf) @@ -1287,19 +1321,15 @@ peer_group_active (struct peer *peer) /* Peer group cofiguration. */ static struct peer_group * -peer_group_new (struct bgp *bgp) +peer_group_new () { - struct peer_group *group; - - group = XCALLOC (MTYPE_PEER_GROUP, sizeof (struct peer_group)); - group->bgp = bgp_lock (bgp); - return group; + return (struct peer_group *) XCALLOC (MTYPE_PEER_GROUP, + sizeof (struct peer_group)); } static void peer_group_free (struct peer_group *group) { - bgp_unlock (group->bgp); XFREE (MTYPE_PEER_GROUP, group); } @@ -1326,7 +1356,8 @@ peer_group_get (struct bgp *bgp, const char *name) if (group) return group; - group = peer_group_new (bgp); + group = peer_group_new (); + group->bgp = bgp; group->name = strdup (name); group->peer = list_new (); group->conf = peer_new (bgp); @@ -1398,26 +1429,16 @@ peer_group2peer_config_copy (struct peer_group *group, struct peer *peer, else peer->v_routeadv = BGP_DEFAULT_EBGP_ROUTEADV; -#ifdef HAVE_TCP_MD5SIG /* password apply */ - if (CHECK_FLAG (conf->flags, PEER_FLAG_PASSWORD)) - { - if (peer->password) - free (peer->password); - peer->password = strdup (conf->password); + if (peer->password) + XFREE (MTYPE_PEER_PASSWORD, peer->password); - if (sockunion_family (&peer->su) == AF_INET) - bgp_md5_set (bm->sock, &peer->su.sin, peer->password); - } - else if (peer->password) - { - free (peer->password); - peer->password = NULL; + if (conf->password) + peer->password = XSTRDUP (MTYPE_PEER_PASSWORD, conf->password); + else + peer->password = NULL; - if (sockunion_family (&peer->su) == AF_INET) - bgp_md5_set (bm->sock, &peer->su.sin, NULL); - } -#endif /* HAVE_TCP_MD5SIG */ + bgp_md5_set (peer); /* maximum-prefix */ peer->pmax[afi][safi] = conf->pmax[afi][safi]; @@ -1800,8 +1821,7 @@ peer_group_bind (struct bgp *bgp, union sockunion *su, list_delete_node (bgp->rsclient, pn); } - bgp_table_finish (peer->rib[afi][safi]); - peer->rib[afi][safi] = NULL; + bgp_table_finish (&peer->rib[afi][safi]); /* Import policy. */ if (peer->filter[afi][safi].map[RMAP_IMPORT].name) @@ -1889,7 +1909,6 @@ bgp_create (as_t *as, const char *name) if ( (bgp = XCALLOC (MTYPE_BGP, sizeof (struct bgp))) == NULL) return NULL; - bgp_lock(bgp); /* initial reference */ bgp->peer_self = peer_new (bgp); bgp->peer_self->host = strdup ("Static announcement"); @@ -2018,7 +2037,7 @@ bgp_get (struct bgp **bgp_val, as_t *as, const char *name) } /* Delete BGP instance. */ -void +int bgp_delete (struct bgp *bgp) { struct peer *peer; @@ -2026,6 +2045,7 @@ bgp_delete (struct bgp *bgp) struct listnode *node; struct listnode *next; afi_t afi; + safi_t safi; int i; /* Delete static route. */ @@ -2050,16 +2070,7 @@ bgp_delete (struct bgp *bgp) list_delete (bgp->rsclient); listnode_delete (bm->bgp, bgp); - - bgp_unlock(bgp); -} - -void -bgp_free(struct bgp *bgp) -{ - afi_t afi; - safi_t safi; - + if (bgp->name) free (bgp->name); @@ -2074,6 +2085,8 @@ bgp_free(struct bgp *bgp) XFREE (MTYPE_ROUTE_TABLE,bgp->rib[afi][safi]); } XFREE (MTYPE_BGP, bgp); + + return 0; } struct peer * @@ -3389,26 +3402,25 @@ peer_local_as_unset (struct peer *peer) return 0; } -#ifdef HAVE_TCP_MD5SIG /* Set password for authenticating with the peer. */ int peer_password_set (struct peer *peer, const char *password) { - struct peer_group *group; struct listnode *nn, *nnode; int len = password ? strlen(password) : 0; + int ret = BGP_SUCCESS; if ((len < PEER_PASSWORD_MINLEN) || (len > PEER_PASSWORD_MAXLEN)) return BGP_ERR_INVALID_VALUE; if (peer->password && strcmp (peer->password, password) == 0 && ! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) - return 0; + return 0; - SET_FLAG (peer->flags, PEER_FLAG_PASSWORD); if (peer->password) - free (peer->password); - peer->password = strdup (password); + XFREE (MTYPE_PEER_PASSWORD, peer->password); + + peer->password = XSTRDUP (MTYPE_PEER_PASSWORD, password); if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { @@ -3416,50 +3428,46 @@ peer_password_set (struct peer *peer, const char *password) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); else BGP_EVENT_ADD (peer, BGP_Stop); - - if (sockunion_family (&peer->su) == AF_INET) - bgp_md5_set (bm->sock, &peer->su.sin, peer->password); - return 0; + + return (bgp_md5_set (peer) >= 0) ? BGP_SUCCESS : BGP_ERR_TCPSIG_FAILED; } - group = peer->group; - /* #42# LIST_LOOP (group->peer, peer, nn) */ - for (ALL_LIST_ELEMENTS (group->peer, nn, nnode, peer)) + for (ALL_LIST_ELEMENTS (peer->group->peer, nn, nnode, peer)) { if (peer->password && strcmp (peer->password, password) == 0) continue; - - SET_FLAG (peer->flags, PEER_FLAG_PASSWORD); + if (peer->password) - free (peer->password); - peer->password = strdup (password); + XFREE (MTYPE_PEER_PASSWORD, peer->password); + + peer->password = XSTRDUP(MTYPE_PEER_PASSWORD, password); if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); else BGP_EVENT_ADD (peer, BGP_Stop); - - if (sockunion_family (&peer->su) == AF_INET) - bgp_md5_set (bm->sock, &peer->su.sin, peer->password); + + if (bgp_md5_set (peer) < 0) + ret = BGP_ERR_TCPSIG_FAILED; } - return 0; + return ret; } int peer_password_unset (struct peer *peer) { - struct peer_group *group; struct listnode *nn, *nnode; - if (! CHECK_FLAG (peer->flags, PEER_FLAG_PASSWORD) - && ! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) + if (!peer->password + && !CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) return 0; - if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) + if (!CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP)) { if (peer_group_active (peer) - && CHECK_FLAG (peer->group->conf->flags, PEER_FLAG_PASSWORD)) + && peer->group->conf->password + && strcmp (peer->group->conf->password, peer->password) == 0) return BGP_ERR_PEER_GROUP_HAS_THE_FLAG; if (peer->status == Established) @@ -3467,46 +3475,37 @@ peer_password_unset (struct peer *peer) else BGP_EVENT_ADD (peer, BGP_Stop); - if (sockunion_family (&peer->su) == AF_INET) - bgp_md5_set (bm->sock, &peer->su.sin, NULL); - - UNSET_FLAG (peer->flags, PEER_FLAG_PASSWORD); if (peer->password) - free (peer->password); + XFREE (MTYPE_PEER_PASSWORD, peer->password); + peer->password = NULL; + + bgp_md5_set (peer); return 0; } - UNSET_FLAG (peer->flags, PEER_FLAG_PASSWORD); - if (peer->password) - free (peer->password); + XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = NULL; - group = peer->group; - /* #42# LIST_LOOP (group->peer, peer, nn) */ - for (ALL_LIST_ELEMENTS (group->peer, nn, nnode, peer)) + for (ALL_LIST_ELEMENTS (peer->group->peer, nn, nnode, peer)) { - if (! CHECK_FLAG (peer->flags, PEER_FLAG_PASSWORD)) + if (!peer->password) continue; if (peer->status == Established) bgp_notify_send (peer, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE); else BGP_EVENT_ADD (peer, BGP_Stop); - - if (sockunion_family (&peer->su) == AF_INET) - bgp_md5_set (bm->sock, &peer->su.sin, NULL); - - UNSET_FLAG (peer->flags, PEER_FLAG_PASSWORD); - if (peer->password) - free (peer->password); + + XFREE (MTYPE_PEER_PASSWORD, peer->password); peer->password = NULL; + + bgp_md5_set (peer); } return 0; } -#endif /* HAVE_TCP_MD5SIG */ /* Set distribute list to the peer. */ int @@ -4513,13 +4512,13 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp, vty_out (vty, " neighbor %s peer-group%s", addr, VTY_NEWLINE); if (peer->as) - vty_out (vty, " neighbor %s remote-as %u%s", addr, (unsigned)peer->as, + vty_out (vty, " neighbor %s remote-as %d%s", addr, peer->as, VTY_NEWLINE); } else { if (! g_peer->as) - vty_out (vty, " neighbor %s remote-as %u%s", addr, (unsigned)peer->as, + vty_out (vty, " neighbor %s remote-as %d%s", addr, peer->as, VTY_NEWLINE); if (peer->af_group[AFI_IP][SAFI_UNICAST]) vty_out (vty, " neighbor %s peer-group %s%s", addr, @@ -4545,19 +4544,17 @@ bgp_config_write_peer (struct vty *vty, struct bgp *bgp, ! CHECK_FLAG (g_peer->flags, PEER_FLAG_SHUTDOWN)) vty_out (vty, " neighbor %s shutdown%s", addr, VTY_NEWLINE); -#ifdef HAVE_TCP_MD5SIG /* Password. */ - if (CHECK_FLAG (peer->flags, PEER_FLAG_PASSWORD)) - if (! peer_group_active (peer) - || ! CHECK_FLAG (g_peer->flags, PEER_FLAG_PASSWORD) + if (peer->password) + if (!peer_group_active (peer) + || ! g_peer->password || strcmp (peer->password, g_peer->password) != 0) vty_out (vty, " neighbor %s password %s%s", addr, peer->password, VTY_NEWLINE); -#endif /* HAVE_TCP_MD5SIG */ /* BGP port. */ if (peer->port != BGP_PORT_DEFAULT) - vty_out (vty, " neighbor %s port %d%s", addr, peer->port, + vty_out (vty, " neighbor %s port %d%s", addr, peer->port, VTY_NEWLINE); /* Local interface name. */ @@ -4920,7 +4917,7 @@ bgp_config_write (struct vty *vty) vty_out (vty, "!%s", VTY_NEWLINE); /* Router bgp ASN */ - vty_out (vty, "router bgp %u", (unsigned)bgp->as); + vty_out (vty, "router bgp %d", bgp->as); if (bgp_option_check (BGP_OPT_MULTIPLE_INSTANCE)) { @@ -5087,12 +5084,10 @@ bgp_master_init (void) bm = &bgp_master; bm->bgp = list_new (); + bm->listen_sockets = list_new (); bm->port = BGP_PORT_DEFAULT; bm->master = thread_master_create (); bm->start_time = time (NULL); -#ifdef HAVE_TCP_MD5SIG - bm->sock = -1; -#endif /* HAVE_TCP_MD5SIG */ } diff --git a/bgpd/bgpd.conf.sample b/bgpd/bgpd.conf.sample index 62cacc85..b6a8b6f1 100644 --- a/bgpd/bgpd.conf.sample +++ b/bgpd/bgpd.conf.sample @@ -2,7 +2,7 @@ ! ! BGPd sample configuratin file ! -! $Id$ +! $Id: bgpd.conf.sample,v 1.1 2002/12/13 20:15:29 paul Exp $ ! hostname bgpd password zebra diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index 124ccb24..3be7f56d 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -42,6 +42,9 @@ struct bgp_master struct work_queue *process_main_queue; struct work_queue *process_rsclient_queue; + /* Listening sockets */ + struct list *listen_sockets; + /* BGP port number. */ u_int16_t port; @@ -390,7 +393,10 @@ struct peer #define PEER_FLAG_ORF_PREFIX_RM (1 << 13) /* orf capability receive-mode */ #define PEER_FLAG_MAX_PREFIX (1 << 14) /* maximum prefix */ #define PEER_FLAG_MAX_PREFIX_WARNING (1 << 15) /* maximum prefix warning-only */ -#define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */ +#define PEER_FLAG_NEXTHOP_LOCAL_UNCHANGED (1 << 16) /* leave link-local nexthop unchanged */ + + /* MD5 password */ + char *password; /* MD5 password */ char *password; @@ -550,13 +556,9 @@ struct peer #define PEER_RMAP_TYPE_EXPORT (1 << 7) /* neighbor route-map export */ }; -#if defined(HAVE_TCP_MD5SIG) - #define PEER_PASSWORD_MINLEN (1) #define PEER_PASSWORD_MAXLEN (80) -#endif /* HAVE_TCP_MD5SIG */ - /* This structure's member directly points incoming packet data stream. */ struct bgp_nlri @@ -810,7 +812,8 @@ enum bgp_clear_type #define BGP_ERR_INSTANCE_MISMATCH -26 #define BGP_ERR_LOCAL_AS_ALLOWED_ONLY_FOR_EBGP -27 #define BGP_ERR_CANNOT_HAVE_LOCAL_AS_SAME_AS -28 -#define BGP_ERR_MAX -29 +#define BGP_ERR_TCPSIG_FAILED -29 +#define BGP_ERR_MAX -30 extern struct bgp_master *bm; @@ -984,10 +987,9 @@ extern int peer_route_map_set (struct peer *, afi_t, safi_t, int, const char *); extern int peer_route_map_unset (struct peer *, afi_t, safi_t, int); extern int peer_unsuppress_map_set (struct peer *, afi_t, safi_t, const char *); -#ifdef HAVE_TCP_MD5SIG + extern int peer_password_set (struct peer *, const char *); extern int peer_password_unset (struct peer *); -#endif /* HAVE_TCP_MD5SIG */ extern int peer_unsuppress_map_unset (struct peer *, afi_t, safi_t); diff --git a/configure.ac b/configure.ac index 29ad1fdd..a94dac54 100755 --- a/configure.ac +++ b/configure.ac @@ -5,10 +5,10 @@ ## Copyright (c) 1996, 97, 98, 99, 2000 Kunihiro Ishiguro <kunihiro@zebra.org> ## Portions Copyright (c) 2003 Paul Jakma <paul@dishone.st> ## -## $Id$ +## $Id: configure.ac,v 1.144 2008/07/22 21:11:48 paul Exp $ AC_PREREQ(2.53) -AC_INIT(Quagga, 0.99.9, [http://bugzilla.quagga.net]) +AC_INIT(Quagga, 0.99.10, [http://bugzilla.quagga.net]) AC_CONFIG_SRCDIR(lib/zebra.h) dnl ----------------------------------- @@ -917,6 +917,27 @@ AC_CHECK_HEADER([net/if.h], QUAGGA_INCLUDES)], [], QUAGGA_INCLUDES ) +dnl ------------------------ +dnl TCP_MD5SIG socket option +dnl ------------------------ + +AC_CHECK_HEADER([netinet/tcp.h], + [m4_define([MD5_INCLUDES], + QUAGGA_INCLUDES + [#include <netinet/tcp.h> + ]) + AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)], + [], + QUAGGA_INCLUDES) +if test $ac_cv_have_decl_TCP_MD5SIG = no; then + AC_CHECK_HEADER([linux/tcp.h], + [m4_define([MD5_INCLUDES], + QUAGGA_INCLUDES + [#include <linux/tcp.h> + ]) + AC_CHECK_DECLS([TCP_MD5SIG], [], [], MD5_INCLUDES)]) +fi + dnl ----------------------- dnl check proc file system. dnl ----------------------- @@ -1198,7 +1219,9 @@ case "${enable_solaris}" in esac if test "${enable_bgp_announce}" = "no";then - AC_DEFINE(DISABLE_BGP_ANNOUNCE,,Disable BGP installation to zebra) + AC_DEFINE(DISABLE_BGP_ANNOUNCE,1,Disable BGP installation to zebra) +else + AC_DEFINE(DISABLE_BGP_ANNOUNCE,0,Disable BGP installation to zebra) fi AC_SUBST(ZEBRA) diff --git a/isisd/dict.c b/isisd/dict.c index 6c3e1e7f..8a7dc588 100644 --- a/isisd/dict.c +++ b/isisd/dict.c @@ -14,8 +14,8 @@ * into proprietary software; there is no requirement for such software to * contain a copyright notice related to this source. * - * $Id$ - * $Name$ + * $Id: dict.c,v 1.5 2007/08/07 18:49:18 paul Exp $ + * $Name: $ */ #include <stdlib.h> diff --git a/isisd/dict.h b/isisd/dict.h index 92972061..9395d1c0 100644 --- a/isisd/dict.h +++ b/isisd/dict.h @@ -14,8 +14,8 @@ * into proprietary software; there is no requirement for such software to * contain a copyright notice related to this source. * - * $Id$ - * $Name$ + * $Id: dict.h,v 1.3 2005/09/25 12:04:25 hasso Exp $ + * $Name: $ */ #ifndef DICT_H diff --git a/lib/ChangeLog b/lib/ChangeLog index da0fa8ca..688c44f7 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,26 @@ +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 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 Denis Ovsienko + + * workqueue.[ch]: completely drop WQ_AIM_HEAD flag and + work_queue_aim_head() function, they aren't needed any more + with the new meta queue structure; (work_queue_run) don't + increment the counter on work item requeueing + 2008-02-28 Paul Jakma <paul.jakma@sun.com> * log.c: (mes_lookup) Sowmini Varadhan diagnosed a problem where diff --git a/lib/command.c b/lib/command.c index f3d96ede..270bf0d3 100644 --- a/lib/command.c +++ b/lib/command.c @@ -1,5 +1,5 @@ /* - $Id$ + $Id: command.c,v 1.55 2007/04/28 22:14:10 ajs Exp $ Command interpreter routine for virtual terminal [aka TeletYpe] Copyright (C) 1997, 98, 99 Kunihiro Ishiguro @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: log.c,v 1.34 2008/02/28 23:26:02 paul Exp $ * * Logging of zebra * Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: log.h,v 1.20 2008/02/28 23:26:02 paul Exp $ * * Zebra logging funcions. * Copyright (C) 1997, 1998, 1999 Kunihiro Ishiguro @@ -1,6 +1,6 @@ /* $USAGI: md5.c,v 1.2 2000/11/02 11:59:24 yoshfuji Exp $ */ /* $KAME: md5.c,v 1.2 2000/05/27 07:07:48 jinmei Exp $ */ -/* $Id$ */ +/* $Id: md5.c,v 1.6 2006/01/17 23:39:04 vincent Exp $ */ /* * Copyright (C) 2004 6WIND @@ -1,6 +1,6 @@ /* $USAGI: md5.h,v 1.2 2000/11/02 11:59:25 yoshfuji Exp $ */ /* $KAME: md5.h,v 1.4 2000/03/27 04:36:22 sumikawa Exp $ */ -/* $Id$ */ +/* $Id: md5.h,v 1.3 2006/01/17 17:40:45 paul Exp $ */ /* * Copyright (C) 2004 6WIND diff --git a/lib/memtypes.awk b/lib/memtypes.awk index fbd5e251..5429f6e8 100644 --- a/lib/memtypes.awk +++ b/lib/memtypes.awk @@ -1,4 +1,4 @@ -# $Id$ +# $Id: memtypes.awk,v 1.4 2006/03/30 14:30:19 paul Exp $ # # Scan a file of memory definitions (see eg memtypes.c) and generate # a corresponding header file with an enum of the MTYPE's and declarations diff --git a/lib/memtypes.c b/lib/memtypes.c index f1b10e71..5c2c9034 100644 --- a/lib/memtypes.c +++ b/lib/memtypes.c @@ -6,7 +6,7 @@ * The script is sensitive to the format (though not whitespace), see * the top of memtypes.awk for more details. * - * $Id$ + * $Id: memtypes.c,v 1.13 2008/07/21 21:02:50 paul Exp $ */ #include "zebra.h" @@ -95,6 +95,7 @@ struct memory_list memory_list_bgp[] = { MTYPE_BGP_PEER_HOST, "BGP peer hostname" }, { MTYPE_PEER_GROUP, "Peer group" }, { MTYPE_PEER_DESC, "Peer description" }, + { MTYPE_PEER_PASSWORD, "Peer password string" }, { MTYPE_ATTR, "BGP attribute" }, { MTYPE_ATTR_EXTRA, "BGP extra attributes" }, { MTYPE_AS_PATH, "BGP aspath" }, diff --git a/lib/route_types.awk b/lib/route_types.awk index eb3d382a..6078406c 100644 --- a/lib/route_types.awk +++ b/lib/route_types.awk @@ -1,4 +1,4 @@ -# $Id$ +# $Id: route_types.awk,v 1.3 2006/06/27 10:42:18 paul Exp $ # # Scan a file of route-type definitions (see eg route_types.txt) and # generate a corresponding header file with: diff --git a/lib/sockopt.c b/lib/sockopt.c index e0027e88..2f01199a 100644 --- a/lib/sockopt.c +++ b/lib/sockopt.c @@ -22,6 +22,7 @@ #include <zebra.h> #include "log.h" #include "sockopt.h" +#include "sockunion.h" int setsockopt_so_recvbuf (int sock, int size) @@ -494,35 +495,69 @@ sockopt_iphdrincl_swab_systoh (struct ip *iph) iph->ip_id = ntohs(iph->ip_id); } -#if defined(HAVE_TCP_MD5SIG) int -sockopt_tcp_signature (int sock, struct sockaddr_in *sin, const char *password) +sockopt_tcp_signature (int sock, union sockunion *su, const char *password) { - int keylen = password ? strlen(password) : 0; - -#if defined(GNU_LINUX) - - struct tcp_md5sig md5sig; - - bzero ((char *)&md5sig, sizeof(md5sig)); - memcpy (&md5sig.tcpm_addr, sin, sizeof(*sin)); - md5sig.tcpm_keylen = keylen; - if (keylen) - memcpy (md5sig.tcpm_key, password, keylen); - - return setsockopt (sock, IPPROTO_TCP, TCP_MD5SIG, &md5sig, sizeof md5sig); - -#else /* !GNU_LINUX */ - - int enable = keylen ? (TCP_SIG_SPI_BASE + sin->sin_port) : 0; - +#if HAVE_DECL_TCP_MD5SIG +#ifndef GNU_LINUX /* * XXX Need to do PF_KEY operation here to add/remove an SA entry, * and add/remove an SP entry for this peer's packet flows also. */ - return setsockopt (sock, IPPROTO_TCP, TCP_MD5SIG, &enable, - sizeof(enable)); - -#endif /* !GNU_LINUX */ -} + int md5sig = password && *password ? 1 : 0; +#else + int keylen = password ? strlen (password) : 0; + struct tcp_md5sig md5sig; + union sockunion *su2, *susock; + int ret; + + /* Figure out whether the socket and the sockunion are the same family.. + * adding AF_INET to AF_INET6 needs to be v4 mapped, you'd think.. + */ + if (!(susock = sockunion_getsockname (sock))) + return -1; + + if (susock->sa.sa_family == su->sa.sa_family) + su2 = su; + else + { + /* oops.. */ + su2 = susock; + + if (su2->sa.sa_family == AF_INET) + { + sockunion_free (susock); + return -1; + }; + + /* If this does not work, then all users of this sockopt will need to + * differentiate between IPv4 and IPv6, and keep seperate sockets for + * each. + * + * Sadly, it doesn't seem to work at present. It's unknown whether + * this is a bug or not. + */ + if (su2->sa.sa_family == AF_INET6 + && su->sa.sa_family == AF_INET) + { + su2->sin6.sin6_family = AF_INET6; + /* V4Map the address */ + memset (&su2->sin6.sin6_addr, 0, sizeof (struct in6_addr)); + su2->sin6.sin6_addr.s6_addr32[2] = htonl(0xffff); + memcpy (&su2->sin6.sin6_addr.s6_addr32[3], &su->sin.sin_addr, 4); + } + } + + memset (&md5sig, 0, sizeof (md5sig)); + memcpy (&md5sig.tcpm_addr, su2, sizeof (*su2)); + md5sig.tcpm_keylen = keylen; + if (keylen) + memcpy (md5sig.tcpm_key, password, keylen); +#endif /* GNU_LINUX */ + ret = setsockopt (sock, IPPROTO_TCP, TCP_MD5SIG, &md5sig, sizeof md5sig); + sockunion_free (susock); + return ret; +#else /* HAVE_TCP_MD5SIG */ + return -2; #endif /* HAVE_TCP_MD5SIG */ +} diff --git a/lib/sockopt.h b/lib/sockopt.h index df0de61c..95382792 100644 --- a/lib/sockopt.h +++ b/lib/sockopt.h @@ -22,6 +22,8 @@ #ifndef _ZEBRA_SOCKOPT_H #define _ZEBRA_SOCKOPT_H +#include "sockunion.h" + extern int setsockopt_so_recvbuf (int sock, int size); extern int setsockopt_so_sendbuf (const int sock, int size); extern int getsockopt_so_sendbuf (const int sock); @@ -87,7 +89,6 @@ extern int setsockopt_multicast_ipv4(int sock, int optname, unsigned int ifindex /* optional: if non-zero, may be used instead of if_addr */); -extern int setsockopt_ipv4_tos(int sock, int tos); /* Ask for, and get, ifindex, by whatever method is supported. */ extern int setsockopt_ifindex (int, int, int); @@ -99,32 +100,6 @@ extern int getsockopt_ifindex (int, struct msghdr *); extern void sockopt_iphdrincl_swab_htosys (struct ip *iph); extern void sockopt_iphdrincl_swab_systoh (struct ip *iph); -#if defined(HAVE_TCP_MD5SIG) - -#if defined(GNU_LINUX) && !defined(TCP_MD5SIG) - -/* XXX these will come from <linux/tcp.h> eventually */ - -#define TCP_MD5SIG 14 -#define TCP_MD5SIG_MAXKEYLEN 80 - -struct tcp_md5sig { - struct sockaddr_storage tcpm_addr; /* address associated */ - __u16 __tcpm_pad1; /* zero */ - __u16 tcpm_keylen; /* key length */ - __u32 __tcpm_pad2; /* zero */ - __u8 tcpm_key[TCP_MD5SIG_MAXKEYLEN]; /* key (binary) */ -}; - -#endif /* defined(GNU_LINUX) && !defined(TCP_MD5SIG) */ - -#if !defined(GNU_LINUX) && !defined(TCP_SIG_SPI_BASE) -#define TCP_SIG_SPI_BASE 1000 /* XXX this will go away */ -#endif - -extern int sockopt_tcp_signature(int sock, struct sockaddr_in *sin, +extern int sockopt_tcp_signature(int sock, union sockunion *su, const char *password); - -#endif /* HAVE_TCP_MD5SIG */ - #endif /*_ZEBRA_SOCKOPT_H */ diff --git a/lib/sockunion.c b/lib/sockunion.c index 7721666e..cfd3bf9a 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -254,6 +254,7 @@ sockunion_accept (int sock, union sockunion *su) client_sock = accept (sock, (struct sockaddr *) su, &len); /* Convert IPv4 compatible IPv6 address to IPv4 address. */ +#if 0 #ifdef HAVE_IPV6 if (su->sa.sa_family == AF_INET6) { @@ -268,7 +269,7 @@ sockunion_accept (int sock, union sockunion *su) } } #endif /* HAVE_IPV6 */ - +#endif return client_sock; } @@ -592,6 +593,7 @@ sockunion_getsockname (int fd) su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)); memcpy (su, &name, sizeof (struct sockaddr_in6)); +#if 0 if (IN6_IS_ADDR_V4MAPPED (&su->sin6.sin6_addr)) { struct sockaddr_in sin; @@ -601,6 +603,7 @@ sockunion_getsockname (int fd) sin.sin_port = su->sin6.sin6_port; memcpy (su, &sin, sizeof (struct sockaddr_in)); } +#endif return su; } #endif /* HAVE_IPV6 */ @@ -645,7 +648,7 @@ sockunion_getpeername (int fd) { su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion)); memcpy (su, &name, sizeof (struct sockaddr_in6)); - +#if 0 if (IN6_IS_ADDR_V4MAPPED (&su->sin6.sin6_addr)) { struct sockaddr_in sin; @@ -655,6 +658,7 @@ sockunion_getpeername (int fd) sin.sin_port = su->sin6.sin6_port; memcpy (su, &sin, sizeof (struct sockaddr_in)); } +#endif return su; } #endif /* HAVE_IPV6 */ @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: str.h,v 1.4 2005/09/19 09:53:21 hasso Exp $ */ #ifndef _ZEBRA_STR_H diff --git a/lib/stream.c b/lib/stream.c index 7034d904..983330ff 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -458,7 +458,7 @@ stream_get_ipv4 (struct stream *s) * stream_write() is saner */ void -stream_put (struct stream *s, void *src, size_t size) +stream_put (struct stream *s, const void *src, size_t size) { /* XXX: CHECK_SIZE has strange semantics. It should be deprecated */ @@ -833,7 +833,7 @@ stream_recvmsg (struct stream *s, int fd, struct msghdr *msgh, int flags, /* Write data to buffer. */ size_t -stream_write (struct stream *s, u_char *ptr, size_t size) +stream_write (struct stream *s, const void *ptr, size_t size) { CHECK_SIZE(s, size); diff --git a/lib/stream.h b/lib/stream.h index 715a083d..3e4ba7b4 100644 --- a/lib/stream.h +++ b/lib/stream.h @@ -150,7 +150,7 @@ extern void stream_forward_getp (struct stream *, size_t); extern void stream_forward_endp (struct stream *, size_t); /* steam_put: NULL source zeroes out size_t bytes of stream */ -extern void stream_put (struct stream *, void *, size_t); +extern void stream_put (struct stream *, const void *, size_t); extern int stream_putc (struct stream *, u_char); extern int stream_putc_at (struct stream *, size_t, u_char); extern int stream_putw (struct stream *, u_int16_t); @@ -200,7 +200,7 @@ extern ssize_t stream_recvmsg (struct stream *s, int fd, struct msghdr *, extern ssize_t stream_recvfrom (struct stream *s, int fd, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); -extern size_t stream_write (struct stream *, u_char *, size_t); +extern size_t stream_write (struct stream *, const void *, size_t); /* reset the stream. See Note above */ extern void stream_reset (struct stream *); diff --git a/lib/workqueue.c b/lib/workqueue.c index 8880b9e2..1d32d241 100644 --- a/lib/workqueue.c +++ b/lib/workqueue.c @@ -67,7 +67,6 @@ work_queue_new (struct thread_master *m, const char *queue_name) new->name = XSTRDUP (MTYPE_WORK_QUEUE_NAME, queue_name); new->master = m; SET_FLAG (new->flags, WQ_UNPLUGGED); - UNSET_FLAG (new->flags, WQ_AIM_HEAD); if ( (new->items = list_new ()) == NULL) { @@ -131,10 +130,7 @@ work_queue_add (struct work_queue *wq, void *data) } item->data = data; - if (CHECK_FLAG (wq->flags, WQ_AIM_HEAD)) - listnode_add_after (wq->items, NULL, item); - else - listnode_add (wq->items, item); + listnode_add (wq->items, item); work_queue_schedule (wq, wq->spec.hold); @@ -231,15 +227,6 @@ work_queue_unplug (struct work_queue *wq) work_queue_schedule (wq, wq->spec.hold); } -void -work_queue_aim_head (struct work_queue *wq, const unsigned aim_head) -{ - if (aim_head) - SET_FLAG (wq->flags, WQ_AIM_HEAD); - else - UNSET_FLAG (wq->flags, WQ_AIM_HEAD); -} - /* timer thread to process a work queue * will reschedule itself if required, * otherwise work_queue_item_add @@ -317,6 +304,7 @@ work_queue_run (struct thread *thread) } case WQ_REQUEUE: { + item->ran--; work_queue_item_requeue (wq, node); break; } diff --git a/lib/workqueue.h b/lib/workqueue.h index 3150c32e..f59499a0 100644 --- a/lib/workqueue.h +++ b/lib/workqueue.h @@ -48,7 +48,6 @@ struct work_queue_item }; #define WQ_UNPLUGGED (1 << 0) /* available for draining */ -#define WQ_AIM_HEAD (1 << 1) /* add new items before list head, not after tail */ struct work_queue { @@ -119,8 +118,6 @@ extern void work_queue_add (struct work_queue *, void *); extern void work_queue_plug (struct work_queue *wq); /* unplug the queue, allow it to be drained again */ extern void work_queue_unplug (struct work_queue *wq); -/* control the value for WQ_AIM_HEAD flag */ -extern void work_queue_aim_head (struct work_queue *wq, const unsigned); /* Helpers, exported for thread.c and command.c */ extern int work_queue_run (struct thread *); diff --git a/lib/zassert.h b/lib/zassert.h index 525d866c..79126760 100644 --- a/lib/zassert.h +++ b/lib/zassert.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: zassert.h,v 1.2 2004/12/03 18:01:04 ajs Exp $ */ #ifndef _QUAGGA_ASSERT_H diff --git a/lib/zebra.h b/lib/zebra.h index d4f68cf0..2716460f 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -163,6 +163,7 @@ typedef int socklen_t; #include <linux/netlink.h> #include <linux/rtnetlink.h> #include <linux/filter.h> +#include <stddef.h> #else #define RT_TABLE_MAIN 0 #endif /* HAVE_NETLINK */ diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 00000000..86e2b5ed --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,101 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.2 2003/02/17 23:54:05 paul Exp $ + +errstatus=0 +dirmode="" + +usage="\ +Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..." + +# process command line arguments +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) # -h for help + echo "${usage}" 1>&2; exit 0 ;; + -m ) # -m PERM arg + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + dirmode="${1}" + shift ;; + -- ) shift; break ;; # stop option processing + -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option + * ) break ;; # first non-opt arg + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in +0) exit 0 ;; +esac + +case $dirmode in +'') + if mkdir -p -- . 2>/dev/null; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + fi ;; +*) + if mkdir -m "$dirmode" -p -- . 2>/dev/null; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + fi ;; +esac + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + + lasterr="" + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# Local Variables: +# mode: shell-script +# sh-indentation: 3 +# End: +# mkinstalldirs ends here diff --git a/ospf6d/ospf6_main.c b/ospf6d/ospf6_main.c index 8380bc89..680f4b7f 100644 --- a/ospf6d/ospf6_main.c +++ b/ospf6d/ospf6_main.c @@ -227,7 +227,8 @@ main (int argc, char *argv[], char *envp[]) break; } vty_port = atoi (optarg); - vty_port = (vty_port ? vty_port : OSPF6_VTY_PORT); + if (vty_port <= 0 || vty_port > 0xffff) + vty_port = OSPF6_VTY_PORT; break; case 'u': ospf6d_privs.user = optarg; diff --git a/ospfd/OSPF-ALIGNMENT.txt b/ospfd/OSPF-ALIGNMENT.txt index a5fe931b..dac6182f 100644 --- a/ospfd/OSPF-ALIGNMENT.txt +++ b/ospfd/OSPF-ALIGNMENT.txt @@ -1,4 +1,4 @@ -$Id$ +$Id: OSPF-ALIGNMENT.txt,v 1.1 2004/11/17 17:59:52 gdt Exp $ Greg Troxel <gdt@ir.bbn.com> 2004-11-17 diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 27a12dd0..1a200a8f 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -245,7 +245,8 @@ main (int argc, char **argv) break; } vty_port = atoi (optarg); - vty_port = (vty_port ? vty_port : OSPF_VTY_PORT); + if (vty_port <= 0 || vty_port > 0xffff) + vty_port = OSPF_VTY_PORT; break; case 'u': ospfd_privs.user = optarg; diff --git a/pkgsrc/README.txt b/pkgsrc/README.txt index 1cae5c14..13ec449a 100644 --- a/pkgsrc/README.txt +++ b/pkgsrc/README.txt @@ -1,4 +1,4 @@ -$Id$ +$Id: README.txt,v 1.1 2004/08/27 15:57:35 gdt Exp $ This directory contains files for use with the pkgsrc framework (http://www.pkgsrc.org) used with NetBSD and other operating systems. diff --git a/ripd/ChangeLog b/ripd/ChangeLog index ecf353d0..60baef5d 100644 --- a/ripd/ChangeLog +++ b/ripd/ChangeLog @@ -1,3 +1,7 @@ +2008-05-29 Stephen Hemminger <stephen.hemminger@vyatta.com> + + * ripd.c: (rip_auth_md5) fix bogus empty string test + 2008-03-13 Paul Jakma <paul.jakma@sun.com> * ripd.c/rip_interface.c: Remove 0 entries from rip_msg diff --git a/ripd/rip_main.c b/ripd/rip_main.c index dfcd6c26..0b29107d 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -236,7 +236,8 @@ main (int argc, char **argv) break; } vty_port = atoi (optarg); - vty_port = (vty_port ? vty_port : RIP_VTY_PORT); + if (vty_port <= 0 || vty_port > 0xffff) + vty_port = RIP_VTY_PORT; break; case 'r': retain_mode = 1; diff --git a/ripd/ripd.conf.sample b/ripd/ripd.conf.sample index f72e5e85..2902ff9c 100644 --- a/ripd/ripd.conf.sample +++ b/ripd/ripd.conf.sample @@ -2,7 +2,7 @@ ! ! RIPd sample configuration file ! -! $Id$ +! $Id: ripd.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $ ! hostname ripd password zebra diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 70553910..a18ce9de 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -240,7 +240,8 @@ main (int argc, char **argv) break; } vty_port = atoi (optarg); - vty_port = (vty_port ? vty_port : RIPNG_VTY_PORT); + if (vty_port <= 0 || vty_port > 0xffff) + vty_port = RIPNG_VTY_PORT; break; case 'r': retain_mode = 1; diff --git a/ripngd/ripngd.conf.sample b/ripngd/ripngd.conf.sample index 1daf3b39..ad673e57 100644 --- a/ripngd/ripngd.conf.sample +++ b/ripngd/ripngd.conf.sample @@ -2,7 +2,7 @@ ! ! RIPngd sample configuration file ! -! $Id$ +! $Id: ripngd.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $ ! hostname ripngd password zebra diff --git a/solaris/ChangeLog b/solaris/ChangeLog index 8a2ad7d3..65135d99 100644 --- a/solaris/ChangeLog +++ b/solaris/ChangeLog @@ -1,3 +1,13 @@ +2008-07-03 Paul Jakma <paul.jakma@sun.com> + + * quagga.{xml,init}.in: Sync with OpenSolaris SFW. This changes the + SMF schema used, from the SMF schema supplied initially with + Quagga, to the version which was approved by the Sun PSARC for + inclusion into Solaris. This change is incompatible. Settings, + such as vty_port, etc. will not transfer over. The Sun schema is + however supported by Sun, and supports running Quagga in a zone + with IP instances, and configuration via the routeadm utility. + 2008-01-13 Paul Jakma <paul.jakma@sun.com> * Makefile.am: pkg target should depend on the 'depend.%' files. diff --git a/solaris/Makefile.am b/solaris/Makefile.am index 674f4ebf..835d3a70 100644 --- a/solaris/Makefile.am +++ b/solaris/Makefile.am @@ -1,5 +1,5 @@ # Solaris packages automake file -# $Id$ +# $Id: Makefile.am,v 1.9 2008/01/13 18:52:15 paul Exp $ # XXX This file uses GNU make extensions. diff --git a/solaris/quagga.init.in b/solaris/quagga.init.in index 30a9c694..b489b28e 100755 --- a/solaris/quagga.init.in +++ b/solaris/quagga.init.in @@ -1,6 +1,6 @@ #!/sbin/sh # -# Copyright 2001,2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # This file is part of Quagga. @@ -20,18 +20,156 @@ # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # -# $Id$ +# $Id: quagga.init.in,v 1.8 2008/07/03 20:41:08 paul Exp $ # # Starts/stops the given daemon SMFINCLUDE=/lib/svc/share/smf_include.sh +ROUTEADMINCLUDE=/lib/svc/share/routing_include.sh +GLOBAL_OPTIONS="PAfiug" DAEMON_PATH=@sbindir@ +USER=@enable_user@ +GROUP=@enable_group@ +# handle upgrade of daemon-args SMF property to new routeadm properties +# used during upgrade too by routeadm. +# relevant to S10U4+ only. +handle_routeadm_upgrade () { + GLOBAL_OPTIONS="PAfiug" + + daemon_args=`get_daemon_args $SMF_FMRI` + + if [ -n "$daemon_args" ]; then + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "P" vty_port 0 + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "A" vty_address + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "f" config_file + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "i" pid_file + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "u" user + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "$GLOBAL_OPTIONS" "g" group + + case "$1" in + zebra) + set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}b" "b" batch true false + ;; + ripd|ripngd) + set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}r" "r" retain true false + ;; + bgpd) + set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}rnp" "r" retain true false + set_daemon_boolean_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}rnp" "n" no_kernel true false + set_daemon_value_property "$SMF_FMRI" "$daemon_args" \ + "${GLOBAL_OPTIONS}rnp" "p" bgp_port + esac + clear_daemon_args $SMF_FMRI + fi +} + +upgrade_config () { + DAEMON=$1 + # handle upgrade of SUNWzebra to Quagga + if [ -d "/etc/quagga" -a ! -f "/etc/quagga/${DAEMON}.conf" ] ; then + if [ -f "/etc/sfw/zebra/${DAEMON}.conf" ] ; then + cp "/etc/sfw/zebra/${DAEMON}.conf" \ + "/etc/quagga/${DAEMON}.conf.upgrade" \ + || exit $SMF_EXIT_ERR_FATAL + chown "${USER}:${GROUP}" "/etc/quagga/${DAEMON}.conf.upgrade" \ + || exit $SMF_EXIT_ERR_FATAL + chmod 0600 "/etc/quagga/${DAEMON}.conf.upgrade" \ + || exit $SMF_EXIT_ERR_FATAL + mv "/etc/quagga/${DAEMON}.conf.upgrade" "/etc/quagga/${DAEMON}.conf" \ + || exit $SMF_EXIT_ERR_FATAL + fi + fi + + if [ ! -f "/etc/quagga/${DAEMON}.conf" ] ; then + touch "/etc/quagga/${DAEMON}.conf.new" \ + || exit $SMF_EXIT_ERR_FATAL + chown "${USER}:${GROUP}" "/etc/quagga/${DAEMON}.conf.new" \ + || exit $SMF_EXIT_ERR_FATAL + chmod 0600 "/etc/quagga/${DAEMON}.conf.new" \ + || exit $SMF_EXIT_ERR_FATAL + mv "/etc/quagga/${DAEMON}.conf.new" "/etc/quagga/${DAEMON}.conf" \ + || exit $SMF_EXIT_ERR_FATAL + fi +} + +# Relevant to S10+ quagga_is_globalzone () { - if [ "${QUAGGA_INIT_ZONENAME:=`/sbin/zonename`}" != "global" ]; then - return 1 - else + if [ "${QUAGGA_INIT_ZONENAME:=`/sbin/zonename`}" = "global" \ + -o `/sbin/zonename -t` = "exclusive" ]; then return 0 + else + return 1 + fi +} + +routeadm_daemon_args () { + # globals + args="`get_daemon_option_from_property $SMF_FMRI config_file f`" + args="${args} `get_daemon_option_from_property $SMF_FMRI vty_port P`" + args="${args} `get_daemon_option_from_property $SMF_FMRI vty_address A`" + args="${args} `get_daemon_option_from_property $SMF_FMRI pid_file i`" + + # user and group we need for config file upgrade.. + SMF_USER=`get_routeadm_property $SMF_FMRI user` + SMF_GROUP=`get_routeadm_property()$SMF_FMRI group` + if [ "${SMF_USER}" ] ; then + USER="${SMF_USER}" + args="${args} -u ${SMF_USER}" + fi + if [ "${SMF_GROUP}" ] ; then + GROUP="${SMF_GROUP}" + args="${args} -g ${SMF_GROUP}" + fi + + case $1 in + zebra) + args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI batch -b true`" + ;; + ripd|ripngd) + args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI retain -r true`" + ;; + bgpd) + args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI retain -r true`" + args="${args} `get_daemon_option_from_boolean_property $SMF_FMRI no_kernel -n true`" + args="${args} `get_daemon_option_from_property $SMF_FMRI bgp_port p 179`" + ;; + esac + echo ${args} +} + +# certain daemons need zebra +routeadm_zebra_enable () { + + if [ "$DAEMON" = "zebra" ]; then + return + fi + + enable_zebra=`/usr/bin/svcprop -p \ + routing/enable_zebra $SMF_FMRI 2> /dev/null` + if [ "$enable_zebra" != "false" ]; then + zenabled=`/usr/bin/svcprop -p general/enabled zebra:quagga` + zenabledt=`/usr/bin/svcprop -p general_ovr/enabled zebra:quagga` + if [ "$zenabled" = "true" -o "$zenabledt" = "true" ]; then + /usr/sbin/svcadm disable zebra:quagga + /usr/sbin/svcadm enable -st zebra:quagga + else + /usr/sbin/svcadm enable -st zebra:quagga + fi + if [ "$?" != "0" ]; then + echo "Could not enable zebra:quagga" + exit $SMF_EXIT_ERR_FATAL + fi fi } @@ -39,6 +177,11 @@ quagga_is_globalzone () { # there is no SMF. Should allow this script to work pre-S10. if [ -f "$SMFINCLUDE" ] ; then . "$SMFINCLUDE"; + + # source the SMF-routeadm include if present.. + if [ -f "$ROUTEADMINCLUDE" ] ; then + . "$ROUTEADMINCLUDE" + fi else # pre-SMF system, fake up any functions and exit codes # which SMFINCLUDE usually provides. @@ -55,7 +198,7 @@ smf_present || DAEMON_ARGS="" usage () { if smf_present ; then - echo "Usage: $0 <daemon> <daemon arguments>"; + echo "Usage: $0 <daemon>"; else echo "Usage: $0 <stop|start> <daemon> <daemon arguments>"; fi @@ -67,7 +210,7 @@ usage () { case $1 in 'help' | 'usage') usage - exit SMF_EXIT_OK + exit $SMF_EXIT_OK ;; esac @@ -79,8 +222,6 @@ else fi DAEMON="$1" -shift -DAEMON_ARGS="$@" # daemon path must be given if [ -z "$DAEMON_PATH/$DAEMON" ]; then @@ -91,12 +232,9 @@ fi # only bgpd is suitable for running in a non-global zone, at this # time. case "${DAEMON}" in - zebra) - quagga_is_globalzone || exit $SMF_EXIT_OK - ;; bgpd) ;; - ospfd | ospf6d | ripd | ripngd ) + zebra | ospfd | ospf6d | ripd | ripngd ) quagga_is_globalzone || exit $SMF_EXIT_OK ;; *) @@ -105,6 +243,27 @@ case "${DAEMON}" in ;; esac +# Older Quagga SMF packages pass daemon args on the commandline +# Newer SMF routeadm model uses properties for each argument +# so we must handle that. +if [ smf_present -a -f "$ROUTEADMINCLUDE" ]; then + handle_routeadm_upgrade $DAEMON; + DAEMON_ARGS=`routeadm_daemon_args`; + routeadm_zebra_enable $DAEMON; +else + if [ $# -gt 0 ] ; then + shift + DAEMON_ARGS="$@" + fi +fi + +upgrade_config "$DAEMON" + +if [ ! -f "@sysconfdir@/${DAEMON}.conf" ] ; then + echo "Could not find config file, @sysconfdir@/${DAEMON}.conf" + exit $SMF_EXIT_ERR_CONFIG +fi + # we need @quagga_statedir@ to exist, it probably is on tmpfs. if [ ! -d @quagga_statedir@ ] ; then mkdir -p @quagga_statedir@ @@ -115,7 +274,11 @@ fi PIDFILE="@quagga_statedir@/${DAEMON}.pid" start () { - $DAEMON_PATH/$DAEMON $DAEMON_ARGS --pid_file ${PIDFILE} & + if [ ! -x "$DAEMON_PATH/$DAEMON" ] ; then + echo "Error, could not find daemon, $DAEMON_PATH/$DAEMON" + exit $SMF_EXIT_ERR_FATAL + fi + eval exec $DAEMON_PATH/$DAEMON $DAEMON_ARGS --pid_file ${PIDFILE} & } stop () { @@ -134,7 +297,7 @@ case "$QUAGGA_METHOD" in *) usage - exit SMF_EXIT_ERR_FATAL + exit $SMF_EXIT_ERR_FATAL ;; esac diff --git a/solaris/quagga.xml.in b/solaris/quagga.xml.in index 3cd402f6..50c52c22 100644 --- a/solaris/quagga.xml.in +++ b/solaris/quagga.xml.in @@ -18,18 +18,20 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Copyright 2005 Sun Microsystems, Inc. All rights reserved. + Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. ident "@(#)quagga.xml 1.0 05/03/15 SMI" --> -<service_bundle type='manifest' name='QUAGGAdaemons:quagga'> +<service_bundle type='manifest' name='SUNWquagga-daemons:quagga'> + <service name='network/routing/zebra' type='service' version='1'> - + + <single_instance /> <instance name='quagga' enabled='false'> <dependency name='fs' @@ -46,24 +48,24 @@ type='service'> <service_fmri value='svc:/network/initial' /> </dependency> - - <dependency name='config_data' + + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' grouping='require_all' - restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/zebra.conf' /> + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga zebra %{routing/daemon-args}' + exec='/lib/svc/method/quagga zebra' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_rawaccess,sys_admin,sys_net_config'/> + user='root' group='root'/> </method_context> </exec_method> @@ -84,17 +86,55 @@ <propval name='ignore_error' type='astring' value='core,signal' /> </property_group> - + + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/zebra' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <!-- zebra should not contribute to ipv4/ipv6 routing state --> + <propval name='protocol' type='astring' value='zebra' /> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> + <stability value='Evolving' /> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons + Property names are equivalent to the long + option name, consult Quagga documentation --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> + + <!-- Options specific to zebra --> + <propval name='batch' type='boolean' value='false' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -111,7 +151,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> <service @@ -129,39 +169,40 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on Work-In-Progress, not yet in SNV - <dependency name='net' - grouping='require_all' - restart_on='none' + <dependency + name='ipv4-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv4-routing' /> + <service_fmri value='svc:/network/ipv4-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='require_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> - </dependency> - - <dependency name='config_data' + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' grouping='require_all' - restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/ripd.conf' /> + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' + restart_on='restart' + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> + </dependency> + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga ripd %{routing/daemon-args}' + exec='/lib/svc/method/quagga ripd' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess'/> + user='root' group='root'/> </method_context> </exec_method> @@ -179,16 +220,52 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/ripd' /> + <propval name='legacy-daemon' type='astring' + value='/usr/sfw/sbin/ripdstart' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <propval name='protocol' type='astring' value='ipv4' /> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> + + <!-- Options specific to ripd --> + <propval name='retain' type='boolean' value='false' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -205,7 +282,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> <service @@ -223,39 +300,40 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on WIP, not yet in SNV - <dependency name='net' - grouping='require_all' - restart_on='none' + <dependency + name='ipv6-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv6-routing' /> + <service_fmri value='svc:/network/ipv6-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='require_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' + grouping='require_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - <dependency name='config_data' - grouping='require_all' + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/ripngd.conf' /> + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga ripngd %{routing/daemon-args}' + exec='/lib/svc/method/quagga ripngd' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess'/> + user='root' group='root'/> </method_context> </exec_method> @@ -273,16 +351,50 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/ripngd' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <propval name='protocol' type='astring' value='ipv6'/> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> + + <!-- Options specific to ripngd --> + <propval name='retain' type='boolean' value='false' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -299,7 +411,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> <service @@ -317,47 +429,51 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on WIP, not yet in SNV - <dependency name='net' - grouping='require_all' - restart_on='none' + <dependency + name='ipv4-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv4-routing' /> + <service_fmri value='svc:/network/ipv4-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='require_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' + grouping='require_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - <dependency name='config_data' - grouping='require_all' + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/ospfd.conf' /> + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga ospfd %{routing/daemon-args}' + exec='/lib/svc/method/quagga ospfd' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess,sys_net_config'/> + user='root' group='root'/> </method_context> </exec_method> + <!-- ospfd can take a long time to shutdown, due to graceful + shutdown + --> <exec_method type='method' name='stop' exec=':kill' - timeout_seconds='60'> + timeout_seconds='600'> </exec_method> <property_group name='startd' @@ -367,16 +483,49 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/ospfd' /> + <propval name='legacy-daemon' type='astring' + value='/usr/sfw/sbin/ospfdstart' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <propval name='protocol' type='astring' value='ipv4'/> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -393,7 +542,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> <service @@ -411,39 +560,40 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on WIP, not yet in SNV - <dependency name='net' - grouping='require_all' - restart_on='none' + <dependency + name='ipv6-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv6-routing' /> + <service_fmri value='svc:/network/ipv6-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='require_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' + grouping='require_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - <dependency name='config_data' - grouping='require_all' + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/ospf6d.conf' /> + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga ospf6d %{routing/daemon-args}' + exec='/lib/svc/method/quagga ospf6d' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess'/> + user='root' group='root'/> </method_context> </exec_method> @@ -461,22 +611,53 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/ospf6d' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <propval name='protocol' type='astring' value='ipv6'/> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> <common_name> <loctext xml:lang='C'> - Quagga: ospf6d, OSPFv3 IPv6 routing protocol daemon. + Quagga: ospf6d, OSPFv3 IPv6 routing protocol daemon. </loctext> </common_name> <documentation> @@ -487,7 +668,7 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> @@ -506,40 +687,48 @@ value='svc:/system/filesystem/usr:default' /> </dependency> - <!-- Depends on WIP, not yet in SNV - <dependency name='net' - grouping='require_any' - restart_on='none' + <dependency + name='ipv6-forwarding' + grouping='optional_all' + restart_on='refresh' type='service'> - <service_fmri value='svc:/network/routing/ipv6-routing' /> - <service_fmri value='svc:/network/routing/ipv4-routing' /> + <service_fmri value='svc:/network/ipv6-forwarding' /> + </dependency> + + <dependency + name='ipv4-forwarding' + grouping='optional_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/ipv4-forwarding' /> </dependency> - --> - <dependency name='zebra' - grouping='optional_all' - restart_on='restart' - type='service'> - <service_fmri value='svc:/network/routing/zebra:quagga' /> + <!-- do not not run unless routing-setup has run --> + <dependency + name='network_routing_setup' + grouping='require_all' + restart_on='refresh' + type='service'> + <service_fmri value='svc:/network/routing-setup' /> </dependency> - <dependency name='config_data' - grouping='require_all' + <!-- ensure that restart of zebra is propogated to daemon --> + <dependency + name='zebra' + grouping='optional_all' restart_on='restart' - type='path'> - <service_fmri - value='file://localhost/@sysconfdir@/bgpd.conf' /> + type='service'> + <service_fmri value='svc:/network/routing/zebra:quagga' /> </dependency> - + <exec_method type='method' name='start' - exec='/lib/svc/method/quagga bgpd %{routing/daemon-args}' + exec='/lib/svc/method/quagga bgpd' timeout_seconds='60'> <method_context> <method_credential - user='root' group='root' - privileges='basic,net_icmpaccess,net_privaddr,net_rawaccess'/> + user='root' group='root'/> </method_context> </exec_method> @@ -557,16 +746,65 @@ type='astring' value='core,signal' /> </property_group> + <!-- Properties in this group are used by routeadm (1M) --> + <property_group name='routeadm' type='application'> + <stability value='Unstable' /> + <!-- Identifies service as a routing service --> + <propval name='daemon' type='astring' + value='@sbindir@/bgpd' /> + <propval name='legacy-daemon' type='astring' + value='/usr/sfw/sbin/bgpdstart' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.value.routing' /> + <property name='protocol' type='astring'> + <astring_list> + <value_node value='ipv4'/> + <value_node value='ipv6'/> + </astring_list> + </property> + </property_group> + + <!-- Properties in this group are modifiable via routeadm (1M) --> <property_group name='routing' type='application'> <propval name='value_authorization' type='astring' - value='solaris.smf.modify.routing' /> - <propval name='daemon-args' type='astring' value='-P 0'/> + value='solaris.smf.value.routing' /> + + <!-- Options common to Quagga daemons. --> + <!-- The config file to use, if not the default --> + <propval name='config_file' type='astring' value=''/> + <!-- The vty_port to listen on if not the default. + 0 to disable --> + <propval name='vty_port' type='integer' value='0' /> + <!-- The address to bind the VTY interface to, if not any. --> + <propval name='vty_address' type='astring' value='' /> + <!-- The user to switch to after startup, if not the default --> + <propval name='user' type='astring' value='' /> + <!-- The group to switch to, if not the default. + If user is specified, this defaults to a group with + same name as user --> + <propval name='group' type='astring' value='' /> + <!-- The pidfile to use, if not the default of + @quagga_statedir@ --> + <propval name='pid_file' type='astring' value='' /> + + <!-- Options specific to bgpd --> + <propval name='retain' type='boolean' value='false' /> + <propval name='no_kernel' type='boolean' value='false' /> + <propval name='bgp_port' type='astring' value='' /> + + <!-- + If enable_zebra is false, it will not be switched + on by the start method. + --> + <propval name='enable_zebra' type='boolean' value='true' /> </property_group> <property_group name='general' type='framework'> <!-- to start stop routing services --> <propval name='action_authorization' type='astring' value='solaris.smf.manage.routing' /> + <propval name='value_authorization' type='astring' + value='solaris.smf.manage.routing' /> </property_group> <template> @@ -583,6 +821,6 @@ </documentation> </template> </instance> - <stability value='Evolving' /> + <stability value='Unstable' /> </service> </service_bundle> diff --git a/tests/ChangeLog b/tests/ChangeLog index 098afb55..18696519 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2008-06-07 Paul Jakma <paul@jakma.org + + * bgp_mp_attr_test.c: MP_(UN)REACH_NLRI unit tests + 2008-02-23 Paul Jakma <paul.jakma@sun.com> * aspath_test.c: Test for 0-ASN sequences that still have data. diff --git a/tests/Makefile.am b/tests/Makefile.am index 2045496e..d00485f1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,7 +2,9 @@ INCLUDES = @INCLUDES@ -I.. -I$(top_srcdir) -I$(top_srcdir)/lib DEFS = @DEFS@ $(LOCAL_OPTS) -DSYSCONFDIR=\"$(sysconfdir)/\" noinst_PROGRAMS = testsig testbuffer testmemory heavy heavywq heavythread \ - aspathtest testprivs teststream testbgpcap ecommtest + aspathtest testprivs teststream testbgpcap ecommtest \ + testbgpmpattr + testsig_SOURCES = test-sig.c testbuffer_SOURCES = test-buffer.c testmemory_SOURCES = test-memory.c @@ -14,6 +16,7 @@ heavythread_SOURCES = heavy-thread.c main.c aspathtest_SOURCES = aspath_test.c testbgpcap_SOURCES = bgp_capability_test.c ecommtest_SOURCES = ecommunity_test.c +testbgpmpattr_SOURCES = bgp_mp_attr_test.c testsig_LDADD = ../lib/libzebra.la @LIBCAP@ testbuffer_LDADD = ../lib/libzebra.la @LIBCAP@ @@ -26,3 +29,4 @@ heavythread_LDADD = ../lib/libzebra.la @LIBCAP@ -lm aspathtest_LDADD = ../lib/libzebra.la @LIBCAP@ -lm ../bgpd/libbgp.a testbgpcap_LDADD = ../lib/libzebra.la @LIBCAP@ -lm ../bgpd/libbgp.a ecommtest_LDADD = ../lib/libzebra.la @LIBCAP@ -lm ../bgpd/libbgp.a +testbgpmpattr_LDADD = ../lib/libzebra.la @LIBCAP@ -lm ../bgpd/libbgp.a diff --git a/tests/bgp_mp_attr_test.c b/tests/bgp_mp_attr_test.c new file mode 100644 index 00000000..dde0df2f --- /dev/null +++ b/tests/bgp_mp_attr_test.c @@ -0,0 +1,535 @@ +#include <zebra.h> + +#include "vty.h" +#include "stream.h" +#include "privs.h" +#include "memory.h" + +#include "bgpd/bgpd.h" +#include "bgpd/bgp_attr.h" +#include "bgpd/bgp_open.h" +#include "bgpd/bgp_debug.h" + +#define VT100_RESET "\x1b[0m" +#define VT100_RED "\x1b[31m" +#define VT100_GREEN "\x1b[32m" +#define VT100_YELLOW "\x1b[33m" + + +#define CAPABILITY 0 +#define DYNCAP 1 +#define OPT_PARAM 2 + +/* need these to link in libbgp */ +struct zebra_privs_t *bgpd_privs = NULL; +struct thread_master *master = NULL; + +static int failed = 0; +static int tty = 0; + +/* test segments to parse and validate, and use for other tests */ +static struct test_segment { + const char *name; + const char *desc; + const u_char data[1024]; + int len; +#define SHOULD_PARSE 0 +#define SHOULD_ERR -1 + int parses; /* whether it should parse or not */ + + /* AFI/SAFI validation */ + afi_t afi; + safi_t safi; +#define VALID_AFI 1 +#define INVALID_AFI 0 + int afi_valid; +} mp_reach_segments [] = +{ + { "IPv6", + "IPV6 MP Reach, global nexthop, 1 NLRI", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 16, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 32, 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + }, + (4 + 16 + 1 + 5), + SHOULD_PARSE, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-2", + "IPV6 MP Reach, global nexthop, 2 NLRIs", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 16, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, /* ffee:102:... */ + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 32, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + }, + (4 + 16 + 1 + 5 + 9), + SHOULD_PARSE, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-default", + "IPV6 MP Reach, global nexthop, 2 NLRIs + default", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 16, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 32, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + 0x0, /* ::/0 */ + }, + (4 + 16 + 1 + 5 + 9 + 1), + SHOULD_PARSE, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-lnh", + "IPV6 MP Reach, global+local nexthops, 2 NLRIs + default", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 32, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, /* fffe:102:... */ + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + /* Nexthop (local) */ 0xfe, 0x80, 0x0, 0x0, /* fe80::210:2ff:.. */ + 0x0, 0x0, 0x0, 0x0, + 0x2, 0x10, 0x2, 0xff, + 0x1, 0x2, 0x3, 0x4, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 32, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + 0x0, /* ::/0 */ + }, + (4 + 32 + 1 + 5 + 9 + 1), + SHOULD_PARSE, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-nhlen", + "IPV6 MP Reach, inappropriate nexthop length", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 4, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, /* fffe:102:... */ + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + /* Nexthop (local) */ 0xfe, 0x80, 0x0, 0x0, /* fe80::210:2ff:.. */ + 0x0, 0x0, 0x0, 0x0, + 0x2, 0x10, 0x2, 0xff, + 0x1, 0x2, 0x3, 0x4, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 32, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + 0x0, /* ::/0 */ + }, + (4 + 32 + 1 + 5 + 9 + 1), + SHOULD_ERR, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-nhlen2", + "IPV6 MP Reach, invalid nexthop length", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 5, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, /* fffe:102:... */ + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + /* Nexthop (local) */ 0xfe, 0x80, 0x0, 0x0, /* fe80::210:2ff:.. */ + 0x0, 0x0, 0x0, 0x0, + 0x2, 0x10, 0x2, 0xff, + 0x1, 0x2, 0x3, 0x4, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 32, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + 0x0, /* ::/0 */ + }, + (4 + 32 + 1 + 5 + 9 + 1), + SHOULD_ERR, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-nhlen3", + "IPV6 MP Reach, nexthop length overflow", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 32, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, /* fffe:102:... */ + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + }, + (4 + 16), + SHOULD_ERR, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-nhlen4", + "IPV6 MP Reach, nexthop length short", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 16, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, /* fffe:102:... */ + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + /* Nexthop (local) */ 0xfe, 0x80, 0x0, 0x0, /* fe80::210:2ff:.. */ + 0x0, 0x0, 0x0, 0x0, + 0x2, 0x10, 0x2, 0xff, + 0x1, 0x2, 0x3, 0x4, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 32, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + 0x0, /* ::/0 */ + }, + (4 + 32 + 1 + 5 + 9 + 1), + SHOULD_ERR, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-nlri", + "IPV6 MP Reach, NLRI bitlen overflow", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* nexthop bytes */ 32, + /* Nexthop (global) */ 0xff, 0xfe, 0x1, 0x2, /* fffe:102:... */ + 0xaa, 0xbb, 0xcc, 0xdd, + 0x3, 0x4, 0x5, 0x6, + 0xa1, 0xa2, 0xa3, 0xa4, + /* Nexthop (local) */ 0xfe, 0x80, 0x0, 0x0, /* fe80::210:2ff:.. */ + 0x0, 0x0, 0x0, 0x0, + 0x2, 0x10, 0x2, 0xff, + 0x1, 0x2, 0x3, 0x4, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 120, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + 0, /* ::/0 */ + }, + (4 + 32 + 1 + 5 + 9 + 1), + SHOULD_ERR, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv4", + "IPv4 MP Reach, 2 NLRIs + default", + { + /* AFI / SAFI */ 0x0, AFI_IP, SAFI_UNICAST, + /* nexthop bytes */ 4, + /* Nexthop */ 192, 168, 0, 1, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */ + 17, 10, 2, 3, /* 10.2.3/17 */ + 0, /* 0/0 */ + }, + (4 + 4 + 1 + 3 + 4 + 1), + SHOULD_PARSE, + AFI_IP, SAFI_UNICAST, VALID_AFI, + }, + { "IPv4-nhlen", + "IPv4 MP Reach, nexthop lenth overflow", + { + /* AFI / SAFI */ 0x0, AFI_IP, SAFI_UNICAST, + /* nexthop bytes */ 32, + /* Nexthop */ 192, 168, 0, 1, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */ + 17, 10, 2, 3, /* 10.2.3/17 */ + 0, /* 0/0 */ + }, + (4 + 4 + 1 + 3 + 4 + 1), + SHOULD_ERR, + AFI_IP, SAFI_UNICAST, VALID_AFI, + }, + { "IPv4-nlrilen", + "IPv4 MP Reach, nlri lenth overflow", + { + /* AFI / SAFI */ 0x0, AFI_IP, SAFI_UNICAST, + /* nexthop bytes */ 4, + /* Nexthop */ 192, 168, 0, 1, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */ + 30, 10, + 0, /* 0/0 */ + }, + (4 + 4 + 1 + 3 + 2 + 1), + SHOULD_ERR, + AFI_IP, SAFI_UNICAST, VALID_AFI, + }, + { "IPv4-vpnv4", + "IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRIs", + { + /* AFI / SAFI */ 0x0, AFI_IP, BGP_SAFI_VPNV4, + /* nexthop bytes */ 12, + /* RD */ 0, 0, 1, 2, + 0, 0xff, 3, 4, + /* Nexthop */ 192, 168, 0, 1, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */ + 17, 10, 2, 3, /* 10.2.3/17 */ + 0, /* 0/0 */ + }, + (4 + 12 + 1 + 3 + 4 + 1), + SHOULD_PARSE, + AFI_IP, SAFI_UNICAST, VALID_AFI, + }, + /* From bug #385 */ + { "IPv6-bug", + "IPv6, global nexthop, 1 default NLRI", + { + /* AFI / SAFI */ 0x0, 0x2, 0x1, + /* nexthop bytes */ 0x20, + /* Nexthop (global) */ 0x20, 0x01, 0x04, 0x70, + 0x00, 0x01, 0x00, 0x06, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, + /* Nexthop (local) */ 0xfe, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x02, 0x0c, 0xdb, 0xff, + 0xfe, 0xfe, 0xeb, 0x00, + /* SNPA (defunct, MBZ) */ 0, + /* NLRI tuples */ /* Should have 0 here for ::/0, but dont */ + }, + 37, + SHOULD_ERR, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + + { NULL, NULL, {0}, 0, 0} +}; + +/* MP_UNREACH_NLRI tests */ +static struct test_segment mp_unreach_segments [] = +{ + { "IPv6-unreach", + "IPV6 MP Unreach, 1 NLRI", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* NLRI tuples */ 32, 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + }, + (3 + 5), + SHOULD_PARSE, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-unreach2", + "IPV6 MP Unreach, 2 NLRIs", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* NLRI tuples */ 32, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + }, + (3 + 5 + 9), + SHOULD_PARSE, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-unreach-default", + "IPV6 MP Unreach, 2 NLRIs + default", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* NLRI tuples */ 32, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + 0x0, /* ::/0 */ + }, + (3 + 5 + 9 + 1), + SHOULD_PARSE, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv6-unreach-nlri", + "IPV6 MP Unreach, NLRI bitlen overflow", + { + /* AFI / SAFI */ 0x0, AFI_IP6, SAFI_UNICAST, + /* NLRI tuples */ 120, + 0xff, 0xfe, 0x1, 0x2, /* fffe:102::/32 */ + 64, + 0xff, 0xfe, 0x0, 0x1, /* fffe:1:2:3::/64 */ + 0x0, 0x2, 0x0, 0x3, + 0, /* ::/0 */ + }, + (3 + 5 + 9 + 1), + SHOULD_ERR, + AFI_IP6, SAFI_UNICAST, VALID_AFI, + }, + { "IPv4-unreach", + "IPv4 MP Unreach, 2 NLRIs + default", + { + /* AFI / SAFI */ 0x0, AFI_IP, SAFI_UNICAST, + /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */ + 17, 10, 2, 3, /* 10.2.3/17 */ + 0, /* 0/0 */ + }, + (3 + 3 + 4 + 1), + SHOULD_PARSE, + AFI_IP, SAFI_UNICAST, VALID_AFI, + }, + { "IPv4-unreach-nlrilen", + "IPv4 MP Unreach, nlri length overflow", + { + /* AFI / SAFI */ 0x0, AFI_IP, SAFI_UNICAST, + /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */ + 30, 10, + 0, /* 0/0 */ + }, + (3 + 3 + 2 + 1), + SHOULD_ERR, + AFI_IP, SAFI_UNICAST, VALID_AFI, + }, + { "IPv4-unreach-vpnv4", + "IPv4/VPNv4 MP Unreach, RD, 3 NLRIs", + { + /* AFI / SAFI */ 0x0, AFI_IP, BGP_SAFI_VPNV4, + /* nexthop bytes */ 12, + /* RD */ 0, 0, 1, 2, + 0, 0xff, 3, 4, + /* Nexthop */ 192, 168, 0, 1, + /* SNPA (defunct, MBZ) */ 0x0, + /* NLRI tuples */ 16, 10, 1, /* 10.1/16 */ + 17, 10, 2, 3, /* 10.2.3/17 */ + 0, /* 0/0 */ + }, + (3 + 3 + 4 + 1), + SHOULD_PARSE, + AFI_IP, SAFI_UNICAST, VALID_AFI, + }, + { NULL, NULL, {0}, 0, 0} +}; + + +/* basic parsing test */ +static void +parse_test (struct peer *peer, struct test_segment *t, int type) +{ + int ret; + int oldfailed = failed; + struct attr attr; + struct bgp_nlri nlri; +#define RANDOM_FUZZ 35 + + stream_reset (peer->ibuf); + stream_put (peer->ibuf, NULL, RANDOM_FUZZ); + stream_set_getp (peer->ibuf, RANDOM_FUZZ); + + stream_write (peer->ibuf, t->data, t->len); + + printf ("%s: %s\n", t->name, t->desc); + + if (type == BGP_ATTR_MP_REACH_NLRI) + ret = bgp_mp_reach_parse (peer, t->len, &attr, &nlri); + else + ret = bgp_mp_unreach_parse (peer, t->len, &nlri); + + if (!ret) + { + safi_t safi = t->safi; + + if (bgp_afi_safi_valid_indices (t->afi, &safi) != t->afi_valid) + failed++; + + printf ("MP: %u/%u (%u): recv %u, nego %u\n", + t->afi, t->safi, safi, + peer->afc_recv[t->afi][safi], + peer->afc_nego[t->afi][safi]); + } + + printf ("parsed?: %s\n", ret ? "no" : "yes"); + + if (ret != t->parses) + failed++; + + if (tty) + printf ("%s", (failed > oldfailed) ? VT100_RED "failed!" VT100_RESET + : VT100_GREEN "OK" VT100_RESET); + else + printf ("%s", (failed > oldfailed) ? "failed!" : "OK" ); + + if (failed) + printf (" (%u)", failed); + + printf ("\n\n"); +} + +static struct bgp *bgp; +static as_t asn = 100; + +int +main (void) +{ + struct peer *peer; + int i, j; + + conf_bgp_debug_fsm = -1UL; + conf_bgp_debug_events = -1UL; + conf_bgp_debug_packet = -1UL; + conf_bgp_debug_normal = -1UL; + conf_bgp_debug_as4 = -1UL; + term_bgp_debug_fsm = -1UL; + term_bgp_debug_events = -1UL; + term_bgp_debug_packet = -1UL; + term_bgp_debug_normal = -1UL; + term_bgp_debug_as4 = -1UL; + + master = thread_master_create (); + bgp_master_init (); + + if (fileno (stdout) >= 0) + tty = isatty (fileno (stdout)); + + if (bgp_get (&bgp, &asn, NULL)) + return -1; + + peer = peer_create_accept (bgp); + peer->host = "foo"; + + for (i = AFI_IP; i < AFI_MAX; i++) + for (j = SAFI_UNICAST; j < SAFI_MAX; j++) + { + peer->afc[i][j] = 1; + peer->afc_adv[i][j] = 1; + } + + i = 0; + while (mp_reach_segments[i].name) + parse_test (peer, &mp_reach_segments[i++], BGP_ATTR_MP_REACH_NLRI); + + i = 0; + while (mp_unreach_segments[i].name) + parse_test (peer, &mp_unreach_segments[i++], BGP_ATTR_MP_UNREACH_NLRI); + + printf ("failures: %d\n", failed); + return failed; +} diff --git a/tests/heavy-thread.c b/tests/heavy-thread.c index 80f73cee..cd3a3b9d 100644 --- a/tests/heavy-thread.c +++ b/tests/heavy-thread.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: heavy-thread.c,v 1.2 2005/04/25 16:42:24 paul Exp $ * * This file is part of Quagga. * diff --git a/tests/heavy-wq.c b/tests/heavy-wq.c index a2c609d4..543b9dbb 100644 --- a/tests/heavy-wq.c +++ b/tests/heavy-wq.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: heavy-wq.c,v 1.4 2006/08/27 06:53:24 paul Exp $ * * This file is part of Quagga. * diff --git a/tests/heavy.c b/tests/heavy.c index d9bde8e2..577a4816 100644 --- a/tests/heavy.c +++ b/tests/heavy.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: heavy.c,v 1.3 2005/04/25 16:42:24 paul Exp $ * * This file is part of Quagga. * diff --git a/tests/main.c b/tests/main.c index 19e00082..edc3b2de 100644 --- a/tests/main.c +++ b/tests/main.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: main.c,v 1.1 2005/04/25 16:42:24 paul Exp $ * * This file is part of Quagga. * diff --git a/tests/test-privs.c b/tests/test-privs.c index c0e0d821..a888ea0f 100644 --- a/tests/test-privs.c +++ b/tests/test-privs.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: test-privs.c,v 1.1 2005/10/11 03:48:28 paul Exp $ * * This file is part of Quagga. * diff --git a/tools/multiple-bgpd.sh b/tools/multiple-bgpd.sh index 40977544..028ad696 100644 --- a/tools/multiple-bgpd.sh +++ b/tools/multiple-bgpd.sh @@ -6,19 +6,24 @@ NUM=5 VTYBASE=2610 ASBASE=64560 BGPD=/path/to/bgpd -PREFIX=192.168.145 +PREFIX=192.168.145. +#PREFIX=3ffe:123:456:: +ADDRPLEN=32 +CONFBASE=/tmp +PIDBASE=/var/run/quagga +CHOWNSTR=quagga:quagga for H in `seq 1 ${NUM}` ; do - CONF=/etc/quagga/bgpd${H}.conf - ADDR=${PREFIX}.${H} + CONF="${CONFBASE}"/bgpd${H}.conf + ADDR=${PREFIX}${H} if [ ! -e "$CONF" ] ; then # This sets up a ring of bgpd peerings NEXT=$(( ($H % ${NUM}) + 1 )) PREV=$(( (($H + 3) % ${NUM}) + 1 )) - NEXTADDR="${PREFIX}.${NEXT}" + NEXTADDR="${PREFIX}${NEXT}" NEXTAS=$((${ASBASE} + $NEXT)) - PREVADDR="${PREFIX}.${PREV}" + PREVADDR="${PREFIX}${PREV}" PREVAS=$((${ASBASE} + $PREV)) # Edit config to suit. @@ -39,17 +44,33 @@ for H in `seq 1 ${NUM}` ; do neighbor ${NEXTADDR} peer-group default neighbor ${PREVADDR} remote-as ${PREVAS} neighbor ${PREVADDR} peer-group default + ! + address-family ipv6 + network 3ffe:${H}::/48 + network 3ffe:${H}:1::/48 pathlimit 1 + network 3ffe:${H}:2::/48 pathlimit 3 + network 3ffe:${H}:3::/48 pathlimit 3 + neighbor default activate + neighbor default capability orf prefix-list both + neighbor default default-originate + neighbor ${NEXTADDR} peer-group default + neighbor ${PREVADDR} peer-group default + exit-address-family + ! + line vty + ! + end EOF - chown quagga:quagga "$CONF" + chown ${CHOWNSTR} "$CONF" fi # You may want to automatically add configure a local address # on a loop interface. # - # Solaris: ifconfig vni${H} plumb ${ADDR}/32 up - # Linux: ip address add ${ADDR}/32 dev lo 2> /dev/null - ${BGPD} -i /var/run/quagga/bgpd${H}.pid \ + # Solaris: ifconfig vni${H} plumb ${ADDR}/${ADDRPLEN} up + # Linux: ip address add ${ADDR}/${ADDRPLEN} dev lo 2> /dev/null + ${BGPD} -i "${PIDBASE}"/bgpd${H}.pid \ -l ${ADDR} \ - -f /etc/quagga/bgpd${H}.conf \ + -f "${CONF}" \ -P $((${VTYBASE}+${H})) \ -d done diff --git a/vtysh/ChangeLog b/vtysh/ChangeLog index de62763c..af55c6f2 100644 --- a/vtysh/ChangeLog +++ b/vtysh/ChangeLog @@ -1,3 +1,13 @@ +2008-07-03 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp> + + * extract.pl.in: Fix as-range to match CPP output. + * vtysh.c: Add missing router_bgp_view_cmd alias. + +2008-07-02 MIYAJIMA Mitsuharu <miyajima.mitsuharu@anchor.jp> + + * CMD_AS_RANGE was being used inside command strings, and thus + not being expanded, fix by dequoting. + 2007-06-20 Nicolas Deffayet <nicolas@deffayet.com> * vtysh.c: (vtysh_write_terminal) Write 'end' when done, diff --git a/vtysh/extract.pl.in b/vtysh/extract.pl.in index 789819c6..0b9ee516 100755 --- a/vtysh/extract.pl.in +++ b/vtysh/extract.pl.in @@ -37,8 +37,8 @@ $ignore{'"router ripng"'} = "ignore"; $ignore{'"router ospf"'} = "ignore"; $ignore{'"router ospf <0-65535>"'} = "ignore"; $ignore{'"router ospf6"'} = "ignore"; -$ignore{'"router bgp CMD_AS_RANGE"'} = "ignore"; -$ignore{'"router bgp CMD_AS_RANGE view WORD"'} = "ignore"; +$ignore{'"router bgp " "<1-4294967295>"'} = "ignore"; +$ignore{'"router bgp " "<1-4294967295>" " view WORD"'} = "ignore"; $ignore{'"router isis WORD"'} = "ignore"; $ignore{'"router zebra"'} = "ignore"; $ignore{'"address-family ipv4"'} = "ignore"; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 1218ad39..e2ac9ab7 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -34,6 +34,7 @@ #include "memory.h" #include "vtysh/vtysh.h" #include "log.h" +#include "bgpd/bgp_vty.h" /* Struct VTY. */ struct vty *vty; @@ -840,7 +841,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_BGPD, router_bgp, router_bgp_cmd, - "router bgp CMD_AS_RANGE", + "router bgp " CMD_AS_RANGE, ROUTER_STR BGP_STR AS_STR) @@ -849,6 +850,16 @@ DEFUNSH (VTYSH_BGPD, return CMD_SUCCESS; } +ALIAS_SH (VTYSH_BGPD, + router_bgp, + router_bgp_view_cmd, + "router bgp " CMD_AS_RANGE " view WORD", + ROUTER_STR + BGP_STR + AS_STR + "BGP view\n" + "view name\n") + DEFUNSH (VTYSH_BGPD, address_family_vpnv4, address_family_vpnv4_cmd, @@ -2343,6 +2354,7 @@ vtysh_init_vty (void) #endif install_element (CONFIG_NODE, &router_isis_cmd); install_element (CONFIG_NODE, &router_bgp_cmd); + install_element (CONFIG_NODE, &router_bgp_view_cmd); install_element (BGP_NODE, &address_family_vpnv4_cmd); install_element (BGP_NODE, &address_family_vpnv4_unicast_cmd); install_element (BGP_NODE, &address_family_ipv4_unicast_cmd); diff --git a/watchquagga/watchquagga.c b/watchquagga/watchquagga.c index f4c483cf..90cff00f 100644 --- a/watchquagga/watchquagga.c +++ b/watchquagga/watchquagga.c @@ -1,5 +1,5 @@ /* - $Id$ + $Id: watchquagga.c,v 1.12 2007/05/10 02:38:52 paul Exp $ Monitor status of quagga daemons and restart if necessary. diff --git a/zebra/ChangeLog b/zebra/ChangeLog index d9cae283..341c42a4 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,33 @@ +2008-07-01 Paul Jakma <paul.jakma@sun.com> + + * ioctl.c: (if_get_flags) Deal more gracefully with failure + of the BSD link-state SIOCGIFMEDIA ioctl, as some interfaces + apparently don't implement it (e.g. tun). + Also, make BSD link-state checking be conditional on the + 'link-detect' interface configuration flag, as it should be. + Fixes bug #465. + +2008-06-02 Denis Ovsienko + + * connected.c: (connected_up_ipv4, connected_down_ipv4, + connected_up_ipv6, connected_down_ipv6): don't call + work_queue_aim_head() + * rib.h: adjust RIB_ROUTE_QUEUED macro for meta_queue, + declare meta_queue structure + * zebra_rib.c: (process_subq, meta_queue_process, rib_meta_queue_add, + meta_queue_new) new functions; (rib_queue_add) don't try checking + RIB_QUEUE_ADDED flag, rib_meta_queue_add() does it better, take care + of the meta queue instead; (rib_queue_init) initialize the meta queue + as well; (rib_lookup_and_pushup) don't call work_queue_aim_head(); + (rib_process) only do actual processing, don't do deallocation; + * zserv.h: include meta_queue field into zebra_t structure + +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-26 Denis Ovsienko * zebra_rib.[ch]: (rib_lookup_and_pushup) New function, which makes sure, that if_set_prefix() has nothing in its way of assigning an address. diff --git a/zebra/client_main.c b/zebra/client_main.c index e59b09d0..c319aac7 100644 --- a/zebra/client_main.c +++ b/zebra/client_main.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: client_main.c,v 1.1 2002/12/13 20:15:30 paul Exp $ * * GNU Zebra client test main routine. * Copyright (C) 1997 Kunihiro Ishiguro diff --git a/zebra/connected.c b/zebra/connected.c index ca22a011..f3e5396c 100644 --- a/zebra/connected.c +++ b/zebra/connected.c @@ -188,15 +188,8 @@ connected_up_ipv4 (struct interface *ifp, struct connected *ifc) if (prefix_ipv4_any (&p)) return; - /* Always push arriving/departing connected routes into the head of - * the working queue to make possible proper validation of the rest - * of the RIB queue (which will contain the whole RIB after the first - * call to rib_update()). - */ - work_queue_aim_head (zebrad.ribq, 1); rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, NULL, ifp->ifindex, RT_TABLE_MAIN, ifp->metric, 0); - work_queue_aim_head (zebrad.ribq, 0); rib_update (); } @@ -302,9 +295,7 @@ connected_down_ipv4 (struct interface *ifp, struct connected *ifc) return; /* Same logic as for connected_up_ipv4(): push the changes into the head. */ - work_queue_aim_head (zebrad.ribq, 1); rib_delete_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0); - work_queue_aim_head (zebrad.ribq, 0); rib_update (); } @@ -349,10 +340,8 @@ connected_up_ipv6 (struct interface *ifp, struct connected *ifc) return; #endif - work_queue_aim_head (zebrad.ribq, 1); rib_add_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, ifp->metric, 0); - work_queue_aim_head (zebrad.ribq, 0); rib_update (); } @@ -426,9 +415,7 @@ connected_down_ipv6 (struct interface *ifp, struct connected *ifc) if (IN6_IS_ADDR_UNSPECIFIED (&p.prefix)) return; - work_queue_aim_head (zebrad.ribq, 1); rib_delete_ipv6 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0); - work_queue_aim_head (zebrad.ribq, 0); rib_update (); } diff --git a/zebra/ioctl.c b/zebra/ioctl.c index d536771a..5cf9e7b0 100644 --- a/zebra/ioctl.c +++ b/zebra/ioctl.c @@ -362,22 +362,29 @@ if_get_flags (struct interface *ifp) return; } #ifdef HAVE_BSD_LINK_DETECT /* Detect BSD link-state at start-up */ - (void) memset(&ifmr, 0, sizeof(ifmr)); - strncpy (&ifmr.ifm_name, ifp->name, IFNAMSIZ); - if (if_ioctl(SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) - { - zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s", safe_strerror(errno)); - return; - } - if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */ + + /* Per-default, IFF_RUNNING is held high, unless link-detect says + * otherwise - we abuse IFF_RUNNING inside zebra as a link-state flag, + * following practice on Linux and Solaris kernels + */ + SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); + + if (CHECK_FLAG (ifp->status, ZEBRA_INTERFACE_LINKDETECTION)) { - if (ifmr.ifm_status & IFM_ACTIVE) - SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); - else - UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING); - } - else /* Force always up */ - SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); + (void) memset(&ifmr, 0, sizeof(ifmr)); + strncpy (&ifmr.ifm_name, ifp->name, IFNAMSIZ); + + /* Seems not all interfaces implement this ioctl */ + if (if_ioctl(SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) + zlog_err("if_ioctl(SIOCGIFMEDIA) failed: %s", safe_strerror(errno)); + else if (ifmr.ifm_status & IFM_AVALID) /* Link state is valid */ + { + if (ifmr.ifm_status & IFM_ACTIVE) + SET_FLAG(ifreq.ifr_flags, IFF_RUNNING); + else + UNSET_FLAG(ifreq.ifr_flags, IFF_RUNNING); + } + } #endif /* HAVE_BSD_LINK_DETECT */ if_flags_update (ifp, (ifreq.ifr_flags & 0x0000ffff)); diff --git a/zebra/main.c b/zebra/main.c index 6019260f..61750f1d 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -275,7 +275,8 @@ main (int argc, char **argv) break; } vty_port = atoi (optarg); - vty_port = (vty_port ? vty_port : ZEBRA_VTY_PORT); + if (vty_port <= 0 || vty_port > 0xffff) + vty_port = ZEBRA_VTY_PORT; break; case 'r': retain_mode = 1; diff --git a/zebra/rib.h b/zebra/rib.h index f3572ffa..0d6ab815 100644 --- a/zebra/rib.h +++ b/zebra/rib.h @@ -83,6 +83,20 @@ struct rib u_char nexthop_fib_num; }; +/* meta-queue structure: + * sub-queue 0: connected, kernel + * sub-queue 1: static + * sub-queue 2: RIP, RIPng, OSPF, OSPF6, IS-IS + * sub-queue 3: iBGP, eBGP + * sub-queue 4: any other origin (if any) + */ +#define MQ_SIZE 5 +struct meta_queue +{ + struct list *subq[MQ_SIZE]; + u_int32_t size; /* sum of lengths of all subqueues */ +}; + /* Static route information. */ struct static_ipv4 { diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index 2621a922..3e8048ba 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -1876,7 +1876,7 @@ static void netlink_install_filter (int sock, __u32 pid) .filter = filter, }; - if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &prog, sizeof(prog)) < 0) + if (setsockopt(sock, SOL_SOCKET, SO_ATTACH_FILTER, &prog, sizeof(prog)) < 0) zlog_warn ("Can't install socket filter: %s\n", safe_strerror(errno)); } diff --git a/zebra/zebra.conf.sample b/zebra/zebra.conf.sample index cf135281..a5d0732f 100644 --- a/zebra/zebra.conf.sample +++ b/zebra/zebra.conf.sample @@ -2,7 +2,7 @@ ! ! zebra sample configuration file ! -! $Id$ +! $Id: zebra.conf.sample,v 1.1 2002/12/13 20:15:30 paul Exp $ ! hostname Router password zebra diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index a511577b..545481d1 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1085,15 +1085,14 @@ rib_uninstall (struct route_node *rn, struct rib *rib) static void rib_unlink (struct route_node *, struct rib *); /* Core function for processing routing information base. */ -static wq_item_status -rib_process (struct work_queue *wq, void *data) +static void +rib_process (struct route_node *rn) { struct rib *rib; struct rib *next; struct rib *fib = NULL; struct rib *select = NULL; struct rib *del = NULL; - struct route_node *rn = data; int installed = 0; struct nexthop *nexthop = NULL; char buf[INET6_ADDRSTRLEN]; @@ -1281,10 +1280,95 @@ rib_process (struct work_queue *wq, void *data) end: if (IS_ZEBRA_DEBUG_RIB_Q) zlog_debug ("%s: %s/%d: rn %p dequeued", __func__, buf, rn->p.prefixlen, rn); - if (rn->info) - UNSET_FLAG (((struct rib *)rn->info)->rn_status, RIB_ROUTE_QUEUED); - route_unlock_node (rn); /* rib queue lock */ - return WQ_SUCCESS; +} + +/* Take a list of route_node structs and return 1, if there was a record picked from + * it and processed by rib_process(). Don't process more, than one RN record; operate + * only in the specified sub-queue. + */ +unsigned int +process_subq (struct list * subq, u_char qindex) +{ + struct listnode *lnode; + struct route_node *rnode; + if (!(lnode = listhead (subq))) + return 0; + rnode = listgetdata (lnode); + rib_process (rnode); + if (rnode->info) /* The first RIB record is holding the flags bitmask. */ + UNSET_FLAG (((struct rib *)rnode->info)->rn_status, RIB_ROUTE_QUEUED(qindex)); + route_unlock_node (rnode); + list_delete_node (subq, lnode); + return 1; +} + +/* Dispatch the meta queue by picking, processing and unlocking the next RN from + * a non-empty sub-queue with lowest priority. wq is equal to zebra->ribq and data + * is pointed to the meta queue structure. + */ +static wq_item_status +meta_queue_process (struct work_queue *dummy, void *data) +{ + struct meta_queue * mq = data; + u_char i; + for (i = 0; i < MQ_SIZE; i++) + if (process_subq (mq->subq[i], i)) + { + mq->size--; + break; + } + return mq->size ? WQ_REQUEUE : WQ_SUCCESS; +} + +/* Look into the RN and queue it into one or more priority queues, increasing the size + * for each data push done. + */ +void rib_meta_queue_add (struct meta_queue *mq, struct route_node *rn) +{ + u_char qindex; + struct rib *rib; + char buf[INET6_ADDRSTRLEN]; + if (IS_ZEBRA_DEBUG_RIB_Q) + inet_ntop (rn->p.family, &rn->p.u.prefix, buf, INET6_ADDRSTRLEN); + for (rib = rn->info; rib; rib = rib->next) + { + switch (rib->type) + { + case ZEBRA_ROUTE_KERNEL: + case ZEBRA_ROUTE_CONNECT: + qindex = 0; + break; + case ZEBRA_ROUTE_STATIC: + qindex = 1; + break; + case ZEBRA_ROUTE_RIP: + case ZEBRA_ROUTE_RIPNG: + case ZEBRA_ROUTE_OSPF: + case ZEBRA_ROUTE_OSPF6: + case ZEBRA_ROUTE_ISIS: + qindex = 2; + break; + case ZEBRA_ROUTE_BGP: + qindex = 3; + break; + default: + qindex = 4; + break; + } + /* Invariant: at this point we always have rn->info set. */ + if (CHECK_FLAG (((struct rib *)rn->info)->rn_status, RIB_ROUTE_QUEUED(qindex))) + { + if (IS_ZEBRA_DEBUG_RIB_Q) + zlog_debug ("%s: %s/%d: rn %p is already queued in sub-queue %u", __func__, buf, rn->p.prefixlen, rn, qindex); + continue; + } + SET_FLAG (((struct rib *)rn->info)->rn_status, RIB_ROUTE_QUEUED(qindex)); + listnode_add (mq->subq[qindex], rn); + route_lock_node (rn); + mq->size++; + if (IS_ZEBRA_DEBUG_RIB_Q) + zlog_debug ("%s: %s/%d: queued rn %p into sub-queue %u", __func__, buf, rn->p.prefixlen, rn, qindex); + } } /* Add route_node to work queue and schedule processing */ @@ -1306,17 +1390,6 @@ rib_queue_add (struct zebra_t *zebra, struct route_node *rn) return; } - /* Route-table node already queued, so nothing to do */ - if (CHECK_FLAG (((struct rib *)rn->info)->rn_status, RIB_ROUTE_QUEUED)) - { - if (IS_ZEBRA_DEBUG_RIB_Q) - zlog_debug ("%s: %s/%d: rn %p already queued", __func__, buf, - rn->p.prefixlen, rn); - return; - } - - route_lock_node (rn); /* rib queue lock */ - if (IS_ZEBRA_DEBUG_RIB_Q) zlog_info ("%s: %s/%d: work queue added", __func__, buf, rn->p.prefixlen); @@ -1325,13 +1398,21 @@ rib_queue_add (struct zebra_t *zebra, struct route_node *rn) if (zebra->ribq == NULL) { zlog_err ("%s: work_queue does not exist!", __func__); - route_unlock_node (rn); return; } - - work_queue_add (zebra->ribq, rn); - SET_FLAG (((struct rib *)rn->info)->rn_status, RIB_ROUTE_QUEUED); + /* The RIB queue should normally be either empty or holding the only work_queue_item + * element. In the latter case this element would hold a pointer to the meta queue + * structure, which must be used to actually queue the route nodes to process. So + * create the MQ holder, if necessary, then push the work into it in any case. + * This semantics was introduced after 0.99.9 release. + */ + + /* Should I invent work_queue_empty() and use it, or it's Ok to do as follows? */ + if (!zebra->ribq->items->count) + work_queue_add (zebra->ribq, zebra->mq); + + rib_meta_queue_add (zebra->mq, rn); if (IS_ZEBRA_DEBUG_RIB_Q) zlog_debug ("%s: %s/%d: rn %p queued", __func__, buf, rn->p.prefixlen, rn); @@ -1339,6 +1420,30 @@ rib_queue_add (struct zebra_t *zebra, struct route_node *rn) return; } +/* Create new meta queue. A destructor function doesn't seem to be necessary here. */ +struct meta_queue * +meta_queue_new () +{ + struct meta_queue *new; + unsigned i, failed = 0; + + if ((new = XCALLOC (MTYPE_WORK_QUEUE, sizeof (struct meta_queue))) == NULL) + return NULL; + for (i = 0; i < MQ_SIZE; i++) + if ((new->subq[i] = list_new ()) == NULL) + failed = 1; + if (failed) + { + for (i = 0; i < MQ_SIZE; i++) + if (new->subq[i]) + list_delete (new->subq[i]); + XFREE (MTYPE_WORK_QUEUE, new); + return NULL; + } + new->size = 0; + return new; +} + /* initialise zebra rib work queue */ static void rib_queue_init (struct zebra_t *zebra) @@ -1353,12 +1458,17 @@ rib_queue_init (struct zebra_t *zebra) } /* fill in the work queue spec */ - zebra->ribq->spec.workfunc = &rib_process; + zebra->ribq->spec.workfunc = &meta_queue_process; zebra->ribq->spec.errorfunc = NULL; /* XXX: TODO: These should be runtime configurable via vty */ zebra->ribq->spec.max_retries = 3; zebra->ribq->spec.hold = rib_process_hold_time; + if (!(zebra->mq = meta_queue_new ())) + { + zlog_err ("%s: could not initialise meta queue!", __func__); + return; + } return; } @@ -1767,11 +1877,7 @@ void rib_lookup_and_pushup (struct prefix_ipv4 * p) } } if (changed) - { - work_queue_aim_head (zebrad.ribq, 1); rib_queue_add (&zebrad, rn); - work_queue_aim_head (zebrad.ribq, 0); - } } int diff --git a/zebra/zserv.h b/zebra/zserv.h index 5e223776..87a33a45 100644 --- a/zebra/zserv.h +++ b/zebra/zserv.h @@ -80,6 +80,7 @@ struct zebra_t /* rib work queue */ struct work_queue *ribq; + struct meta_queue *mq; }; /* Count prefix size from mask length */ |