Chirag Shah [Tue, 15 Aug 2017 01:57:46 +0000 (18:57 -0700)]
ospfd: Fix ospfd crash in free_nexthop
Fix ANVL-OSPF-5.1 reported ospfd crash.
vertex_nexthop_free was added as valgrind reported potential
memory leak, but in some cases nexthop would not be available
freed.
The actual nexthop free is part of ospf_canonical_nexthops_free(),
upon trying to free, qfree checks mtype count becomes 0 and asserts.
Removing vertex_nexthop_free() from ospf_spf_flush_parents().
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
David Lamparter [Tue, 15 Aug 2017 09:17:36 +0000 (11:17 +0200)]
tests: fix clippy include paths / double-build
A mismatch between the make rule and the include path causes dependency
tracking to try to build the clippy.c file twice (at the same time),
which results in spurious build failures.
Fixes: #971 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Donald Sharp [Mon, 14 Aug 2017 23:06:39 +0000 (19:06 -0400)]
pimd: Ensure cleanup of S,G on ifchannel failure to create
There exists a path for ifchannel creation that if a S,G
fails to create and a corresponding *,G ifchannel is there,
the S,G will be deleted but we were leaving the S,G in the
*,G ifchannel sources list. Remove from the list in this case
Ticket: CM-17605 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Brian Rak [Mon, 14 Aug 2017 21:22:03 +0000 (17:22 -0400)]
bgpd: Check for per-peer outbound configuration, in addition to the peer-group config
When displaying the config, bgpd only checked for the existance of a peer-group prefix-list before
deciding to not display the outbound prefix-list. This commit updates the outbound prefix-list
logic to match the inbound.
Chirag Shah [Mon, 14 Aug 2017 00:41:01 +0000 (17:41 -0700)]
pimd: pim bfd vrf aware
BFD replay for all interfaces was only considering VRF_DEFAULT interface
list.
The change will walk all VRFs, interface list per VRF to register pim
neighbor with BFD.
Signed-off-by: Chirag shah <chirag@cumulusnetworks.com>
Chirag Shah [Mon, 14 Aug 2017 00:28:11 +0000 (17:28 -0700)]
pimd: Fix pim bfd config order dependecny
Upon frr restart vtysh replays pim bfd configuration
cli before pim sm command, this results in failure
of pim bfd config on the VIF as it is not pim enabled yet.
Inside pim bfd configuration, call to create PIM vif
handler if it is not created yet.
no ip pim bfd, if pim is not enabled display warning and return.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
David Lamparter [Fri, 11 Aug 2017 16:54:26 +0000 (18:54 +0200)]
lib: fix prefix list trie corruption
The specific code here needs to establish an absolute order of more
specific to less specific possible matches in a prefix list. This is
indirectly checked by an assert on insertion, because the "next best"
entry is required to be consistent even when joining multiple chains
of candidates.
Unfortunately, trie_install_fn() would insert entries too far ahead in
the chain if another entry with higher sequence number was seen. This
breaks the trie and (rightfully) triggers the assertion failure on
insert.
Fixes: #937 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Fri, 11 Aug 2017 16:54:26 +0000 (18:54 +0200)]
lib: fix prefix list trie corruption
The specific code here needs to establish an absolute order of more
specific to less specific possible matches in a prefix list. This is
indirectly checked by an assert on insertion, because the "next best"
entry is required to be consistent even when joining multiple chains
of candidates.
Unfortunately, trie_install_fn() would insert entries too far ahead in
the chain if another entry with higher sequence number was seen. This
breaks the trie and (rightfully) triggers the assertion failure on
insert.
Fixes: #937 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Fri, 11 Aug 2017 13:43:28 +0000 (15:43 +0200)]
lib: don't close stdio when running foreground
c9c8d0d ("lib: close stdin/out/err in non-terminal case") overshot its
goal and closes stdin/stdout/stderr even when a daemon is running in
foreground. That means stdout logging & exit memory reporting are both
broken.
Reported-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Fri, 11 Aug 2017 12:25:56 +0000 (14:25 +0200)]
bgpd: don't sidestep vty code
afi_header_vty_out is sidestepping the vty code, writing straight to the
output (either stdout or the obuf), which results in newline translation
not being performed.
Easiest fix is replacing it with a macro. Longer-term, I have some old
code to add "prefaces" to the vty output, planning to dig that up.
Fixes: #949 ("bgpd show running doesn't show new lines") Reported-by: Lou Berger <lberger@labn.net> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Donald Sharp [Thu, 10 Aug 2017 20:13:45 +0000 (16:13 -0400)]
pimd: Remove mroute when RPF is gone
This does three things:
1) When we get a RPF_FAILURE, remove the mroute associated
with it.
-> This way when the RPF comes back we can just add the
mroute in as part of the normal scanning process.
2) When we do a ecmp_nexthop_search return 1 when we found
something we can use.
3) Ignore output from pim_update_rp_nh
-> When we do a ecmp_nexthop_search ignore the return
code and do not attempt to gather it up to return
to the calling function. It is just ignored
and we were not taking into account the what of
multiple RP's we were looking at.
Ticket: CM-17218 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Chirag Shah [Fri, 23 Jun 2017 00:19:00 +0000 (17:19 -0700)]
ospfd: Fix conflict router-id, memory leaks
Remove assert in path of router_id_update:
Upon configuring same router-id as neighbor's
assert would cause a crash. Log a warning message
and neighborship would not come up.
Address memory leaks
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Quentin Young [Thu, 10 Aug 2017 21:01:59 +0000 (17:01 -0400)]
bgpd: don't use DECLVAR without qobj pointer
Since we don't actually have a BGP context until we enter into the
`router bgp` node, debugging commands which use DECLVAR before that
happens will fail. This is just `no debug bgp` and `no debug bgp
updates`. Instead just iterate over all bgp instances and do the deed.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Andrew Lunn [Wed, 9 Aug 2017 18:46:52 +0000 (13:46 -0500)]
eigrp: Don't dereference NULL timer in a Neighbour
Current, a eigrp_neighbor only has a t_holddown timer when in state
EIGRP_NEIGHBOR_PENDING and EIGRP_NEIGHBOR_UP. In state
EIGRP_NEIGHBOR_DOWN it could be a NULL pointer. Don't dereference the
timer when dumping the neighbour table without first checking it
exists. If it does not exist, display - instead of the remaining time.
Quentin Young [Thu, 10 Aug 2017 16:31:47 +0000 (12:31 -0400)]
lib, bgpd: fix `set ip next-hop peer-address`
This bgp-specific command had its positive form defined only in bgpd and
its negative form defined only in lib, which broke the whole rule for
other daemons.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
David Lamparter [Wed, 9 Aug 2017 18:30:34 +0000 (20:30 +0200)]
lib: some final MAC access-list fixes
- couldn't load back written configs because it was trying to parse
"any" as MAC address
- don't need special-casing in filter_match_zebra(), exact is going to
be 0 for AF_ETHERNET anyway
- some vty formatting was slightly different
- is_zero_mac now static to prefix.c
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Quentin Young [Wed, 9 Aug 2017 15:57:13 +0000 (11:57 -0400)]
lib: use load factor as hash expansion trigger
Previous strategy was to resize the hash table when the length of any
one bucket exceeded a certain size, with some logic for intelligently
stopping resizes when the gains from doing so weren't sufficient. While
this was a good idea that attempted to optimize both space and lookup
time, unfortunately under transient degenerate conditions this led to
some issues with the tables not resizing when they should have,
harming performance. The resizing restriction was lifted, but this had
the result of exacerbating degenerate behavior and caused out of memory
conditions.
This patch changes the hash expansion criterion to be based on the
number of elements in the table. Once the # of elements in the table
exceeds the number of buckets, the table size is doubled. While the
space efficiency of this method decreases relative to the perfectness of
the hash function, at least this strategy puts the table performance
squarely in the hands of the hash function.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Andrew Lunn [Wed, 9 Aug 2017 16:56:13 +0000 (11:56 -0500)]
eigrpd: Add missing install_element for debug eigrp transmit
debug eigrp transmit command is added to the ENABLE_NODE list, but not
CONFIG_NODE. As a result the command cannot be used in the
configuration file. Add the missing call.
Donald Sharp [Wed, 9 Aug 2017 13:13:33 +0000 (09:13 -0400)]
zebra: Pay attention to metric from kernel
When the linux kernel adds/deletes routes, the
metric is important, but our routing protocols
add/delete in a slightly different manner,
so allow kernel metrics to match so that our
rib matches the kernel's fib.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
David Lamparter [Wed, 9 Aug 2017 10:37:45 +0000 (12:37 +0200)]
zebra: fix pseudowire code re. upstream changes
- VTY_NEWLINE is out
- thread API changed with the extra arg
- struct rib got renamed to struct route_entry
- MPLS_NO_LABEL was removed
- RB-tree implementation has some extra args
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
In some scenarios, it's possible to send a Label Withdraw to a neighbor
and not receive a corresponding Label Release right away. This can happen
during reconvergence after a network failure or configuration change.
When this happens, the list of upstream mappings of a given FEC might
not be empty even after sending a Label Withdraw to all neighbors. This
situation holds until all neighbors either send a Label Release or are
torn down (e.g. keepalive timeout).
With that said, we shouldn't check for 'RB_EMPTY(&fn->upstream)'
in lde_kernel_update() because it can prevent ldpd from sending label
mappings in such circumstances. This check was introduced to avoid sending
the same label mapping more than once to the same neighbor, but we need
to remove this optimization for now until we find a better solution (which
probably involves refactoring the whole zebra<->ldpd communication).
While here, add a new debug message in lde_send_labelmapping() which
can aid in troubleshooting label problems in the future.
Renato Westphal [Fri, 30 Jun 2017 15:19:39 +0000 (12:19 -0300)]
ldpd: integrate with the pseudowire manager in zebra
If we receive a notification from zebra indicating that the installation
of a pseudowire has failed (e.g. no reachability), send a PW Status
notification to the remote peer (or a Label Withdraw if the remote peer
doesn't support the PW Status TLV).
Renato Westphal [Thu, 8 Jun 2017 23:29:12 +0000 (20:29 -0300)]
zebra: add new flag to detect nexthop label updates
With the introduction of the pseudowire manager, the NHT tracking code
needs to detect label updates as well.
Create a specific nexthop flag for that. We can't reuse the
RIB_ENTRY_NEXTHOPS_CHANGED flag for this porpose because this flag is
always cleared and reevaluated in rib_process(), setting it outside that
function is a nop.
Renato Westphal [Fri, 30 Jun 2017 15:26:04 +0000 (12:26 -0300)]
zebra: add nexthop tracking for pseudowires
If the remote end of a pseudowire becomes unreachable (no route or an
unlabeled route), then it must be uninstalled. In the same way, when
the remote end becomes reachable, the pseudowire must be installed.
ßingen [Mon, 15 May 2017 15:09:28 +0000 (17:09 +0200)]
zebra: add pseudowire manager
Base framework for supporting MPLS pseudowires in FRR.
A consistent zserv interface is provided so that any client daemon
(e.g. ldpd, bgpd) can install/uninstall pseudowires in a standard
way. Static pseudowires can also be implemented by using the same
interface.
When zebra receives a request to install a pseudowire and the installation
in the kernel or hardware fails, a notification is sent back to the
client daemon and a new install attempt is made every 60 seconds (until
it succeeds).
Support for external dataplanes is provided by the use of hooks to
install/uninstall pseudowires.
ßingen [Tue, 1 Aug 2017 09:38:19 +0000 (11:38 +0200)]
ospf: Fix segfault if compiled with DEBUG
If OSPF_LS_REFRESH_TIME is 60, min_delay in ospf_refresher_register_lsa
function (ospf_lsa.c) would be negative, so index (which is unsigned)
would be out of range, causing a segfault.