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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
[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.
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
When bgp calls getaddrinfo, it gets both ipv6 and ipv4 addresses.
Unless IPV6_ONLY is set on Linux, only the ipv6 bind will succeed,
and the IPV4 connections will come in as mapped connections on the
IPV6 socket.
[bgpd] AS4 bugfix by Chris Caputo <ccaputo@alt.net>
* bgpd/bgp_aspath.c: (aspath_make_str_count) "assert (len < str_size)" was
getting hit under certain 4-byte ASN conditions. New realloc strategy.
* bgpd/bgp_aspath.c: (aspath_key_make) const warning fix.
"%d" -> "%u" 4-byte ASN corrections. Prevent negative number when ASN is
above 2^31.
Joakim Tjernlund [Mon, 10 Nov 2008 08:33:30 +0000 (09:33 +0100)]
[lib] Fix timer precision.
Whenever a thread adds an timer funcname_thread_add_timer_timeval() gets called
to add the timer. Before adding the timer a quagga_gettimeofday() call
is made to do some time house keeping. However quagga_gettimeofday() only
updates recent_time, not relative_time that is used to calculate
the alarm_time. Replace with quagga_get_relative (NULL)
Joakim Tjernlund [Mon, 17 Nov 2008 10:22:25 +0000 (11:22 +0100)]
[lib] Move type cast in Fletcher checksum
The int type cast should be on the whole expression
passed to the mod operator. Otherwise it won't work
when/if c0/c1 is unsigned.
Making c0/c1 unsigned makes it possible to use 5802
as MODX value.
Paul Jakma [Sun, 16 Nov 2008 18:34:19 +0000 (18:34 +0000)]
[lib] Switch Fletcher checksum back to old ospfd version
* lib/checksum.c: (fletcher_checksum) Switch the second phase of the checksum
back to the old ospfd logic.
The isisd-derived version:
a) is very hard to follow
b) had some kind of subtle bug that caused it be wrong when c0=0 and c1=254
(potentially fixable by doing the mods before adjusting x and y)
Additionally:
- explicitely cast expressions using non-internal variables to int, to ensure
the result is signed.
- defensively change the length argument to 'size_t', to ensure the code
works with that argument being unsigned..
Thanks to Joakim Tjernlund for the investigative work into this bug.
* tests/test-checksum.c: new file to exercise the checksum code.
[ospfd] Fix SEGV during startup introduced in recent commit
* ospfd/ospfd.c: (opsf_if_update) Check if ospf_lookup() returns NULL.
Fixes bug introduced with recent ospf_network_run changes in a49eb30a, where SEGV will happen if not the "router ospf" command has
been executed before the first interfaces are reported by zebra.
Paul Jakma [Tue, 9 Sep 2008 20:17:04 +0000 (21:17 +0100)]
[lib] re-enable conversion of v6mapped INET6 sockunions to regular INET
* lib/sockunion.c: Re-enable conversion of v6mapped INET6 sockunions to
regular INET sockunions, which was disabled in 0df7c9, as it leads to
failures in sockunion_cmp.
(sockunion_normalise_mapped) consolidate here
(sockunion_accept) remove conversion code altogether here - no sockunion
is created
(sockunion_get{sockname,peername}) normalise newly created sockunion.
Paul Jakma [Tue, 9 Sep 2008 16:14:33 +0000 (17:14 +0100)]
[bgpd] Allow accepted peers to progress even if realpeer is in Connect
* bgpd/bgp_packet.c: (bgp_open_receive) Try fix the little race in the FSM,
where a accept-peer that progress faster than realpeer gets closed down if
realpeer is still just in Connect, by allowing the realpeer to be
bgp_stop'ed and doing the regular swapping-of-FSM state.
Paul Jakma [Sat, 6 Sep 2008 12:09:35 +0000 (13:09 +0100)]
[bgpd] Document the FSM dummy-peer race that sometimes afflicts session setup
* bgp_packet.c: (bgp_open_receive) the accept-peer hack can sometimes
cause a race between two peers that try to establish sessions to each other,
causing session setup to fail when it should have succeeded. In the worst
case, the race can 'loop', causing prolonged failure to establish sessions.
Paul Jakma [Thu, 4 Sep 2008 12:52:07 +0000 (13:52 +0100)]
[ospfd] Minor enhancements to recent self-host-routes suppression patch
* ospf_spf.c: (ospf_spf_process_stubs) Track whether
parent router vertex is the root, so that the host-route
suppression logic need only be activated for such vertices.
Move the actual logic to ospf_intra_add_stub.
* ospf_route.c: (ospf_intra_add_stub) Main test of link moved
here, notionally more appropriate.
[ospfd] Restructure opsf_if_update() and ospf_network_run()
Add an struct interface paramenter and adjust the affected
code accordingly.
The old code was a mess looping over all interfaces several times
when one interface was added/changed.
* ospfd/ospfd.h: Add struct interface parameter to ospf_if_update()
* ospfd/ospf_zebra.c: Add ifp arg to ospf_if_update() calls.
(ospf_interface_address_delete) delete ospf_if_update() call,
redundant as function calls ospf_if_free() itself.
* ospfd/ospfd.c: (ospf_network_unset) handle deconfiguration here,
rather than ospf_if_update.
(ospf_network_run_interface) ospf_network_run, for
any given interface.
(ospf_network_run) move guts to previous, and use it.
(ospf_if_update) Adjust to take struct interface as argument, as
all callers have a specific ifp in mind.
Iterate over ifp's connected list and call ospf_network_run_interface
instead of ospf_network_run, turning this path into O(nm) rather
than O(n^2).
Adjust all code dealing with opsf_if_update and ospf_network_run to
pass the new struct interface * arg.
(some minor modifications and bug-additions by Paul Jakma).