lib: treat realloc of null pointer as alloc Now use zalloc rather than alloc with null. Fixes issue seen in bgp check tests.Signed-off-by: Lou Berger <lberger@labn.net>
lib: fix bookkeeping for libreadline malloc()sWhen libreadline is used, we mistakenly mix in strdup() done in
libreadline with Quagga's lib/memory bookkeeping/counting, leading to
counter underflows on MTYPE_TMP.
Signed-off-by: Lou Berger <lberger@labn.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: make RTF_LLINFO optional to fix FreeBSDSigned-off-by: Lou Berger <lberger@labn.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
zebra: wire up "debug zebra packet detail"There was no way to actually set ZEBRA_DEBUG_DETAIL, even though some
debug output was conditional to it. Add CLI command.
Signed-off-by: Lou Berger <lberger@labn.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib, bgpd, tests: Refactor FILTER_X in zebra.hlib/zebra.h has FILTER_X #define's. These do not belong there.
Put them in lib/filter.h where they belong.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib, bgpd: Fixup afi_t to be an enum and cleanup zebra.hThis code change does two things:
1) Removes ZEBRA_AFI_XXX #defines since they were redundant information
2) Switches afi_t to an enumerated type so that the compiler
can do a bit more compile time checking.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
docs: Update bgpd docs, inc. on decision process, and with a section on MED.* bgpd.texi: Document the -l argument. Update the 'BGP decision process' table
to reflect what /actually/ is implemented. Add docs on 'compare-routerid' in
the bestpath section.
Add a section on MED, to highlight the issues it has by default, and to
highlight that it is terminally broken for its original purpose in many
modern iBGP topologies.
Mention the potential workarounds and...
bgpd: make bgp_info_cmp and multiple-path decision logic more regular* bgp_route.c: (bgp_info_cmp) This function is supposed to return a
preference between the given paths, and does so as binary either or. When
mpath was added, the binary return value was left as is and instead an out
parameter 'paths_eq' was added to indicate the mpath-equality case. It's
a bit odd, as is the resulting logic in the caller.
Regularise things again by making the func...
bgpd: bgp_scan shouldn't queue up route_nodes with no routes for processing* bgp_nexthop.c: (bgp_scan) There is little point queueing an rn with no routing
information for processing.
* bgp_route.c: (bgp_process) Do nothing on rn's with no routes. Add an assert
for now, to try catch any other cases, but prob should be removed.
(bgp_best_selection) rn with no routes == finish early.
bgpd: Check capability falls on right multiple of size, where possible.* bgp_open.c: (cap_modsizes) Table of multiple a capability's data size
should fall on, if applicable.
(bgp_capability_parse) Check the header lengthcap_modsizes should fall on.
Inspiration from Cumulus bgpd-capability-cleanup.patch patch, with a
slightly different approach.
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd: OPEN parse errors should send OPEN_ERR and UNSPECIFIC subcode.CEASE NOTIFICATION for OPEN parsing errors seems, to my reading of RFC4271
§6.2 to be incorrect.
* bgp_packet.c: (bgp_open_receive) OPEN/UNACEP_HOLDTIME is not an
appropriate error subcode if bgp_open_option_parse returns an error. Set
it to "Unspecific". Where a more specific subcode is appropriate, then lower
level should send that.
* bgp_open.c: (bgp_open_option_parse) Malformed OPEN...
bgpd: Fix VU#270232, VPNv4 NLRI parser memcpys to stack on unchecked lengthAddress CERT vulnerability report VU#270232, memcpy to stack data structure
based on length field from packet data whose length field upper-bound was
not properly checked.
This likely allows BGP peers that are enabled to send Labeled-VPN SAFI
routes to Quagga bgpd to remotely exploit Quagga bgpd.
Mitigation: Do not enable Labeled-VPN SAFI with untrusted neighbours.
Impact: Labeled-VPN SAFI i...
zebra: Fix solaris build issueThe number of parameters to rib_add_ipv4 has been increased.
Submitter of original patch failed to modify solaris code path.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd: Implicit updates in BGP may require a withdrawal from zebra RIB* J Yu <jackiesyu@hotmail.com> noted a problem with bgpd of routes not
having their nexthop updated correctly.
Martin Winter <mwinter@opensourcerouting.org> pinned this down to the
case where a BGP route is updated from one with a valid nexthop to an
invalid next-hop, using a test tool. Once the problem occurs, the incorrect
route may remain, even after further UPDATEs, so long...
isisd, lib: Fix some more compiler warningsA couple compiler warnings snuck in from the last
round of work being looked at. This cleans them up
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra: Cleanup RTADV defineThe RTADV define was not being set correctly or consistently.
Make the code consistent with our HAVE_IPV6 define.
If the user wants to explicitly turn it off then they should
run --disable-rtadv from the configure cli
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
isisd: fix misleading wording in logThe changed messages are actually located before transmission is
attempted. Therefore, the tense is somewhat misleading, especially
since transmission may not always succeed.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
isisd: provide more detailed log for failed address removalSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
isisd: fix assertion in LSP refresh timer calculationSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
isisd: add a slight delay to lsp_regenerate_scheduleisisd implements a holdoff interval and will refrain from regenerating
an lsp if the difference between the current time and its last refresh
is less than the holdoff interval. Instead, it will schedule a timer
to regenerate the lsp after the holdoff interval has passed.
This implementation has one disadvantage in the case where there is a
succession of calls to lsp_regenerate_schedule. In suc...
isisd: initialize circuit to match area is_typeNew circuits should be initialized to match the is_type
of their area. Also add an additional check to make sure
that no IIHs are sent for levels which are not enabled.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
isisd: do remove ipv6 routes from ZebraWe can abort isis_zebra_route_del_ipv6 if the route in question has
ISIS_ROUTE_FLAG_ZEBRA_SYNCED unset, meaning it's not in the kernel.
Aborting the function if the flag is set prevents us from removing
any routes.
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
isisd: don't corrupt memory for long hostnamesSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
isisd: annotate some function arguments with constSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib: don't have log functions change errnoSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd: Update dump to allow Extended Time FormatAllow the bgp dump functionality to handle the Extended Time format
as specified in RFC 6396.
Fixes a segmentation fault with multiple dump rules as well.
Signed-off-by: Alexis Fasquel <alexis@pch.net>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
lib: add function to get precise remaining time of timer threadSigned-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
ripd, isisd: fix warnings that make the build failThese issues have been found by running buildtest.sh
using GCC 5.2.0 and Clang 3.7.0
Fixes pointer checks that can never be null
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Tested-by: NetDEF CI System <cisystem@netdef.org>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra: Fix change of distance on ipv6 route creating duplicate routesIf you enter:
ipv6 route 2002:44:44:44::44/128 swp1 4
ipv6 route 2002:44:44:44::44/128 swp1 99
You get:
host-111# show ipv6 route
Codes: K - kernel route, C - connected, S - static, R - RIPng,
O - OSPFv6, I - IS-IS, B - BGP, A - Babel, T - Table,
> - selected route, * - FIB route
S 2002:44:44:44::44/128 [99/0] is directly connected, swp1
S>* 2002:44:44:44::44/128 [4/0] is directly connected,...
zebra: combine static_ipv[4|6]_nexthop_same into one functionCombine the static_ipv[4|6]_nexthop_same into static_nexthop_same.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra: Combine static_install_ipv[4|6]Combine the static_install_ipv[4|6] function calls into
static_install_route.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra: Collapse struct static_ipv[4|6] into struct static_routeThe 'struct static_ipv4' and 'struct static_ipv6' structures
are essentially the same. Collapse them into one data structure
'struct static_route'.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra: implement per-route mtu handlingThis commits allow overriding MTU using netlink attributes on
per-route basis. This is useful for routing protocols that can
advertice prefix specific MTUs between routers (e.g. NHRP).
Signed-off-by: Timo Teräs <timo.teras@iki.fi>