Commit Graph

264 Commits

Author SHA1 Message Date
Rafael Zalamena
d40d6c2274 bfdd,lib,vtysh: new command node for BFD profiles
Add the necessary code to implement the BFD profile command node.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-05-20 10:39:34 -03:00
Rafael Zalamena
4d12e1f90e bfdd: remove duplicated code
Move echo/shutdown toggle code to a function and remove the duplicated
logic.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-05-15 11:32:47 -03:00
Rafael Zalamena
29191d3183 bfdd: tell peer when our control plane is dead
Simplify and fix the code that handles session teardown on control
plane shutdown (either failure or graceful).

- Don't move the `NULL` check inside `free` functions that expect
  data: it creates harder to understand flows.
- Add some new debug messages to aid visualizing session deletions.
- Add sanity check error message (if it ever happens).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-05-13 19:41:50 -03:00
Rafael Zalamena
c516ebf90f
Merge pull request #6301 from pguibert6WIND/bfd_debug_show
bfdd: display debugging status of bfd
2020-04-27 15:12:07 -03:00
Philippe Guibert
9be4b18a2f bfdd: display debugging status of bfd
display debugging status of bfd.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-04-27 17:22:13 +02:00
David Lamparter
189be3996d bfdd: fix frr-format false warning
Dealing with PRIu64 is unfortunately a bit hacky in the frr-format
plugin, as in, it works correctly with snprintfrr, but breaks on plain
snprintf.  There's no good solution unfortunately :/.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27 09:52:41 +02:00
David Lamparter
94cfb0692e build: make clippy Makefile rules nicer
These are easy to get subtly wrong, and doing so can cause
nondeterministic failures when racing in parallel builds.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27 09:52:41 +02:00
David Lamparter
2768748b88 build: use VPATH for vtysh_scan
No need to put $(top_srcdir) everywhere.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-04-27 09:30:01 +02:00
Renato Westphal
60ee8be107 *: change the signature of the northbound callbacks to be more flexible
Having a fixed set of parameters for each northbound callback isn't a
good idea since it makes it difficult to add new parameters whenever
that becomes necessary, as several hundreds or thousands of existing
callbacks need to be updated accordingly.

To remediate this issue, this commit changes the signature of all
northbound callbacks to have a single parameter: a pointer to a
'nb_cb_x_args' structure (where x is different for each type
of callback). These structures encapsulate all real parameters
(both input and output) the callbacks need to have access to. And
adding a new parameter to a given callback is as simple as adding
a new field to the corresponding 'nb_cb_x_args' structure, without
needing to update any instance of that callback in any daemon.

This commit includes a .cocci semantic patch that can be used to
update old code to the new format automatically.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2020-04-23 10:14:32 -03:00
Rafael Zalamena
5920b3eb38 *: replace all random() calls
Replace all `random()` calls with a function called `frr_weak_random()`
and make it clear that it is only supposed to be used for weak random
applications.

Use the annotation described by the Coverity Scan documentation to
ignore `random()` call warnings.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-17 20:57:43 -03:00
Donald Sharp
a83014ccd6
Merge pull request #6247 from FRRouting/nb_conversions
Merge nb_converions branch to master
2020-04-16 19:39:14 -04:00
Donald Sharp
2ff99507ad
Merge pull request #6135 from opensourcerouting/cli-node-cleanup
*: clean up the mess that is CLI command nodes
2020-04-16 19:24:56 -04:00
Chirag Shah
6fd8972aef *: include vrf northbound module in init
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:00:15 -07:00
Santosh P K
09133ff4f7
Merge pull request #5451 from opensourcerouting/rcu-log
logging subsystem rewrite
2020-04-16 20:23:44 +05:30
David Lamparter
f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter
243895805a *: move CLI parent data to cmd_node->parent_node
Same as before, instead of shoving this into a big central list we can
just put the parent node in cmd_node.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter
62b346eefa *: clean up cmd_node initializers
... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
Rafael Zalamena
24843702a0 bfdd: add more zebra debug messages
Uncomment old debug about relayed messages from zebra.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-14 09:35:08 -03:00
Rafael Zalamena
6e10bd9772 bfdd: constify satostr
Detect modifications to the `sockaddr_any` struct.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-14 09:35:08 -03:00
Rafael Zalamena
869dada534 bfdd: remove time calculation debugs
These were disabled by default and not used by a long time.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-14 09:35:08 -03:00
Rafael Zalamena
08de92aff3 bfdd: simplify code flow
Don't attempt to handle out-of-memory situations: XMALLOC/XCALLOC will
`assert` if there is no memory left.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-14 09:35:08 -03:00
Rafael Zalamena
48da2c3169 bfdd: add debug fine tuning capabilities
Move most of the log messages to debug guards so they only get activated
if the user configured the proper debug level.

