]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
5 years agobgpd: Allow registration of nexthops after zebra connection
Donald Sharp [Fri, 5 Oct 2018 15:31:29 +0000 (11:31 -0400)]
bgpd: Allow registration of nexthops after zebra connection

If we attempt to register nexthops before we have the zebra
connection, they will not be installed.  After we have noticed
that we are up, re-install them.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: Add some debugs to note when we are not talking to zebra
Donald Sharp [Fri, 5 Oct 2018 13:43:28 +0000 (09:43 -0400)]
bgpd: Add some debugs to note when we are not talking to zebra

Allow some debug notification when we are unable to talk
to zebra due to the connection not being there yet.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Add counting to nexthop register/unregister events
Donald Sharp [Fri, 5 Oct 2018 13:28:41 +0000 (09:28 -0400)]
zebra: Add counting to nexthop register/unregister events

Add a bit of code to note how many register/unregister nht
events we have had.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: move non-best local path checks outside the function
Anuradha Karuppiah [Fri, 19 Oct 2018 15:46:46 +0000 (08:46 -0700)]
bgpd: move non-best local path checks outside the function

This change is a fixup to -
7b5e18 -  bgpd: use IP address as tie breaker if the MM seq number is the
same

And is being done in response to review comments. This commit brings no
functional change; simply moves around code for easier maintanence.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
5 years agobgpd, lib, vtysh, zebra: Convert to using CMD_VNI_RANGE
Donald Sharp [Fri, 19 Oct 2018 00:44:52 +0000 (20:44 -0400)]
bgpd, lib, vtysh, zebra: Convert to using CMD_VNI_RANGE

For the vni range use a macro to keep track of it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: set remoteseq to 0 when remote mac is deleted by bgpd
Anuradha Karuppiah [Tue, 16 Oct 2018 19:59:24 +0000 (12:59 -0700)]
zebra: set remoteseq to 0 when remote mac is deleted by bgpd

When the remote mac is deleted by bgpd we can end up with an auto mac
entry in zebra if there are neighs referring to the mac. The remote sequence
number in the auto mac entry needs to be reset to 0 as the mac entry may
have been removed on all VTEPs (including the originating one).

Now if the MAC comes back on a remote VTEP it may be added with MM=0 which
 will NOT be accepted if the remote seq was not reset in the previous step.

Ticket: CM-22707

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
5 years agozebra: make neigh active when it is modified from local to remote
Anuradha Karuppiah [Tue, 16 Oct 2018 15:23:22 +0000 (08:23 -0700)]
zebra: make neigh active when it is modified from local to remote

This is a fixup to commit -
f32ea5c07 - zebra: act on kernel notifications for remote neighbors

The original commit handled a race condition between kernel and zebra
that would result in an inconsistent state i.e.
kernel has an offload/remote neigh
zebra has a local neigh

The original commit missed setting the neigh to active when zebra
tried to resolve the inconsistency by modifying the local neigh to
remote neigh on hearing back its own kernel update. Fixed here.

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Ticket: CM-22700

5 years agobgpd: use IP address as tie breaker if the MM seq number is the same
Anuradha Karuppiah [Mon, 15 Oct 2018 15:16:51 +0000 (08:16 -0700)]
bgpd: use IP address as tie breaker if the MM seq number is the same

Same sequence number handling is specified by RFC 7432 -
[
If two (or more) PEs advertise the same MAC address with the same
sequence number but different Ethernet segment identifiers, a PE that
receives these routes selects the route advertised by the PE with the
lowest IP address as the best route.

If the PE is the originator of the MAC route and it receives the same
MAC address with the same sequence number that it generated, it will
compare its own IP address with the IP address of the remote PE and
will select the lowest IP.  If its own route is not the best one, it
will withdraw the route.
]

To implement that specification this commit uses nexthop IP as a tie
breaker between two paths of equal seq number with lower IP winning.

Now if a local path already exists with the same sequence number but higher
(local-VTEP) IP it is evicted (deleted and withdrawn from the peers) and
the winning new remote path is installed in zebra. This is existing code
and handled implicitly via evpn_route_select_install.

If a local path is rxed from zebra with the same sequence as the
current remote winner it is rejected (not installed in the bgp
routing tables) and zebra is asked to re-install the older/remote winner.
This is a race condition that can only happen if bgp's add and zebra's add
cross paths. Additional handling has been added in this commit via
evpn_cleanup_local_non_best_route to take care of the race condition.

Ticket: CM-22674
Reviewed By: CCR-7937

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
5 years agobgpd: perform route selection again when the local path is deleted
Anuradha Karuppiah [Fri, 12 Oct 2018 15:43:19 +0000 (08:43 -0700)]
bgpd: perform route selection again when the local path is deleted

This is needed to install the remote dst when a more preferred local
path is removed.

