build: include git infoIf enabled with --with-pkg-gitversion on ./configure, this will append
git version strings and branch information at the following places:
- overall version number: 0.99.21-g0123456
- login motd and show version: tag information + git id + branches
Sample output:
Hello, this is Quagga (version 0.99.21-g14b49ad-dirty).
Copyright 1996-2005 Kunihiro Ishiguro, et al.
This is a git build o...
zebra: include intf when sending IPv4 nexthop to FPM* zebra/zebra_fpm_netlink.c
Change the zebra FPM code to include an interface index when
encoding a nexthop even if the protocol only provided a gateway
address (e.g, NEXTHOP_TYPE_IPV4).
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
doc: add blurbs on zebra FPM interface and commandsUpdate documentation with some text on the zebra interface to the
optional Forwarding Path Manager component, and the related cli
commands.
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: add module to communicate routes to FPMEnhance zebra to send routes to the (optional) Forwarding Path Manager
component using the interface defined by fpm/fpm.h.
* configure.ac
- Add --enable-fpm flag.
The FPM-related code in zebra is activated only if the build is
configured with '--enable-fpm'.
- Add HAVE_NETLINK automake conditional.
This allows us to conditionally build netlink-dependent C code.
...
fpm: Add public header for Forwarding Plane ManagerThe Forwarding Plane Manager (FPM) is an optional component that may
be used in scenarios where the router has a forwarding path that is
distinct from the kernel, commonly a hardware-based fast path. It is
responsible for programming forwarding information (such as routes and
nexthops) in the fast path.
In Quagga, the Routing Information Base is maintained in the 'zebra'
infrastructure daemon....
lib: bring in sys/queue.h from FreeBSD treeBring in sys/queue.h from the FreeBSD tree as lib/queue.h.
This header implements lists of various flavors using inline
linkages. The imported file corresponds to SVN revision 221843 (url
below) and is available under the terms of the New BSD license
(3-clause).
http://svnweb.freebsd.org/base/head/sys/sys/queue.h?revision=221843
Signed-off-by: Avneesh Sachdev <avneesh@opensourcerouting.org...
zebra: extern/extract some functions from rt_netlink.c* zebra/{rib.h,zebra_rib.c}
Add nexthop_type_to_str(), which returns a human-readable string
corresponding to a nexthop type.
* zebra/rt_netlink.[hc]
- Add new header file that exposes some existing and new
netlink-related functions from rt_netlink.c to the rest of
zebra.
addattr32
addattr_l
rta_addattr_l
nl_msg_type_to_str (new)
...
zebra: add iterator for walking all tables in RIB* lib/zebra.h
Add macro ZEBRA_NUM_OF, which returns the number of elements in a
static array.
* zebra/rib.h
Add the rib_tables_iter_t structure and associated functions,
which allow one to walk all tables in the rib.
* zebra/zebra_rib.c
- Add vrf_id_get_next() to retrieve the first VRF id (if any) that
is greater than a given VRF id.
- Add rib_tables_iter...
zebra: add way to determine VRF/AFI/SAFI of tableAdd some code that allows us to determine which VRF and AFI/SAFI a
given RIB table corresponds to.
* zebra/rib.h
Add rib_table_info_t structure, which contains information about
the VRF, AFI and SAFI that a table is for.
* zebra/zebra_rib.c
- Add the vrf_table_create() function, which creates a table and
sets its 'info' pointer to a newly created rib_table_info_t.
...
zebra: add structure to hold per-prefix state in RIBAdd the rib_dest_t structure to hold per-prefix state in the routing
information base. This gives us an appropriate place to maintain the
queueing state of a route_node. Queuing state was previously being
stored on the first rib in the list of ribs hanging off the
route_node.
* zebra/rib.h
- Add new structure rib_dest_t.
- Remove the rn_status field from 'struct rib', it is no long...
bgpd: Fixed out-of-date commentWhen going through the code to write the documentation for local-as,
I discovered that one of the comments was out-of-date.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd: add replace-as modifier for BGP neighborAdded replace-as modifier for BGP neighbors when using
local-as. If the replace-as modifier is specified, only the
replacement AS as specified by the local-as modifier is
prepended to the AS_PATH, not the process's AS.
In bgp_attr.c, I decided that
if (peer->change_local_as) {
/* If replace-as is specified, we only use the change_local_as when
advertising routes. */
if( ! CHECK_FLAG ...
lib: Implement monotonically increasing clock for Darwin.There is no Posix CLOCK_MONOTONIC in Darwin, but monotonically
increasing clock can be implemented using mach_absolute_time().
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: clock_gettime() -> quagga_gettime() conversion.* isisd/isis_spf.c: Use portable quagga_gettime() like the rest of
the Quagga code.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd: remove some buggy extra ';' symbols. * ospfd/ospf_apiserver.c: extra ; causing lookup to fail always
* ospfd/ospf_lsa.c: extra ; causing debug output even when disabled
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
build: check actually-used BSD link state fieldsifi_link_state missing in OS X. There could be other *BSD's that haven't
implemented it and possibly affects older implementations.
The existing HAVE_BSD_LINK_DETECT configure.ac check is only confirming
the link state detection using ifmediareq.ifm_status found in
<net/if_media.h>. This is the link state detection used in
zebra/ioctl.c. Later, *BSD redefined struct if_data in <net/if.h> and
i...
zebra: kernel_socket: fix overflow in RTA_ADDR & RTA_ATTRIn zebra/kernel_socket.c, copying sockaddr from *_msghdr:
There are really 2 different lengths that need to be determined.
1) the length required to point to the next sockaddr in the mesg
buffer which might include any required padding and
2) the actual length of the sockaddr data that needs to be copied
into the destination field.
They may or may not be the same value.
Sizeof s...
zebra: kernel_socket: fix 64bit MacOS X alignmentIn OS X 10.7 zebra crashed on invalid execution address.
sockaddr padding in *_msghdr is observed to be 4 bytes in 64bit OS X.
The ROUNDUP macro assumed alignment on sizeof(long) which
allocates 8 bytes on 64bit systems, 4 bytes on 32bit systems
which is true for BSD generally.
Test for Apple and use sizeof(int) which allocates 4 bytes on 32 & 64bit
systems.
Tested on 64bit OS X 10.7, FreeB...
doc: update installation instructionsconfigure parameters have changed quite a bit, several options are
enabled by default now and there's --disable-tests. Update
documentation to match.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
build: compile tests/ by defaultBroke the tests again... let's just build them by default so it's easier
to notice. If anyone doesn't want to build tests, there's
--disable-tests.
NB: tests will be neither run nor installed.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
tests: fix missing array_size() include * tests/test-sig.c: add #include "lib/memory.h" to get array_size()
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd: CVE-2012-1820, DoS in bgp_capability_orf()An ORF (code 3) capability TLV is defined to contain exactly one
AFI/SAFI block. Function bgp_capability_orf(), which parses ORF
capability TLV, uses do-while cycle to call its helper function
bgp_capability_orf_entry(), which actually processes the AFI/SAFI data
block. The call is made at least once and repeated as long as the input
buffer has enough data for the next call.
The helper functio...
build: reorder libraries to address linker errorThe linker on some systems (for example, Ubuntu 12.04 LTS x86_64)
appears to be sensitive to the order in which libraries are
specified. On these systems, if a library 'A' depends on a library
'B', it has to be specified before 'B' when linking an executable.
* zebra/Makefile.am: Make sure LIBCAP comes after libzebra.
* tests/Makefile.am: Ensure libm comes after libbgp.
Signed-off-by: Av...
lib: treat OSX as BSD for IP_HDRINCL (BZ#739)Mac OS X needs HAVE_IP_HDRINCL_BSD_ORDER defined like BSD. If it's not
defined, it'll fail like this:
*** sendmsg in ospf_write failed to 224.0.0.5, id 0, off 0, len 64,
interface en0, mtu 1500: Invalid argument
Which is caused by reordering iph->ip_len in
sockopt_iphdrincl_swab_htosys.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
*: use array_size() helper macroUse the array_size() helper macro. Replaces several instances of local
macros with the same definition.
Reviewed-by: Scott Feldman <sfeldma@cumulusnetworks.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: don't overrun list of protocolsisisd currently has a list of supported protocols as a fixed array of
size 4. this can be overran, leading to an overwrite of the ipv4_addrs
pointer.
* isisd/isis_pdu.c: don't accept more protocols than there's space for
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: don't process invalid prefixes from TLVsit's possible to feed invalid prefixes (1.2.3.4/40 or dead::beef/200) on
IS-IS. if this is not checked, it will later cause an assert in
processing. let's simply abort processing the TLV if the prefix is
invalid.
* isisd/isis_tlv.c: check prefix lengths for validity
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: pull up invalid prefix assert()processing invalid prefixes causes isisd to assert() or otherwise
misbehave in ip_masklen/apply_mask. pull up the assert() to indicate
better there's broken data in isisd's LSDB.
* isisd/isis_spf.c: assert() prefix lengths
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
isisd: fix null pointer dereference in send_lsp() * isisd/isis_pdu.c: (send_lsp) Handle case where there are no LSPs
on the LSP transmission queue. This can happen if, for instance,
the queue is cleared because of protocol events before the
send_lsp thread gets a chance to run.
isisd: tighten checks on ISIS pdu length * isisd/isis_pdu.c: Fix problem where isisd would crash if it
received a LAN IIH with the 'pdu length' field set to zero.
Similar problems can occur in parsing other ISIS PDUs as well --
check that the PDU length in an ISIS hello, LSP or SNP packet is
at least as big as the size of the respective fixed header.
lib: improve sanity checks in stream_set_endp() * lib/stream.c: (stream_set_endp) Add checks to make sure that the
supplied 'endp' is within the 'size' of the stream, and that the
current read pointer 'getp' is not beyond the specified 'endp'.
ospfd: respect max-metric over configured cost for summary LSAsISSUE
When max-metric router-lsa administrative is invoked on an ABR created with...
area <area> range <addr/mask>
the summary LSAs are sent out with 65535 (max-metric) added to the normal cost.
When max-metric router-lsa administrative is invoked on an ABR created with...
area <area> range <addr/mask> cost <cost>
the summary LSAs are sent out with <cost> (the max-metric is ignored). This
se...
ospfd: ABR algorithm not propagating MAXAGE LSAs into areaWhen a range (or sub-range) is deleted, the area is notified by propagating a
MAXAGE LSA. This LSA stays in the database for a while to both insure
propagation as well as in the off chance that it's useful in the near future.
Unfortunately, the ABR algorithm was treating these MAXAGE LSAs as unchanged and
not propagating them within the areas.
Signed-off-by: JR Rivers <jrrivers@cumulusnetwor...
ospfd: blackhole route removal for area rangeISSUE
When an area range is created in which there the sub-area has routes that are
smaller than the range, an ABR creates a blackhole route to cover the range.
When the range is removed, the blackhole route is not removed.
--A----B----C---
B is an ABR with A in area 1 and C in area 0. If A advertises `10.2.0.0/30` and
`10.2.0.4/30` and B is configured with `area 0.0.0.1 range 10.2.0.0/29` ...
lib: improve fletcher checksum validationOVERVIEW
The checksum used in OSPF (rfc2328) is specified in rc905 annex B. There is an
sample implementation in rfc1008 which forms the basis of the quagga
implementation. This algorithm works perfectly when generating a checksum;
however, validation is a bit problematic.
The following LSA (generated by a non-quagga implementation) is received by
quagga and marked with an invalid checksum;...
zebra: make static routes respect table settingMake static routes respect non-default routing tables.
BEFORE PATCH
------------
! in zebra.conf
table 1
! add static route
vtysh> ip route 10.0.0.0/30 eth0
cumulus@net-top0:~$ ip route
default via 192.168.0.2 dev eth0
10.0.0.0/30 dev eth0 proto zebra
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.15
! nothing in table 1
cumulus@net-top0:~$ ip route show table 1
AFTER P...
Revert "ospfd: Do not fall back to intervening router."This reverts commit 9289c6ff55cd96c943d23e43fc9e5f987aa965ed.
The commit reverted an earlier change which was fixed a bug that caused
black-holes to remote destinations with multiple paths, that could occur
during convergence. Overall, the previous code is more correct.
lib/table: add route_table_get_next() and iterator * lib/table.[ch]
- Add a function (route_table_get_next()) to get the route_node in
a tree that succeeds a given prefix in iteration order.
This allows one to reliably walk nodes in a tree while allowing
modifications, and is useful for achieving scale and
performance. Other approaches are also possible -- the main plus
point of this one is that it does not...
bgpd: make bgp_table a wrapper around table libraryMake the BGP table code a thin wrapper around the table implementation
in libzebra.
* bgpd/bgp_table.[ch]
- Use the ROUTE_NODE_FIELDS macro to embed the fields of a
route_node in the bgp_node structure.
- Add a route_table field to the bgp_table structure.
Initialize the route_table with a delegate, such that the nodes
in the table are bgp_node structures.
-...
lib: prepare table code for reuse by bgp_table * lib/table.[ch]
- Add a macro (ROUTE_NODE_FIELDS) that expands to all the fields
of a route_node structure.
- Add the route_table_delegate_t structure, a function vector
which allows clients to customize the behavior of one or more
tables.
The delegate currently contains the 'create_node' and
'destroy_node' functions, and hence enables a table to use ...
lib: bring some changes over from bgp_table to table * lib/table.c
- Maintain table node count. Expose it via the route_table_count()
function (from revision cbdfbaa5).
- route_unlock_node(): Add assertion (from revision 228da428).
- route_table_free(): Make static and fix up cleanup code (from
revision 228da428).
- route_node_delete(): Change to be static.
- Add 'const' qualifier in a couple places.
Signed...
build: fix extract.pl for cross compilationextract.pl should invoke the C preprocessor for the target system, not the
host.
* vtysh/extract.pl.in: use @CPP@ to get target cpp
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ripd: clear sockaddr_in before usingripd_create_socket() failed in bind() on Mac OS X 10.7 since there was garbage
in unused fields of struct sockaddr_in.
* ripd/ripd.c: zero out struct sockaddr_sin from before filling.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
build: fix autoconf multicast check on OpenBSDFix the "BSD struct ip_mreq hack" autoconf test to work with OpenBSD.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
build: correct libtool parameter used within MakefilesThis corrects the parameters passed to libtool when linking
the shared libraries. The paramter name is -version-info not
-version.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
ospfd: Do not fall back to intervening router.The patch in bug 330 did two things. It add a return value
whether ospf_nexthop_calculation() failed or not and also
moved the return stmt for 16.1.1 para 5 so now SPF
will fallback to the intervening router when no back links are found
by 16.1.1 para 5. This is wrong and can potentially create black holes
or routing loops according to Dave Katz and Acee Lindem at ospf@ietf.org
Even if the cur...
ospfd: use ZEBRA_NEXTHOP_IPV4_IFINDEXOSPF really needs to specify interface in its routes. Otherwise
ospf may change the wrong route.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
[fixed up some whitespace errors, split patch in two]
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>