]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
5 years agolib: introduce new YANG helper function
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
lib: introduce new YANG helper function

One use case for the new yang_data_list_find() function is to find
input parameters in RPC northbound callbacks easily, without the
need to iterate over the input parameters manually.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agolib: constify a few parameters in the VRF code
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
lib: constify a few parameters in the VRF code

Parameters should be const whenever possible to improve code
readability and remove the need to cast away the constness of
const arguments.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripngd: remove the ripng global variable
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripngd: remove the ripng global variable

This is the last step to make ripngd ready for multi-instance
support.

Remove the ripng global variable and add a "ripng" parameter
to all functions that need to know the RIPng instance they are
working on. On some functions, retrieve the RIPng instance from
the interface variable when it exists (this assumes interfaces can
pertain to one RIPng instance at most, which is ok for VRF support).

In preparation for the next commits (VRF support), add a "vrd_id"
member to the ripng structure, and use ripng->vrf_id instead of
VRF_DEFAULT wherever possible.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripngd: move "ripng_offset_list_master" to the ripng structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripngd: move "ripng_offset_list_master" to the ripng structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripdng: clear list of peers when RIPng is deconfigured
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripdng: clear list of peers when RIPng is deconfigured

This is an old standing bug where the list of RIPng peers wasn't
cleared after deconfiguring RIPng, which caused the existing peers
to still be present on a newly configured RIPng instance (except
when the timed out after ~3 minutes). Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripngd: move "peer_list" to the ripng structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripngd: move "peer_list" to the ripng structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripngd: move "Vripng_passive_interface" to the ripng structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripngd: move "Vripng_passive_interface" to the ripng structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripngd: move "ripng_enable_network" to the ripng structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripngd: move "ripng_enable_network" to the ripng structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripngd: move "ripng_enable_if" to the ripng structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripngd: move "ripng_enable_if" to the ripng structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripngd: simplify cleaning up of routing instance
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripngd: simplify cleaning up of routing instance

* Call ripng_clean() only when RIPng is configured, this way we can
  remove one indentation level from this function.
* ripng_redistribute_clean() is only called on shutdown, so there's
  no need to call ripng_redistribute_withdraw() there since the RIPng
  table is already cleaned up elsewhere.
* Deallocate the ripng structure only at the end of the function. This
  prepares the ground for the next commits where all global variables
  will be moved to the ripng structure.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: remove the rip global variable
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: remove the rip global variable

This is the last step to make ripd ready for multi-instance support.

Remove the rip global variable and add a "rip" parameter to all
functions that need to know the RIP instance they are working
on. On some functions, retrieve the RIP instance from the interface
variable when it exists (this assumes interfaces can pertain to
one RIP instance at most, which is ok for VRF support).

In preparation for the next commits (VRF support), add a "vrd_id"
member to the rip structure, and use rip->vrf_id instead of
VRF_DEFAULT wherever possible.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: clear list of peers when RIP is deconfigured
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: clear list of peers when RIP is deconfigured

This is an old standing bug where the list of RIP peers wasn't
cleared after deconfiguring RIP, which caused the existing peers
to still be present on a newly configured RIP instance (except when
the timed out after ~3 minutes). Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: move "rip_distance_table" to the rip structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: move "rip_distance_table" to the rip structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: move global counters to the rip structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: move global counters to the rip structure

The only sideeffect of this change is that these counters will be
reset when RIP is deconfigured and then configured again, but this
shouldn't be a problem as the RIP MIB isn't specific about this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: remove dead code
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: remove dead code

None of these variables or functions were being used since the
initial revision ~16 years ago. It's safe to say we can remove
them now.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: move "rip_offset_list_master" to the rip structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: move "rip_offset_list_master" to the rip structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: move "peer_list" to the rip structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: move "peer_list" to the rip structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: move "Vrip_passive_nondefault" to the rip structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: move "Vrip_passive_nondefault" to the rip structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: move "rip_enable_network" to the rip structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: move "rip_enable_network" to the rip structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: move "rip_enable_interface" to the rip structure
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: move "rip_enable_interface" to the rip structure

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: simplify cleaning up of routing instance
Renato Westphal [Fri, 4 Jan 2019 21:08:10 +0000 (19:08 -0200)]
ripd: simplify cleaning up of routing instance

* Call rip_clean() only when RIP is configured, this way we can
  remove one indentation level from this function.
* rip_redistribute_clean() is only called on shutdown, so there's
  no need to call rip_redistribute_withdraw() there since the RIP
  table is already cleaned up elsewhere.
* There's no need to clean up the "rip->neighbor" nodes manually before
  calling route_table_finish().
* Deallocate the rip structure only at the end of the function. This
  prepares the ground for the next commits where all global variables
  will be moved to the rip structure.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripngd: fix valgrind warning about uninitialized memory usage
Renato Westphal [Fri, 4 Jan 2019 21:08:09 +0000 (19:08 -0200)]
ripngd: fix valgrind warning about uninitialized memory usage