Ticket: CM-22685
Reviewed By: CCR-7936

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
5 years agozebra: send a local-mac del to bgpd on mac mod to remote
Anuradha Karuppiah [Thu, 11 Oct 2018 15:48:42 +0000 (08:48 -0700)]
zebra: send a local-mac del to bgpd on mac mod to remote

When events cross paths between bgp and zebra bgpd could end up with a
dangling local MAC entry. Consider the following sequence of events on
rack-1 -
1. MAC1 has MM sequence number 1 and points to rack-3
2. Now a packet is rxed locally on rack-1 and rack-2 (simultaneously) with
source-mac=MAC1.
3. This would cause rack-1 and rack-2 to set the MM seq to 2 and
simultaneously report the MAC as local.
4. Now let's say on rack-1 zebra's MACIP_ADD is in bgpd's queue. bgpd
accepts rack-3's update and sends a remote MACIP add to zebra with MM=2.
5. zebra updates the MAC entry from local=>remote.
6. bgpd now processes zebra's "stale local" making it the best path.
However zebra no longer has a local MAC entry.

At this point bgpd and zebra are effectively out of sync i.e. bgpd has a
local-MAC which is not present in the kernel or in zebra.

To handle this window zebra should send a local MAC delete to bgpd on
modifying its cache to remote.

Ticket: CM-22687
Reviewed By: CCR-7935

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
5 years agobgpd: hidden commands to add/del a local mac
Anuradha Karuppiah [Wed, 10 Oct 2018 21:28:32 +0000 (14:28 -0700)]
bgpd: hidden commands to add/del a local mac

local mac add/del comes from zebra. the hidden commands help verify
various race conditions between bgp and zebra.

Ticket: CM-22687
Reviewed By: CCR-7939

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
5 years agobgpd: make name of default vrf/bgp instance consistent
Don Slice [Fri, 20 Jul 2018 15:02:15 +0000 (15:02 +0000)]
bgpd: make name of default vrf/bgp instance consistent

Problems were reported with the name of the default vrf and the
default bgp instance being different, creating confusion.  This
fix changes both to "default" for consistency.

Ticket: CM-21791
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
Reviewed-by: CCR-7658
Testing: manual testing and automated tests before pushing

5 years agoconfigure.ac: add --with-yangmodelsdir=DIR and
Lou Berger [Tue, 30 Oct 2018 21:39:47 +0000 (17:39 -0400)]
configure.ac: add  --with-yangmodelsdir=DIR and
      --with-libyang-pluginsdir=DIR config options

Signed-off-by: Lou Berger <lberger@labn.net>
5 years agozebra: temporary workaround for a clang issue with atomics
Mark Stapp [Tue, 30 Oct 2018 18:05:47 +0000 (14:05 -0400)]
zebra: temporary workaround for a clang issue with atomics

Current clang has an issue with the pointer/target argument
to at least one atomic/intrinsic. A variable with '_Atomic'
generates a compile-time error. Use a cast as a workaround
here to allow use of clang for now.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agoMerge pull request #3261 from mjstapp/fix_rib_close
Donald Sharp [Tue, 30 Oct 2018 16:12:10 +0000 (12:12 -0400)]
Merge pull request #3261 from mjstapp/fix_rib_close

zebra: only uninstall once, when closing rib table

5 years agoMerge pull request #3257 from kooky/patch-1
David Lamparter [Tue, 30 Oct 2018 14:54:32 +0000 (15:54 +0100)]
Merge pull request #3257 from kooky/patch-1

Link-detect documentation

5 years agozebra: only uninstall once, when closing rib table
Mark Stapp [Tue, 30 Oct 2018 13:41:55 +0000 (09:41 -0400)]
zebra: only uninstall once, when closing rib table

When the rib code is informed that a table is closing/
going away, only try once to uninstall associated routes from
the fib/dataplane. The close path can be called multiple times
in some cases - zebra shutdown, e.g.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agoLink-detect documentation
Tim Bray [Mon, 29 Oct 2018 21:12:14 +0000 (21:12 +0000)]
Link-detect documentation

As a quagga user, I didn't realise link-detect is on by default.

5 years agozebra: remove space from json string for show evpn mac vni <num> mac <mac>
Don Slice [Mon, 29 Oct 2018 17:16:14 +0000 (17:16 +0000)]
zebra: remove space from json string for show evpn mac vni <num> mac <mac>

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
5 years agodoc: add section on protocol
Quentin Young [Mon, 29 Oct 2018 15:06:00 +0000 (15:06 +0000)]
doc: add section on protocol

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agobgpd: fix small error in community-list patch
Quentin Young [Mon, 29 Oct 2018 14:08:45 +0000 (14:08 +0000)]
bgpd: fix small error in community-list patch

Couldn't delete an expanded community-list by name alone

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agozebra: add json support to show evpn mac vni <num> mac <mac>
Don Slice [Fri, 26 Oct 2018 20:57:23 +0000 (20:57 +0000)]
zebra: add json support to show evpn mac vni <num> mac <mac>

