]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
15 years ago[bgpd] Stability fixes including bugs 397, 492
Chris Caputo [Sat, 18 Jul 2009 05:44:03 +0000 (05:44 +0000)]
[bgpd] Stability fixes including bugs 397, 492

I've spent the last several weeks working on stability fixes to bgpd.
These patches fix all of the numerous crashes, assertion failures, memory
leaks and memory stomping I could find.  Valgrind was used extensively.

Added new function bgp_exit() to help catch problems.  If "debug bgp" is
configured and bgpd exits with status of 0, statistics on remaining
lib/memory.c allocations are printed to stderr.  It is my hope that other
developers will use this to stay on top of memory issues.

Example questionable exit:

  bgpd: memstats: Current memory utilization in module LIB:
  bgpd: memstats:  Link List                     :          6
  bgpd: memstats:  Link Node                     :          5
  bgpd: memstats:  Hash                          :          8
  bgpd: memstats:  Hash Bucket                   :          2
  bgpd: memstats:  Hash Index                    :          8
  bgpd: memstats:  Work queue                    :          3
  bgpd: memstats:  Work queue item               :          2
  bgpd: memstats:  Work queue name string        :          3
  bgpd: memstats: Current memory utilization in module BGP:
  bgpd: memstats:  BGP instance                  :          1
  bgpd: memstats:  BGP peer                      :          1
  bgpd: memstats:  BGP peer hostname             :          1
  bgpd: memstats:  BGP attribute                 :          1
  bgpd: memstats:  BGP extra attributes          :          1
  bgpd: memstats:  BGP aspath                    :          1
  bgpd: memstats:  BGP aspath str                :          1
  bgpd: memstats:  BGP table                     :         24
  bgpd: memstats:  BGP node                      :          1
  bgpd: memstats:  BGP route                     :          1
  bgpd: memstats:  BGP synchronise               :          8
  bgpd: memstats:  BGP Process queue             :          1
  bgpd: memstats:  BGP node clear queue          :          1
  bgpd: memstats: NOTE: If configuration exists, utilization may be expected.

Example clean exit:

  bgpd: memstats: No remaining tracked memory utilization.

This patch fixes bug #397: "Invalid free in bgp_announce_check()".

This patch fixes bug #492: "SIGBUS in bgpd/bgp_route.c:
bgp_clear_route_node()".

My apologies for not separating out these changes into individual patches.
The complexity of doing so boggled what is left of my brain.  I hope this
is all still useful to the community.

This code has been production tested, in non-route-server-client mode, on
a linux 32-bit box and a 64-bit box.

Release/reset functions, used by bgp_exit(), added to:

  bgpd/bgp_attr.c,h
  bgpd/bgp_community.c,h
  bgpd/bgp_dump.c,h
  bgpd/bgp_ecommunity.c,h
  bgpd/bgp_filter.c,h
  bgpd/bgp_nexthop.c,h
  bgpd/bgp_route.c,h
  lib/routemap.c,h

File by file analysis:

* bgpd/bgp_aspath.c: Prevent re-use of ashash after it is released.

* bgpd/bgp_attr.c: #if removed uncalled cluster_dup().

* bgpd/bgp_clist.c,h: Allow community_list_terminate() to be called from
  bgp_exit().

* bgpd/bgp_filter.c: Fix aslist->name use without allocation check, and
  also fix memory leak.

* bgpd/bgp_main.c: Created bgp_exit() exit routine.  This function frees
  allocations made as part of bgpd initialization and, to some extent,
  configuration.  If "debug bgp" is configured, memory stats are printed
  as described above.

* bgpd/bgp_nexthop.c: zclient_new() already allocates stream for
  ibuf/obuf, so bgp_scan_init() shouldn't do it too.  Also, made it so
  zlookup is global so bgp_exit() can use it.

* bgpd/bgp_packet.c: bgp_capability_msg_parse() call to bgp_clear_route()
  adjusted to use new BGP_CLEAR_ROUTE_NORMAL flag.

* bgpd/bgp_route.h: Correct reference counter "lock" to be signed.
  bgp_clear_route() now accepts a bgp_clear_route_type of either
  BGP_CLEAR_ROUTE_NORMAL or BGP_CLEAR_ROUTE_MY_RSCLIENT.

