zebra: add an exception for link-local connected routes
Link-local routes are unique in the sense that they all have the same
prefix but have different nexthops (local interfaces). Add an exception
in rib_add() to allows us to keep track of all of them.
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.
Nigel Kukard [Wed, 30 Aug 2017 09:39:36 +0000 (09:39 +0000)]
bgpd: Fixed incorrect calculation of pointer location
com_index_to_delete[i] holds the location in lcom->val of where the
value is stored, we cannot just increment it by this value on each
iteration as we'll overflow the size of lcom->val.
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, 28 Sep 2016 21:19:50 +0000 (23:19 +0200)]
lib: "ferr" error-information system
This provides an API to pass around extra information for errors, more
than a simple return value can carry. This is particularly used for the
Cap'n Proto interface to be able to report more useful errors.
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>