Added the json output capability in order to improve troubleshooting
capabilities.

Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
5 years agodoc: add dev doc for vtysh
Quentin Young [Mon, 29 Oct 2018 03:00:24 +0000 (03:00 +0000)]
doc: add dev doc for vtysh

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agoMerge pull request #2946 from mjstapp/dplane_2
Donald Sharp [Sun, 28 Oct 2018 20:10:45 +0000 (16:10 -0400)]
Merge pull request #2946 from mjstapp/dplane_2

Zebra: async dataplane, phase 1

5 years agoMerge pull request #3252 from opensourcerouting/buildfoo-20181028
Donald Sharp [Sun, 28 Oct 2018 20:07:50 +0000 (16:07 -0400)]
Merge pull request #3252 from opensourcerouting/buildfoo-20181028

build: SNMP license, rfptest & ospfclient as noinst, redhat spec w/o CONFDATE

5 years agoredhat: remove @CONFDATE@ from spec
David Lamparter [Sun, 28 Oct 2018 18:49:32 +0000 (19:49 +0100)]
redhat: remove @CONFDATE@ from spec

CONFDATE should not be used like this.  Also, the extraversion is now
burned into tarballs anyway so this is no longer neccessary.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agobuild: make rfptest and ospfclient "noinst"
David Lamparter [Sun, 28 Oct 2018 15:05:38 +0000 (16:05 +0100)]
build: make rfptest and ospfclient "noinst"

Both of these are testing/demo-style tools that don't make sense as part
of a normal installation.  So don't install them.

NB: this is only the executables, libospfclient and the RFP code are not
affected.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agodoc: use correct specifier for code block
Quentin Young [Sun, 28 Oct 2018 16:19:36 +0000 (16:19 +0000)]
doc: use correct specifier for code block

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agobuild: crop excessive net-snmp library list
David Lamparter [Sat, 27 Oct 2018 17:06:22 +0000 (19:06 +0200)]
build: crop excessive net-snmp library list

This fixes the longstanding GPL vs. OpenSSL licensing issue in our SNMP
code (and cuts down on its other dependencies a wee bit.)

In a way, net-snmp is really buggy here in what it says that we should
link against, but I don't know their application scenarios well enough
to say it should be changed at their end.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agozebra: force neighbor entry reinstallation
Quentin Young [Tue, 9 Oct 2018 20:12:21 +0000 (20:12 +0000)]
zebra: force neighbor entry reinstallation

Even if the neighbor entry we want already exists, force its
reinstallation to ensure that it's valid. This will now take place when
we request an update of the neighbor entry.

Ticket: CM-22604
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agozebra: fix zebra router memleaks
Quentin Young [Sun, 28 Oct 2018 10:54:52 +0000 (10:54 +0000)]
zebra: fix zebra router memleaks

* Correctly set safi to prevent duplicate allocations
* Free previously allocated table->info before overwriting it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: update zebra protocol documentation
Quentin Young [Sun, 28 Oct 2018 09:29:24 +0000 (09:29 +0000)]
doc: update zebra protocol documentation

* Add full version history with header diagrams
* Update field descriptions
* Update overview section
* Update list of protocol commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: remove mention of 'secondary' ip[v6] commands
Quentin Young [Sun, 28 Oct 2018 07:24:36 +0000 (07:24 +0000)]
doc: remove mention of 'secondary' ip[v6] commands

These haven't existed for 14 years

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agozebra: cleanup some leftovers from removed cmds
Quentin Young [Sun, 28 Oct 2018 07:19:59 +0000 (07:19 +0000)]
zebra: cleanup some leftovers from removed cmds

* Remove vestigial 'secondary' option for v6 address installation
  functions
* Update comments mentioning it

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agolib: remove agentx already enabled warning
Quentin Young [Sun, 28 Oct 2018 02:50:47 +0000 (02:50 +0000)]
lib: remove agentx already enabled warning

This duplicates itself N times since it's not wrappered in a vtysh
command. In lieu of doing that, just remove the message, it's not really
necessary.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agofrr: ignore libtool.orig
Quentin Young [Sun, 28 Oct 2018 02:25:42 +0000 (02:25 +0000)]
frr: ignore libtool.orig

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years ago.github: remove style reminder from PR template
Quentin Young [Sun, 28 Oct 2018 02:14:40 +0000 (02:14 +0000)]
.github: remove style reminder from PR template

Tired of deleting this thing, doubt people read it, and we have
checkpatch anyway

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: include maintainer release procedure in docs
Quentin Young [Sun, 28 Oct 2018 02:09:40 +0000 (02:09 +0000)]
doc: include maintainer release procedure in docs