* bgpd/bgp_route.c:
  - bgp_process_rsclient(): attr was being zero'ed and then
    bgp_attr_extra_free() was being called with it, even though it was
    never filled with valid data.

  - bgp_process_rsclient(): Make sure rsclient->group is not NULL before
    use.

  - bgp_processq_del(): Add call to bgp_table_unlock().

  - bgp_process(): Add call to bgp_table_lock().

  - bgp_update_rsclient(): memset clearing of new_attr not needed since
    declarationw with "= { 0 }" does it.  memset was already commented
    out.

  - bgp_update_rsclient(): Fix screwed up misleading indentation.

  - bgp_withdraw_rsclient(): Fix screwed up misleading indentation.

  - bgp_clear_route_node(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT.

  - bgp_clear_node_queue_del(): Add call to bgp_table_unlock() and also
    free struct bgp_clear_node_queue used for work item.

  - bgp_clear_node_complete(): Do peer_unlock() after BGP_EVENT_ADD() in
    case peer is released by peer_unlock() call.

  - bgp_clear_route_table(): Support BGP_CLEAR_ROUTE_MY_RSCLIENT.  Use
    struct bgp_clear_node_queue to supply data to worker.  Add call to
    bgp_table_lock().

  - bgp_clear_route(): Add support for BGP_CLEAR_ROUTE_NORMAL or
    BGP_CLEAR_ROUTE_MY_RSCLIENT.

  - bgp_clear_route_all(): Use BGP_CLEAR_ROUTE_NORMAL.

  Bug 397 fixes:

    - bgp_default_originate()
    - bgp_announce_table()

* bgpd/bgp_table.h:
  - struct bgp_table: Added reference count.  Changed type of owner to be
    "struct peer *" rather than "void *".

  - struct bgp_node: Correct reference counter "lock" to be signed.

* bgpd/bgp_table.c:
  - Added bgp_table reference counting.

  - bgp_table_free(): Fixed cleanup code.  Call peer_unlock() on owner if
    set.

  - bgp_unlock_node(): Added assertion.

  - bgp_node_get(): Added call to bgp_lock_node() to code path that it was
    missing from.

* bgpd/bgp_vty.c:
  - peer_rsclient_set_vty(): Call peer_lock() as part of peer assignment
    to owner.  Handle failure gracefully.

  - peer_rsclient_unset_vty(): Add call to bgp_clear_route() with
    BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.

* bgpd/bgp_zebra.c: Made it so zclient is global so bgp_exit() can use it.

* bgpd/bgpd.c:
  - peer_lock(): Allow to be called when status is "Deleted".

  - peer_deactivate(): Supply BGP_CLEAR_ROUTE_NORMAL purpose to
    bgp_clear_route() call.

  - peer_delete(): Common variable listnode pn.  Fix bug in which rsclient
    was only dealt with if not part of a peer group.  Call
    bgp_clear_route() for rsclient, if appropriate, and do so with
    BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.

  - peer_group_get(): Use XSTRDUP() instead of strdup() for conf->host.

  - peer_group_bind(): Call bgp_clear_route() for rsclient, and do so with
    BGP_CLEAR_ROUTE_MY_RSCLIENT purpose.

  - bgp_create(): Use XSTRDUP() instead of strdup() for peer_self->host.

  - bgp_delete(): Delete peers before groups, rather than after.  And then
    rather than deleting rsclients, verify that there are none at this
    point.

  - bgp_unlock(): Add assertion.

  - bgp_free(): Call bgp_table_finish() rather than doing XFREE() itself.

* lib/command.c,h: Compiler warning fixes.  Add cmd_terminate().  Fixed
  massive leak in install_element() in which cmd_make_descvec() was being
  called more than once for the same cmd->strvec/string/doc.

* lib/log.c: Make closezlog() check fp before calling fclose().

* lib/memory.c: Catch when alloc count goes negative by using signed
  counts.  Correct #endif comment.  Add log_memstats_stderr().

* lib/memory.h: Add log_memstats_stderr().

* lib/thread.c: thread->funcname was being accessed in thread_call() after
  it had been freed.  Rearranged things so that thread_call() frees
  funcname.  Also made it so thread_master_free() cleans up cpu_record.

* lib/vty.c,h: Use global command_cr.  Add vty_terminate().

* lib/zclient.c,h: Re-enable zclient_free().

15 years ago[bgpd] Fix compiler warnings related to MD5
Chris Caputo [Sat, 18 Jul 2009 05:42:34 +0000 (05:42 +0000)]
[bgpd] Fix compiler warnings related to MD5

This patch fixes:

bgp_network.c: In function 'bgp_md5_set':
bgp_network.c:107: warning: cast from pointer to integer of different size
bgp_network.c: In function 'bgp_socket':
bgp_network.c:447: warning: cast to pointer from integer of different size

15 years ago[build] fix default CFLAGS and squish warning
Paul Jakma [Sun, 19 Jul 2009 16:33:21 +0000 (17:33 +0100)]
[build] fix default CFLAGS and squish warning

* configure.ac: Move down the AC_SYS_LARGEFILE test - it was setting CFLAGS
  and so disabling the default CFLAGS setting section.
  Squish warning by adding AC_CONFIG_MACRO_DIR on the reccommendation of
  autoreconf.

15 years ago[bgpd] Bug #533: Fix crash with copy/pasted commands, inc 'no bgp ...'
Paul Jakma [Thu, 16 Jul 2009 18:27:32 +0000 (19:27 +0100)]
[bgpd] Bug #533: Fix crash with copy/pasted commands, inc 'no bgp ...'

* bgpd.c: Removal of (struct bgp *) from the master list was being left to
  bgp_free time.  This meant there was a window of time between bgp_delete
  and refcounts hitting 0 (e.g.  routes to be processed) where bgp_lookup's
  could return a deleted (struct bgp *).

  (bgp_delete) This is the logical place where a (struct bgp *) should lose
  its visibility, so move the deletion from the bgp-master list to here,
  from bgp_free.

  Many thanks to Fritz Reichmann for his thorough debugging of the problem
  and testing of fixes and Chris Caputo for his further analysis.

15 years ago[lib] Fix IPv6 normalisation
Stephen Hemminger [Sun, 12 Jul 2009 04:27:51 +0000 (21:27 -0700)]
[lib] Fix IPv6 normalisation

* lib/sockunion.c: (sockunion_normalise_mapped) The code to normalize
  address was not copying port value - probably reason why IPV4 in IPV6
  never worked right.

15 years ago[ospf6d] Fix regression in monotonic time patch - LSA max-aging broke
Tom Henderson [Thu, 16 Jul 2009 16:20:37 +0000 (17:20 +0100)]
[ospf6d] Fix regression in monotonic time patch - LSA max-aging broke

* ospf6_lsa.c: (ospf6_lsa_premature_aging) set age to MAX_AGE - don't
  rely on 0 magically meaning same.
  (ospf6_lsa_age_current) handle MAXAGE.

15 years ago[lib/cleanup] Use a typedef for the thread type
Paul Jakma [Tue, 30 Jun 2009 15:12:49 +0000 (16:12 +0100)]
[lib/cleanup] Use a typedef for the thread type

* lib/thread.{c,h}: As per subject. This will avoid head-scratching for next
  person who adds a thread-type and gets strange breakage.

15 years ago[ospfd] Do not use stale Network/Router LSAs
Joakim Tjernlund [Mon, 5 Jan 2009 16:44:46 +0000 (17:44 +0100)]
[ospfd] Do not use stale Network/Router LSAs

Should a self originated Network/Router LSA with higher
LS seq. nr. be received we should flood and install it in
the LSDB but we cannot use it for our internal calculations
as it is stale.
Reorginate an new LSA to replace the stale one as soon
as possible.

15 years ago[bgpd] Log a debug/update warning if filters are configured but don't exist
Paul Jakma [Thu, 25 Jun 2009 17:06:31 +0000 (18:06 +0100)]
[bgpd] Log a debug/update warning if filters are configured but don't exist

* bgp_route.c: (bgp_{input,output}_filter) Log a debug warning if a route is
  received or sent and a filter name is configured for a prefix, as or
  distribute list but none is found - guaranteed configuration mistake.

15 years agoAdd test for Internet checksum.
Joakim Tjernlund [Mon, 1 Dec 2008 15:25:06 +0000 (16:25 +0100)]
Add test for Internet checksum.

Add 2 impl. of the Internet Checksum. One new optimized nad
one form RFC 1071. Turns out that the current Quagga in_cksum()
is buggy. On Big Endian routers it miscalculates odd sized buffers.

15 years ago[ospfd] compare ifIndex too when matching paths
Joakim Tjernlund [Sun, 1 Feb 2009 10:12:11 +0000 (11:12 +0100)]
[ospfd] compare ifIndex too when matching paths

ospf_path_lookup(), ospf_route_match_same() and
ospf_ase_route_match_same() needs to
compare if the interface matches too.

15 years ago[doc] Add "--disable-doc" to configure
Joakim Tjernlund [Mon, 16 Feb 2009 08:40:39 +0000 (09:40 +0100)]
[doc] Add "--disable-doc" to configure

Configure option "--disable-doc" will prevent building
the documents under doc. Saves build time and the need to
have document building tools installed. Useful when your build
machine is different from your development machine.

15 years ago[ospfd] external LSA route_unlock_node() fixes
Joakim Tjernlund [Wed, 4 Feb 2009 14:05:19 +0000 (15:05 +0100)]
[ospfd] external LSA route_unlock_node() fixes

A few route_unlock_node() calls was missing.

15 years ago[ospfd] Fix a few LSA performance "bugs"
Joakim Tjernlund [Tue, 4 Nov 2008 13:37:29 +0000 (13:37 +0000)]
[ospfd] Fix a few LSA performance "bugs"

ospf_lsa_install() will calculate LSA checksum so no
need to do it before calling ospf_lsa_install().

Set the OSPF_LSA_SELF_CHECKED flag on own LSA's to
save ospf_lsa_is_self_originated() some work.

Do not memset() memory that is about to overwritten
with memcpy().

15 years agoMerge remote branch 'origin/master'
Paul Jakma [Wed, 24 Jun 2009 21:52:43 +0000 (22:52 +0100)]
Merge remote branch 'origin/master'

15 years agozebra: Static route does not reach kernel.
Joakim Tjernlund [Wed, 24 Jun 2009 17:15:36 +0000 (19:15 +0200)]
zebra: Static route does not reach kernel.

A static route like below: ip route 172.16.1.0/30 192.168.101.162 11
does not move properly to a new interface when the
interface used goes down. Zebra reports that it have
moved but kernel isn't informed so the route is lost.

* zebra_rib.c: (nexthop_active_update) if ifindex has changed, then the
  route should be considered to have changed.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
15 years ago[vtysh] Save vtysh history to a file
Tomasz Pala [Wed, 24 Jun 2009 21:23:11 +0000 (22:23 +0100)]
[vtysh] Save vtysh history to a file

vtsh_main.c: save 1000 last lines of history to $HOME/.history_quagga (the
file must be created by hand first, this is intended behaviour)

15 years ago[configure] Allow for large-file support, e.g. for log files >2GB
Tomasz Pala [Wed, 24 Jun 2009 21:09:46 +0000 (22:09 +0100)]
[configure] Allow for large-file support, e.g. for log files >2GB

15 years ago[cleanup] Add log.h includes
Tomasz Pala [Wed, 24 Jun 2009 20:48:22 +0000 (21:48 +0100)]
[cleanup] Add log.h includes

15 years ago[bgpd] Add 'show ip bgp view WORD neighbors IP (advertised|received)-routes'
Tomasz Pala [Wed, 24 Jun 2009 20:36:50 +0000 (21:36 +0100)]
[bgpd] Add 'show ip bgp view WORD neighbors IP (advertised|received)-routes'

* bgp_route.c: Was missing these commands.

15 years ago[ospfd] discount IP header size from a new LSA pkt
Dmitry Tejblum [Wed, 24 Jun 2009 16:14:30 +0000 (20:14 +0400)]
[ospfd] discount IP header size from a new LSA pkt

15 years ago[bgpd] review 32-bit AS-path hotfix for 0.99.12
Denis Ovsienko [Tue, 23 Jun 2009 17:10:45 +0000 (21:10 +0400)]
[bgpd] review 32-bit AS-path hotfix for 0.99.12

The patch by Chris Caputo, which was used to prepare 0.99.12
release, consists of three parts:

1. memory allocation fix itself
2. fix for warnings about constant variables
3. fix for printf format specs (%d was used instead of %u)

It was confirmed later, that:
a. a much simpler bugfix was available for memory allocation
b. committed version of the bugfix wasn't optimal CPU-wise

At this point I consider reasonable to revert the allocation
portion of that patch and to replace it with the shorter
version, which is:

-#define ASN_STR_LEN (5 + 1)
+#define ASN_STR_LEN (10 + 1)

Other two parts of Mr. Caputo's patch remain intact.

15 years ago[zebra] linux policy routing support with ipv6
Mathieu Goessens [Tue, 23 Jun 2009 14:59:45 +0000 (15:59 +0100)]
[zebra] linux policy routing support with ipv6

Quagga support linux policy routing (ip route ... table $X) with zebra.conf
table $X option.  It works fine on ipv4.  On ipv6 the parameter is ignored
(table 0 is used).

* zebra/...: Pass appropriate table arg to rib_{add,delete}_ipv6

15 years agoMerge remote branch 'origin/master'
Paul Jakma [Tue, 23 Jun 2009 13:30:52 +0000 (14:30 +0100)]
Merge remote branch 'origin/master'

15 years ago[trivia] work around ksh93 builtin name (#451)
Jingjing Duan [Tue, 23 Jun 2009 13:28:23 +0000 (17:28 +0400)]
[trivia] work around ksh93 builtin name (#451)

ksh93 script cannot have 'stop' functions w/o cancelling
existing definition first. Fixed.

15 years agoFix "show ip bgp dampened-paths" garbage output.
Chris Caputo [Tue, 23 Jun 2009 06:06:49 +0000 (06:06 +0000)]
Fix "show ip bgp dampened-paths" garbage output.

* bgpd/bgp_damp.c: Make bgp_damp_reuse_time_vty() accept a buffer and
  length, rather than returning a local var buffer whose contents can get
  trounced.  Remove duplicate BGP_UPTIME_LEN define.
* bgpd/bgp_damp.h: bgp_damp_reuse_time_vty() prototype change.
* bgpd/bgp_route.c: Provide bgp_damp_reuse_time_vty() with a buffer and
  length.  Remove duplicate BGP_UPTIME_LEN define.

This problem was noticed in 2005...

  http://hibernia.jakma.org/~paul/patches/quagga-test.diff

...but the fix didn't make it into the code.

Signed-off-by: Chris Caputo <ccaputo@alt.net>
15 years agoFix vtysh based "write term" output.
Chris Caputo [Tue, 23 Jun 2009 05:55:57 +0000 (05:55 +0000)]
Fix vtysh based "write term" output.

* vtysh/vtysh.c: "end" should be printed at the bottom, not the top.
* vtysh/vtysh_config.c: PROTOCOL_NODE was not being handled, and thus was
  being displayed at the top of a config, rather than in its rightful
  place near the bottom.

Signed-off-by: Chris Caputo <ccaputo@alt.net>
15 years agoFixes to RFC2385/MD5 BGP
Chris Caputo [Tue, 23 Jun 2009 05:34:29 +0000 (05:34 +0000)]
Fixes to RFC2385/MD5 BGP

* bgpd/bgp_network.c: Fix MD5 listen in IPv4 version of bgp_socket() by
  adding listen socket to listen_sockets list so that MD5 passwords can
  get set.
* lib/sockopt.c: (sockopt_tcp_signature) Fix bogus "% Error while applying
  TCP-Sig to session(s)" / "can't set TCP_MD5SIG option" startup error
  messages by not returning error when there isn't one.

15 years ago[ospfd] cancel OSPF timer hack in nsm_change_state
Dmitry Tejblum [Tue, 23 Jun 2009 13:16:32 +0000 (17:16 +0400)]
[ospfd] cancel OSPF timer hack in nsm_change_state

This piece of code causes all Quagga routers on a broadcast link to
send a HELLO packet simultaneously if they see a new neighbor. It also
resets the HELLO timer, so all the quagga routers will continue to
send HELLO packets simultaneously in the future. This is not good
(especially on networks with a lot of Quagga routers connected), and
is explicitly discouraged by the OSPF standard, RFC 2328 (chapter
4.4.Timers).

I suggest to remove the code snippet, it does not provide much benefit
anyway.

15 years agoRFC 4191 Default Router Preference support for router advertisements
Chris Caputo [Sun, 3 May 2009 04:40:57 +0000 (04:40 +0000)]
RFC 4191 Default Router Preference support for router advertisements

Adds "ipv6 nd router-preference (high|medium|low)" and
"no ipv6 nd router-preference" interface commands.

Files modified:

   doc/ipv6.texi
   zebra/interface.c
   zebra/interface.h
   zebra/rtadv.c
   zebra/rtadv.h

Signed-off-by: Chris Caputo <ccaputo@alt.net>
15 years ago[doc] remove -dither arg to imagemagick, in building PDFs
Paul Jakma [Mon, 22 Jun 2009 15:11:06 +0000 (16:11 +0100)]
[doc] remove -dither arg to imagemagick, in building PDFs

* doc/Makefile.am: arguments for the 'convert' programme seem to have
  changed incompatibly at some stage - just remove the problematic -dither.

15 years agoConvert ospf6d over to quagga_gettime() wrappers.
Takashi Sogabe [Mon, 22 Jun 2009 04:07:02 +0000 (13:07 +0900)]
Convert ospf6d over to quagga_gettime() wrappers.

15 years ago[bgpd] Fix 'update-source' command: It doesn't accept interface names
Paul Jakma [Mon, 22 Jun 2009 10:30:47 +0000 (11:30 +0100)]
[bgpd] Fix 'update-source' command: It doesn't accept interface names

* bgp_vty.c: BGP_UPDATE_SOURCE_STR define should only specify IP addresses,
  the underlying mechanisms won't do anything useful with interface names.
  Fix bug #527.

15 years ago[ospfd/BSD] add missing UINT16_MAX - picked up from FreeBSD ports patch
Jeremy Jackson [Fri, 23 Jan 2009 20:48:10 +0000 (15:48 -0500)]
[ospfd/BSD] add missing UINT16_MAX - picked up from FreeBSD ports patch

Should probably have AC_TYPE_UINT16_T in configure.ac to make it really
clean...  and a fresh import of gnulib, the existing copy of gnulib seems to
be manually put some stuff in zebra.h.  I'm leaving that alone for now,
since a fresh import will probably clean up a lot of cruft and it would be a
duplicated effort to fix some things now.

The FreeBSD port 0.99.11_1 files/patch-ospfd-ospfd.h can probably go away
after this is applied.

15 years ago[configure] fix check for GNU awk/gawk to abort ./configure if missing
Jeremy Jackson [Thu, 22 Jan 2009 03:10:40 +0000 (22:10 -0500)]
[configure] fix check for GNU awk/gawk to abort ./configure if missing

It also prints what were comments explaining why gawk is necessary, and
not-in-PATH to help user figure out why it's not found.

Build was mysteriously failing with the old version of this check when gawk
wasn't installed.

15 years ago[cleanup] convert bzero() deprecated by POSIX to memset()
Jeremy Jackson [Thu, 22 Jan 2009 01:51:57 +0000 (20:51 -0500)]
[cleanup] convert bzero() deprecated by POSIX to memset()

autoscan 2.62 complains about bzero(), so a good fix
nowadays is to just replace it.

15 years ago[configure] remove unused/broken autoconf cache variable ac_statedir
Jeremy Jackson [Thu, 22 Jan 2009 01:29:39 +0000 (20:29 -0500)]
[configure] remove unused/broken autoconf cache variable ac_statedir

It wasn't used, and the code wasn't printing progress or the result in some
cases.  the test uses minimal resources, so it's probably better to not
cache so as to avoid inconsistencies if --with-prefix or directory variables
are changed between ./configure runs.

15 years ago[configure/cleanup] fix broken autoconf cache variables
Jeremy Jackson [Wed, 21 Jan 2009 23:27:37 +0000 (18:27 -0500)]
[configure/cleanup] fix broken autoconf cache variables

Fix zebra_rtread and zebra_ipforward_path.

It looks like someone tried to make this cached, but it was being ignored at
least on autoconf 2.6.1.  2.6.2 now gives a warning about the situation,
hence this fix.

Although they are just warnings, it's dangerous to leave them as-is, because
someone not diligent in reading the autoconf manual might just stick _cv_ in
the name, with the effect that running a ./configure --config-cache would
fail horribly, since variables are being set inside the AC_CACHE_CHECK()
block that would not be seen when the variable's value was read from cache.

Also added m4 quotes [] to macro arguments as autoconf manual
suggests.

15 years ago[configure] remote support for AIX, it conflicts on newer autoconf
Jeremy Jackson [Wed, 21 Jan 2009 21:35:51 +0000 (16:35 -0500)]
[configure] remote support for AIX, it conflicts on newer autoconf

AC_AIX and AC_GNU_SOURCE conflict > autoconf 2.53 or so,
but the replacement AC_USE_SYSTEM_EXTENSIONS isn't available
until later versions.  So either we narrow the supported
autconf version range, or disable AIX (if it has any effect),
or determin that AC_AIX doesn't do anything useful anyhow.

15 years ago[build] cleanup low-hanging autoreconf warnings
Jeremy Jackson [Wed, 21 Jan 2009 19:15:44 +0000 (14:15 -0500)]
[build] cleanup low-hanging autoreconf warnings

Some uses of GNU make extensions were not necessary.  There are still some,
but they might exist as workarounds for older versions of autoconf that have
since been solved.

Lesson learned: implicit target rules have opposite order to pattern target
rules.

15 years ago[configure] add configure support for PCRE Posix library
Jeremy Jackson [Mon, 12 Jan 2009 21:06:12 +0000 (16:06 -0500)]
[configure] add configure support for PCRE Posix library

Debian tried unsuccessfully to build with libpcreposix.  This adds proper
support to autoconf/configure.ac for it.

Based on the patch by C.J.  Adams-Collier in bug #483.

bgpd/bgp_{regex,routemap}.h: Pull in PCRE POSIX header if available.

15 years ago[daemons/cleanup] Remove disabled log_mode argument support.
Jeremy Jackson [Sun, 28 Dec 2008 17:57:42 +0000 (12:57 -0500)]
[daemons/cleanup] Remove disabled log_mode argument support.

* */*main.c: Seems that the actual code was removed previously, but the
  argument processing code remained.

15 years ago[doc] Removes documentation of nonexistant option.
Jeremy Jackson [Sun, 28 Dec 2008 17:40:06 +0000 (12:40 -0500)]
[doc] Removes documentation of nonexistant option.

Expansion of Ubuntu quagga-0.99.11-1 30_doc__ospfd.8__nolog.dpatch

15 years ago[configure] Refine CLOCK_MONOTONIC test
Paul Jakma [Thu, 18 Jun 2009 16:38:01 +0000 (17:38 +0100)]
[configure] Refine CLOCK_MONOTONIC test

* configure.ac: Check for the actual CLOCK_MONOTONIC symbol, as clock_gettime
  need not imply that clock type is supported
* lib/zebra.h: use the method given in autoconf docs for sys/time.h
  inclusion

15 years ago[configure] Detect support for monotonic clock
Stephen Hemminger [Thu, 28 May 2009 22:29:10 +0000 (15:29 -0700)]
[configure] Detect support for monotonic clock

Quagga has code to support monotonic clock to avoid issues where
time of day changes. The support was incomplete since it was not being
detected by autoconf.

15 years ago[BGP/cleanup] make message list in bgp_open const
Stephen Hemminger [Fri, 15 May 2009 17:16:34 +0000 (10:16 -0700)]
[BGP/cleanup] make message list in bgp_open const

15 years ago[BGP/cleanup] make community hash table static
Stephen Hemminger [Fri, 15 May 2009 17:17:09 +0000 (10:17 -0700)]
[BGP/cleanup] make community hash table static

15 years ago[BGP/cleanup] make some damp function static
Stephen Hemminger [Fri, 15 May 2009 17:19:31 +0000 (10:19 -0700)]
[BGP/cleanup] make some damp function static

15 years ago[BGP/cleanup] make ecommunity variables/functions local
Stephen Hemminger [Fri, 15 May 2009 17:28:11 +0000 (10:28 -0700)]
[BGP/cleanup] make ecommunity variables/functions local

15 years ago[BGP/cleanup] main program cleanup
Stephen Hemminger [Fri, 15 May 2009 17:29:41 +0000 (10:29 -0700)]
[BGP/cleanup] main program cleanup

Check result of daemon() call to fix warning
Make local variables static

15 years ago[zebra/cleanup] make message table read only
Stephen Hemminger [Fri, 15 May 2009 17:47:04 +0000 (10:47 -0700)]
[zebra/cleanup] make message table read only

15 years ago[OSPF/cleanup] make message lists read only
Stephen Hemminger [Fri, 15 May 2009 17:47:45 +0000 (10:47 -0700)]
[OSPF/cleanup] make message lists read only

15 years ago[bgpd/cleanup] make message lists read only
Stephen Hemminger [Fri, 15 May 2009 17:48:03 +0000 (10:48 -0700)]
[bgpd/cleanup] make message lists read only

15 years ago[bgpd] add comment that bgp_capability_receive is exported for unit-tests
Paul Jakma [Thu, 18 Jun 2009 11:34:43 +0000 (12:34 +0100)]
[bgpd] add comment that bgp_capability_receive is exported for unit-tests

15 years ago[cleanup] Allow message tables to be constant
Stephen Hemminger [Fri, 15 May 2009 16:47:34 +0000 (09:47 -0700)]
[cleanup] Allow message tables to be constant

Avoid bugs, and improve cache locality by allowing message lists
to be read/only.

15 years ago[cleanup] Fix compile warnings
Stephen Hemminger [Fri, 15 May 2009 16:48:55 +0000 (09:48 -0700)]
[cleanup] Fix compile warnings

Fix printf format warning and make capability table 'const static'

15 years ago[cleanup] Use const in smux interface
Stephen Hemminger [Fri, 15 May 2009 16:59:03 +0000 (09:59 -0700)]
[cleanup] Use const in smux interface

smux_trap and oid_copy should allow read-only source.

15 years ago[bgpd/cleanup] BGP make attribute variables local
Stephen Hemminger [Fri, 15 May 2009 16:59:51 +0000 (09:59 -0700)]
[bgpd/cleanup] BGP make attribute variables local

Message lists can be read-only, and hash tables are local to this
code.

15 years ago[bgpd/cleanup] Make BGP FSM table read-only static
Stephen Hemminger [Fri, 15 May 2009 17:02:27 +0000 (10:02 -0700)]
[bgpd/cleanup] Make BGP FSM table read-only static

The finite state machine table is immutable.

15 years ago[bgpd] reference count the BGP instance
Stephen Hemminger [Thu, 21 May 2009 15:51:03 +0000 (08:51 -0700)]
[bgpd] reference count the BGP instance

When a BGP instance is deleted with lots of routes and neighbors
it is possible for the peer rsclient queue to run after
bgp_delete has been called. This would lead to bgpd crashing,
see https://bugzilla.vyatta.com/show_bug.cgi?id=3436

The fix is to add reference counting to the BGP instance and defer
actual freeing until all references are gone.

This patch also fixes a memory leak where the self-reference
peer instance was being created but never freed.

The check in bgp_clear_route is no longer valid because it is possible
for it to be called when peer is in Deleted state during cleanup.

15 years ago[bgpd] Make declarations match
Stephen Hemminger [Fri, 8 May 2009 22:19:07 +0000 (15:19 -0700)]
[bgpd] Make declarations match

These variables are const.

15 years ago[zebra] Remove unused structure element
Stephen Hemminger [Thu, 30 Apr 2009 04:55:48 +0000 (21:55 -0700)]
[zebra] Remove unused structure element

15 years ago[zebra] Force rib_update when connected route deleted
Stephen Hemminger [Thu, 30 Apr 2009 04:54:59 +0000 (21:54 -0700)]
[zebra] Force rib_update when connected route deleted

15 years ago[cleanup] Use correct buffer size for inet_ntop()
Stephen Hemminger [Tue, 28 Apr 2009 21:28:00 +0000 (14:28 -0700)]
[cleanup] Use correct buffer size for inet_ntop()

Don't need big buffer 1024 to hold IPV4 (INET_ADDRSTRLEN)
or IPv6 (INET6_ADDRSTRLEN) message.

15 years ago[ripd] Ignore non-running interfaces in rip status
Stephen Hemminger [Tue, 7 Apr 2009 22:00:46 +0000 (15:00 -0700)]
[ripd] Ignore non-running interfaces in rip status

Vyatta Bug 3999

15 years ago[lib] Put symbolic backtrace on system log
Stephen Hemminger [Mon, 9 Mar 2009 23:09:50 +0000 (16:09 -0700)]
[lib] Put symbolic backtrace on system log

When BGP crashes, sometimes all we get to see is syslog.

15 years ago[lib] sockopt_tcp_signature: sin6 requires HAVE_IPV6
Stephen Hemminger [Fri, 20 Feb 2009 07:01:41 +0000 (23:01 -0800)]
[lib] sockopt_tcp_signature: sin6 requires HAVE_IPV6

An external user was building on system without IPv6 and
it wouldn't work.

15 years ago[ospf6d] Remove 'no router' from OSPF6_NODE
Stephen Hemminger [Thu, 12 Feb 2009 07:55:32 +0000 (23:55 -0800)]
[ospf6d] Remove 'no router' from OSPF6_NODE

Don't need command twice.

15 years ago[ospf6d] Fix ospf6d crash if removing interface with no area
Jon [Thu, 12 Feb 2009 01:30:44 +0000 (17:30 -0800)]
[ospf6d] Fix ospf6d crash if removing interface with no area

ospf6d will crash if attempting to remove interface when no areas have been
defined Check if any areas have been defined.  Should prevent use of empty
pointer.

15 years ago[ospf6d] Fix ospf6d crash in show border routers
Jon [Thu, 12 Feb 2009 01:27:06 +0000 (17:27 -0800)]
[ospf6d] Fix ospf6d crash in show border routers

ospf6d will crash if this command is executed on a non-border-router.
Included test to verify that any routes are defined, preventing empty
pointer from being used.

15 years ago[ospf6] Add no router ospf6
Jon [Thu, 12 Feb 2009 01:19:07 +0000 (17:19 -0800)]
[ospf6] Add no router ospf6

Suggestion: Makes no sense to me that the statement to remove ospf6
configuration is located in OSPF6D_NODE.
Moved to CONFIG_NODE next to matching define command.

15 years ago[ospf6d] Fix ospf6d crash if range defined twice
Jon [Thu, 12 Feb 2009 01:22:03 +0000 (17:22 -0800)]
[ospf6d] Fix ospf6d crash if range defined twice

ospf6d will crash if the same range is defined twice.
There was no check if the same range had previously been defined,
thereby causing a later assert to fail.

15 years ago[ospfd] Fix OSPF route refcount leak
Stephen Hemminger [Wed, 3 Jun 2009 23:44:21 +0000 (16:44 -0700)]
[ospfd] Fix OSPF route refcount leak

This may fix vyatta BUG 3096. The reference count for OSPF route table was
never completely freed on deleting all neighbors.

15 years ago[zebra] Only announce connected routes if link is detected
Stephen Hemminger [Sat, 5 Jul 2008 23:32:37 +0000 (16:32 -0700)]
[zebra] Only announce connected routes if link is detected

Need to check both IFF_UP and IFF_RUNNING if link-detect is enabled,
before announcing routes.

15 years ago[zebra] MTU is unsigned
Stephen Hemminger [Mon, 1 Dec 2008 22:19:38 +0000 (14:19 -0800)]
[zebra] MTU is unsigned

The MTU data in the netlink message is always unsigned 32 bits.
Don't use integer.

15 years ago[zebra] remove incorrect debug message
Stephen Hemminger [Thu, 18 Sep 2008 23:51:06 +0000 (16:51 -0700)]
[zebra] remove incorrect debug message

15 years ago[zebra] Cleanup meta-queue code
Stephen Hemminger [Mon, 11 Aug 2008 23:22:15 +0000 (16:22 -0700)]
[zebra] Cleanup meta-queue code

Do some cleanup work on recently added meta-queue code:
  * use table rather than switch
  * indent with quagga standard indentation
  * since meta_queue_new is only used at initialization
    allocation failure should be fatal.

15 years ago[zebra] netlink interface minor cleanup
Stephen Hemminger [Wed, 28 May 2008 17:47:30 +0000 (10:47 -0700)]
[zebra] netlink interface minor cleanup

Add more prototypes and make some functions static

15 years ago[zebra] Fix vyatta bug 2814: Add "show ip route summary" command.
Stig Thormodsrud [Tue, 4 Nov 2008 23:45:07 +0000 (15:45 -0800)]
[zebra] Fix vyatta bug 2814: Add "show ip route summary" command.

15 years ago[vtysh] Add a --noerror option
Stephen Hemminger [Wed, 30 Jul 2008 21:16:47 +0000 (14:16 -0700)]
[vtysh] Add a --noerror option

There are times that configuration scripts want to run vtysh but
don't want to get error messages or failed exit status

15 years ago[vtysh] Return non-zero exit code on error.
Stephen Hemminger [Mon, 28 Jul 2008 22:04:56 +0000 (15:04 -0700)]
[vtysh] Return non-zero exit code on error.

If passed a bad command, return non-zero exit code

15 years ago[vtysh] Make vtysh more useable for scripting
Stephen Hemminger [Mon, 28 Jul 2008 19:19:04 +0000 (12:19 -0700)]
[vtysh] Make vtysh more useable for scripting

Add environment variable (VTYSH_LOG) for logging.
If a command fails, exit with non-zero exit code and don't
continue multipart commands.

15 years ago[vtysh] Force line buffered mode.
Stephen Hemminger [Fri, 2 May 2008 16:25:02 +0000 (09:25 -0700)]
[vtysh] Force line buffered mode.

Vtysh is used in pipelines and it helps if the output starts right
away instead of waiting for a whole buffer to fill.

15 years ago[gcc] Add gcc printf format checks
Stephen Hemminger [Fri, 8 Aug 2008 22:15:23 +0000 (15:15 -0700)]
[gcc] Add gcc printf format checks

15 years ago[cleanup] Make command nodes static
Stephen Hemminger [Mon, 1 Dec 2008 19:10:34 +0000 (11:10 -0800)]
[cleanup] Make command nodes static

The cmd_nodes used to configure vty, can mostly be static so
(basic data hiding 101).

15 years ago[cleanup] functions taking no args should be declared with void args
Stephen Hemminger [Mon, 9 Feb 2009 18:14:16 +0000 (10:14 -0800)]
[cleanup] functions taking no args should be declared with void args

Use Ansi-C prototypes rather than old K&R method of declaring
function without arguments

15 years ago[cleanup] add const attribute to lib/if.c::if_dump
Stephen Hemminger [Fri, 12 Jun 2009 15:58:49 +0000 (16:58 +0100)]
[cleanup] add const attribute to lib/if.c::if_dump

15 years ago[cleanup] Convert XMALLOC/memset to XCALLOC
Stephen Hemminger [Mon, 18 Aug 2008 21:13:29 +0000 (14:13 -0700)]
[cleanup] Convert XMALLOC/memset to XCALLOC

Simple conversion of XMALLOC/memset to XCALLOC

15 years ago[bgpd] Add support for the old Linux 2.4, TCP_MD5_AUTH RFC2385 patch
Paul Jakma [Fri, 12 Jun 2009 13:21:02 +0000 (14:21 +0100)]
[bgpd] Add support for the old Linux 2.4, TCP_MD5_AUTH RFC2385 patch

* configure.ac: Add a --enable-linux24-tcp-md5 argument, to compile in
  support for the old TCP-MD5 patch for Linux 2.4 systems.  This overrides
  auto-detection of TCP-MD5 supported by the target system.
* lib/sockopt.c: (sockopt_tcp_signature) add in a variant for the old
  Linux 2.4, TCP_MD5_AUTH variant of TCP-MD5 support, conditional
  on the previous configure arg.

15 years ago[bgpd] Fixed as-path prepend/exclude ASN handling
Denis Ovsienko [Tue, 9 Jun 2009 11:15:33 +0000 (15:15 +0400)]
[bgpd] Fixed as-path prepend/exclude ASN handling

 - aspath_gettoken(): use as_t to fix 4-byte ASN scanning (bug #484)
 - set_aspath_prepend_cmd(): use CMD_AS_RANGE in message to match
   actual range
 - no_set_aspath_prepend_val_cmd(): idem
 - set_aspath_exclude_cmd(): idem
 - no_set_aspath_exclude_val_cmd(): idem

15 years agoMerge remote branch 'origin/master'
Paul Jakma [Tue, 2 Jun 2009 18:43:51 +0000 (19:43 +0100)]
Merge remote branch 'origin/master'

15 years ago[snmp] Compiler warning fixes for when "--enable-snmp" is configured.
Chris Caputo [Tue, 2 Jun 2009 17:40:07 +0000 (18:40 +0100)]
[snmp] Compiler warning fixes for when "--enable-snmp" is configured.

Compiled on 32-bit and 64-bit linux gcc 4.1.2 platforms.
No run-time testing on 32-bit and limited run-time testing on 64-bit.

15 years ago[smux] 64-bit fix for lib/smux.h SNMP_INTEGER() macro
Chris Caputo [Tue, 2 Jun 2009 17:37:11 +0000 (18:37 +0100)]
[smux] 64-bit fix for lib/smux.h SNMP_INTEGER() macro

Macro SNMP_INTEGER() prepares data which is eventually processed
by asn_build_int().  SNMP_INTEGER() was using "int32_t" whereas
asn_build_int() uses "long".  On 32-bit systems these are the
same, both 4 bytes, but on x86 64-bit systems "long" is 8 bytes.

asn_build_int()'s reaction to an improperly sized value is to return
a NULL pointer.  Quagga's smux.c would eventually get this NULL
pointer and use it in calculations to determine how much data to send
over the smux connection, resulting in garbage being sent to the
SNMP agent.

Corrected SNMP_INTEGER() to use "long".

Tested on 32-bit and 64-bit x86 Linux 2.6.27.10 systems running
Quagga 0.99.11 with bgpd smux.

15 years ago[ospfd] fix vty ospfd no ospf abr-type standard
Francesco Dolcini [Tue, 2 Jun 2009 17:20:09 +0000 (18:20 +0100)]
[ospfd] fix vty ospfd no ospf abr-type standard

"no ospf abr-type standard" was broken

15 years ago[ripd] Fix metrix in call to rip_zebra_ipv4_delete
Krisztian Kovacs [Tue, 2 Jun 2009 17:09:48 +0000 (18:09 +0100)]
[ripd] Fix metrix in call to rip_zebra_ipv4_delete

Fix a potential problem (most probably not triggering a real problem, at
least on Linux). When an interface goes down and ripd tries to delete the
corresponding route it errorneously passes the interface's index instead of
the metric to zebra.

15 years ago[bgp] Fix crash on SIGHUP, deref of freed workqueues
Steve Hill [Tue, 2 Jun 2009 13:28:16 +0000 (14:28 +0100)]
[bgp] Fix crash on SIGHUP, deref of freed workqueues

* lib/workqueue.c: free-ing workqueues had never been tested obviously,
  queue's thread was not being stopped
* bgpd/bgpd.c: null out freed workqueues, to prevent acting on freed
  workqueues

15 years ago[trivia] Fixed typos in communities text (#334)
Denis Ovsienko [Mon, 1 Jun 2009 16:20:36 +0000 (20:20 +0400)]
[trivia] Fixed typos in communities text (#334)

15 years ago[doc] Stick with quagga.net for consistency (#436)
Denis Ovsienko [Mon, 1 Jun 2009 16:07:46 +0000 (20:07 +0400)]
[doc] Stick with quagga.net for consistency (#436)

15 years ago[bgpd] 64-bit bugfix in community_del_val by Jeremy Jackson <jerj@coplanar.net>
Andrew J. Schorr [Fri, 29 May 2009 13:15:20 +0000 (09:15 -0400)]
[bgpd] 64-bit bugfix in community_del_val by Jeremy Jackson <jerj@coplanar.net>

* bgpd/bgp_community.c: (community_del_val) Fix bug in memcpy that was
  using the wrong size on architectures where a pointer is not 32 bits.

15 years ago[release] Bump version to 0.99.12
Paul Jakma [Fri, 8 May 2009 22:20:19 +0000 (23:20 +0100)]
[release] Bump version to 0.99.12