Fixes the following warning when running ripngd with valgrind:
==38== Syscall param sendmsg(msg.msg_control) points to uninitialised
byte(s)
==38==    at 0x5EA1E47: sendmsg (sendmsg.c:28)
==38==    by 0x118C48: ripng_send_packet (ripngd.c:226)
==38==    by 0x11D1D6: ripng_request (ripngd.c:1924)
==38==    by 0x120BD8: ripng_interface_wakeup (ripng_interface.c:666)
==38==    by 0x4ECB4B4: thread_call (thread.c:1601)
==38==    by 0x4E8D9CE: frr_run (libfrr.c:1011)
==38==    by 0x1121C8: main (ripng_main.c:180)
==38==  Address 0xffefffc34 is on thread 1's stack
==38==  in frame #1, created by ripng_send_packet (ripngd.c:172)

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd, ripngd: fix null pointer dereference in YANG RPCs
Renato Westphal [Fri, 4 Jan 2019 13:55:15 +0000 (11:55 -0200)]
ripd, ripngd: fix null pointer dereference in YANG RPCs

These RPCs should do nothing when RIP/RIPng aren't configured.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoMerge pull request #3625 from donaldsharp/clist_strlen
Mark Stapp [Thu, 17 Jan 2019 16:25:45 +0000 (11:25 -0500)]
Merge pull request #3625 from donaldsharp/clist_strlen

bgpd: Use string length not sizeof the array

5 years agobgpd: Use string length not sizeof the array
Donald Sharp [Thu, 17 Jan 2019 01:43:53 +0000 (20:43 -0500)]
bgpd: Use string length not sizeof the array

strlen is the same as sizeof when the memory is dynamically allocated
but it is not the same when the memory being looked at is an array.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3624 from mjstapp/fix_ldpd_bind
Rafael Zalamena [Wed, 16 Jan 2019 23:58:50 +0000 (21:58 -0200)]
Merge pull request #3624 from mjstapp/fix_ldpd_bind

ldpd: fix missing return value in bindany

5 years agoldpd: fix missing return value in bindany
Mark Stapp [Wed, 16 Jan 2019 21:35:10 +0000 (16:35 -0500)]
ldpd: fix missing return value in bindany

One of the socket utilities was missing a return value in
one of its ifdef'd paths.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agoMerge pull request #3617 from donaldsharp/cleanup_old_stale_netlink
Jafar Al-Gharaibeh [Tue, 15 Jan 2019 16:53:49 +0000 (11:53 -0500)]
Merge pull request #3617 from donaldsharp/cleanup_old_stale_netlink

zebra: Cleanup unnecessary check

5 years agoMerge pull request #3570 from donaldsharp/dire_warning
Lou Berger [Tue, 15 Jan 2019 16:44:25 +0000 (11:44 -0500)]
Merge pull request #3570 from donaldsharp/dire_warning

more doc stuff for configure

5 years agoMerge pull request #3610 from donaldsharp/bgp_default_doc
Lou Berger [Tue, 15 Jan 2019 15:27:09 +0000 (10:27 -0500)]
Merge pull request #3610 from donaldsharp/bgp_default_doc

doc: Add `[no] bgp default ipv4-unicast` documentation

5 years agoMerge pull request #3532 from donaldsharp/community_list_speedup
Lou Berger [Tue, 15 Jan 2019 15:05:20 +0000 (10:05 -0500)]
Merge pull request #3532 from donaldsharp/community_list_speedup

bgp Community list speedup

5 years agozebra: Cleanup unnecessary check
Donald Sharp [Tue, 15 Jan 2019 13:55:34 +0000 (08:55 -0500)]
zebra: Cleanup unnecessary check

We self include the enum that has the RTA_EXPIRES in it,
as such this will always be true.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3180 from qlyoung/prefixlen-u8-to-u16
Renato Westphal [Tue, 15 Jan 2019 02:39:39 +0000 (00:39 -0200)]
Merge pull request #3180 from qlyoung/prefixlen-u8-to-u16

lib: convert prefixlen to 16-bit integer

5 years agoMerge pull request #3611 from opensourcerouting/nb-fixes
Donald Sharp [Mon, 14 Jan 2019 22:28:49 +0000 (17:28 -0500)]
Merge pull request #3611 from opensourcerouting/nb-fixes

Minor northbound fixes

5 years agodoc: update build instructions for freebsd on how to obtain libyang
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
doc: update build instructions for freebsd on how to obtain libyang

Unfortunately the first version of the FreeBSD libyang port contained
a bug in which the libyang pkginfo file wasn't being installed
correctly in the system, and this prevented the FRR build system from
detecting the library. This bug was already fixed months ago but some
FreeBSD package repositories still have the old bugged version of the
port. This means we can't suggest people to install libyang using
"pkg install" since this causes problems for most people. In this
case, suggest FreeBSD users to build and install libyang manually
as we suggest for other BSD platforms.

This commit should be reverted once all FreeBSD package repositories
are updated with the new version of the libyang port.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agolib: update suggestions related to some northbound errors
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
lib: update suggestions related to some northbound errors