Gotta include it in a toctree for it to show up

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: fix code-block syntax errors
Quentin Young [Sun, 28 Oct 2018 02:07:09 +0000 (02:07 +0000)]
doc: fix code-block syntax errors

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: ignore libyang-building.rst in sources
Quentin Young [Sun, 28 Oct 2018 02:06:30 +0000 (02:06 +0000)]
doc: ignore libyang-building.rst in sources

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: add missing docs for ipv6 isis router cmd
Quentin Young [Sun, 28 Oct 2018 01:31:08 +0000 (01:31 +0000)]
doc: add missing docs for ipv6 isis router cmd

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: strip trailing whitespace
Quentin Young [Sun, 28 Oct 2018 01:07:06 +0000 (01:07 +0000)]
doc: strip trailing whitespace

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agotools: update checkpatch to allow indented labels
Renato Westphal [Sat, 20 Oct 2018 14:37:39 +0000 (11:37 -0300)]
tools: update checkpatch to allow indented labels

clang-format always indent labels by default and that can't be changed
with any configuration option. Also, indented labels tend to improve
code readability, especially in long functions.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agodebianpkg: fix lintian warn: No need to keep .la libs for packages
Martin Winter [Sat, 20 Oct 2018 10:39:07 +0000 (12:39 +0200)]
debianpkg: fix lintian warn: No need to keep .la libs for packages

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
5 years agolib: fix fetching enum values for derived types
Emanuele Di Pascale [Wed, 17 Oct 2018 13:10:47 +0000 (15:10 +0200)]
lib: fix fetching enum values for derived types

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
5 years agodoc: add build instructions for libyang
Renato Westphal [Tue, 16 Oct 2018 01:00:12 +0000 (22:00 -0300)]
doc: add build instructions for libyang

These instructions are intended to be temporary until we have libyang
packages available for all supported platforms.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agodebianpkg: Add yang files to packages
Martin Winter [Wed, 10 Oct 2018 23:07:44 +0000 (16:07 -0700)]
debianpkg: Add yang files to packages

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
5 years agoredhat: Added libyang dependencies to package
Martin Winter [Thu, 4 Oct 2018 02:00:00 +0000 (19:00 -0700)]
redhat: Added libyang dependencies to package

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
5 years agoyang: add a module translator for ietf-rip.yang
Renato Westphal [Sun, 5 Aug 2018 15:28:33 +0000 (12:28 -0300)]
yang: add a module translator for ietf-rip.yang

As it can be seen below, this translator covers only ~13% of the
ietf-rip YANG module. Work must be done to increase that number.

ripd> en
ripd# conf t
ripd(config)# yang module-translator load /tmp/frr-ietf-translator.json
% Module translator "ietf" loaded successfully.

ripd(config)# do show yang module-translator
 Family  Module           Deviations                      Coverage (%)
 -----------------------------------------------------------------------
 ietf    ietf-interfaces  frr-deviations-ietf-interfaces  3.92
 ietf    ietf-routing     frr-deviations-ietf-routing     1.56
 ietf    ietf-rip         frr-deviations-ietf-rip         13.60

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: implement two YANG notifications
Renato Westphal [Wed, 9 May 2018 04:35:04 +0000 (01:35 -0300)]
ripd: implement two YANG notifications

Implement the 'authentication-failure' and 'authentication-type-failure'
notifications defined in the frr-ripd YANG module.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: implement the 'clear-rip-route' YANG RPC
Renato Westphal [Wed, 9 May 2018 04:35:04 +0000 (01:35 -0300)]
ripd: implement the 'clear-rip-route' YANG RPC

This command deletes all received routes from the RIP routing table.
It should be used with caution as it can create black holes in the
network until RIP reconverges. Very useful to make automated testing
(e.g. ANVL) more predictable, since the internal state of ripd can be
cleared after each test.

Implement the command using a YANG RPC so that it can be executed by
other northbound clients in addition to the CLI.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: implement northbound callbacks to fetch route information
Renato Westphal [Wed, 9 May 2018 04:35:03 +0000 (01:35 -0300)]
ripd: implement northbound callbacks to fetch route information

Support for fetching operational data is experimental at this point.
Locks must be introduced to ensure the rip->table routing table won't
be modified while we're iterating asynchronously over it (or iterating
from a separate pthread).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: implement northbound callbacks to fetch neighbor information
Renato Westphal [Wed, 9 May 2018 04:35:03 +0000 (01:35 -0300)]
ripd: implement northbound callbacks to fetch neighbor information

Support for fetching operational data is experimental at this point.
Locks must be introduced to ensure the peer_list global variable won't
be modified while we're iterating asynchronously over it (or iterating
from a separate pthread).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: reduce excessive indentation in a few places
Renato Westphal [Mon, 2 Jul 2018 18:51:15 +0000 (15:51 -0300)]
ripd: reduce excessive indentation in a few places

