Commit Graph

55 Commits

Author SHA1 Message Date
F. Aragon
48944eb65e
isisd lib ospfd pbrd python: fix empty init
ISO C forbids empty initializer braces. Empty initializers have been
replaced with {0}

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-11-21 14:45:42 +01:00
Donald Sharp
26f63a1ec6 *: Replace zclient_new with zclient_new_notify
It's been a year since we added the new optional parameters
to instantiation.  Let's switch over to the new name.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-11-12 09:16:23 -05:00
Renato Westphal
a4bed468f9 yang, lib: add 'frr-interface.yang' and associated stub callbacks
Introduce frr-interface.yang, which defines a model for managing FRR
interfaces.

Update the 'frr_yang_module_info' array of all daemons that will
implement this module.

Add automatically generated stub callbacks in if.c. These callbacks will
be implemented in the following commit.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-27 16:16:12 -02:00
Renato Westphal
8fcdd0d635 *: add empty array of YANG modules
FRR_DAEMON_INFO should now contain an array of 'frr_yang_module_info'
structures describing the YANG modules implemented by the daemon.

This array will be used by frr_init() function to load all YANG modules
and initialize the northbound callbacks during the daemon initialization.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-27 16:16:12 -02:00
David Lamparter
0437e10517 *: spelchek
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-25 20:10:57 +02:00
Donald Sharp
74df8d6d9d *: Replace hash_cmp function return value to a bool
The ->hash_cmp and linked list ->cmp functions were sometimes
being used interchangeably and this really is not a good
thing.  So let's modify the hash_cmp function pointer to return
a boolean and convert everything to use the new syntax.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-19 13:14:45 -04:00
F. Aragon
7fe96307ee
bgpd lib ospf6d pbrd tests zebra: shadowing fixes
This fixes all remaining local variable shadowing cases

Signed-off-by: F. Aragon <paco@voltanet.io>
2018-09-13 17:37:08 +02:00
David Lamparter
f4f2f2ccac build: fix not building docs w/o sphinx
Can't build manpages without sphinx-build, oops...

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-09 20:01:08 +02:00
David Lamparter
e7c25325cc *: cleanup .gitignore files
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
David Lamparter
74dc19a2f5 build: move vtysh & manpage listings to subdir.am
Since we're now building through one large Makefile, we can easily put
things with their daemons and crossreference nicely.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:19 +02:00
Philippe Guibert
ecbc5a3781 *: add a vrf update hook to be informed of the vrf name
The Vrf aliases can be known with a specific hook. That hook will then,
from zebra propagate the information to the relevant zapi clients.
The registration hook function is the same for all daemons.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-28 16:23:50 +02:00
Renato Westphal
91e5b43ab4 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.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-08-13 18:59:31 -03:00
Donald Sharp
0ce1ca805d *: ALLOC calls cannot fail
There is no need to check for failure of a ALLOC call
as that any failure to do so will result in a assert
happening.  So we can safely remove all of this code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-11 17:14:58 +02:00
Quentin Young
a4044dc10d pbrd: add logging messages when out of table id's
* Add log messages to indicate when we have run out of table IDs
* Increase minimum range size to 1000 to reduce risk of hitting this

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-13 20:00:58 +00:00
Quentin Young
8c28c034dc pbrd, lib: move PBR_STR def. to lib
Per request

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-13 16:22:01 +00:00
Quentin Young
24a21176ce pbrd: use PBR_STR
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-12 20:28:04 +00:00
Quentin Young
ef18ed6e93 pbrd: remove json options
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-12 20:27:30 +00:00
Quentin Young
7bec514c7e pbrd: allow configurable table id range
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-06-12 19:51:12 +00:00
Philippe Guibert
373dd3b5fd pbrd: add ZAPI_RULE_FAIL_REMOVE flag in switch
The notification handler consecutive to an add/remove of a rule in zebra
is being added the FAIL_REMOVE flag. It is mapped on REMOVE flag
behaviour for now.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-05-25 15:49:38 +02:00
Donald Sharp
06210d1f40 pbrd: Fix compilation warn -> error
The buffer size was insufficiently sized to hold the
entirety of the data being passed in.