Since commit 3a11599c, the FRR YANG modules are embedded inside the
binaries and no longer need to be loaded from the file system. This
way, it's impossible for the FRR binaries and YANG modules to be out
of sync anymore. As such, update the suggestions of the northbound
error codes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agolib: don't abort when incomplete xpath is given by the user
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
lib: don't abort when incomplete xpath is given by the user

Instead of aborting when an incomplete xpath is given to the
nb_oper_data_iterate() function, just return an error so that the
callers have a chance to treat this error. Aborting based on invalid
user input is never the right thing to do.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agolib: fix "use of uninitialised value" valgrind warning
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
lib: fix "use of uninitialised value" valgrind warning

When FRR is built without the --enable-config-rollbacks option,
the nb_db_transaction_save() function does nothing and the
"transaction_id" output parameter is left uninitialized. For
this reason, all northbound clients should initialize the
"transaction_id" argument before calling nb_candidate_commit() or
nb_candidate_commit_apply() (except when a NULL pointer is given,
which is the case of the confd and sysrepo plugins).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agolib: fix "may be used uninitialized" build warning
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
lib: fix "may be used uninitialized" build warning

We are already handling all possible four cases from the "nb_event"
enumeration, so this problem can't happen in practice. Initialize the
"ref" variable to zero to silence the warning.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoMerge pull request #3607 from opensourcerouting/default_information_afi
Donald Sharp [Mon, 14 Jan 2019 17:04:11 +0000 (12:04 -0500)]
Merge pull request #3607 from opensourcerouting/default_information_afi

lib, zebra: add AFI parameter to the ZEBRA_REDISTRIBUTE_DEFAULT_* messages

5 years agodoc: Add `[no] bgp default ipv4-unicast` documentation
Donald Sharp [Mon, 14 Jan 2019 16:32:44 +0000 (11:32 -0500)]
doc: Add `[no] bgp default ipv4-unicast` documentation

This command had no documentation so add it in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
5 years agolib, zebra: add AFI parameter to the ZEBRA_REDISTRIBUTE_DEFAULT_* messages
Renato Westphal [Fri, 11 Jan 2019 21:20:13 +0000 (19:20 -0200)]
lib, zebra: add AFI parameter to the ZEBRA_REDISTRIBUTE_DEFAULT_* messages

Some daemons like ospfd and isisd have the ability to advertise a
default route to their peers only if one exists in the RIB. This
is what the "default-information originate" commands do when used
without the "always" parameter.

For that to work, these daemons use the ZEBRA_REDISTRIBUTE_DEFAULT_ADD
message to request default route information to zebra. The problem
is that this message didn't have an AFI parameter, so a default route
from any address-family would satisfy the requests from both daemons
(e.g. ::/0 would trigger ospfd to advertise a default route to its
peers, and 0.0.0.0/0 would trigger isisd to advertise a default route
to its IPv6 peers).

Fix this by adding an AFI parameter to the
ZEBRA_REDISTRIBUTE_DEFAULT_{ADD,DELETE} messages and making the
corresponding code changes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoMerge pull request #3605 from donaldsharp/bfd_24_minutes
Rafael Zalamena [Mon, 14 Jan 2019 13:20:54 +0000 (11:20 -0200)]
Merge pull request #3605 from donaldsharp/bfd_24_minutes

bfdd: Fix timer print-out function

5 years agoMerge pull request #3567 from donaldsharp/cleanup_route_table_creation
Renato Westphal [Mon, 14 Jan 2019 12:56:07 +0000 (10:56 -0200)]
Merge pull request #3567 from donaldsharp/cleanup_route_table_creation

Route Table Handling and shows

5 years agoMerge pull request #3564 from chiragshah6/evpn_dev1
Renato Westphal [Mon, 14 Jan 2019 12:50:20 +0000 (10:50 -0200)]
Merge pull request #3564 from chiragshah6/evpn_dev1

zebra: use default vrf_id for zvrf reference

5 years agoMerge pull request #3588 from donaldsharp/bgp_label_nonsense
Renato Westphal [Mon, 14 Jan 2019 12:46:42 +0000 (10:46 -0200)]
Merge pull request #3588 from donaldsharp/bgp_label_nonsense

bgpd: Do not send a label to zebra that it doesn't understand

5 years agoMerge pull request #3600 from opensourcerouting/bfd-zebra-if
Donald Sharp [Mon, 14 Jan 2019 00:18:38 +0000 (19:18 -0500)]
Merge pull request #3600 from opensourcerouting/bfd-zebra-if

bfdd: use zebra API to learn about interfaces

5 years agobfdd: Fix timer print-out function
Donald Sharp [Sat, 12 Jan 2019 21:22:32 +0000 (16:22 -0500)]
bfdd: Fix timer print-out function

The timer2str function thought 24 minutes was an hour and had a
couple of other issues that needed to be corrected.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3563 from donaldsharp/minimize_the_stuff
Mark Stapp [Fri, 11 Jan 2019 21:34:20 +0000 (16:34 -0500)]
Merge pull request #3563 from donaldsharp/minimize_the_stuff

