Donald Sharp [Thu, 16 Aug 2018 20:29:08 +0000 (16:29 -0400)]
zebra: When using BFD ensure that zebra thinks ptm is disabled
In order for connected routes to be installed the if_is_operative
function is called. This function checks the status of ptm
and decides to use ptm enabled/disabled on the interface.
The call to zebra_ptm_get_enable was returning true and causing
the interface subsystem to do the wrong thing. Modify the
internal bfd case to when checking for ptm enabled to say it
is not enabled.
Tested-by: Mark Stapp <mjs@voltanet.io> Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Sarita Patra [Thu, 16 Aug 2018 13:41:01 +0000 (06:41 -0700)]
pimd: Fix memory leak pim nexthop creation
While terminating pim instance, the memory allocated for pim nexthop
should be released before deallocating the memory of pim nexthop cache(pnc).
This resolves the memory leak detected in pnc->nexthop creation.
Donald Sharp [Thu, 16 Aug 2018 00:44:31 +0000 (20:44 -0400)]
bgpd: zlog_warn to assert for code that must be executed first
In bgp_keepalives.c, it was noticed that we were
ensuring that we called an intialization function first,
but this is a development escape in that once this
was fixed we never see it. So if a developer moves
this assumption around, let's crash the program and
lead them to this spot instead of silently ignoring
the problem.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Wed, 15 Aug 2018 19:50:30 +0000 (15:50 -0400)]
lib: Update hash.h documentation
The hash_get function when called and the alloc_func returns
a NULL value, we do not create a backet nor do we insert
anything into the hash. As such backet->data must always
be non-NULL.
Modify the description in hash_get to inform of this.
Additionally indicate that hash_walk and hash_iterate
cannot have a NULL backet->data value.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Wed, 15 Aug 2018 19:06:53 +0000 (15:06 -0400)]
lib, ripngd, zebra: Remove pre-solaris 9 special cased code
The CMSG_FIRSTHDR was broken on solaris pre version 9. Version 9
was released in May of 2002 and EOL'ed in 2014. Version 8 EOL'ed
in 2012. Remove special case code for a little used platform
that has not seen the light of day in a very long time.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Wed, 15 Aug 2018 17:48:09 +0000 (13:48 -0400)]
bfdd: Fix `don't assign to value to ourself` compiler warning
We were attempting to get around a unused value by setting
a variable to itself, but it runs afoul of a different
compiler and a message about not setting a variable to
itself. So let's mark the ttl value as unused.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
David Lamparter [Fri, 10 Aug 2018 15:35:29 +0000 (17:35 +0200)]
lib: add frr_elevate_privs() wrapper
Used as:
frr_elevate_privs(&my_privs) {
... code ...
}
and handles privilege raise/lower automatically in conjunction with the
C expression block. This makes it impossible to accidentally exit a
function with privileges raised (and then running a whole bunch of other
code with privs.)
Signed-off-by: David Lamparter <equinox@diac24.net>
Quentin Young [Tue, 19 Jun 2018 20:58:44 +0000 (20:58 +0000)]
*: fix source file headers & includes for errcodes
* Use the correct license header
* Stop headers from including themselves
* Use uniform relative include conventions
* Ensure that sources include what they use
* Turn off clang-format around struct array blocks
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Donald Sharp [Tue, 19 Jun 2018 20:28:45 +0000 (16:28 -0400)]
lib: Convert zlog_err for clippy build
The clippy code does not need to log the error messages
as errors as that it is only run as part of the build
itself and as long as we see the notifications we are good.
So convert zlog_err to zlog_notice so that we do not think
we have any zlog_err's in lib anymore
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Donald Sharp [Mon, 18 Jun 2018 13:13:37 +0000 (09:13 -0400)]
lib: Add LIB_ERR_DEVELOPMENT
Sometimes a error state is detected when we have added
new code to FRR, but not updated all the places that
we should have. Consider this a developmental escape
that needs to be fixed.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Pascal Mathis [Tue, 14 Aug 2018 15:36:41 +0000 (17:36 +0200)]
bgpd: Always show CIDR mask when displaying routes
Classful networking has been obsolete for ages and there is currently an
inconsistency between `show ip route` and `show bgp`, where the first
one always displays the CIDR mask while the second one hides classful
network masks.
This commit adjusts the behavior of `show bgp` to always show the CIDR
mask for a route, even when it is classful.
lib, vtysh: fix inconsistent interface commands in vtysh
The definition of the interface commands in vtysh.c were outdated.
Currently, all daemons that call if_cmd_init() will have the "no interface
IFNAME" command and the "[no] description" commands as well, so there's
no need to define exceptions for these commands anymore.
To fix this, make extract.pl parse the if.c file so that vtysh can get the
interface commands from there automatically. Only the "interface IFNAME
[vrf NAME]" must be kept in vtysh.c because it changes the vty node and
thus needs special treatment.
Finally, make pimd and pbrd display interface descriptions on "sh run"
when they are configured.
lib, vtysh: fix inconsistent VRF commands in vtysh
* Only zebra and pimd call vrf_cmd_init(), so these are the only daemons
that should receive VRF commands from vtysh;
* "netns NAME" and "no netns NAME" are available only in zebra, write
custom DEFSHs in vtysh to make it aware of that;
* Remove the "no vrf NAME" definition from vtysh.c and expose the
original command to vtysh by converting the DEFUN_NOSH to a simple
DEFUN. This command doesn't change the vty node so there's no need to
special case it.
We must hide only "pseudowire IFNAME" from vtysh, the "no" form of the
command should be made available to the extract.pl script. Split the
command into two to fix this problem.
All ldpd commands were written using DEFPY except the ones that needed
to be ignored by vtysh, in which case we were using DEFUN_NOSH. Now that
DEFPY_NOSH is available, convert the remaining commands for consistency
and to simplify the code a little bit.