]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
11 years agozebra: fix recursive-routes via ifindex routes
Christian Franke [Fri, 5 Jul 2013 15:35:40 +0000 (15:35 +0000)]
zebra: fix recursive-routes via ifindex routes

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: implement NEXTHOP_FLAG_ONLINK
Christian Franke [Fri, 5 Jul 2013 15:35:39 +0000 (15:35 +0000)]
zebra: implement NEXTHOP_FLAG_ONLINK

On Linux, the kernel will only allow for a route to be installed when
its gateway is directly attached according the kernel fib.

There are cases when this restriction by the kernel is too strong, in
those cases, we deploy the RTNH_F_ONLINK netlink flag.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: handle blackholes encountered in recursive resolution
Christian Franke [Fri, 5 Jul 2013 15:35:38 +0000 (15:35 +0000)]
zebra: handle blackholes encountered in recursive resolution

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: rework recursive route resolution
Christian Franke [Fri, 5 Jul 2013 15:35:37 +0000 (15:35 +0000)]
zebra: rework recursive route resolution

Change the datastructure for recursive routes. This brings the following
benefits:

By using struct nexthop also to store nexthops obtained by recursive
resolution, we can get rid of quite a bit of code duplication in the fib
management. (rt_netlink, rt_socket, ...)

With the new datastructure we can make use of all available paths when
recursive routes are resolved with multipath routes.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: improve interface shutdown behaviour
Christian Franke [Thu, 24 Jan 2013 14:04:50 +0000 (14:04 +0000)]
zebra: improve interface shutdown behaviour

Linux removes IPv6 addresses when the interface is set down. Those
addresses need to be readded when the interface is set up again.

Also, an interface should not be reactivated from shutdown by configuring
an ip address.

Finally, remove the three-state logic for the shutdown setting as its
sole current use may be mild confusion.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: don't change connected state from zebra/interface.c
Christian Franke [Thu, 24 Jan 2013 14:04:49 +0000 (14:04 +0000)]
zebra: don't change connected state from zebra/interface.c

Try to avoid changing connected state from zebra/interface.c as this
means making assumptions about kernel behaviour which may be or may
become wrong. This state should rather be updated by events from the
kernel.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: add ZEBRA_IFC_QUEUED to keep track of kernel state
Christian Franke [Thu, 24 Jan 2013 14:04:48 +0000 (14:04 +0000)]
zebra: add ZEBRA_IFC_QUEUED to keep track of kernel state

As there are timeframes when we don't get a notification from the kernel
about new addresses. (e.g. while Linux performs IPv6 DAD), we need to
have some information whether an address has been sent to the kernel or
not.

One case where this is relevant would be a user adding an IPv6 address,
but deleting it before DAD has been complete. With the next patch which
removes some (ill assuming) synchronous parts in address setup,
ipv6_address_uninstall would not know whether or not it has to actually
delete the prefix from the kernel. Resolving these windows where we lack
information is what the flag ZEBRA_IFC_QUEUED is intended for.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: warn if advertising connected with _REAL unset
Christian Franke [Thu, 24 Jan 2013 14:04:47 +0000 (14:04 +0000)]
zebra: warn if advertising connected with _REAL unset

The implementation in zebra and the zclient protocol allow to communicate
addresses to clients which are not yet in the kernel.

This is usually not done and most clients seem to expect an address to be
configured in the kernel when they receive it. Therefore, it seems
reasonable to issue a warning when advertising an address to the clients
that is not yet in the kernel.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: consolidate connected_implicit_withdraw
Christian Franke [Thu, 24 Jan 2013 14:04:46 +0000 (14:04 +0000)]
zebra: consolidate connected_implicit_withdraw

connected_implicit_withdraw is used at two places and followed by exactly
the same code. Move that code into connected_implicit_withdraw and give
that function a more descriptive name.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: clear ZEBRA_IFC_CONFIGURED on "no ipv6 addr"
Christian Franke [Thu, 24 Jan 2013 14:04:45 +0000 (14:04 +0000)]
zebra: clear ZEBRA_IFC_CONFIGURED on "no ipv6 addr"

To match the semantics of IPv4, the ZEBRA_IFC_CONFIGURED flag
should be cleared when an IPv6 connected is uninstalled via
vty.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: make if_subnet_delete a bit more strict
Christian Franke [Thu, 24 Jan 2013 14:04:44 +0000 (14:04 +0000)]
zebra: make if_subnet_delete a bit more strict

