ospfd: Bring in some OSPF useful changes that were lost during Quagga fork
Several changes were made from the original patch to resolve conflicts
and also to fix various issues that were discovered during testing. Below
is the original commit message minus a few parts that correspond to code
that was dropped during bug fixing.
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
ospfd: Extend 'ip ospf area' to take address argument + rationalise ospf enable
* ospfd.c: (general) Clean up the whole running of OSPF on interfaces.
(add_ospf_interface) taking (struct interface *) arg is pointless here.
(ospf_is_ready) new helper.
(ospf_network_run_subnet) Put all the code for choosing whether to enable
OSPF on a subnet, and if so which area configuration to use, here. If a
subnet should not be enabled, ensure an existing oi is freed.
(ospf_network_run_interface) Just call run_subnet for all subnets on an
interface.
(ospf_network_run) Just call run_interface for all interfaces.
(ospf_if_update) Just call run_interface for the given interface.
(ospf_network_unset) Just call run_subnet for existing ois.
(ospf_update_interface_area) helper: update area on an oi, or create it.
(ospf_interface_set) renamed to ospf_interface_area_set for clarity.
Ensures OSPF is created, then into if_update.
(ospf_interface_unset) renamed to ospf_interface_area_unset and collapses
down to simple loop to call run_subnet for all ois.
* ospf_interface.h: add a more general OSPF_IF_PARAM_IS_SET, which does the
right thing and takes default config into account.
* doc/ospfd.texi: add 'ip ospf area' command.
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
This patch has been part of Quagga since October 2015
Orignial Author: Paul Jakma <paul@quagga.net>
Date: Thu Aug 27 16:51:42 2009 +0100
Quentin Young [Tue, 20 Jun 2017 23:56:50 +0000 (23:56 +0000)]
*: simplify log message lookup
log.c provides functionality for associating a constant (typically a
protocol constant) with a string and finding the string given the
constant. However this is highly delicate code that is extremely prone
to stack overflows and off-by-one's due to requiring the developer to
always remember to update the array size constant and to do so correctly
which, as shown by example, is never a good idea.b
The original goal of this code was to try to implement lookups in O(1)
time without a linear search through the message array. Since this code
is used 99% of the time for debugs, it's worth the 5-6 additional cmp's
worst case if it means we avoid explitable bugs due to oversights...
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Donald Sharp [Fri, 16 Jun 2017 21:40:17 +0000 (17:40 -0400)]
lib: Fix ordering of RB Tree
So the *bsd implementations of RB Tree's for older
platforms use a macro implementation. New platforms
have converted to a function implementation that uses
a different calling parameter list. So when
we attempt to build FRR on older *bsd implementations
the macro's and functions do not interact too well.
As a workaround put the openbsd-tree.h #include
inside of zebra.h at a point before the particular
platforms version is included. Since we use
the same #if guard for the header we should be ok.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Quentin Young [Fri, 16 Jun 2017 18:03:34 +0000 (18:03 +0000)]
bgpd: fix misc cli ranges & config writes
* Ranges for some MED were 2^32 - 2 instead of 2^32 - 1
* Use correct printf specifiers for unsigned values
* Some drive-by CLI collapsing and simplification
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Renato Westphal [Mon, 12 Jun 2017 14:39:12 +0000 (11:39 -0300)]
ldpd: convert cli and get rid of the xml interface
The xml2cli.pl script was useful years ago when the vty code was very
rudimentary. This is not the case anymore, so convert all ldpd CLI
commands to use DEFUNs directly and get rid of the XML interface.
The benefits are:
* Consistency with the other daemons;
* One less build dependency (the LibXML perl module);
* Easier to add new commands.
Quentin Young [Wed, 14 Jun 2017 19:47:14 +0000 (19:47 +0000)]
lib: allow 'do' commands in ENABLE_NODE
'do' is syntax sugar that allows the user to execute a command under
ENABLE_NODE when in another CLI node. If the user is already in
ENABLE_NODE, use of 'do' was previously disallowed. This patch allows it
because it makes it easier for us to hack around certain instances of
the node synchronization problem with vtysh.
Also included is a fix for one of these problems.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Rafael Zalamena [Fri, 16 Jun 2017 13:44:31 +0000 (10:44 -0300)]
lib: improve the RB implementation
Switch the RB tree implementation completely to the new dlg@'s version
that uses pre-declared functions instead of macros for tree functions.
Original e-mail/diff:
https://marc.info/?l=openbsd-tech&m=147087487111068&w=2
Pros:
* Reduces the amount of code that the usage of those macros generate
* Allows the compiler to do a better compile-time check job
* Might have better i-cache utilization since the tree code is shared
Con:
* dlg@ benchmarks shows it has 'very slightly slower' insertions
* imported RB_* code must adapt the following calls:
RB_INIT(), RB_GENERATE(), RB_ROOT(), RB_EMPTY(), make compare
functions use 'const' (if not already) and maybe others.
Donald Sharp [Tue, 13 Jun 2017 18:23:52 +0000 (14:23 -0400)]
zebra: Remove unused testzebra and ancillary files
The testzebra command was unused as well as unmaintained.
The NS and VRF changes never made into testzebra so when
you actually ran testzebra it would just crash due to
uninitialized assumptions.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Daniel Walton [Mon, 12 Jun 2017 20:09:09 +0000 (20:09 +0000)]
bgpd: "no neighbor x.x.x.x send-community" not displayed correctly
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
We would only diplay one "no neighbor 2.2.2.2 send-community XYZ" but
there might be multiple that need to be displayed.
Donald Sharp [Thu, 8 Jun 2017 12:48:10 +0000 (08:48 -0400)]
tools, zebra: Fix netlink notification of who owns the routes
For NHRP, EIGRP and LDP( This is for consistency as opposed to correctness )
assign some new values to routes to be installed into the kernel
so we can know who owns them later.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Renato Westphal [Wed, 7 Jun 2017 00:24:02 +0000 (21:24 -0300)]
ldpd: remove pledge calls
In OpenBSD pledge is a mitigation mechanism used to restrict the syscalls
a program can use, enforcing its correct behavior.
In this port of OpenBSD's ldpd(8), it's hard to run under the same
tight pledge promises because of libfrr and additional components we
introduced, like a zclient in lde. Since ldpd is already privsep'ed,
removing the pledge calls shouldn't be a big compromise security-wise.