Make the code a bit easier to read. No binary changes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: remove vty configuration lock
Renato Westphal [Mon, 28 May 2018 13:18:37 +0000 (10:18 -0300)]
ripd: remove vty configuration lock

The vty configuration lock is used to prevent inconsistencies when
multiple users are editing the configuration at the same time. The
pointer stored in vty->index might become invalid if the associated
configuration object is removed by another user in another CLI session.

Commands converted to the new northbound model don't use vty->index,
but vty->xpath_index and the vty->xpath array. The nb_cli_cfg_change()
function uses the VTY_CHECK_XPATH macro to check if the configuration
object being edited still exists and returns an error if it doesn't.

Now that all ripd commands were converted to the new northbound model,
remove the ripd vty lock because it's not necessary anymore.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: fix SIGHUP handling
Renato Westphal [Mon, 2 Jul 2018 01:24:29 +0000 (22:24 -0300)]
ripd: fix SIGHUP handling

We can now leverage the new northbound API to perform a full configuration
reload in ripd without the need for external help (i.e. frr-reload.py).

When vty_read_config() is called with the 'config' parameter set to
NULL, it performs a new configuration transaction where the running
configuration is *replaced* by the provided configuration file. With that
said, we don't need to do anything other than calling this function in
the SIGHUP handler of all FRR daemons. If a daemon hasn't been converted
to the new northbound model, vty_read_config() will simply *merge*
the configuration file into the running configuration.

The calls to rip_clean() and rip_reset() in the SIGUP handler were
changing configuration variables directly, bypassing the northbound
layer. Configuration variables should be changed only by the northbound
callbacks, and failure to respect that inevitably leads to inconsistencies
and crashes. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: fix memory leaks when interfaces are deleted
Renato Westphal [Mon, 9 Jul 2018 13:46:40 +0000 (10:46 -0300)]
ripd: fix memory leaks when interfaces are deleted

This memleak has been present for at least 16 years. Fix it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit all RIP interface commands to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:35:03 +0000 (01:35 -0300)]
ripd: retrofit all RIP interface commands to the new northbound model

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: no need to use qobj anymore to keep track of "router rip"
Renato Westphal [Wed, 9 May 2018 04:35:02 +0000 (01:35 -0300)]
ripd: no need to use qobj anymore to keep track of "router rip"

Now that "router rip" and all underlying commands were converted to the
new northbound model, there's no need to use the qobj infrastructure to
keep track of the 'rip' global variable anymore.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'version' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:35:01 +0000 (01:35 -0300)]
ripd: retrofit the 'version' command to the new northbound model

Trivial conversion.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'timer basic' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:35:01 +0000 (01:35 -0300)]
ripd: retrofit the 'timer basic' command to the new northbound model

Trivial conversion. Use the northbound 'apply_finish()' callback so
we'll call rip_event() only once even if we change the three RIP timers
at the same time.

Convert the timers to uint32_t to match their representation in the
YANG model.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'route' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:35:01 +0000 (01:35 -0300)]
ripd: retrofit the 'route' command to the new northbound model

Trivial conversion. Remove the rip->route routing table and associated
code because this variable was used only to show the running
configuration.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'redistribute' commands to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:35:01 +0000 (01:35 -0300)]
ripd: retrofit the 'redistribute' commands to the new northbound model

Trivial conversion. As usual, combine multiple DEFUNs into a single
DEFPY for simplicity.

As a bonus of the northbound conversion, this commit fixes the
redistribution of certain protocols into ripd. The 'redist_type' array
used by the "redistribute" commands was terribly outdated, which was
preventing the CLI to parse correctly certain protocols like isis
and babel.

Remove the route_map hooks installed by rip_route_map_init() since they
were redundant (rip_init() already takes care of that).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'passive-interface' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:35:00 +0000 (01:35 -0300)]
ripd: retrofit the 'passive-interface' command to the new northbound model

In ripd, the "passive-interface default" command has the following
behavior:
* All interfaces are converted to the passive mode;
* The "passive-interface IFNAME" command becomes a no-operation and
  "passive-interface IFNAME" statements are removed from the running
  configuration.
* The "no passive-interface IFNAME" can be used to remove interfaces
  from the passive mode.

This command was modeled using the following YANG data nodes in the
frr-ripd module:

  leaf passive-default {
    type boolean;
    default "false";
    description
      "Control whether interfaces are in the passive mode
       by default or not.";
  }
  leaf-list passive-interface {
    when "../passive-default = 'false'";
    type string {
      length "1..16";
    }
    description
      "A list of interfaces where the sending of RIP packets
       is disabled.";
  }
  leaf-list non-passive-interface {
    when "../passive-default = 'true'";
    type string {
      length "1..16";
    }
    description
      "A list of interfaces where the sending of RIP packets
       is enabled.";
  }