Modify the nht code to use a bit bigger buffer.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-15 13:52:02 -04:00
Donald Sharp
9a55f79a26 pbrd, vtysh: Limit range to actual 1-700
The range for sequence numbers needs to be limited
by the range we have currently choosen for rule
ranges.

Ticket: CM-20562
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-08 19:24:15 -04:00
Philippe Guibert
614827f88b pbrd: encode null fwmark to be consistent with zebra decode rule
A null 4-byte long fwmark is encoded in pbr rule.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-05-07 18:59:41 +02:00
Donald Sharp
29d5a14634 pbrd: Fix nearly impossible truncation
Since we are writing into the name field which is PBR_MAP_NAMELEN
size, we are expecting this to field to be at max 100 bytes.
Newer compilers understand that the %s portion may be up to
100 bytes( because of the size of the string.  The %u portion
is expected to be 10 bytes.  So in `theory` there are situations
where we might truncate.  The reality this is never going to
happen( who is going to create a nexthop group name that is
over say 30 characters? ).  As such we are expecting the
calling function to subtract 10 from the size_t l before
we pass it in to get around this new gcc fun.

Fixes: #2163
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-05-02 20:14:36 -04:00
Donald Sharp
10a00758a7 pbrd: Fix a couple SA issues
1) addr will never be non-null because of the way we build the cli
at this point in time, but the SA system does not understand this,
add a bread crumb for it.

2) Fix a possible memory leak of the pbr_ifp

3) Fix possible integer overflow when bit shifting.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-23 22:09:33 -04:00
Russ White
5998141e07
Merge pull request #2051 from donaldsharp/PBRD_EXTRA
Pbrd extra
2018-04-20 07:54:30 -04:00
Quentin Young
6612590d9a pbrd: fix multiple unsafe string copies
Coverity #1467828
Coverity #1467827
Coverity #1467826
Coverity #1467825
Coverity #1467824
Coverity #1467823
Coverity #1467822

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-18 12:16:19 -04:00
Quentin Young
68a63f60ae pbrd: remove potential null dereference
Coverity #1467832

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-18 12:16:19 -04:00
Quentin Young
d64169679f pbrd: remove pbr-policy resource leak
Removing a non-existent pbr-policy caused a pbr_interface to leak.

Coverity #1467829

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-18 12:16:19 -04:00
Quentin Young
5f504f14a9 pbrd: remove unsafe string copy
A user could overflow the pbr_ifp->mapname buffer by entering a pbr-map
name longer than 100 characters.

Coverity #1467821
Coverity #1467821

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-18 12:16:19 -04:00
Donald Sharp
d7b3ad4016 pbrd: Use proper decode function for interface
Use a proper decode function for a interface state change.

Ticket: CM-20489
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-17 18:43:47 -04:00
Donald Sharp
24010e9231 pbrd: Fix unused function
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-17 18:43:47 -04:00
Donald Sharp
d02e9432b5 pbrd: Allow pbr-policy add/removal to install/remove rules
The pbrm->installed variable was being used only in a couple
of places and it has no real bearing on whether or not
we should install a rule or not.  Remove this value.

Ticket: CM-20429
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-17 18:43:47 -04:00
Quentin Young
56c63eeb23 pbrd: don't collapse pbr debugs
While compact, collapsing the various debugs into simply `debug pbr` if
all debugs are on is potentially confusing to users.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-17 18:43:47 -04:00
Quentin Young
e14f43ccae pbrd: move debug vty into pbr_vty.c
Dev docs say that CLI goes in _vty.c files

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-17 18:43:47 -04:00
Donald Sharp
0f03639ded pbrd, zebra: Properly notice rule deletion
When a rule is deleted properly notice it in pbr.