Current debug levels:
- Peer events.
- Zebra events.
- Network layer debugs.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-14 09:35:08 -03:00
Rafael Zalamena
259b64ebb5 bfdd: use standard log macros
Remove old log_* macros and standardize on FRR's logging infrastructure.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-10 11:06:22 -03:00
Rafael Zalamena
4caf638833 bfdd: fix transmission timer calculation
According to the RFC 5880 the transmission time should be mandated by
the slowest system.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-09 17:46:02 -03:00
Rafael Zalamena
bfea10110c bfdd: initialize packet data with zeroes
Lets avoid garbage data on packets by zeroing the packet before setting
the fields/flags.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-09 17:44:56 -03:00
Rafael Zalamena
b88113ef73 bfdd: remove BFD_*_FLAG macros
Lets use what FRR provide us instead of implementing a new macros.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-09 16:54:11 -03:00
David Lamparter
0bdeb5e58d lib: rewrite zlog lock-free & TLS-buffered
This is a full rewrite of the "back end" logging code.  It now uses a
lock-free list to iterate over logging targets, and the targets
themselves are as lock-free as possible.  (syslog() may have a hidden
internal mutex in the C library;  the file/fd targets use a single
write() call which should ensure atomicity kernel-side.)

Note that some functionality is lost in this patch:
- Solaris printstack() backtraces are ditched (unlikely to come back)
- the `log-filter` machinery is gone (re-added in followup commit)
- `terminal monitor` is temporarily stubbed out.  The old code had a
  race condition with VTYs going away.  It'll likely come back rewritten
  and with vtysh support.
- The `zebra_ext_log` hook is gone.  Instead, it's now much easier to
  add a "proper" logging target.

v2: TLS buffer to get some actual performance

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-01 06:53:26 +02:00
Ruben Kerkhof
0cd61f8d24 bfdd: fix -Wundef warning
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2020-03-30 11:22:58 +02:00
David Lamparter
566bdaf68c *: fix format string warnings
Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-29 10:45:46 +02:00
David Lamparter
d6951e5ef9 *: remove tabs from log messages
Some logging systems are, er, "allergic" to tabs in log messages.
(RFC5424: "The syslog application SHOULD avoid octet values below 32")

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2020-03-24 18:47:12 +01:00
Donatas Abraitis
a8f58eb6a5 *: Use short version of bool expressions
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-04 15:04:23 +02:00
Donald Sharp
7f5818fbd6 *: change hash_backet to hash_bucket
It's been a year search and destroy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-28 13:59:13 -05:00
Jafar Al-Gharaibeh
4d67e75282 Revert "*: change hash_backet to hash_bucket"
This reverts commit 3895c42a2e.

LabN CI update needs to be coordinated before merging this

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2020-02-27 09:52:02 -06:00
Donald Sharp
3895c42a2e *: change hash_backet to hash_bucket
It's been a year search and destroy.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-26 20:03:34 -05:00
Quentin Young
b3ba5dc7fe *: don't null after XFREE; XFREE does this itself
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-03 11:22:13 -05:00
Russ White
6fe6a8b544
Merge pull request #5716 from opensourcerouting/bfdd-log
bfdd: remove logging shim & fix warnings
2020-01-28 10:25:56 -05:00
Quentin Young
abe5af1774
Merge pull request #5412 from opensourcerouting/bfdd-vrf-fix
bfdd: fix multiple VRF handling
2020-01-22 14:14:21 -05:00
David Lamparter
b7b3d466eb bfdd: fix format strings
... now that we get warnings about them ...

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-01-21 16:35:00 +01:00
David Lamparter
d85b048d48 bfdd: remove logging shim
This does exactly nothing, other than hiding format warnings...

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-01-21 16:35:00 +01:00
David Lamparter
429576883e doc: rename man pages to frr-*
The vrrpd one conflicts with the standalone vrrpd package; also we're
installing daemons to /usr/lib/frr on some systems so they're not on
PATH.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-01-15 14:05:11 +01:00
SumitAgarwal123
1d0a11e6cf bfdd: Json fields for multiplier
Adding fields "detect-multiplier" and "remote-detect-multiplier"
for JSON to to reflect changes in "show bfd peers output"

