Renato Westphal [Thu, 31 Aug 2017 20:28:05 +0000 (17:28 -0300)]
zebra: fix detection of duplicate system routes
Fixes the following bugs:
1)
% ip -6 route add 5000::/64 via 3000::2
% ip -6 route replace 5000::/64 via 3000::2
% ip -6 route replace 5000::/64 via 3000::2
% ip -6 route replace 5000::/64 via 3000::2
% ip -6 route replace 5000::/64 via 3000::2
%
% vtysh -c "show ipv6 route"
[snip]
K * 5000::/64 [0/1024] via 3000::2, rt1-eth0
K * 5000::/64 [0/1024] via 3000::2, rt1-eth0
K * 5000::/64 [0/1024] via 3000::2, rt1-eth0
K * 5000::/64 [0/1024] via 3000::2, rt1-eth0
K>* 5000::/64 [0/1024] via 3000::2, rt1-eth0
2)
% ip -6 route add 7000::/64 via 3000::2
% ip -6 route replace 7000::/64 via 3000::3
% ip -6 ro | grep 7000
7000::/64 via 3000::3 dev rt1-eth0 metric 1024 pref medium
%
% vtysh -c "show ipv6 route"
[snip]
K * 7000::/64 [0/1024] via 3000::3, rt1-eth0
K>* 7000::/64 [0/1024] via 3000::2, rt1-eth0
NOTE: the check for ROUTE_ENTRY_REMOVED was redundant as it was already
performed at the beginning of the loop.
Renato Westphal [Thu, 31 Aug 2017 23:36:14 +0000 (20:36 -0300)]
zebra: remove refcnt from the route_entry structure
This reference counter was introduced in 2001, apparently to solve a
problem with connected routes being added/removed multiple times. The RIB
code changed a lot since then, and giving the current callers of rib_add()
and rib_delete() it's safe to assume that we don't need this anymore.
Donald Sharp [Wed, 30 Aug 2017 23:38:22 +0000 (19:38 -0400)]
zebra: Allow bh_type to override nexthop selection
If we've set the bh_type to something besides BLACKHOLE_UNSPEC
due to the received route type being RTN_BLACKHOLE,
RTN_UNREACHABLE or RTN_PROHIBIT then just trust that
the nexthop is just what it is and set accordingly.
Fixes: #1082 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Daniel Walton [Wed, 30 Aug 2017 15:18:02 +0000 (19:18 +0400)]
*: return CMD_WARNING if command was already configured
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
If the user configures some command that is already in the config we
should return CMD_WARNING instead of CMD_WARNING_CONFIG_FAILED
Matthew Smith [Wed, 30 Aug 2017 18:36:20 +0000 (13:36 -0500)]
redhat: Set permissions on systemd service file
Systemd on CentOS 7.3 logs a warning about the execute bit being
set every time the frr service file is invoked by systemctl.
Modify the spec file to explicitly set the permissions to 644.
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Donald Sharp [Wed, 30 Aug 2017 11:49:51 +0000 (07:49 -0400)]
pimd: Fix pim->keep_alive_time missed patch
The commit '19b807c pimd: Allow the keepalive time to be per vrf.'
is missing some data. Probably as a result of the indentation
and I accidently dropped it.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
David Lamparter [Sun, 27 Aug 2017 20:18:32 +0000 (22:18 +0200)]
bgpd: get rid of afi_header_vty_out() & co.
afi_header_vty_out() is easily replaced with vty_frame(), which means we
can drop a whole batch of "int *write" args as well as the entirety of
bgp_config_write_family_header().
=> AFI/SAFI config writing is now a lot simpler.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Fri, 5 Feb 2010 08:48:45 +0000 (09:48 +0100)]
*: remove empty "interface XYZ" config blocks
Using the previously-added vty_frame() support, this gets rid of all the
pointless empty "interface XYZ" blocks that get added for any interface
that shows up in the system (e.g. dummys, tunnels, etc.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Fri, 5 Feb 2010 08:48:45 +0000 (09:48 +0100)]
lib: add vty_frame() to get rid of unneeded config
vty_frame() can be used to reduce the amount of output produced by "show
running-config" and "write ...". It buffers output in struct vty->frame
(1024 bytes) and outputs it when vty_out is called. If vty_out isn't
called, it can be removed with vty_endframe() later.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Mitesh Kanjariya [Mon, 28 Aug 2017 23:52:29 +0000 (16:52 -0700)]
lib: new APIs for get/set system hostname/domainname
1. Change hostname_get to cmd_hostname_get
2. Change domainname_get to cmd_domainname_get
3. New API to set domainname
3. Provide a CLI command to set domainname
Donald Sharp [Thu, 24 Aug 2017 16:16:24 +0000 (12:16 -0400)]
configure: Add `-funwind-tables`
Certain platforms( ARM comes to mind ) in order
to get a proper stack trace on crash you need
to compile with this value. Since it only
slightly increases the size of the binary for
other platforms, I would consider it worthwhile
to include this directive.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
David Lamparter [Sun, 27 Aug 2017 18:38:54 +0000 (20:38 +0200)]
vtysh: cleanup SUID handling
Eliminate several more SUID problems (VTYSH_LOG, history file) and make
the whole SUID approach more robust. Still possibly unsafe to use, but
much better.
[v2: wrap seteuid/setegid calls] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Wed, 17 May 2017 16:27:54 +0000 (18:27 +0200)]
lib: ZeroMQ read handler, v2
This uses zmq_getsockopt(ZMQ_FD) to create a libfrr read event, which
then wraps zmq_poll and calls an user-specified ZeroMQ read handler.
It's wrapped in a separate library in order to make ZeroMQ support an
installation-time option instead of build-time.
Extended to support per-message and per-fragment callbacks as discussed
with Bingen in PR #566.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Wed, 11 Apr 2012 21:52:46 +0000 (23:52 +0200)]
*: remove ZEBRA_FLAG_{BLACKHOLE,REJECT} from API
FLAG_BLACKHOLE is used for different things in different places. remove
it from the zclient API, instead indicate blackholes as proper nexthops
inside the message.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Wed, 20 Jan 2010 17:27:16 +0000 (18:27 +0100)]
zebra: netlink backend support setting a P-t-P address
add a few bits to properly set a pointopoint address via netlink. the
structures have all the neccessary support, just need to send the proper
message bits to the kernel.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
David Lamparter [Sat, 27 Mar 2010 17:31:42 +0000 (18:31 +0100)]
zebra: fix interface deletion bug introduced by ptp address support
meh. forgot to even look at the interface deletion path. this doesn't
really work well when looking for the local address in the subnet list
which has the connected prefix in it... loop ensues.
fix by using the connected prefix when looking at the list of connected
prefixes. duh.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Don Slice [Sat, 26 Aug 2017 19:51:43 +0000 (15:51 -0400)]
eigrpd: add correct interface metrics when interface comes up
Problem noticed where we were not sending the correct metric values
to our peers for connected interfaces. Found that we were not storing
these values on the structure used to send the update packets.
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
David Lamparter [Fri, 25 Aug 2017 23:14:25 +0000 (01:14 +0200)]
*: fix compiler warnings
Specifically, gcc 4.2.1 on OpenBSD 6.0 warns about these; they're bogus
(gcc 4.2, being rather old, isn't quite as "intelligent" as newer
versions; the newer ones apply more logic and less warnings.)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Quentin Young [Fri, 25 Aug 2017 17:39:13 +0000 (13:39 -0400)]
lib: fix rare bug in ambiguous command resolution
In certain situations, the CLI matcher would not handle ambiguous
commands properly. If it found an ambiguous result in a lower subgraph,
the ambiguous result would not correctly propagate up to previous frames
in the resolution DFS as ambiguous; instead it would propagate up as a
non-match, which could subsequently be overridden by a partial match.
Example CLI space:
show ip route summary
show ip route supernet-only
show ipv6 route summary
Entering `show ip route su` would result in an ambiguous resolution for
the `show ip route` subgraph but would propagate up to the `show ip`
subgraph as a no-match, allowing `ip` to partial-match `ipv6` and
execute that command.
In this example entering `show ip route summary` would disambiguate the
`show ip` subgraph. So this bug would only appear when entering input
that caused ambiguities in at least two parallel subgraphs.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
David Lamparter [Fri, 25 Aug 2017 16:54:13 +0000 (18:54 +0200)]
clippy: disable unneeded autogenerated code
Coverity is generating a lot of warnings about unused stuff being
around. Disabling these bits is most easily done by just putting a few
preprocessor directives into the template.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Donald Sharp [Fri, 25 Aug 2017 12:07:58 +0000 (08:07 -0400)]
zebra: Coverity Code Cleanup
1) Various socket close issues
2) Ensure afi passed is usable
3) Fix some reads beyond buffer and reads after free
4) Ensure some failure modes are handled properly
5) Memory Leak(s) fix
6) There is no 6.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Fri, 25 Aug 2017 12:31:03 +0000 (08:31 -0400)]
*: Add RMAP_COMPILE_SUCCESS to enum
Add the RMAP_COMPILE_SUCCESS and switch over to using it.
Refactoring allows a removal of a if statement to just
use the switch statement already in place. Additionally
the reworking cleans up memory freeing in a couple of spots.
In one spot we no longer will leak memory too.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Thu, 24 Aug 2017 23:15:20 +0000 (19:15 -0400)]
eigrpd: Cleanup various SA Issues
1) Handle key value not found on interface
2) Handle various NULL pointer possibilities
3) Fix possible integer overflow
4) Fix memory leak
5) Check return codes on sscanf
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>