The 'when' statements guarantee that the list of passive interfaces
is cleared when the "passive-interface default" command is entered
(likewise, they guarantee that the list of non-passive interfaces is
cleared when the "passive-interface default" command is removed). This
matches exactly the behavior we want to model.

Finally, move the 'passive_default' global variable into the
'rip' structure where it belongs. This fixed the bug where the
"passive-interface default" command was being retained after a "no router
rip" + "router rip".

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'offset-list' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:35:00 +0000 (01:35 -0300)]
ripd: retrofit the 'offset-list' command to the new northbound model

Remove the rip_offset_list_set() and rip_offset_list_unset() functions
since they set/unset multiple configuration options at the same time. The
northbound callbacks need to set/unset configuration options individually.

The frr-ripd YANG module models the "offset-list" command using a list
keyed by the 'interface' and 'direction' leafs. One important detail is
that the IFNAME parameter is optional, and when it's not present it means
we want to match all interfaces. This is modeled using an interface name
of '*' since key lists are mandatory by definition in YANG.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'network' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:35:00 +0000 (01:35 -0300)]
ripd: retrofit the 'network' command to the new northbound model

The frr-ripd YANG module models the ripd "network" command using two
separate leaf-lists for simplicity: one leaf-list for interfaces and
another leaf-list for actual networks. In the 'cli_show' callbacks,
display the "network" command for entries of both leaf-lists.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'neighbor' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:34:59 +0000 (01:34 -0300)]
ripd: retrofit the 'neighbor' command to the new northbound model

Make rip_neighbor_add() and rip_neighbor_delete() return northbound
error codes since their return values are used as the return value of
some northbound callbacks.

These functions shouldn't fail in normal conditions because the northbound
layer guarantees it will never call the 'create' or 'delete' callback
more than once for the same object. Hence any failure in those functions
would indicate an internal inconsistency that needs to be investigated
(by returning NB_ERR the northbound will log a detailed error message
indicating the xpath of the object, the event and the callback where
the error happened).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'distance source' commands to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:34:59 +0000 (01:34 -0300)]
ripd: retrofit the 'distance source' commands to the new northbound model

The "distance (1-255) A.B.C.D/M [WORD]" command was modeled using a
YANG list, which makes it a little bit more complicated to convert to
the new northbound model.

The rip_distance_set() and rip_distance_unset() functions were removed
since they set/unset multiple configuration options at the same time. The
northbound callbacks need to set/unset configuration options individually.

When a distance list is created, use yang_dnode_set_entry() to store
a pointer in the configuration node, and retrieve this pointer in the
other callbacks using yang_dnode_get_entry().

The 'rip_distance' structure was moved to ripd.h so that it can be used
in the rip_northbound.c file.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'distance' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:34:59 +0000 (01:34 -0300)]
ripd: retrofit the 'distance' command to the new northbound model

Trivial conversion.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'default-metric' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:34:59 +0000 (01:34 -0300)]
ripd: retrofit the 'default-metric' command to the new northbound model

Trivial conversion.

rip->default_metric was converted to an uint8_t to match the way it's
defined in the YANG module.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'default-information' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:34:58 +0000 (01:34 -0300)]
ripd: retrofit the 'default-information' command to the new northbound model

Trivial conversion.

'rip->default_information_route_map' was removed since it wasn't being
used anywhere.

'rip->default_information' was removed too because it was being used only
to display the running configuration and thus is not necessary anymore.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'allow-ecmp' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:34:58 +0000 (01:34 -0300)]
ripd: retrofit the 'allow-ecmp' command to the new northbound model

Trivial conversion. The rip->ecmp variable was converted to a boolean to
match the way it's defined in the YANG module.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoripd: retrofit the 'router rip' command to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:34:58 +0000 (01:34 -0300)]
ripd: retrofit the 'router rip' command to the new northbound model

* Implement the northbound callbacks associated to the
  '/frr-ripd:ripd/instance' YANG path (the code is mostly a copy and paste
  from the original "router rip" DEFUNs);
* Move rip_create_socket() out of rip_create() since creating a socket
  is an error-prone operation and thus needs to be performed separately
  during the NB_EV_PREPARE phase;
* On rip_create(), fetch the defaults from the frr-ripd YANG model;
* Convert the "[no] router rip" CLI commands to be dumb wrappers around
  the northbound callbacks;
* On config_write_rip(), write logic to call all 'cli_show' northbound
  callbacks defined under the '/frr-ripd:ripd/instance' YANG path.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoyang, ripd: add 'frr-ripd.yang' and associated stub callbacks
Renato Westphal [Wed, 9 May 2018 04:34:57 +0000 (01:34 -0300)]
yang, ripd: add 'frr-ripd.yang' and associated stub callbacks

Introduce frr-ripd.yang, which defines a model for managing the FRR
ripd daemon. Also add frr-route-types.yang which defines typedefs for
FRR route types.