Signed-off-by: Sayed Mohd Saquib sayed.saquib@broadcom.com
2019-12-03 21:20:31 -05:00
SumitAgarwal123
fa6e709f3f bfdd: Adding new CLI, show bfd peers brief
Added new CLI to display all BFD peer in brief format

Signed-off-by: Sayed Mohd Saquib <sayed.saquib@broadcom.com>
2019-12-03 21:20:28 -05:00
SumitAgarwal123
d679003308 bfdd: Adding new cli, clear bfd counters
Adding new CLI clear bfd counters,
This CLI wil only reset Rx/Tx counters,
it will not reset session UP/DOWN and Zebra event count

Signed-off-by: Sayed Mohd Saquib <sayed.saquib@broadcom.com>
2019-12-03 21:14:36 -05:00
SumitAgarwal123
825e3b9457 bfdd: Adding new fields to display show bfd peer
Adding 2 two new fields
1. Peer type, configured/dynamic
2. Detect multiplier

Signed-off-by: Sayed Mohd Saquib <sayed.saquib@broadcom.com>
2019-12-03 21:14:36 -05:00
David Lamparter
2b64873d24 *: generously apply const
const const const your boat, merrily down the stream...

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-12-02 15:01:29 +01:00
David Lamparter
0d8c7a26a1 *: make frr_yang_module_info const
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-11-30 00:38:32 +01:00
Rafael Zalamena
d1ca89aead bfdd: fix multiple VRF handling
Use the interface VRF information instead of relying on the VRF specific
socket information.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit c05c48621c)
2019-11-22 08:37:18 -03:00
Russ White
1157238115
Merge pull request #5274 from opensourcerouting/bfdd-vrf-socket
bfdd: VRF security improvement
2019-11-19 11:41:06 -05:00
Mark Stapp
f7b3ca193b bfdd: remove unused initialization sa warning
There's a variable initialization that's triggering an SA
warning - don't do that.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-11-14 08:29:09 -05:00
Rafael Zalamena
4a9feb66b9 bfdd: bind VRF sockets to devices
Always bind the created sockets to their respective VRF devices. With
this it should be possible to run BFD on VRFs without needing to weaken
the security setting `net.ipv4.udp_l3mdev_accept=1`.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-11-04 09:50:54 -03:00
Renato Westphal
6c57402944 bfdd: split northbound callbacks into multiple files
Rearrange the bfdd northbound callbacks as following:
* bfd_nb.h: prototypes of all northbound callbacks.
* bfd_nb.c: definition of all northbound callbacks and their
  associated YANG data paths.
* bfd_nb_config.c: implementation of YANG configuration nodes.
* bfd_nb_state.c: implementation of YANG state nodes.

This should help to keep to code more organized and easier to
maintain.

No behavior changes intended.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-10-30 10:32:51 -03:00
Rafael Zalamena
37cdb6e91d
Merge pull request #5197 from SumitAgarwal123/BFD_ADMIN_DOWN
bfdd: Handling local and remote admin-down
2019-10-29 12:12:27 -03:00
SumitAgarwal123
7555dc6116 bfdd: Handling local and remote admin-down
Scenarios where this code change is required:

1. BFD is un-configured from BGP at remote end.

Neighbour BFD sends ADMIN_DOWN state, but BFD on local side will send
DOWN to BGP, resulting in BGP session DOWN.
Removing BFD session administratively shouldn't bring DOWN BGP session
at local or remote.

2. BFD is un-configured from BGP or shutdown locally.

BFD will send state DOWN to BGP resulting in BGP session DOWN.
(This is akin to saying do not use BFD for BGP)
Removing BFD session administratively shouldn't bring DOWN BGP session at
local or remote.