Zebra - Some Cleanup

5 years agoMerge pull request #3601 from mjstapp/fix_prov_uninit
Donald Sharp [Fri, 11 Jan 2019 20:55:26 +0000 (15:55 -0500)]
Merge pull request #3601 from mjstapp/fix_prov_uninit

zebra: Fix uninitialized value warning in dplane code

5 years agozebra: Fix uninitialized value warning in dplane code
Mark Stapp [Fri, 11 Jan 2019 18:38:41 +0000 (13:38 -0500)]
zebra: Fix uninitialized value warning in dplane code

Fix a gcc-8 warning (at least) about a possible uninitialized
value in the zebra_dplane code.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: Add a switch statement for rib_process_after
Donald Sharp [Thu, 3 Jan 2019 18:50:23 +0000 (13:50 -0500)]
zebra: Add a switch statement for rib_process_after

Future commits are going to introduce more rigor in
state setting in the case of received results from
the data plane.  So let us move the DPLANE_OP_ROUTE_DELETE
state check to the same spot as the rest of the code that
is handling a particular operation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Modify the status flag to 32 bits, add more flags
Donald Sharp [Thu, 3 Jan 2019 18:35:58 +0000 (13:35 -0500)]
zebra: Modify the status flag to 32 bits, add more flags

Modify the status flag from 8 bits to 32 bits and to add
a few new flags that will be used in future commits.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Limit meta_queue insertion to one time.
Donald Sharp [Thu, 3 Jan 2019 16:56:35 +0000 (11:56 -0500)]
zebra: Limit meta_queue insertion to one time.

Modify the meta_queue insertion such that we only enqueue
the route_node into one meta_queue instead of several.

Suppose we have multiple route_entries associated with
a particular node from rip, bgp, staticd.  If we receive a
route update from rip, we would enqueue the route_node into
the 1, 2, 3 meta-nodes.  Which means that we would run
the entire process of figuring out a route 3 times, while
nothing would change the second two times.

Modify the code to choose the lowest meta-queue and
install it into that one for processing.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3599 from donaldsharp/vtysh_sharp
Mark Stapp [Fri, 11 Jan 2019 15:27:36 +0000 (10:27 -0500)]
Merge pull request #3599 from donaldsharp/vtysh_sharp

sharpd: Clean up vtysh warning about insufficient doc string

5 years agoMerge pull request #3597 from mjstapp/dplane_return_prov
Donald Sharp [Fri, 11 Jan 2019 15:24:25 +0000 (10:24 -0500)]
Merge pull request #3597 from mjstapp/dplane_return_prov

zebra: return dataplane provider plugin handle

5 years agosharpd: Clean up vtysh warning about insufficient doc string
Donald Sharp [Fri, 11 Jan 2019 13:58:36 +0000 (08:58 -0500)]
sharpd: Clean up vtysh warning about insufficient doc string

Not sure why this wasn't caught by our CI system.  I thought it
would.  My screw up this should have been right from the start.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com.
5 years agozebra: return dataplane provider plugin handle
Mark Stapp [Thu, 10 Jan 2019 18:50:33 +0000 (13:50 -0500)]
zebra: return dataplane provider plugin handle

When a dataplane provider/plugin registers, return the new
handle/object - that's needed to use some provider apis
later on.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agoMerge pull request #3591 from donaldsharp/sharp_v6
Mark Stapp [Fri, 11 Jan 2019 12:54:18 +0000 (07:54 -0500)]
Merge pull request #3591 from donaldsharp/sharp_v6

Sharp v6 and stuff

5 years agosharpd: Do addition/subtraction for me
Donald Sharp [Thu, 10 Jan 2019 00:27:10 +0000 (19:27 -0500)]
sharpd: Do addition/subtraction for me

Write a bit of code to track the start/stop times and do subtraction!
In the future we expect this code to slice and dice as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agosharpd: Allow route install/removal of v6 routes.
Donald Sharp [Wed, 9 Jan 2019 23:58:36 +0000 (18:58 -0500)]
sharpd: Allow route install/removal of v6 routes.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib: Add another 32 bit accessor to the prefix data structure
Donald Sharp [Wed, 9 Jan 2019 23:28:10 +0000 (18:28 -0500)]
lib: Add another 32 bit accessor to the prefix data structure

It would be nice to have the ability to access the prefix data structure
address as a block of 4 uint32_t's.  This will allow me to easily/quickly
update the v6 address by 1.  This will be used in subsuquent commits.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3511 from pguibert6WIND/handle_multiple_netns_delete_event
Donald Sharp [Fri, 11 Jan 2019 00:21:34 +0000 (19:21 -0500)]
Merge pull request #3511 from pguibert6WIND/handle_multiple_netns_delete_event

zebra: handle multiple events for netns deletion event

