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>
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>
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>
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>
guile: remove
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>
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>
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).
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>