Signed-off-by: Sayed Mohd Saquib sayed.saquib@broadcom.com
2019-10-28 21:38:20 -07:00
Donald Sharp
102e215737 bfdd: VRF and Coverity
Fixup a couple of Coverity issues surrounding pointers

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-10-25 20:26:29 -04:00
Rafael Zalamena
38e9efd85f bfdd: don't allow link-local without interface
When using link-local addresses we must provide scope-id to the
operating system so it knows where to send packets.

Spotted by Pavel Ivashchenko (@zays26).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-10-11 16:54:51 -03:00
Rafael Zalamena
ced291deb7 bfdd: simplify session observers code
Don't be selective about what to observe, always observe all possible
aspects of the session that may change on run-time (i.e. bind address,
interface and VRF existence).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-10-11 16:13:24 -03:00
Rafael Zalamena
8ee0862e80 bfdd: set session down after disabling it
If a session is no longer able to send/receive packets, it is very
likely it will be down in a few milliseconds so lets speed up the
process and correctly mark it as down.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-10-11 16:12:49 -03:00
Rafael Zalamena
507d75d453 bfdd: disable sockets polling before closing it
Otherwise the `thread_read` will keep waking us up to handle closing
sockets which are never unregistered.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-10-11 11:15:56 -03:00
Philippe Guibert
c7666ae7a1 bfdd: upon vrf disable, unlink bfd session with vrf
bfd session has a vrf pointer that needs to be reset, when vrf is
disabled.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-10-11 11:12:21 -03:00
SumitAgarwal123
13044b6f6f bfdd: Fixing coredump in log
Param missing in debug log, leading to coredump

Signed-off-by: Sayed Mohd Saquib <sayed.saquib@broadcom.com>
2019-10-11 10:59:20 -03:00
Igor Ryzhov
1e81afc365 *: remove redundant brackets in commands
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-10-08 15:31:40 +03:00
Russ White
9898a2fb34
Merge pull request #5009 from donaldsharp/interface_deletion
lib, zebra: Allow for interface deletion when kernel event happens
2019-09-30 07:46:19 -04:00
Igor Ryzhov
e429a2a0cc *: fix missing VRF autocompletions
Current autocompletion works only for simple "vrf NAME" case.

This commit expands it also for the following cases:
- "nexthop-vrf NAME" in staticd
- usage of $varname in many daemons

All daemons are updated to use single varname "$vrf_name".

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2019-09-24 19:51:46 +03:00
Donald Sharp
3c3c325203 *: Convert zapi->interface_delete to ifp callback
Convert the callback of the interface_delete to the new
ifp callback.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
ef7bd2a3d5 *: Switch all zclient->interface_add to interface create callback
Switch the zclient->interface_add functionality to have everyone
use the interface create callback in lib/if.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp
138c5a7450 *: Add infrastructure to support zapi interface callbacks
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.

This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff

Create 4 new callback functions that will be controlled by
lib/if.c

create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.

At this point this is just boilerplate setup for future commits.
There is no new functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Renato Westphal
8685be73e0 Revert "lib: introduce a read-write lock for northbound configurations"
Adding a lock to protect the global running configuration doesn't
help much since the FRR daemons are not prepared to process
configuration changes in a pthread that is not the main one (a
whole lot of new protections would be necessary to prevent race
conditions).

This means the lock added by commit 83981138 only adds more
complexity for no benefit. Remove it now to simplify the code.

All northbound clients, including the gRPC one, should either run
in the main pthread or use synchronization primitives to process
configuration transactions in the main pthread.

This reverts commit 83981138fe.
2019-09-18 14:35:10 -03:00
Russ White
fe8d933c2c
Merge pull request #4564 from pguibert6WIND/misc_vrf_update_name
Misc vrf update name
2019-09-17 07:22:22 -04:00
Quentin Young
9dcb41a65c
Merge pull request #4604 from opensourcerouting/mutex-sugar
mutex syntactic sugar
2019-09-03 14:55:14 -04:00
David Lamparter
0cf6db21ec *: frr_elevate_privs -> frr_with_privs
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-09-03 17:18:35 +02:00
Philippe Guibert
8cf3c21737 bfdd: close bfd echo sockets, upon vrf disable
upon vrf disable, an event informs bfd daemon that the vrf contexts
should be removed. in the case a vrf backend is netns based, all sockets
opened under that netns have to be closed. otherwise it is impossible
for the system to completely close the network namespace. that implies
that some interfaces may not be deleted, and may not be given back to
default vrf.