5 years agoMerge pull request #3526 from mjstapp/dplane_lists
Donald Sharp [Fri, 11 Jan 2019 00:20:35 +0000 (19:20 -0500)]
Merge pull request #3526 from mjstapp/dplane_lists

zebra: pass lists of results from dataplane to zebra

5 years agobfdd: remove unused OS specific functions
Rafael Zalamena [Thu, 10 Jan 2019 19:20:09 +0000 (17:20 -0200)]
bfdd: remove unused OS specific functions

We are using zebra to learn about the network interfaces and no longer
need to use OS specific system calls to get it.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agobfdd: use zebra to learn about network interfaces
Rafael Zalamena [Thu, 10 Jan 2019 19:13:32 +0000 (17:13 -0200)]
bfdd: use zebra to learn about network interfaces

Don't use system calls to search for and get interface information,
instead use the FRR provided API to learn and cache it.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agozebra: pass lists of results from dataplane to zebra
Mark Stapp [Fri, 21 Dec 2018 19:12:33 +0000 (14:12 -0500)]
zebra: pass lists of results from dataplane to zebra

Pass lists of results back to zebra from the dataplane subsystem
(and pthread). This helps reduce the lock/unlock cycles when
zebra is busy. Also remove a couple of typedefs that made their
way into the dataplane header file - those violate the FRR style
guidelines.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agoMerge pull request #3589 from donaldsharp/self_vs_thread
Mark Stapp [Thu, 10 Jan 2019 13:49:01 +0000 (08:49 -0500)]
Merge pull request #3589 from donaldsharp/self_vs_thread

lib: Convert RUSAGE_SELF to RUSAGE_THREAD where we can

5 years agoMerge pull request #3590 from donaldsharp/zebra_pthread_setnames
Mark Stapp [Thu, 10 Jan 2019 13:36:11 +0000 (08:36 -0500)]
Merge pull request #3590 from donaldsharp/zebra_pthread_setnames

FRR pthread setnames

5 years agoMerge pull request #3198 from donaldsharp/mac_rejection
Renato Westphal [Thu, 10 Jan 2019 13:21:18 +0000 (11:21 -0200)]
Merge pull request #3198 from donaldsharp/mac_rejection

Mac rejection

5 years agoMerge pull request #3415 from pguibert6WIND/flowspec_support_nh_tracking
Donald Sharp [Wed, 9 Jan 2019 20:41:16 +0000 (15:41 -0500)]
Merge pull request #3415 from pguibert6WIND/flowspec_support_nh_tracking

Flowspec support nh tracking

5 years agoMerge pull request #3525 from pguibert6WIND/priorise_default_vrf_configured
Donald Sharp [Wed, 9 Jan 2019 20:30:50 +0000 (15:30 -0500)]
Merge pull request #3525 from pguibert6WIND/priorise_default_vrf_configured

zebra: start the netns notification mechanism after ns initialisation

5 years agolib, bgpd: Convert frr_pthread_set_name to only cause it to set os name of the thread
Donald Sharp [Wed, 9 Jan 2019 19:59:22 +0000 (14:59 -0500)]
lib, bgpd: Convert frr_pthread_set_name to only cause it to set os name of the thread

The current invocation of frr_pthread_set_name was causing it reset the os_name.
There is no need for this, we now always create the pthread appropriately
to have both name and os_name.  So convert this function to a simple
call through of the pthread call now.

Before(any of these changes):
sharpd@robot ~/frr1> ps -L -p 16895
  PID   LWP TTY          TIME CMD
16895 16895 ?        00:01:39 bgpd
16895 16896 ?        00:00:54
16895 16897 ?        00:00:07 bgpd_ka

After:
sharpd@donna ~/frr1> ps -L -p 1752
  PID   LWP TTY          TIME CMD
 1752  1752 ?        00:00:00 bgpd
 1752  1753 ?        00:00:00 bgpd_io
 1752  1754 ?        00:00:00 bgpd_ka

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib: Cleanup thread name setting to happen at start
Donald Sharp [Wed, 9 Jan 2019 19:32:44 +0000 (14:32 -0500)]
lib: Cleanup thread name setting to happen at start

When we start a thread we always call fpt_run and since
the last commit we know os_name is filled with something,
therefore we can just set the name on startup.

This creates this output now for zebra:

sharpd@donna ~/frr2> ps -L -p 25643
  PID   LWP TTY          TIME CMD
25643 25643 ?        00:00:00 zebra
25643 25644 ?        00:00:00 Zebra dplane
25643 25684 ?        00:00:00 zebra_apic
sharpd@donna ~/frr2>

I removed the abstraction to frr_pthread_set_name because
it was snprintf'ing into the same buffer which was the
real bug here( the first character of os_name became null).
In the next commit I'll remove that api because
it is unneeded and was a horrible hack to get
this to work for the one place it was wanted.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib: On frr_pthread_new save a os_name
Donald Sharp [Wed, 9 Jan 2019 18:41:46 +0000 (13:41 -0500)]
lib: On frr_pthread_new save a os_name