Update the 'frr_yang_module_info' array of ripd with the new 'frr-ripd'
module.

Add two new files (rip_cli.[ch]) which should contain all ripd commands
converted to the new northbound model. Centralizing all commands in a
single place will facilitate the process of moving the CLI to a separate
program in the future.

Add automatically generated stub callbacks in rip_northbound.c. These
callbacks will be implemented gradually in the following commits.

Add example JSON/XML ripd configurations in yang/examples/.

Add the confd.frr-ripd.yang YANG module with annotations specific to
the ConfD daemon.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agolib: retrofit interface commands to the new northbound model
Renato Westphal [Wed, 9 May 2018 04:34:57 +0000 (01:34 -0300)]
lib: retrofit interface commands to the new northbound model

The frr-interface YANG module models interfaces using a YANG list keyed
by the interface name and the interface VRF. Interfaces can't be keyed
only by their name since interface names might not be globally unique
when the netns VRF backend is in use. When using the VRF-Lite backend,
however, interface names *must* be globally unique. In this case, we need
to validate the uniqueness of interface names inside the appropriate
northbound callback since this constraint can't be expressed in the
YANG language. We must also ensure that only inactive interfaces can be
removed, among other things we need to validate in the northbound layer.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoyang, lib: add 'frr-interface.yang' and associated stub callbacks
Renato Westphal [Sun, 8 Jul 2018 01:04:33 +0000 (22:04 -0300)]
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>
5 years agolib: add a new northbound plugin for Sysrepo
Renato Westphal [Wed, 23 May 2018 23:12:29 +0000 (20:12 -0300)]
lib: add a new northbound plugin for Sysrepo

This plugin leverages the northbound API to integrate FRR with Sysrepo,
a YANG-based configuration and operational state data store.

The plugin is linked to the libsysrepo library and communicates with
the sysrepod daemon using GPB (Google Protocol Buffers) over AF_UNIX
sockets. The integration consists mostly of glue code that calls the
appropriate FRR northbound callbacks in response to events triggered
by the sysrepod daemon (e.g. request to change the configuration or to
fetch operational data).

To build the sysrepo plugin, provide the --enable-sysrepo option to the
configure script while building FRR (the libsysrepo library needs to be
installed in the system).

When installed, the sysrepo plugin will be available for all FRR daemons
and can be loaded using the -M (or --module) command line option.

Example: bgpd -M sysrepo.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agolib: add a new northbound plugin for ConfD
Renato Westphal [Wed, 23 May 2018 23:11:59 +0000 (20:11 -0300)]
lib: add a new northbound plugin for ConfD

This plugin leverages the northbound API to integrate FRR with the ConfD
management agent.

The plugin is linked to the libconfd library and communicates with the
confd daemon using local TCP sockets. The integration consists mostly
of glue code that calls the appropriate FRR northbound callbacks in
response to events triggered by the confd daemon (e.g. request to change
the configuration or to fetch operational data).

By integrating FRR with the libconfd library, FRR can be managed using
all northbound interfaces provided by ConfD, including NETCONF, RESTCONF
and their Web API.

The ConfD CDB API is used to handle configuration changes and the ConfD
Data Provider API is used to provide operational data, process RPCs and
send notifications. Support for configuration management using the ConfD
Data Provider API is not available at this point.

The ConfD optional 'get_object()' and 'get_next_object()' callbacks were
implemented for optimal performance when fetching operational data.

This plugins requires ConfD 6.5 or later since it uses the new leaf-list
API introduced in ConfD 6.5.

To install the plugin, the --enable-confd option should be given to the
configure script, specifying the location where ConfD is installed.

Example: ./configure --enable-confd=/root/confd-6.6

When installed, the confd plugin will be available for all FRR daemons
and can be loaded using the -M (or --module) command line option.

Example: zebra -M confd.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years ago*: add empty array of YANG modules
Renato Westphal [Wed, 23 May 2018 23:29:50 +0000 (20:29 -0300)]
*: 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>
5 years agolib: introduce new northbound API
Renato Westphal [Thu, 7 Dec 2017 19:31:48 +0000 (17:31 -0200)]
lib: introduce new northbound API

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoMerge pull request #3235 from opensourcerouting/buildfoo-20181024
Lou Berger [Sat, 27 Oct 2018 18:14:35 +0000 (14:14 -0400)]
Merge pull request #3235 from opensourcerouting/buildfoo-20181024

build: potpourri

5 years agoMerge pull request #3206 from qlyoung/mac-token-change
David Lamparter [Sat, 27 Oct 2018 11:57:35 +0000 (13:57 +0200)]
Merge pull request #3206 from qlyoung/mac-token-change

lib: change M:A:C to X:X:X:X:X:X

5 years agoMerge pull request #3199 from donaldsharp/eigrp_key
David Lamparter [Fri, 26 Oct 2018 20:25:36 +0000 (22:25 +0200)]
Merge pull request #3199 from donaldsharp/eigrp_key