PR=65291
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Acked-by: Julien Floret <julien.floret@6wind.com>
2019-09-03 17:06:52 +02:00
Philippe Guibert
955d3ad8a8 bfdd: change vrf name with bypassing nb api
bfd operational & config data may already applied and available, while
an external event requests for changing the vrf name. this change
updates the config and operational context of yang.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-08-27 16:58:47 +02:00
Philippe Guibert
f06e248c53 bfdd: update vrf name of bfd session if necessary
if the bfd session is already enabled, then dynamically change the vrf
name if the vrf where bfd is executed changed its name.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-08-27 15:08:50 +02:00
Philippe Guibert
43ba41c1a3 bfdd: add the vrf update hook in case vrf name changes
in case vrf name changes, use a hook to be notified about the vrf
change.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-08-27 15:08:50 +02:00
Philippe Guibert
e0f36c91e2 bfdd: if no vrfname is passed, use default vrf name
default vrf name is used to forge the key that permits storing the
session.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-08-27 15:08:50 +02:00
Philippe Guibert
3a20889ff6 bfdd: add vrf information as key element for bfd session search
the default vrf is looked up, in the search list algorithm.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-08-27 15:08:50 +02:00
Rafael Zalamena
284062bf17 bfdd: keep source information for single hop
Add source address to northbound when creating sessions with this
information. It is not possible to change source address after the
session was created, but we should be able to set it to make IPv6 work.

Spotted by Philippe Guibert.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-09 09:49:45 -03:00
Rafael Zalamena
307fc4259a bfdd: fix some CI warnings
Use `static` functions for file local functions to please `check_patch.pl`.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-07-02 13:05:27 -03:00
Rafael Zalamena
fdf8ac87f8 bfdd: convert bfd command to northbound
This helps northbound to create the `bfd` node on the configuration
output sooner than adding a peer.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-25 09:34:14 -03:00
Rafael Zalamena
77452ad263 bfdd: small tweaks on northbound
* Change `ERR_VALIDATION` to `ERR_INCONSISTENCY` to error on
    inconsistent state.
  * Duplicated sanity checks:
    * Remove detection multiplier sanity check.
    * Remove duplicated session sanity check.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-25 09:06:48 -03:00
Rafael Zalamena
8e0c84ff27 bfdd: fix compilation warnings on OmniOS
Build will fail with `Werror` enabled with:

```
  CC       bfdd/bfdd_cli.o
In file included from ./lib/frratomic.h:21:0,
                 from ./lib/memory.h:22,
                 from ./lib/vector.h:25,
                 from ./lib/command.h:25,
                 from bfdd/bfdd_cli.c:23:
./config.h:665:0: error: "_FILE_OFFSET_BITS" redefined [-Werror]
 #define _FILE_OFFSET_BITS 64
 ^
In file included from /usr/include/iso/stdlib_iso.h:49:0,
                 from /usr/include/stdlib.h:37,
                 from ./lib/memory.h:20,
                 from ./lib/vector.h:25,
                 from ./lib/command.h:25,
                 from bfdd/bfdd_cli.c:23:
/opt/gcc-5.1.0/lib/gcc/i386-pc-solaris2.11/5.1.0/include-fixed/sys/feature_tests.h:231:0: note: this is the location of the previous definition
 #define _FILE_OFFSET_BITS 32
 ^
In file included from ./lib/thread.h:24:0,
                 from ./lib/vty.h:27,
                 from ./lib/command.h:26,
                 from bfdd/bfdd_cli.c:23:
./lib/zebra.h:271:2: error: #warning "assuming 4-byte alignment for CMSG_SPACE" [-Werror=cpp]
 #warning "assuming 4-byte alignment for CMSG_SPACE"
  ^
./lib/zebra.h:277:2: error: #warning "assuming 4-byte alignment for CMSG_LEN" [-Werror=cpp]
 #warning "assuming 4-byte alignment for CMSG_LEN"
  ^
cc1: all warnings being treated as errors
Makefile:6876: recipe for target 'bfdd/bfdd_cli.o' failed
gmake[1]: *** [bfdd/bfdd_cli.o] Error 1
```

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-24 13:42:40 -03:00
Rafael Zalamena
eefca51eb3 bfdd: fix compilation warnings on OpenBSD
Build will fail with `Werror` enabled with:

```
bfdd/bfdd_northbound.c:876: warning: initialized field overwritten
bfdd/bfdd_northbound.c:876: warning: (near initialization for 'frr_bfdd_info.nodes[0].cbs')
...
cc1: error: unrecognized command line option "-Wno-unused-result"
gmake[1]: *** [Makefile:6875: bfdd/bfdd_northbound.o] Error 1
```

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-24 11:46:29 -03:00
Philippe Guibert
f7bb830439 bfdd: authorise multihop and interface setting
the restriction to authorise multihop and interface setting has no
meaning here.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-22 10:10:56 -03:00
Philippe Guibert
7818c5fba0 bfdd: add not '\n' to shutdown help string
help string had not a '\n' at the end of the line for bfd shutdown help
command.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-22 10:10:56 -03:00
Rafael Zalamena
8a676ce6b1 bfdd: use microseconds timers in YANG
Lets allow specification to accept microseconds, but limit the timers
configuration in FRR to milliseconds (minimum is 10 ms and maximum is 60
seconds).

This matches the RFC 5880 and the IETF BFD YANG draft model.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:10:56 -03:00
Rafael Zalamena
2a573ff672 bfdd: support global BFD reset
Add command 'no bfd' to remove all BFD sessions configuration and fix
other daemon integration.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:10:56 -03:00
Rafael Zalamena
47a7b00c2d bfdd: fix daemon warning on startup
```
warnings: BFD: [EC 100663317] YANG model "frr-bfdd@*" not embedded, trying external file
```

Embed the YANG model into the binary to avoid reading an external file.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:10:56 -03:00
Rafael Zalamena
49cc9e7b64 bfdd: implement configuration reload
Reload configuration on SIGHUP using the northbound.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:10:56 -03:00
Rafael Zalamena
0030482f5e bfdd: fix northbound remote-discriminator display
When the remote discriminator hasn't been assigned yet, then we can't
return a value of 0. The value '0' is an invalid discriminator and the
yang handlers will complain about it.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:10:56 -03:00
Rafael Zalamena
0287a64a6e bfdd: implement write_config using northbound
Move all the `show running-config` logic to the new northbound
implementation.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:10:56 -03:00
Rafael Zalamena
adc26455bf bfdd: migrate session commands to northbound
Lets start using the new BFD yang model and translate the BFD session
configuration commands to use the northbound.

One important change: all sessions will default to use
`VRF_DEFAULT_NAME` (usually "default") when no VRF is configured. All
places which search for BFD sessions must now take this into account.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:10:56 -03:00
Rafael Zalamena
3e4e7405ff bfdd: remove the label command
This command has no use for CLI and is relevant for the control socket only.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:08:33 -03:00
Rafael Zalamena
014cab13bf bfdd: export some private functions
These functions are going to be used by the future northbound
implementation to handle BFD sessions.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-06-22 10:08:33 -03:00
Donald Sharp
574fa9a597
Merge pull request #4536 from pguibert6WIND/bfd_startup_does_not_work
bfdd: avoid double socket initialisation on same netns
2019-06-21 19:41:02 -04:00
Philippe Guibert
30c5d21ee3 bfdd: avoid double socket initialisation on same netns
when working with a standard vrf backend, bfdd ignores that and tries to
create and configure bfd sockets for each vrf, which will fail for the
second vrf discovered, since the network namespace used is the same, and
it is not possible to use same socket settings twice. Handle this case,
and avoids to reinitialise sockets.
This patch however does not leverage bfd support for vrf-lite.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-21 09:21:03 +02:00
David Lamparter
1b88c3cb4c bfdd: use MTYPE_STATIC
MTYPE definitions should be local to the file using them whereever
possible.  Also remove some superfluous ;

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-21 08:54:25 +02:00
Mark Stapp
fa3bf3a21b lib,bgpd,babeld,ripngd,nhrpd,bfdd: clean up SA warnings
Clean up several SA warnings.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-06-06 13:13:15 -04:00
Rafael Zalamena
9e8238f5d6
Merge pull request #4431 from donaldsharp/mad_gainz
Switch over to `-N FOO` adding FOO to the various directories/files we open up
2019-06-05 11:30:19 -03:00