On call of frr_pthread_new, save the os_name if given,
if not given use the name passed in( shortening to fit
in available space ) and finally if the name was not
passed in use the default value.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: do not create vrf if name already set to default vrf at startup
Philippe Guibert [Fri, 28 Dec 2018 13:27:45 +0000 (14:27 +0100)]
zebra: do not create vrf if name already set to default vrf at startup

if the default vrf name is manually set, by passing -o parameter to
zebra, then this should be detected when walking the list of netns
available in the system. If a netns called vrf0 is present, then it
should be ignored.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
5 years agozebra: start the netns notification mechanism after ns initialisation
Philippe Guibert [Fri, 21 Dec 2018 15:25:20 +0000 (16:25 +0100)]
zebra: start the netns notification mechanism after ns initialisation

when zebra is run, by using vrf netns backend mode, then the parser
detector of netns is run before forcing the default vrf to a possible
value. In that case, there is a possibility that the forced '-o' option
will create a second vrf with same name, whereas this option should be
there to uniquely have a default vrf with a value.
To make things consistent, the forced value will be priorised. Then, the
notifier will attempt to create vrf contexts. The expectation is that
the creation will fail, due to an already present vrf with same name.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
5 years agolib: Convert RUSAGE_SELF to RUSAGE_THREAD where we can
Donald Sharp [Wed, 9 Jan 2019 17:18:21 +0000 (12:18 -0500)]
lib: Convert RUSAGE_SELF to RUSAGE_THREAD where we can

When using getrusage, we have multiple choices about what
to call for data gathering about this particular thread of execution.

RUSAGE_SELF -> This means gather all cpu run time for all pthreads associated
with this process.

RUSAGE_THREAD -> This means gather all cpu run time for this particular
pthread.

Clearly with data gathering for slow thread as well as `show thread cpu`
it would be preferable to gather only data about the current running
pthread.  This probably was the original behavior of using RUSAGE_SELF
when we didn't have multiple pthreads.  So it didn't matter so much.

Prior to this change, 10 iterations of 1 million routes install/remove
from zebra would give us this cpu time for the dataplane pthread:

Showing statistics for pthread Zebra dplane thread
--------------------------------------------------
                      CPU (user+system): Real (wall-clock):
Active   Runtime(ms)   Invoked Avg uSec Max uSecs Avg uSec Max uSecs  Type  Thread
    0     280902.149    326541      860   2609982      550   2468910    E  dplane_thread_loop

After this change we are seeing this:

Showing statistics for pthread Zebra dplane thread
--------------------------------------------------
                      CPU (user+system): Real (wall-clock):
Active   Runtime(ms)   Invoked Avg uSec Max uSecs Avg uSec Max uSecs  Type  Thread
    0      58045.560    334944      173    277226      539   2502268    E  dplane_thread_loop

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: Do not send a label to zebra that it doesn't understand
Donald Sharp [Wed, 9 Jan 2019 13:48:37 +0000 (08:48 -0500)]
bgpd: Do not send a label to zebra that it doesn't understand

When using an `import vrf` mechanism we are marking
the vrf label as BGP_PREVENT_VRF_2_VRF_LEAK, and then sending
this down to zebra.  Since zebra knows nothing about this special
value, convert it to a value that it does know MPLS_LABEL_NONE.

This bug was introduced by: 13b7e7f007833c4e2942f40cbd2c2f93a2767e78

And shows up with this error message in the zebra log:

2019/01/09 08:25:16 ZEBRA: Extended Error: Label >= configured maximum in platform_labels
2019/01/09 08:25:16 ZEBRA: [EC 4043309093] netlink-cmd (NS 0) error: Invalid argument, type=RTM_NEWROUTE(24), seq=8, pid=3321825991
2019/01/09 08:25:16 ZEBRA: [EC 4043309103] LSP Install Failure: 4294967294

And zebra kept the label as:
donna.cumulusnetworks.com# show mpls table
 Inbound                            Outbound
   Label     Type          Nexthop     Label
--------  -------  ---------------  --------
      -2      BGP            GREEN
      -2      BGP             BLUE

After this fix, neither the labels are stored in zebra nor do we see
the log error message.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agodoc: Add more documentation around configure options
Donald Sharp [Sat, 5 Jan 2019 00:46:16 +0000 (19:46 -0500)]
doc: Add more documentation around configure options

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoconfigure: Add a bit more warning to the enable-shell option
Donald Sharp [Sat, 5 Jan 2019 00:43:40 +0000 (19:43 -0500)]
configure: Add a bit more warning to the enable-shell option

This option probably did not have enough of a please be careful
warning around it.  Let's add a bit more.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: Further refine hash lookup to store hash value
Donald Sharp [Wed, 9 Jan 2019 01:23:11 +0000 (20:23 -0500)]
bgpd: Further refine hash lookup to store hash value

Further refine the previous commit to store the hash value in
both the `struct community_list` as well as the `struct rmap_community`
structures.  This allows us to know a priori what our hash value
is.  This change cuts another couple of seconds of convergence
off to ~55 seconds and further reduces cpu load of bgp:

   16      40061.706    433732       92    330102      129   1242965 RWTEX TOTAL