Eigrp cli stuff

5 years agoMerge pull request #2926 from donaldsharp/router
David Lamparter [Fri, 26 Oct 2018 20:24:15 +0000 (22:24 +0200)]
Merge pull request #2926 from donaldsharp/router

zebra_ns split up

5 years agoMerge pull request #3237 from donaldsharp/actual_error
David Lamparter [Fri, 26 Oct 2018 20:21:44 +0000 (22:21 +0200)]
Merge pull request #3237 from donaldsharp/actual_error

lib: If command was successful don't store the command as an error

5 years agoMerge pull request #3227 from qlyoung/fix-exit-vrf-placement-upstream
David Lamparter [Fri, 26 Oct 2018 20:21:27 +0000 (22:21 +0200)]
Merge pull request #3227 from qlyoung/fix-exit-vrf-placement-upstream

vtysh: fix exit-vrf printing

5 years agoMerge pull request #3236 from qlyoung/finish-onlink
David Lamparter [Fri, 26 Oct 2018 20:19:33 +0000 (22:19 +0200)]
Merge pull request #3236 from qlyoung/finish-onlink

Finish onlink stuff

5 years agoMerge pull request #3247 from opensourcerouting/spelchek
Quentin Young [Thu, 25 Oct 2018 19:46:51 +0000 (15:46 -0400)]
Merge pull request #3247 from opensourcerouting/spelchek

*: spelchek

5 years ago*: spelchek
David Lamparter [Thu, 25 Oct 2018 18:06:59 +0000 (20:06 +0200)]
*: spelchek

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agozebra: only perform shutdown signal processing once
Mark Stapp [Mon, 15 Oct 2018 15:14:07 +0000 (11:14 -0400)]
zebra: only perform shutdown signal processing once

Avoid running the shutdown/sigint handler code more than once. With
the async dataplane, once shutdown has been initiated, the completion
of all async updates triggers final shutdown of the zebra main
pthread. During that time, avoid taking and processing a second
signal, such as SIGINT or SIGTERM.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: rebase dataplane, align with master
Mark Stapp [Wed, 26 Sep 2018 13:34:43 +0000 (09:34 -0400)]
zebra: rebase dataplane, align with master

Rebase and pick up dataplane changes on master, including
renamed structs and enums.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: improve safety of netns_notify_close()
Mark Stapp [Fri, 21 Sep 2018 20:21:15 +0000 (16:21 -0400)]
zebra: improve safety of netns_notify_close()

Additional check to ensure the notify event is still valid
before calling the thread lib api.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: limit queued route updates
Mark Stapp [Fri, 21 Sep 2018 18:54:02 +0000 (14:54 -0400)]
zebra: limit queued route updates

Impose a configurable limit on the number of route updates
that can be queued towards the dataplane subsystem.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: revise struct names to resolve review comments
Mark Stapp [Wed, 19 Sep 2018 17:25:12 +0000 (13:25 -0400)]
zebra: revise struct names to resolve review comments

Use standard type naming and remove use of typedef to resolve
some review comments.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: remove old apis after new dplane work
Mark Stapp [Wed, 29 Aug 2018 20:15:18 +0000 (16:15 -0400)]
zebra: remove old apis after new dplane work

Replaced or out-grew a few zebra internal apis during async
dataplane work; removing them.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: support zebra shutdown and cleanup
Mark Stapp [Mon, 27 Aug 2018 20:03:37 +0000 (16:03 -0400)]
zebra: support zebra shutdown and cleanup

Dplane support for zebra's route cleanup during shutdown (clean
shutdown via SIGINT, anyway.) The dplane has the opportunity to
process incoming updates, and then triggers final cleanup
in zebra's main thread.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: add handy res2str utility
Mark Stapp [Fri, 17 Aug 2018 20:53:24 +0000 (16:53 -0400)]
zebra: add handy res2str utility

Add a 2str utility for dplane result codes; use it in
a debug or two.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: add dplane show commands
Mark Stapp [Fri, 17 Aug 2018 19:50:09 +0000 (15:50 -0400)]
zebra: add dplane show commands

Add first pass at show commands for the zebra dplane. Add some stats
counters to show. Start prep for correct shutdown processing, and for
multiple providers.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: update routing socket path
Mark Stapp [Fri, 17 Aug 2018 19:25:24 +0000 (15:25 -0400)]
zebra: update routing socket path

Update route-socket path for route updates using the async
dplane module.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
5 years agozebra: add shutdown callback for dplane providers
Mark Stapp [Tue, 7 Aug 2018 20:00:33 +0000 (16:00 -0400)]
zebra: add shutdown callback for dplane providers

Support fini or shutdown callback for dplane modules, to give
them an opportunity to cleanup.

Signed-off-by: Mark Stapp <mjs@voltanet.io>