Quagga reload handles deletes of entire context by issuing a "no.." on the
entire context itself instead of deleting each individual line of the context.
However, this doesn't work when the context is "interface" since its not
allowed to do "no interface <ifname>" inside quagga. So special case this by
deleting each individual line of the context.
If users specify "ip prefix-list FOO permit 1.2.3.4/24", running config
displays that line as "ip prefix-list FOO seq 5 permit 1.2.3.4/24", which
causes reload to delete the running config line and add back the one in
the config.
Dinesh G Dutt [Fri, 6 Jan 2017 02:49:13 +0000 (18:49 -0800)]
tools: Don't overwrite Quagga.conf on reload, unless user specified.
Ticket: CM-14059
Reviewed By: CCR-5524
Testing Done: the usual
At some point in the 3.x release cycle, it was decided to overwrite the
user's Quagga.conf configuration file with the output of running config
when the user did a quagga reload. This is problematic for several reasons
such as: losing user-specified comments, upsetting network automation
scripts which think some thing has changed all the time from the specified
config etc.
This patch fixes this issue by not overwriting the Quagga.conf file unless
the user specifies it via an additional option, or the file being used as
input to quagga reload isn't the default configuration file (incl. path).
radhika [Fri, 6 Jan 2017 20:54:25 +0000 (12:54 -0800)]
bgpd, zebra: Fix for ignored non-default VRF single-hop BFD status messages in Quagga
Ticket: CM-13425
Reviewed By: Donald, Kanna
Testing Done: Unit, Min tests, PTM Smoke and Nightly, BGP Smoke
Issue: BFD status up/down not reflected in the Quagga for non-default VRF single-hop BFD sessions.
Root Cause: PTM doesn’t keep track of VRF for Single hop BFD sessions since they are interface-based sessions. The status up/down messages to the quagga for single hop sessions do not have VRF information. In zebra daemon, the interface search based on the interface name extracted from the BFD status message is done across all VRFs. So, the search does not fail in zebra daemon. But, the interface search in bgpd/ospd is done per vrf and default VRF is used for search if no VRF is sent in the status message. So, the search fails and the BFD status changes are ignored.
Fix: The VRF information is extracted from the interface if VRF is not sent in the BFD status messages in zebra daemon and passed to bgpd/ospfd. The interface search will not fail since the appropriate VRF is passed to bgpd/ospfd and BFD satus changes are not ignored.
Dinesh G Dutt [Tue, 13 Dec 2016 10:46:52 +0000 (02:46 -0800)]
tools: Fix unnecessary routing perturbations due to old style config
Ticket: CM-14060
Reviewed By:
Testing Done:
There are two harmful problems (cause routing changes in the network) with the
2.5.x style config:
one with the old style specification of "multipath as-relax", and
the other with ip import-table, used by redistribute neighbor
In 2.5, we had the user specify 'no-as-set' as the suffix to
'bgp bestpath as-path multipath relax' to avoid quagga's default behavior
which'd cause weird routing problems. However, in 3.x, we made 'no-as-set' as
the default, and so its neither required to specify it nor is it shown in the
running config. This means when we do quagga reload, we remove the multipath
as-relax line and add it back with the no-as-set line. This causes all BGP
sessions to be reset.
The problem with the "ip import-table" is that it causes us to unimport the
routes and then add it back again, causing routing prefix changes throughout
the network, potentially causing blackholing of traffic.
This fix addresses both these issues and avoids the unnecessary routing blips.
Fixes a couple off-by-ones introduced in previous commit.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
[cherry-picked from master d1e4a518e6f55ccf80c67b58d16eeb1cbf5923e3] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Lou Berger [Sun, 15 Jan 2017 16:58:06 +0000 (11:58 -0500)]
bgpd: partial revert of vpn/encap safi show changes (Issue #14)
To remove commands duplicated in bgp_mplsvpn/_encap
Also until vpn/encap specific show pieces are merged into
generic afi/safi show.
Philippe Guibert [Tue, 17 Jan 2017 16:51:40 +0000 (17:51 +0100)]
bgpd: avoid recalculating as_val value in str2prefix_rd
This is an optimisation that consists in avoiding calling twice atol()
function when converting an ext. community to an AS4 byte or a standard AS byte value.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd: fix nexthop comparison for nexthop vpnv6 attribute
As nexthop attribute for vpnv6 also contains a blank RD and a blank tag,
the IPv6 address length increases from 16 to 24 bytes. The same was
observed for vpnv4 nexthop, but was missing for VPNv6.
The same is done for martian nexthop debugging.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
David Lamparter [Thu, 15 Dec 2016 23:14:55 +0000 (00:14 +0100)]
tests: fix mis-fixed format string
PRIu64 is "u", we need "x", so PRIx64...
Signed-off-by: David Lamparter <equinox@opensourcerouting.org> Cc: Donald Sharp <sharpd@cumulusnetworks.com>
[cherry-picked from master eed831e065694b3746896b126f6ad47548ea9dc0]
David Lamparter [Fri, 13 Jan 2017 10:23:18 +0000 (11:23 +0100)]
tests: ignore stderr for expect
expect redirects both stdout and stderr to its input. This causes
serious problems when libzebra prints log messages to stderr, which are
then asynchronously inserted in the middle of lines of stdout test
output. Ultimately this makes testbgpmpattr fail on FreeBSD.
(The stdio buffering seems to be slightly different on FreeBSD,
triggering the bug.)
Just ignore stderr for expect.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Lou Berger [Fri, 6 Jan 2017 15:50:31 +0000 (10:50 -0500)]
bgpd: restore some missing afi/safi commands (Issue #14)
Added defines and parse utility functions
Fix vty code that treated vpn&encap as AFIs
and some other related vty printing/handline issues
Note: Includes branch specific changes (due to new parser)
Donald Sharp [Thu, 5 Jan 2017 17:52:18 +0000 (12:52 -0500)]
ospfd: Stop attempt to read beyond end of argv
When unconfiguring certain commands in ospf, you can
run into situations where we attempt to read beyond
the end of a argv[] vector created. On certain platforms
this will crash it.
Ticket: CM-14090 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Thu, 5 Jan 2017 17:44:23 +0000 (12:44 -0500)]
lib: Stop potential uninitialized memory access
VRF_UNKNOWN = MAX_INT16_T
The vrf macros to determine where in the bitmap something belongs
assume that the valid values of a vrf are 0 - (MAX_INT16 - 1)
so when they attempt to determine where to look in the bitmap
for VRF_DEFAULT, we can get invalid reads of memory.
This happens because bgp can create vrf's with VRF_UNKNOWN
when we get configuration for a vrf before we've been actually
created in zebra.
Ticket: CM-14090 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Wed, 4 Jan 2017 13:03:14 +0000 (08:03 -0500)]
lib: Update ZAPI to version 4 and HEADER_MARKER to 254
Update the ZEBRA_HEADER_MARKER to 254. This will differentiate
ourselves from Quagga. Zebra should not listen to people not
properly using the right programs now.
Update the ZAPI version number to 4.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Don Slice [Fri, 16 Dec 2016 16:53:30 +0000 (08:53 -0800)]
ospf6d: resolve problem with area range lsid creation
The problem reported was that routers downstream from the ABR would have
prefixes in the IPv6 rib that should have been summarized. Testing showed
that the prefixes were absent in the lsdb but not removed from the rib.
The problem (and others) stemmed from determining the link-state id to use
for the area-range statement only from other entries in the range-table. Since
the area range statement creates inter-prefix LSAs (summaries) which are in all
aspects identical to other inter-prefix LSAs, the number space for the lsid
needs to be unique across all inter-prefix LSAs, not just unique between area
range statements. This fix removes the use of range-table specific lsids and
acquires the lsid just as any other inter-prefix LSA.
Ticket: CM-13626 Signed-off-by: Don Slice
Reviewed By: CCR-5489
Testing Done: Manual testing, repeated runs of the test that previously failed,
ospf-smoke
Donald Sharp [Mon, 12 Dec 2016 12:59:16 +0000 (07:59 -0500)]
lib: Partial Revert of 4ecc09d and modify zclient connect behavior
Commit 43cc09d has been shown to cause several issues with clients
connecting.
Partial revert, since I wanted to keep the debug logs added
for that commit, as well remove the piece of code that
stops attempting to connect to zebra. If we've failed
a bunch of times, there is nothing wrong with continuing
to do so once every 60 seconds. I've debug guarded
the connect failure for those people running bgp
without zebra.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Lou Berger [Fri, 4 Nov 2016 13:30:07 +0000 (09:30 -0400)]
rfapi: pickup recent changes
expose bgp_rfapi_get_group_by_lni_label for use by rfp
add EVPN Ethernet Tag (VID) RT
ensure as is init'ed
fix spelling of information
G. Paul Ziemba [Fri, 4 Nov 2016 16:47:36 +0000 (09:47 -0700)]
BGP: deal with vnc related string ambiguities (issue #9)
- "redist foo" parsing modified to check for foo==vnc and foo==vnc-direct
instead of just leading 'v' character
- string designating ZEBRA_ROUTE_VNC_DIRECT changed from "vpn" to "vnc-direct"
- route_types.pl parser recognizes 7th field to restrict availability
of a route type in the redist command to specific daemons
- restrict "vnc-direct" to bgpd only (doesn't make sense elsewhere)
- vnc documentation updated to match
Renato Westphal [Fri, 16 Dec 2016 12:48:37 +0000 (10:48 -0200)]
zebra: fix FIB route updates on *BSD
On *BSD, we update a route in the FIB by removing the old one and then
installing the new version.
With that said, on kernel_route_rib() we need to provide a pointer to
both the old version and the new version of the route.
We were, however, passing a pointer to the new version to both the
'old' and 'new' parameters. This is not a problem on Linux, which uses
NLM_F_REPLACE to update routes, but it breaks route updates on *BSD
because the 'old' parameter points to a route that is not installed in
the kernel. The kernel_route_rib() function then fails to uninstall the
supposedly 'old' route and can fail to install the new version as well if
the kernel doesn't support ECMP (e.g. FreeBSD with default configuration).