Ticket: CM-20394
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-17 18:43:47 -04:00
Donald Sharp
37c606ffbf pbrd, zebra: Fix multiple pbr-policy install
Somewhere along the way the ability to install multiple
pbr-policys for the same pbr-map was lost.

Add this back.  There is a limitation in that we are limited
to 64 interfaces per pbr-policy.

Ticket: CM-20429
Signed-off-by: Donald Sharp sharpd@cumulusnetworks.com>
2018-04-17 18:43:46 -04:00
Donald Sharp
9b71ea4ba5 pbrd: Fix installation and deletion in some cases
When a nexthop group is modified do not assume that it
is not installed.  The creation of the pnhgc is enough
to set the installed to false.  If we are reinstalling
it is not needed to set it as not installed.

When a pbrms is being installed/removed check to see if it
is already installed/deleted and do the right thing from
there.

Ticket: CM-20371
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-17 18:40:17 -04:00
Donald Sharp
2fb7892ed1 pbrd: Prevent attempt at re-install for several scenarios
There exists several places we attempt to re-install the
same rule.  Figure out when we need to not make an attempt
at doing anything and do it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-17 18:40:17 -04:00
Donald Sharp
cafec8da4f lib, pbrd: Do not allow v6 LL nexthops to be specified without an interface.
Prevent the creation of a v6 LL nexthop that does not include an interface
for proper resolution.

Ticket: CM-20276
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-17 18:40:17 -04:00
Donald Sharp
ad1dabd5c3 pbrd: Allow PBR to ignore Access List commands
PBR is hooked up to receive access-list commands automatically,
as are all daemons, add the bit of code to allow the PBR
daemon to safely receive the command and ignore it for the
moment.

Ticket: CM-20569
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-13 12:56:19 -04:00
Don Slice
49027ce856 pbrd: adjust/remove the rule correctly when dst and/or src removed
When the last match criteria was removed (dst-ip or src-ip), we were
not deleting the rule correctly for ipv6. This fix retains the
needed src-ip/dst-ip during the pbr_send_pbr_map process so the
appropriate information is available for the rule delete.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Donald Sharp
a1b7005bf4 pbrd: Remove table and rule range commands
Since PBR is meant to be for small deployments, allowing
end users to arbitrarily change rule and table ranges
without some more careful thought on what is going on
and how to do it, sets us up for issues.

At this time remove these knobs.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Donald Sharp
3a9210c220 pbrd: Indicate command failure a bit better
When a command is attempted to be configed and it
fails to be installed, indicate via vtysh return
codes that we did not accept the command

Ticket: CM-20216
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Donald Sharp
5e44f18ff1 pbrd: Do not use vrf_frame for pbrms display
When displaying a pbr map sequence for a show run do not use the
vty_frame construct.  We should display the config even if we
do not have much to display.

Ticket: CM-20196
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Donald Sharp
8ee9738bbc pbrd: Reduce range so we cannot go over the vrf rule
The linux kernel puts the vrf rule at 1000, since pbr
rules need to be before this rule, don't allow us to go
beyond.

Ticket: CM-19946
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Donald Sharp
1c33fb1dbb pbrd: Prevent crash from partially configured interface
If an interface is in the process of coming up or
partially deconfigured, prevent pbrd from crashing

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Donald Sharp
b8eb036fb2 pbrd: If we get the same prefix safely ignore
If the match src-ip or dst-ip command entered has already
been received and it's the same prefix, we are done and
do not need to do anything more.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Don Slice
66fd4b64e5 pbrd: fix deletion of match or src of valid pbr-map
When removing either the match dst or match src of a previously
valid pbr map, we would just try to re-install the rule which
was rejected.  This fix deletes the old rule before we re-apply
the new rule.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Don Slice
ff9799c31e pbrd: add ability to delete routes and rules correctly
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00
Quentin Young
57cdafc411 lib, pbrd: rm extra space when displaying nexthop
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-04-06 13:22:43 -04:00