Enhance if_subnet_delete so it will complain about improper use.
Also, fix one occurence of improper use where it was called for
IPv6 as well.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: process information about new addresses (BZ#486)
Christian Franke [Thu, 24 Jan 2013 14:04:43 +0000 (14:04 +0000)]
zebra: process information about new addresses (BZ#486)

Because of a change of semantics in the Linux kernel, information
about changes made by zebra itself was not considered for updates.
This change should fix this by accounting for the new semantics.

It is based on a patch by lich posted to the bugzilla #486

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoospfd: protect vs. VU#229804 (malformed Router-LSA)
David Lamparter [Fri, 2 Aug 2013 07:27:53 +0000 (07:27 +0000)]
ospfd: protect vs. VU#229804 (malformed Router-LSA)

VU#229804 reports that, by injecting Router LSAs with the Advertising
Router ID different from the Link State ID, OSPF implementations can be
tricked into retaining and using invalid information.

Quagga is not vulnerable to this because it looks up Router LSAs by
(Router-ID, LS-ID) pair.  The relevant code is in ospf_lsa.c l.3140.
Note the double "id" parameter at the end.

Still, we can provide an improvement here by discarding such malformed
LSAs and providing a warning to the administrator.  While we cannot
prevent such malformed LSAs from entering the OSPF domain, we can
certainly try to limit their distribution.

cf. http://www.kb.cert.org/vuls/id/229804 for the vulnerability report.
This issue is a specification issue in the OSPF protocol that was
discovered by Dr. Gabi Nakibly.

Reported-by: CERT Coordination Center <cert@cert.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd, zebra: support NEXTHOP_IPV4_IFINDEX in bgp import check
Christian Franke [Sat, 25 May 2013 14:01:36 +0000 (14:01 +0000)]
bgpd, zebra: support NEXTHOP_IPV4_IFINDEX in bgp import check

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd, zebra: Support NEXTHOP_IPV4_IFINDEX in nexthop_lookup api
Christian Franke [Sat, 25 May 2013 14:01:35 +0000 (14:01 +0000)]
bgpd, zebra: Support NEXTHOP_IPV4_IFINDEX in nexthop_lookup api

Since commit ba281d3d040, ospfd uses NEXTHOP_IPV4_IFINDEX
routes. The API between zebra and bgpd which is used to query
nexthops for recursive routes did not support this nexthop
type and therefore, ospf changes (or any other IGP changes
which use NEXTHOP_IPV4_IFINDEX) would never trigger any
recursive route update.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: improve display of NEXTHOP_IPV4_IFINDEX in show ip route
Christian Franke [Sat, 25 May 2013 14:01:34 +0000 (14:01 +0000)]
zebra: improve display of NEXTHOP_IPV4_IFINDEX in show ip route

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: honor PEER_FLAG_DISABLE_CONNECTED_CHECK on bgp_scan
Christian Franke [Thu, 11 Apr 2013 08:24:30 +0000 (08:24 +0000)]
bgpd: honor PEER_FLAG_DISABLE_CONNECTED_CHECK on bgp_scan

When neighbor disable-connected-check was used, bgpd would accept routes
with unconnected nexthop as indended, however those routes would be
invalidated on the next bgp_scan run as that function did not know about
disable-connected-check.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoisisd, ospf6d: use bug-report information from autoconf
Christian Franke [Wed, 20 Mar 2013 10:50:07 +0000 (10:50 +0000)]
isisd, ospf6d: use bug-report information from autoconf

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: don't printf to stdout on ZEBRA_IPV6_NEXTHOP_LOOKUP
Christian Franke [Thu, 11 Apr 2013 08:24:29 +0000 (08:24 +0000)]
zebra: don't printf to stdout on ZEBRA_IPV6_NEXTHOP_LOOKUP

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agovtysh: don't append superflous spaces (BZ#750)
Christian Franke [Mon, 4 Mar 2013 09:23:30 +0000 (09:23 +0000)]
vtysh: don't append superflous spaces (BZ#750)

rl_completion_append_character is reset to space every time the completion
function is entered. So we would have to set it to '\0' every time
new_completion() is called. We can make this conditional and avoid using
rl_pending_input.

This code path is most relevant when there are multiple completion
matches with the same prefix, e.g. in router bgp context: "neighbor 1.2.3.4
pa"<ssive|ssword> would have been completed to "neighbor 1.2.3.4 pass "
instead of "neighbor 1.2.3.4 pass".

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: write NOTIFY non-blockingly
David Lamparter [Wed, 31 Jul 2013 12:39:41 +0000 (14:39 +0200)]
bgpd: write NOTIFY non-blockingly

switching the socket to blocking may well block the entire bgpd process
for some time if our peer is overloaded (which may well be the original
reason for the NOTIFY)

The error handling is slightly different from the previous ML discussion
on this;  buffer exhaustion isn't technically a fatal TCP error, and we
should probably proceed with FSM actions according to a sent NOTIFY
(adjusting timers) even if we didn't manage to get the NOTIFY onto the
wire.

Acked-by: Leonid Rosenboim <lrosenbo@wrs.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: prevent double address delete on shutdown
Rakesh Garimella [Mon, 11 Mar 2013 12:38:31 +0000 (12:38 +0000)]
bgpd: prevent double address delete on shutdown

bgp_interface_down() and bgp_exit() both proceed to delete the address
from bgpd's interface representation, so the second call gets a NULL
result from the hash lookup and subsequently crashes.

Signed-off-by: Rakesh Garimella <rakesh.garimella@sophos.com>
[reformatted]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: stricter packet handling in OpenSent
Leonid Rosenboim [Tue, 30 Jul 2013 18:14:25 +0000 (20:14 +0200)]
bgpd: stricter packet handling in OpenSent

Keepalives and updates are not expected in OpenSent, prior to receiving
the peer's open message.  Terminate the session with the proper
notification.

From: Leonid Rosenboim <lrosenbo@wrs.com>
[split off FSM changes, some reordering & cleanup.  read handling needs
 to be separately addressed]
Signed-off-by: David Lamparter <equinox@diac24.net>
11 years agolib: unconditionally include stddef.h
David Lamparter [Tue, 30 Jul 2013 13:36:26 +0000 (15:36 +0200)]
lib: unconditionally include stddef.h

I've used offsetof() in the previous commit to paper over the security
problems in ospf_api.c.  This blows the build on FreeBSD 7.0, missing
offsetof().  Let's add that to zebra's generally used includes.

stddef.h (and offsetof) is defined in C89 section 4.1.5 (and not
deprecated/removed by any later standard).  If this causes problems, the
bug report should go against the host OS/compiler...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoospfd: CVE-2013-2236, stack overrun in apiserver
David Lamparter [Mon, 8 Jul 2013 21:05:28 +0000 (23:05 +0200)]
ospfd: CVE-2013-2236, stack overrun in apiserver

the OSPF API-server (exporting the LSDB and allowing announcement of
Opaque-LSAs) writes past the end of fixed on-stack buffers.  This leads
to an exploitable stack overflow.

For this condition to occur, the following two conditions must be true:
- Quagga is configured with --enable-opaque-lsa
- ospfd is started with the "-a" command line option

If either of these does not hold, the relevant code is not executed and
the issue does not get triggered.

Since the issue occurs on receiving large LSAs (larger than 1488 bytes),
it is possible for this to happen during normal operation of a network.
In particular, if there is an OSPF router with a large number of
interfaces, the Router-LSA of that router may exceed 1488 bytes and
trigger this, leading to an ospfd crash.

For an attacker to exploit this, s/he must be able to inject valid LSAs
into the OSPF domain.  Any best-practice protection measure (using
crypto authentication, restricting OSPF to internal interfaces, packet
filtering protocol 89, etc.) will prevent exploitation.  On top of that,
remote (not on an OSPF-speaking network segment) attackers will have
difficulties bringing up the adjacency needed to inject a LSA.

This patch only performs minimal changes to remove the possibility of a
stack overrun.  The OSPF API in general is quite ugly and needs a
rewrite.

Reported-by: Ricky Charlet <ricky.charlet@hp.com>
Cc: Florian Weimer <fweimer@redhat.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agodoc: Modernize INSTALL.quagga.txt.
Greg Troxel [Mon, 15 Jul 2013 14:15:49 +0000 (10:15 -0400)]
doc: Modernize INSTALL.quagga.txt.

Note that list of prereq versions is out of date.
Add DejaGnu for testing.
Change references to CVS to git.

Signed-off-by: Greg Troxel <gdt@ir.bbn.com>
11 years agotests: don't build tests unless make check is run
Christian Franke [Fri, 5 Jul 2013 16:30:57 +0000 (18:30 +0200)]
tests: don't build tests unless make check is run

Use check_PROGRAMS instead of noinst_PROGRAMS in tests/Makefile.am
to build the tests only when make check is actually run.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
11 years agotests: fix Makefile.am so it works with BSD make
Christian Franke [Fri, 5 Jul 2013 16:30:56 +0000 (18:30 +0200)]
tests: fix Makefile.am so it works with BSD make

The export statement is specific to GNU make and breaks the build
with BSD make. I couldn't observe any difference in behaviour
between having the export present and absent, therefore, just remove it.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
11 years agoospfd: fix flooding procedure
Christian Franke [Wed, 20 Feb 2013 10:00:54 +0000 (10:00 +0000)]
ospfd: fix flooding procedure

An ospf router should accept a new maxage LSA into its lsdb if it has any
neighbors in state Exchange or Loading. ospfd would however only account
for neighbors on the same interface which does not seem to be a valid
optimization.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Signed-off-by: David Lamparter <equinox@diac24.net>
11 years agoospfd: make ospf_maxage_lsa_remover actually yield
Christian Franke [Wed, 20 Feb 2013 10:00:52 +0000 (10:00 +0000)]
ospfd: make ospf_maxage_lsa_remover actually yield

ospf_maxage_lsa_remover whould check whether to yield,
but run on anyway.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Signed-off-by: David Lamparter <equinox@diac24.net>
11 years agodoc: update TODO for ospf6d work & bgp multipath
Dinesh G Dutt [Fri, 12 Apr 2013 01:37:15 +0000 (01:37 +0000)]
doc: update TODO for ospf6d work & bgp multipath

This is work in progress at Cumulus Networks.

11 years agotests: DejaGNU libzebra
David Lamparter [Thu, 24 Jan 2013 00:39:14 +0000 (01:39 +0100)]
tests: DejaGNU libzebra

Wrap the few libzebra test programs we have up for DejaGNU.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agotests: DejaGNU bgpd
David Lamparter [Tue, 26 Feb 2013 16:53:30 +0000 (17:53 +0100)]
tests: DejaGNU bgpd

this just wraps the existing test programs in expect wrappers that make
their results usable to DejaGNU.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agotests: add DejaGNU framework
David Lamparter [Tue, 26 Feb 2013 15:21:20 +0000 (16:21 +0100)]
tests: add DejaGNU framework

DejaGNU seems to be the 'standard' GNU test framework (which by itself
doesn't say much), but it seems relatively usable and the "remote
system" capabilities might come in handy for virtualisation-based tests
for kernel interactions or something.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoospfd: restore nexthop IP for p2p interfaces
Christian Franke [Wed, 20 Mar 2013 15:28:46 +0000 (15:28 +0000)]
ospfd: restore nexthop IP for p2p interfaces

commit c81ee5c... "ospfd: Optimize and improve SPF nexthop calculation"
subtly changed semantics of routes calculated over pointopoint links by
removing the nexthop IP address and instead using an ifindex route.

This breaks calculation of AS-Ext routes with a forwarding address since
in ospf_ase_complete_direct_routes() this will be hit:
    if (op->nexthop.s_addr == 0)
      op->nexthop.s_addr = nexthop.s_addr;
thus turning the route unusable by having an invalid nexthop.

Fix by restoring the nexthop IP on routes over PtP links.  This also
allows running multi-access (Ethernet) interfaces in PtP mode again.

This bug is a regression against 0.99.21 and only present in 0.99.22.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
[patch description and code comments rewritten]
Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: James Li <jli@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agolib/vty: register vtysh socket in server socket vector (BZ#754)
Christian Franke [Wed, 27 Feb 2013 13:47:23 +0000 (13:47 +0000)]
lib/vty: register vtysh socket in server socket vector (BZ#754)

Register the vtysh socket in Vvty_serv_thread so it will be
correctly closed on vty_reset instead of being leaked.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoripd: correctly redistribute ifindex routes (BZ#664)
David Lamparter [Thu, 28 Feb 2013 21:17:00 +0000 (22:17 +0100)]
ripd: correctly redistribute ifindex routes (BZ#664)

ripd had a check to restrict metric 0 to only directly connected routes.
This check was implemented by checking against Connected as route type.
This is, however, incorrect -- all routes that directly use an interface
without a nexthop should be treated as directly connected and passed off
with metric 0.

ripngd does not posess such a check and was not touched.

Reported-by: Sean Fulton <sean@gcnpublishing.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: reference libcap from libzebra (BZ#393,626)
David Lamparter [Fri, 1 Mar 2013 11:03:58 +0000 (12:03 +0100)]
build: reference libcap from libzebra (BZ#393,626)

While the actual build failures have been fixed independently by
d1d3ac9 "build: reorder libraries to address linker error", libzebra
still does not reference libcap.  This will lead to more build failures
if someone else tries to use libzebra and doesn't add libcap.

Let's just add libcap here and be done with it.

I've not added libcap to the _DEPENDENCIES variable above since libcap
is a system library.  Actually, the whole _DEPENDENCIES thing is rather
fishy; automake automatically sets _DEPENDENCIES from _LIBADD.  For the
sake of not breaking stuff that works (especially since most autotools
stuff is arcane magic), I'm leaving it alone...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoospfd: fix LSA initialization for build without opaque LSA
Christian Franke [Wed, 20 Feb 2013 10:00:53 +0000 (10:00 +0000)]
ospfd: fix LSA initialization for build without opaque LSA

If configured without opaque LSA support, the old code would incorrectly
associate type 5 LSAs with an area.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agotests: make --disable-bgpd kill bgpd tests too
David Lamparter [Sat, 23 Feb 2013 21:17:21 +0000 (22:17 +0100)]
tests: make --disable-bgpd kill bgpd tests too

bgpd tests don't compile or run with --disable-bgpd, let's catch this in
the Makefile.

Reported-by: Joachim Nilsson <troglobit@gmail.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: fix minimal mixup in gitinfo suffix
David Lamparter [Wed, 27 Feb 2013 10:24:24 +0000 (11:24 +0100)]
build: fix minimal mixup in gitinfo suffix

the original version of this had issues with tagless repositories; to
fix that I removed the "-g" part from one of the regexes.  I then failed
to add those 2 characters back, leading to version numbers like
"0.99.220123456" instead of "0.99.22-ga123456".  Let's put the "-g"
back...

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agodoc: fix makeinfo errors and one warning
Timo Teräs [Fri, 22 Mar 2013 08:54:44 +0000 (08:54 +0000)]
doc: fix makeinfo errors and one warning

commit 4afa50b added few lines that are syntactically incorrect
with leading plus sign.

Cc: Denis Ovsienko <infrastation@yandex.ru>
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agodoc: add OSPFv3 homenet to TODO
David Lamparter [Fri, 29 Mar 2013 18:40:39 +0000 (19:40 +0100)]
doc: add OSPFv3 homenet to TODO

The homenet OSPFv3 extensions are not only relevant TODO items, but also
suitable for GSoC students.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agodoc: update TODO
David Lamparter [Fri, 29 Mar 2013 18:31:55 +0000 (19:31 +0100)]
doc: update TODO

the TODO was last touched in 2006.  This is a first pass at cleaning it
up, motivated primarily by the need for an up-to-date idea list for the
Google Summer of Code 2013.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: Update supported versions.
Greg Troxel [Sun, 3 Mar 2013 16:38:17 +0000 (11:38 -0500)]
build: Update supported versions.

INSTALL.quagga.tex:
  Given the statement that it's viewed as a bug if quagga doesn't
  build on OS versions on the list, prune the list to the set for
  which there would be near-universal agreement that it's a bug.

  Clarify that the response to a system on the list not building might
  be dropping it from the list. (Time marches on, and these lists are
  not necessarily maintained.  As an example, the comment saying
  FreeBSD4 support was iffy is now 6 years old.)

  Delete old discussion of ancient texinfo.

  Delete discussion of NetBSD versions before 4 (as no longer relevant).

11 years agohash: dynamically grow hash table
Stephen Hemminger [Fri, 11 Jan 2013 18:25:26 +0000 (18:25 +0000)]
hash: dynamically grow hash table

Dynamically grow the hash table index if the chains get too long.
If expansion doesn't help keep chain length short, then stop expanding,
to avoid bad behavior if there is a poor hash function.
Not a new idea, based on concepts in uthash.

Depends on my previous patch to restrict hash to power of 2.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
[profiling results: sum of cycles spent in hash_get/jhash with RIPE RIS
 test data (single simple BGP peer) improved to 69% of previously spent]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agohash: force size to be a power of 2
Stephen Hemminger [Fri, 4 Jan 2013 22:29:21 +0000 (22:29 +0000)]
hash: force size to be a power of 2

By forcing the hash table size to be a power of 2, a potentially
expensive divide can be replaced by a mask operation. Almost all
usage of the hash table was using default size of 1024. Only places
with different size was thread library (1011) and bgp aspath.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoguile: remove
David Lamparter [Fri, 25 Jan 2013 08:14:52 +0000 (09:14 +0100)]
guile: remove

11 years agobuild: update quagga.spec.in
Matti-Oskari Leppänen [Fri, 15 Feb 2013 10:12:55 +0000 (10:12 +0000)]
build: update quagga.spec.in

both Quagga and RPM have moved a bit since this was last touched.
Should now work again on CentOS 5 and 6.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agovtysh: fix false lib path matching in extract.pl.in
Joakim Tjernlund [Sat, 23 Feb 2013 18:38:37 +0000 (19:38 +0100)]
vtysh: fix false lib path matching in extract.pl.in

The if ($file =~ /lib/) path matching logic is supposed to
match Quagga's lib directory only but will match all path
having lib in it such as /var/lib/jenkins/quagga/...

Fix by matching both lib and file: lib/keychain.c etc.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: fix lost passwords of grouped neighbors
Roman Hoog Antink [Fri, 18 Jan 2013 12:52:03 +0000 (13:52 +0100)]
bgpd: fix lost passwords of grouped neighbors

This patch resolves the significance of order of group and password
statements.

It prevents passwords from being lost in cases where all
three conditions apply:
  1. the peer is member of a group with or without group password
  2. the peer has an individual password set
  3. the peer is added to a group within an address-family ipv6
     section

In addition this patch prevents the same issue in cases, where an IPv4
peer's password is set first and the peer is added to a group
afterwards.

Adding a peer to a group cancels his individual password. Without ipv6
this is not a problem, because choosing the right order of config
statements will do (set password only after adding peer to group).

When adding the peer to a group within the address-family
section, his password is definitely lost. The same workaround (ie.
setting the password after the address-family section) can not be used,
because "show run" will print the configuration statements in the wrong
order.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: use SO_RCVBUFFORCE for netlink socket
Ulrich Weber [Tue, 22 Jan 2013 10:39:18 +0000 (10:39 +0000)]
zebra: use SO_RCVBUFFORCE for netlink socket

so net.core.rmem_max must not be adjusted. Requires
linux kernel >= 2.6.14, falls back to SO_RCVBUF on error

Signed-off-by: Ulrich Weber <ulrich.weber@sophos.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agorelease: 0.99.22
David Lamparter [Sun, 10 Feb 2013 02:08:33 +0000 (03:08 +0100)]
release: 0.99.22

11 years agobuild: fix "pragma weak" mixups
David Lamparter [Sun, 27 Jan 2013 03:46:02 +0000 (04:46 +0100)]
build: fix "pragma weak" mixups

Not only was there a minor typo in the "pragma weak" preprocessor
checks, but also were the tests not behaving as needed - they only
indicated support for the /first/ method of implementing weak aliases,
which on Linux is __attribute__ and not #pragma.

* m4/ax_sys_weak_alias.m4: set defines for _all_ weak alias methods
* zebra/kernel_null.c: fix typo

Cc: Doug VanLeuven <roamdad@sonic.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agodoc: update some introduction paragraphs
David Lamparter [Fri, 18 Jan 2013 18:11:59 +0000 (19:11 +0100)]
doc: update some introduction paragraphs

in particular,
- add IS-IS to some listings
- list Solaris & OSX as "some work required"
- remove OS version numbers.  We have no base to specify any of them.
- list supported C compilers (gcc, clang, icc)
- cut the Quagga 2.0 stuff that promises QoS and firewall functionality

11 years agodoc: update NEWS for 0.99.22 changes
David Lamparter [Fri, 18 Jan 2013 17:56:39 +0000 (18:56 +0100)]
doc: update NEWS for 0.99.22 changes

11 years agobgpd: fix crash in soft-reconfiguration
Christian Franke [Mon, 28 Jan 2013 06:14:43 +0000 (07:14 +0100)]
bgpd: fix crash in soft-reconfiguration

Commit 8692c50652 introduced a bug where bgpd would crash on
soft-reconfiguration.

This happens e.g. when there are filtered unicast routes because
rn->info is NULL in that case, which the code did not account for.

Reported-by: Paweł Staszewski <pstaszewski@itcare.pl>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agotests: fix missing init in bgp_mp_attr_test.c
David Lamparter [Wed, 23 Jan 2013 03:20:37 +0000 (04:20 +0100)]
tests: fix missing init in bgp_mp_attr_test.c

turns out, bgp_mp_reach_parse really doesn't like getting garbage
attribute input.  In particular, attr->extra better be NULL or we
merrily go trample random places (like our stack).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agotests: update & extend AS_PATH tests
David Lamparter [Tue, 22 Jan 2013 22:39:17 +0000 (23:39 +0100)]
tests: update & extend AS_PATH tests

NB: these tests test for current implementation state, not for RFC
conformance.  In particular, behaviour with confederations in AS4_PATH
as well as reconcilation of short AS_PATH + AS4_PATH is currently NOT
conforming to RFC 4893/6793.

* tests/aspath_test.c:  add capability to put both AS4_PATH & AS_PATH,
  add test for AS4_PATH w/o AS_PATH, update confederation test

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: relax ORF capability length handling
David Lamparter [Wed, 23 Jan 2013 04:50:24 +0000 (05:50 +0100)]
bgpd: relax ORF capability length handling

commit fe9bb64... "bgpd: CVE-2012-1820, DoS in bgp_capability_orf()"
made the length test in bgp_capability_orf_entry() stricter and is now
causing us to refuse (with CEASE) ORF capabilites carrying any excess
data.  This does not conform to the robustness principle as laid out by
RFC1122 ("be liberal in what you accept").

Even worse, RFC5291 is quite unclear on how to use the ORF capability
with multiple AFI/SAFIs.  It can be interpreted as either "use one
instance, stuff everything in" but also as "use multiple instances".
So, if not for applying robustness, we end up clearing sessions from
implementations going by the former interpretation.  (or if anyone dares
add a byte of padding...)

Cc: Denis Ovsienko <infrastation@yandex.ru>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: don't try to reconcile AS4_PATH with NULL
David Lamparter [Sun, 20 Jan 2013 17:29:28 +0000 (18:29 +0100)]
bgpd: don't try to reconcile AS4_PATH with NULL

bgp_attr_munge_as4_attrs would previously try to reintegrate an AS4_PATH
with a NULL AS_PATH, leading to a rather nasty SEGV.  Let's go by
RFC6793 and treat missing AS_PATH as 0-length AS_PATH, which in turn
means discarding the AS4_PATH.

[NB: we don't actually stick to the actual rule, which is discarding
AS4_PATH if it's longer than AS_PATH; indeed we should probably fix that
too]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: Quagga 0.99.22-rc1
David Lamparter [Wed, 16 Jan 2013 00:48:04 +0000 (01:48 +0100)]
build: Quagga 0.99.22-rc1

this is not a full release version, so neither release notes nor
documentation are updated yet.  Also, signing the tag with my private
GPG key instead of the Quagga one.

11 years agobgpd: conditional default-originate using route-map
Christian Franke [Fri, 7 Dec 2012 16:45:52 +0000 (16:45 +0000)]
bgpd: conditional default-originate using route-map

Incorporate a patch by Svetozar Mihailov which implements
default-originate route-maps to behave as expected, i.e. allowing
the default route to be advertised conditionally, depending on a
criterion given by the route-map.

I am aware that the performance attributes of the following implementation
are far from optimal. However, this affects only code paths belonging to
a feature that is broken without this patch, therefore, it seems reasonable
to me to have this in the mainline for now.

Cc: Svetozar Mihailov <quagga@j.zarhi.com>
Reported-by: Sébastien Cramatte <scramatte@gmail.com>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: uncork/nagle socket when sending BGP NOTIFY
Leonid Rosenboim [Fri, 14 Dec 2012 19:12:17 +0000 (19:12 +0000)]
bgpd: uncork/nagle socket when sending BGP NOTIFY

This pushes out the NOTIFY message before closing a connection.

Previously, the TCP_CORK bandwidth optimization code caused NOTIFY
messages to disappear prior to when the connection is closed.

* bgpd/bgp_packet.c: unset CORK, set NODELAY, and replace
                     writen() by more correct write()

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoRevert "bgpd: flock() dump files (BZ#742)"
David Lamparter [Wed, 16 Jan 2013 00:28:36 +0000 (01:28 +0100)]
Revert "bgpd: flock() dump files (BZ#742)"

This reverts commit b07458a055493dd37cb955ae90f11ae8bc334d3a.

On second thought, the right way to do this is with rename(), not by
introducing a lock that can potentially even stall bgpd.

Reported-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: fix sockaddr_dl length assumptions (BZ#737)
David Lamparter [Wed, 26 Sep 2012 12:52:39 +0000 (14:52 +0200)]
zebra: fix sockaddr_dl length assumptions (BZ#737)

Quagga makes bad assumptions about sockaddr_dl (on NetBSD, but possibly
on other systems as well).  Particularly, sizeof(struct sockaddr_dl)
returns a size that does not include the full sdl_data field, leading to
not enough data being copied.  This breaks IPv6 RAs in particular, as
a broken mac address from sockaddr_dl will be included in the packets.

From: Matthias-Christian Ott <ott@mirix.org>
Tested-by: Uwe Toenjes <6bone@6bone.informatik.uni-leipzig.de>
[further simplified + more comments]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: update .gitignore for all test programs
Leonid Rosenboim [Tue, 6 Nov 2012 19:44:04 +0000 (11:44 -0800)]
build: update .gitignore for all test programs

11 years agobuild: add buildtest.sh script
David Lamparter [Tue, 15 Jan 2013 16:59:08 +0000 (17:59 +0100)]
build: add buildtest.sh script

This script compiles Quagga in a variety of configurations and
optionally with LLVM and ICC (if those are installed).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: Fix build on MacOSX 10.8 (Mountain Lion)
Hasso Tepper [Sun, 13 Jan 2013 17:45:29 +0000 (17:45 +0000)]
build: Fix build on MacOSX 10.8 (Mountain Lion)

Newer MacOSX versions have support for both IPv6 advanced socket API
RFCs (2292 and 3542) switchable in compile time, but neither of these
is default for some strange reason. RFC3542 will be default in future,
but for now we have to declare that we want to use the RFC3542 API
before including <netinet/in.h>.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: Remove deprecated AM_CONFIG_HEADER
Hasso Tepper [Sun, 13 Jan 2013 17:45:28 +0000 (17:45 +0000)]
build: Remove deprecated AM_CONFIG_HEADER

AM_CONFIG_HEADER has been deprecated for many years and is removed
completely from automake 1.13.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: uncork after each write
Stephen Hemminger [Fri, 11 Jan 2013 18:27:23 +0000 (18:27 +0000)]
bgpd: uncork after each write

Keep data flowing, uncork after each BGP_WRITE_PACKET_MAX.
This makes TCP send data sooner, since thread may not be scheduled
again for a a longish time because of new UPDATE's coming in.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: use recent monotonic time for readtime
Stephen Hemminger [Fri, 4 Jan 2013 22:29:23 +0000 (22:29 +0000)]
bgpd: use recent monotonic time for readtime

The readtime value is for diagnostic, and doesn't have to be highly
accurate. This also fixes a problem where the readtime was being measured
with system clock, but the peer_uptime() was comparing with bgp_clock.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoconfigure: allow building without getrusage
Stephen Hemminger [Fri, 4 Jan 2013 22:29:22 +0000 (22:29 +0000)]
configure: allow building without getrusage

Measuring the resource usage of threads is moderately expensive
since it requires doing an additional system call everytime a
thread context switches. Make it possible to disable this with
a configuration option.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: mark route nodes scheduled into work queue
Stephen Hemminger [Fri, 4 Jan 2013 22:29:20 +0000 (22:29 +0000)]
bgpd: mark route nodes scheduled into work queue

The flag bit BGP_NODE_PROCESS_SCHEDULED is checked but never set.
This causes route node to be scheduled multiple times under load.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: improve logging of invalid BGP Notifications
Leonid Rosenboim [Fri, 7 Dec 2012 21:31:07 +0000 (21:31 +0000)]
bgpd: improve logging of invalid BGP Notifications

Invalid BGP Notification messages should be logged locally, cf.
RFC4271, Sect. 6.4, p 34,
  NOTIFICATION Message Error Handling

Current notification for invalid Notification code:

  2012/10/10 02:17:54 BGP: message index 10 not found in bgp_notify_msg (max is 8)
  2012/10/10 02:17:54 BGP: 192.168.1.1 received NOTIFICATION 10/0 ((no item found)) 0 bytes

the logging should be a bit more clear. The above logging really doesn't
explain much and looks more like a programming error.

[rewrote most of it to get in something I can call a shape -David]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: fix error response to invalid BGP version number
Leonid Rosenboim [Fri, 7 Dec 2012 21:25:00 +0000 (21:25 +0000)]
bgpd: fix error response to invalid BGP version number

BGP4-ANVL 20.1 ANVL tries to open BGP with version 5 and expects correct
notification in response. Quagga sends notification, but with incorrect
information in it.

The data needs to be a 2-byte value, and for now we respond with 0004 for any
peer version other than 4.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: fix a bug in bgp_attr_dup
Christian Franke [Fri, 7 Dec 2012 16:35:00 +0000 (16:35 +0000)]
bgpd: fix a bug in bgp_attr_dup

Commit 558d1fec11749d3257e improved bgp_attr_dup so it would be possible
for the caller to provide attr_extra, allowing to use the stack instead
of the heap for operations requiring only a short lived attr.

However, this commit introduced a bug where bgp_attr_dup wouldn't copy
attr_extra at all (but provide a reference to the original) if the
caller provided attr_extra.

Cc: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: fix a memleak on "set community none"
Christian Franke [Fri, 7 Dec 2012 14:26:09 +0000 (14:26 +0000)]
bgpd: fix a memleak on "set community none"

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: don't overrun afi/safi array boundaries
Leonid Rosenboim [Thu, 6 Dec 2012 20:17:41 +0000 (20:17 +0000)]
zebra: don't overrun afi/safi array boundaries

zebra was not checking afi/safi values.  This was leading to crashes where
these values were coming directly from some protocol's on-wire fields.
Safeguarding them in zebra is a good start.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: store "no neighbor activate" for IPv4 unicast
Christian Franke [Mon, 19 Nov 2012 11:17:31 +0000 (11:17 +0000)]
bgpd: store "no neighbor activate" for IPv4 unicast

If a neighbor was in a peer group for any AFI/SAFI, bgpd would never write a
"no neighbor activate" line for IPv4 unicast, so a valid setup like following
could be configured, but not saved:

    router bgp 64600
     bgp router-id 198.51.100.1
     network 198.51.100.0/24
     neighbor peers peer-group
     neighbor 2001:db8::2 remote-as 64601
     no neighbor 2001:db8::2 activate
    !
     address-family ipv6
     network 2001:db8:1::/48
     neighbor peers activate
     neighbor peers soft-reconfiguration inbound
     neighbor 2001:db8::2 peer-group peers
     exit-address-family
    !

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: avoid heap fragmentation in bgp_clear_route_table
Jorge Boncompte [DTI2] [Mon, 7 May 2012 15:17:33 +0000 (15:17 +0000)]
bgpd: avoid heap fragmentation in bgp_clear_route_table

In bgp_clear_route_table, moved cleanup code before the allocation
of the work queue items. This returns the memory to the system
allocator before allocating new and might therefore help avoiding
heap fragmentation.

* bgp_route.c: (bgp_clear_route_table) moved code blocks.

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Reviewed-by: Leonid Rosenboim <Leonid.Rosenboim@windriver.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobgpd: fix for leaked struct bgp_adj_[in|out] on peer shutdown
Jorge Boncompte [DTI2] [Mon, 7 May 2012 15:17:33 +0000 (15:17 +0000)]
bgpd: fix for leaked struct bgp_adj_[in|out] on peer shutdown

    If a peer with soft-reconfiguration configured is cleared, the
function bgp_clear_route_table() doesn't free the bgp_adj_in and bgp_adj_out
structures of route nodes that for some reason, ej. denied by a filter,
don't have routes attached "rn->info == NULL".

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Reviewed-by: Leonid Rosenboim <Leonid.Rosenboim@windriver.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agolib: remove ALL_LIST_ELEMENTS dead code branch
David Lamparter [Tue, 27 Nov 2012 02:21:44 +0000 (03:21 +0100)]
lib: remove ALL_LIST_ELEMENTS dead code branch

ALL_LIST_ELEMENTS is checking node == NULL twice, which is causing a
whole slew of false positives in Coverity.  In this particular case,
addressing this in the code is reasonable; being a macro, this appears
all over the place without easy remedy.

Acked-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agozebra: fix netlink NL_PKT_BUF_SIZE
高鹏 [Wed, 21 Nov 2012 10:15:43 +0000 (18:15 +0800)]
zebra: fix netlink NL_PKT_BUF_SIZE

Change default value of variable NL_PKT_BUF_SIZE to 8192UL.  Cf.
NLMSG_GOODSIZE definition of linux in include/linux/netlink.h for detail.

Previously, on platforms with a page size greater than 8192, if you had added
too many interfaces, zebra would not have enough buffer space to get the entire
interface list.  This resulted in an incomplete interface list.

From: 高鹏 <gpstrive@gmail.com>
[updated to apply after FPM patches]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: Fix build for systems with no /bin/true
Hasso Tepper [Fri, 14 Dec 2012 12:58:32 +0000 (14:58 +0200)]
build: Fix build for systems with no /bin/true

There are systems with no /bin/true - it might have different path
(/usr/bin/true) or even a shell builtin.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agobuild: MacOSX needs BSD struct ip_mreq hack too
Hasso Tepper [Fri, 14 Dec 2012 12:58:31 +0000 (14:58 +0200)]
build: MacOSX needs BSD struct ip_mreq hack too

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agotestzebra: pragma weak: detect systems with weak alias and provide alternative
Doug VanLeuven [Fri, 14 Dec 2012 12:58:30 +0000 (14:58 +0200)]
testzebra: pragma weak: detect systems with weak alias and provide alternative

LLVM clang does not support #pragma weak (bug 3679) on OS X. There are
other systems where the #pragma weak has varying syntax.

Added m4 file from the autoconf archives:
http://www.gnu.org/software/autoconf-archive/ax_sys_weak_alias.html

Fix up zebra/*_null.c files to use #pragma weak alias or stub functions
if not available. It's incomplete in that the different format #pragma
enable easier fixes on need.

Tested on 64bit OS X 10.7, FreeBSD 9.0 amd64 & i386 (32bit) using
gcc & clang. Tested on linux 64bit.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoMerge remote-tracking branch 'savannah/sf/ospfd'
David Lamparter [Fri, 11 Jan 2013 20:46:18 +0000 (21:46 +0100)]
Merge remote-tracking branch 'savannah/sf/ospfd'

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
11 years agoospfd: Remove dup MaxAge LSA flood
Dinesh G Dutt [Mon, 7 Jan 2013 18:12:52 +0000 (10:12 -0800)]
ospfd: Remove dup MaxAge LSA flood

Stop additional, unnecessary flooding of MaxAge LSAs.

When a MaxAge LSA is installed, if the LSA is prematurely aged or the LSA is
not self-originated, the LSA is flushed. This results in a the LSA being
flooded a second time and in some cases flooded back to the receiver
(unless the receiver is also the advertising router). A MaxAge'd LSA has
already been flooded in ospf_flood() as part of the LSA receive processing
(ospf_ls_upd). A self-originated LSA will be flooded from the originate/refresh
routine. Thus, in the install routine, a MaxAge'd LSA only needs to be added
to the MaxAge LSA list.

Signed-off-by: Dinesh G Dutt <ddutt@cumulusnetworks.com>
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospfd: Corrected ospfd Type-4/Type-5 ls update handling
Vishal Kumar [Fri, 7 Dec 2012 22:47:58 +0000 (14:47 -0800)]
ospfd: Corrected ospfd Type-4/Type-5 ls update handling

This fix is for Type-4 LS updates handling at a ABR router where
ospf daemon is not distributing Type-4 LS updates with correct LS-Age
after learning about a ASBR router in a ospf network. Because of this
Type-5 LS updates are not learnt in ospf network.
Testing Scenario:
This can be re-produced by restarting the ospfd daemon on DUT
(mentioned in figure below)before the Hello time interval expires
for area 0.0.0.1.

 ____                       _______                       ____                    _________
|    |   area: 0.0.0.1     |       |   area: 0.0.0.0     |    |   area: 0.0.0.2  |         |
| R1 |---------------------|DUT/ABR|---------------------| R2 |------------------| R3/ASBR |
|____|     x.x.x.0/24      |_______|    y.y.y.0/64       |____|     z.z.z.0/24   |_________|

In the above setup when ospfd is restarted (imp:before the Hello interval
at R1 expires) and DUT learns about ASBR router R3 (Type-4) in the
network from R2, but this ls-update is not propagates in area
0.0.0.1. So R1 never comes to know about the ASBR router in the
network, so all the type-5 LS updates coming from R3 are not learnt
by R1. Further if we again restart ospfd daemon it starts working fine.
With the fix given this issue can be resolved.

More Discussion on this is available at:
http://www.gossamer-threads.com/lists/quagga/dev/23892

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospfd: compile warning cleanups
Andrew Certain [Tue, 4 Dec 2012 21:43:42 +0000 (13:43 -0800)]
ospfd: compile warning cleanups

A set of patches to clarify some comments as well as cleanup code that was
causing warnings.  After these patches, the code can be compiled with

-Wall -Wsign-compare -Wpointer-arith -Wbad-function-cast -Wwrite-strings
-Wmissing-prototypes -Wmissing-declarations -Wchar-subscripts -Wcast-qual
-Wextra -Wno-unused-parameter -Wno-missing-field-initializers

(what is current in trunk plus -Wextra -Wno-unused-parameter
-Wno-missing-field-initializers).

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospfd: Update nsm_change_state to static scope, as it is not called from elsewhere
Andrew Certain [Tue, 4 Dec 2012 21:40:58 +0000 (13:40 -0800)]
ospfd: Update nsm_change_state to static scope, as it is not called from elsewhere

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospfd: Changed TE instance check to remove -Wtype-limits warning
Andrew Certain [Tue, 4 Dec 2012 21:36:41 +0000 (13:36 -0800)]
ospfd: Changed TE instance check to remove -Wtype-limits warning

Since LEGAL_TE_INSTANCE_RANGE() was being passed an unsigned int, a warning
was being thrown due to the compare against >= 0.  Since this macro was used
only in one place, I removed the macro for an explict compare against a
constant for the MAX.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agolib: Changes to VTY string-parsing macros to remove warnings
Andrew Certain [Tue, 4 Dec 2012 21:33:24 +0000 (13:33 -0800)]
lib: Changes to VTY string-parsing macros to remove warnings

The VTY_GET_INTEGER_RANGE macro was being used also just to check the range
on a variable that wasn't used (for the "no" version of a VTY command), so I
split the macro into two.  Also, since the variable is unsigned, if MIN is
zero, you get a warning about comparing an unsigned number against 0, giving
rise to slightly convoluted logic.  Note that the previous two patches were
found by the -Wtype-limits and -Wunused-variables warnings.  Without the
changes to these macros, these warnings are triggered erroneously, making it
harder to find the real problems.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospfd: Update comments to be more clear in packet processing
Andrew Certain [Tue, 4 Dec 2012 21:29:21 +0000 (13:29 -0800)]
ospfd: Update comments to be more clear in packet processing

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospfd: Fixed signed/unsigned masking of negative metrics
Andrew Certain [Tue, 4 Dec 2012 20:54:18 +0000 (12:54 -0800)]
ospfd: Fixed signed/unsigned masking of negative metrics

In the original code, negative metrics would be converted successfully by
atoi() and then converted to an unsigned int that would always compare
successfully against >= 0, leaving a large positive metric in the route map.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospfd: Fixed typo bug in ospf_vty.h:ospf_neighbor
Andrew Certain [Tue, 4 Dec 2012 20:50:23 +0000 (12:50 -0800)]
ospfd: Fixed typo bug in ospf_vty.h:ospf_neighbor

Typo bug. ospf_nbr_nbma_poll_interval_set() was being sent priority instead
of interval.

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospfd: fix argument parsing for distribute-list
Christian Franke [Tue, 4 Dec 2012 19:31:16 +0000 (11:31 -0800)]
ospfd: fix argument parsing for distribute-list

Use the correct argument for the protocol lookup in
ospf distribute-list commands.

Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospf: fix apiserver enable
David Lamparter [Tue, 4 Dec 2012 19:11:41 +0000 (11:11 -0800)]
ospf: fix apiserver enable

The ospf_apiserver_enable flag was being cleared _after_ the "-a"
command-line option set it to 1.  Move up the initialisation, so
enabling the OSPF API is actually possible.

Reported-by: Rosario Mattera <rosmattera@gmail.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>
11 years agoospf: Fix type-4 network mask to 0 per RFC
Leonard Tracy [Tue, 4 Dec 2012 19:02:35 +0000 (11:02 -0800)]
ospf: Fix type-4 network mask to 0 per RFC

The OSPF RFC (2328) states that the network mask field of a type 4
LSA "is not meaningful and must be zero".  OSPFD has been setting
the mask as /32.  This patch changes OSPFD to set the mask to 0 per
the RFC

Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com>