Down from ~43 seconds previously.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: Add a hash for quick lookup in community_list_lookup
Donald Sharp [Wed, 26 Dec 2018 18:21:10 +0000 (13:21 -0500)]
bgpd: Add a hash for quick lookup in community_list_lookup

The community_list_lookup function in a situation where you have
a large number of communities and route-maps that reference them
becomes a very expensive operation( effectively a linked list walk
per route per route-map you apply per peer that has a routemap that
refereces a community, ecommunity or lcommunity.  This is a very
expensive operation.

In my testbed, I have a full bgp feed that feeds into 14 namespace
view based bgp processes and finally those 14 feed into a final
namespace FRR instance that has route-maps applied to each
incoming peer for in and out:

!
router bgp 65033
 bgp bestpath as-path multipath-relax
 neighbor 192.168.41.1 remote-as external
 neighbor 192.168.42.2 remote-as external
 neighbor 192.168.43.3 remote-as external
 neighbor 192.168.44.4 remote-as external
 neighbor 192.168.45.5 remote-as external
 neighbor 192.168.46.6 remote-as external
 neighbor 192.168.47.7 remote-as external
 neighbor 192.168.48.8 remote-as external
 neighbor 192.168.49.9 remote-as external
 neighbor 192.168.50.10 remote-as external
 neighbor 192.168.51.11 remote-as external
 neighbor 192.168.52.12 remote-as external
 neighbor 192.168.53.13 remote-as external
 neighbor 192.168.54.14 remote-as external
 !
 address-family ipv4 unicast
  neighbor 192.168.42.2 prefix-list two-in in
  neighbor 192.168.42.2 route-map two-in in
  neighbor 192.168.42.2 route-map two-out out
  neighbor 192.168.43.3 prefix-list three-in in
  neighbor 192.168.43.3 route-map three-in in
  neighbor 192.168.43.3 route-map three-out out
  neighbor 192.168.44.4 prefix-list four-in in
  neighbor 192.168.44.4 route-map four-in in
  neighbor 192.168.44.4 route-map four-out out
  neighbor 192.168.45.5 prefix-list five-in in
  neighbor 192.168.45.5 route-map five-in in
  neighbor 192.168.45.5 route-map five-out out
  neighbor 192.168.46.6 prefix-list six-in in
  neighbor 192.168.46.6 route-map six-in in
  neighbor 192.168.46.6 route-map six-out out
  neighbor 192.168.47.7 prefix-list seven-in in
  neighbor 192.168.47.7 route-map seven-in in
  neighbor 192.168.47.7 route-map seven-out out
  neighbor 192.168.48.8 prefix-list eight-in in
  neighbor 192.168.48.8 route-map eight-in in
  neighbor 192.168.48.8 route-map eight-out out
  neighbor 192.168.49.9 prefix-list nine-in in
  neighbor 192.168.49.9 route-map nine-in in
  neighbor 192.168.49.9 route-map nine-out out
  neighbor 192.168.50.10 prefix-list ten-in in
  neighbor 192.168.50.10 route-map ten-in in
  neighbor 192.168.50.10 route-map ten-out out
  neighbor 192.168.51.11 prefix-list eleven-in in
  neighbor 192.168.51.11 route-map eleven-in in
  neighbor 192.168.51.11 route-map eleven-out out
  neighbor 192.168.52.12 prefix-list twelve-in in
  neighbor 192.168.52.12 route-map twelve-in in
  neighbor 192.168.52.12 route-map twelve-out out
  neighbor 192.168.53.13 prefix-list thirteen-in in
  neighbor 192.168.53.13 route-map thirteen-in in
  neighbor 192.168.53.13 route-map thirteen-out out
  neighbor 192.168.54.14 prefix-list fourteen-in in
  neighbor 192.168.54.14 route-map fourteen-in in
  neighbor 192.168.54.14 route-map fourteen-out out
 exit-address-family
!

This configuration on my machine before this change takes about 2:45 to converge
and bgp takes:

Total thread statistics
   16     151715.050    493440      307   3464919      335   7376696 RWTEX TOTAL

CPU time as reported by 'show thread cpu'.

After this change BGP takes 58 seconds to converge and uses:
Total thread statistics
-------------------------
   16      42954.284    350319      122    295743      157   1194820 RWTEX TOTAL

almost 43 seconds of CPU time.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: Use `struct rmap_community` when we use community_list_lookup
Donald Sharp [Wed, 26 Dec 2018 18:01:06 +0000 (13:01 -0500)]
bgpd: Use `struct rmap_community` when we use community_list_lookup

The community_list_lookup function is being changed in a future
commit.  As such we want to use the `struct rmap_community` data
structure for storing compiled information about communities,ecommunities
or lcommunities.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agoMerge pull request #3565 from rhonda/patch-1
Donald Sharp [Tue, 8 Jan 2019 21:40:45 +0000 (16:40 -0500)]
Merge pull request #3565 from rhonda/patch-1

debianpkg: use getent instead of egrepping files

5 years agodebianpkg: use getent instead of egrepping files
Rhonda D'Vine [Fri, 4 Jan 2019 10:34:13 +0000 (11:34 +0100)]
debianpkg: use getent instead of egrepping files

User data might not be stored in the files in etc. getent is the
dedicated tool to extract those information, regardless of where the
user data is stored

Signed-off-by: Rhonda D'Vine <rhonda@proxmox.com>
5 years agoMerge pull request #3569 from donaldsharp/recursive_nexthops
Mark Stapp [Tue, 8 Jan 2019 17:15:10 +0000 (12:15 -0500)]
Merge pull request #3569 from donaldsharp/recursive_nexthops

Small cleanup of zebra_rnh.c code

5 years agoMerge pull request #3552 from donaldsharp/zebra_combined_meta_peanuts
Mark Stapp [Tue, 8 Jan 2019 16:59:45 +0000 (11:59 -0500)]
Merge pull request #3552 from donaldsharp/zebra_combined_meta_peanuts

zebra: Consolidate meta_queue_map into route_info

5 years agoMerge pull request #3531 from marauderlabs/docs-fix
Quentin Young [Tue, 8 Jan 2019 16:04:46 +0000 (11:04 -0500)]
Merge pull request #3531 from marauderlabs/docs-fix

doc: Fix typos and grammar

5 years agoMerge pull request #3566 from pguibert6WIND/fix_vrf_netns_broken
Donald Sharp [Tue, 8 Jan 2019 15:48:16 +0000 (10:48 -0500)]
Merge pull request #3566 from pguibert6WIND/fix_vrf_netns_broken

zebra: fix vrf netns broken

5 years agoMerge pull request #3582 from opensourcerouting/freebsd-route-fix
Donald Sharp [Tue, 8 Jan 2019 15:41:52 +0000 (10:41 -0500)]
Merge pull request #3582 from opensourcerouting/freebsd-route-fix

zebra: fix FreeBSD breakage

5 years agozebra: update local ns_id field
Philippe Guibert [Mon, 7 Jan 2019 08:55:10 +0000 (09:55 +0100)]
zebra: update local ns_id field

ns_id field must be synced with ns_id from netns service.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
5 years agozebra: fix another FreeBSD warning message
Rafael Zalamena [Tue, 8 Jan 2019 12:37:22 +0000 (10:37 -0200)]
zebra: fix another FreeBSD warning message

When an empty netmask a wrong end size is calculated, lets handle this
corner case to avoid spurious warning messages.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agoMerge pull request #3575 from LabNConsulting/working/master/no-bgp-attr-255
Donald Sharp [Tue, 8 Jan 2019 12:35:11 +0000 (07:35 -0500)]
Merge pull request #3575 from LabNConsulting/working/master/no-bgp-attr-255

bgpd: don't use BGP_ATTR_VNC(255) unless ENABLE_BGP_VNC_ATTR is defined

5 years agozebra: fix FreeBSD warning on fresh OS boot
Rafael Zalamena [Tue, 8 Jan 2019 12:32:28 +0000 (10:32 -0200)]
zebra: fix FreeBSD warning on fresh OS boot

Handle corner case where a warning log message is issued on interface
address netmask handling with sockaddr type AF_LINK: it may come empty
or with match all (all 0xFF).

In the first case all lengths are zero and we only need to copy the
first bytes, second case it comes with a zero index and all 0xFF bytes.

In any case we only need to figure out a few of the first bytes instead
of all data.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agoMerge pull request #3562 from donaldsharp/sharp_multiple_installs
Lou Berger [Tue, 8 Jan 2019 11:55:27 +0000 (06:55 -0500)]
Merge pull request #3562 from donaldsharp/sharp_multiple_installs

Sharp multiple installs

5 years agozebra: implement FreeBSD route attr handling
Rafael Zalamena [Tue, 8 Jan 2019 10:14:28 +0000 (08:14 -0200)]
zebra: implement FreeBSD route attr handling

When porting routing socket macro data handling to functions, the
attribute function was forgotten. The only difference between the
attribute and address handler is the family type check.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
5 years agodoc: Fix typos and grammar
Anand [Tue, 8 Jan 2019 04:41:14 +0000 (04:41 +0000)]
doc: Fix typos and grammar

Signed-off-by: Anand <anandakumar.u@gmail.com>
5 years agobgp_rfapi_basic_sanity_config2: delayed timeouts not supported without VNC attr
Lou Berger [Mon, 7 Jan 2019 22:16:37 +0000 (22:16 +0000)]
bgp_rfapi_basic_sanity_config2: delayed timeouts not supported without VNC attr

Signed-off-by: Lou Berger <lberger@labn.net>
5 years agobgp_rfapi_basic_sanity: delayed timeouts not supported without VNC attr
Lou Berger [Mon, 7 Jan 2019 20:00:34 +0000 (20:00 +0000)]
bgp_rfapi_basic_sanity: delayed timeouts not supported without VNC attr

Signed-off-by: Lou Berger <lberger@labn.net>