Commit Graph

14723 Commits

Author SHA1 Message Date
Rafael Zalamena
33400b469e bfdd: header clean up
Remove some unused definitions in the bfd daemon header.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:18:23 -02:00
Rafael Zalamena
46c8ef96a3 bfdd: don't allow VRF for single hop session
Single hop sessions already allow you to select the interface, which
should be enough to determine the VRF we are running in.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:18:23 -02:00
Rafael Zalamena
d245e522f0 bfdd: implement session interface observer
Allow `bfdd` to configure inexisting interfaces / VRF and only activate
them once the interface/VRF start existing. This implementation doesn't
handle dynamic VRFs yet.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:18:23 -02:00
Rafael Zalamena
843b324ddd bfdd: generate random session identificators
This also avoids returning `session_id == 0` which should not happen.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
6f4beb7b30 bfdd: remove unused vrf/interface data structures
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
b333abc295 bfdd: refactor session lookup
Use internal data to lookup sessions. This approach has two main
advantages:

  * it uses less memory because it doesn't use strings for interface /
    vrf, it uses OS indexes instead;
  * prepares code to support VRF;

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
b912b189c7 bfdd: slow down on peer connection loss
Lets be more RFC 5880 compliant and slow down control packets on
connection loss.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
ff91bf7fb2 bfdd: don't try to start echo on protocol restart
`echo-mode` should and will automatically start after session goes up
and it is allowed by the remote peer. See `bs_echo_timer_handler` for
more information.

This avoids having echo controling code spread.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
1f2d5f91ee bfdd: change slow time value
Let's use the RFC 5880 suggested value of 1 second for slow
transmission speed.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
f43b93686f bfdd: simplify timer data structure
Remove some legacy left overs of the old timer data structure bits and
use a simpler version:

  We always keep the current configuration in the timer structure, but
  also keep the running timers (before poll transition) in
  `cur_timers`.

  With this we can remove `new_timers` and avoid timer copy
  configuration copy on final handler (this also simplifies peer
  show command).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
f78dd3a793 bfdd: don't poll to make echo/multiplier changes
RFC 5880 says that it is only necessary to run polling in two cases:

  - Desired minimum transmission interval;
  - Required minimum receive interval;

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
73c62f8eb3 bfdd: deduplicate echo handling code
Use the standardized echo timer handling function.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
0592db9630 bfdd: fix bug on poll sequence
Poll and Final bits can't be set at the same time in a packet.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
8bd859f6d3 bfdd: echo-mode doesn't need poll to start/stop
Remove all polling negotiation when starting/stopping `echo-mode` as it
is not necessary.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
c0ef9a8a50 bfdd: refactor timer handling
Move timer calculation code outside of the packet handling function
and explain how timers are calculated.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
aef131afc5 bfdd: refactor state change handler
Expand state change handling into smaller functions with more
explanatory commentaries. This also handles some corner cases that
were not being handled.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2019-02-14 14:17:29 -02:00
Rafael Zalamena
09720d3189
Merge pull request #3799 from donaldsharp/show_debugging
Show debugging for bfd
2019-02-14 14:16:38 -02:00
Mark Stapp
1d0c39fbd8
Merge pull request #3791 from sworleys/RT-Braces-rtadv
zebra: Fix CLANG suggestion for braces on init of struct
2019-02-14 09:07:47 -05:00
Donald Sharp
a244e59954 bfdd: Add show debugging [bfd] command
This will prevent vtysh from displaying `command imcomplete`
for a `show debugging` issued and we are running this
bfd daemon.  A quick look showed me that there was not
really the ability to turn on/off debugging like other
daemons.  I imagine future work can be focused here.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-13 23:24:05 -05:00
Donald Sharp
6038fe4584 bfdd: Add some code so we can compile from w/ in the bfdd dir
Copy pattern of Makefile from other daemons to allow us to
compile this thingie(tm) from within the bfdd directory.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-13 23:23:48 -05:00
Mark Stapp
77a4dd9320
Merge pull request #3794 from donaldsharp/sharp_import_check
Sharp import check
2019-02-13 15:25:02 -05:00
Mark Stapp
c919c6b6ef
Merge pull request #3796 from donaldsharp/mpls_deletion_cleanup
zebra: Deletion of a lsp is not a failure event
2019-02-13 15:19:39 -05:00
Donald Sharp
3fd385c685 zebra: Deletion of a lsp is not a failure event
FRR is reporting that a lsp deletion event as a failure
in the log messsages.  This will lead to confusion and
lots of fun debugging.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-13 12:49:59 -05:00
Donald Sharp
cfef27e56e
Merge pull request #3622 from mjstapp/fix_cpp_compile
libs, daemons: changes to permit c++ compilation
2019-02-13 12:47:23 -05:00
Donald Sharp
01490ba25d
Merge pull request #3753 from LabNConsulting/working/master/topotest-l3mdev=1
topotest: bgp_l3vpn_to_bgp_vrf: fix setting of TCP l3mdev
2019-02-13 09:32:43 -05:00
Donald Sharp
80d5ff338d sharpd: Add ability to track import-check nexthops
Add the ability to sharp to track import-check type routes
from the cli.  Update docs too.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-13 09:28:38 -05:00
Donald Sharp
b47dc61ade sharpd: Allow the registration of import checks to zebra
Minor code modification to allow the sharp_zebra.c code
to differentiate between import check or nexthop watch
types.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-13 09:28:38 -05:00
Donald Sharp
7a197b9269
Merge pull request #3778 from mjstapp/fix_dplane_update
zebra: use update semantics for routes consistently
2019-02-12 19:36:02 -05:00
Stephen Worley
844e918027 zebra: Fix CLANG suggestion for braces on init of struct
CLANG was throwing an error because struct rtadv_rdnss(dnssl) was being
initialized with = {0} instead of {}. Change to be the latter.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-02-12 15:24:00 -05:00
David Lamparter
7e737f3d40
Merge pull request #3781 from donaldsharp/pbr_debug
pbrd: Add some missing debugs from external events
2019-02-12 18:07:14 +01:00
David Lamparter
c3b9c7ef68
Merge pull request #3783 from mjstapp/fix_bad_rm_decrement
bgpd: remove route-map decrement call on prefix-list
2019-02-12 18:06:07 +01:00
Mark Stapp
f503d522ec bgpd: remove route-map decrement call on prefix-list
Commit b4897fa5 introduced a call to decrement a route-map counter,
applied to a prefix-list in bgp_rfapi_cfg.c. This commit removes
that call.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-02-12 10:10:19 -05:00
David Lamparter
8be328303c
Merge pull request #3773 from pguibert6WIND/bgp_delete_vrfid_unknown
bgpd: if vrf is unknown, bgp deletion not complete
2019-02-12 14:59:39 +01:00
David Lamparter
e0196a847f
Merge pull request #3771 from donaldsharp/eigrp_crash
Eigrp crash
2019-02-12 14:40:09 +01:00
David Lamparter
0fe29323f5
Merge pull request #3723 from slrz/zebra-rtadv-add-rfc8106-support
zebra: add support for IPv6 RA options for DNS configuration (RFC8106)
2019-02-12 14:30:00 +01:00
Donald Sharp
2f61710b73 pbrd: Add some missing debugs from external events
Add some debugs from events that can happen that will
influence our pbr behavior.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-02-12 08:24:58 -05:00
Martin Winter
b7d673c043
Merge pull request #3719 from liam-mcb/master
Revert "redhat: don't Requires initscript on systemd based distros"
2019-02-12 08:54:53 +07:00
David Lamparter
8ed561e1f1 tests: add C++ header compatibility smoke test
Compiling an empty C file with most headers included and -Wc++-compat
gives us a build error if we introduce some stupid C++-incompatible
change.

While this won't catch everything, it's a good start.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-11 22:34:12 -02:00
Renato Westphal
7f04943d6b lib: a few more trivial changes for C++ compatibility
* command_graph.h: stop using "new" as a parameter name as that's a
  reserved C++ keyword.

* module.h: avoid using C99 designated initializers since C++ doesn't
  support them. This change hurts code readability quite considerably,
  so we should try to find a better solution later.

* pw.h: remove unneeded empty structure to silence a C++ warning.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11 22:34:12 -02:00
Renato Westphal
343cd13e17 lib: add macro that performs explicit static casts when using a C++ compiler
C++ doesn't support implicit casts from void pointers like C
does. And the libfrr headers have some bits of code that rely on
implicit casts in order to work. To solve this problem, add a new
"static_cast" macro that performs explicit static casts when a C++
compiler is being used, or do nothing otherwise.

NOTE: since macros are only evaluated when they are used, there
might be other macros from libfrr that will need to use "static_cast"
as well. If a header is successfully compiled using a C++ compiler,
there's no guarantee that its macros are compatible with C++. We'll
only know about such macros when they are used by C++ code, then
we'll need to adapt them one by one in the future.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11 22:34:12 -02:00
Renato Westphal
c139972c0f lib: rename enum to avoid conflict
Two different definitions of "enum filter_type" exist in libfrr:
one in lib/filter.h and other in lib/command_match.h. Rename one
of them to resolve a conflict that happens when both headers are
included by the same file.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11 22:34:12 -02:00
Renato Westphal
5e2444690b lib: add extern "C" {} blocks to all libfrr headers
These are necessary to use functions defined in these headers from C++.

Signed-off-by: David Lamparter <equinox@diac24.net>
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-02-11 22:34:12 -02:00
Mark Stapp
8263d1d0d9 zebra: use update semantics for routes consistently
Use 'update' semantics for route updates, to ensure that
netlink replace behavior works correctly.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2019-02-11 16:11:02 -05:00
Lars Seipel
110765e34a zebra: prefer DEFINE_MTYPE_STATIC for local memtypes
Signed-off-by: Lars Seipel <ls@slrz.net>
2019-02-11 21:46:06 +01:00
Donald Sharp
34afe42a80
Merge pull request #3774 from ton31337/fix/ospfd_instances_do_not_connect_to_default
vtysh: Fix typo in function name
2019-02-11 12:52:31 -05:00
David Lamparter
f8cd615bc4 lib: remove unnamed struct in qobj for C++
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-11 15:49:49 -02:00
David Lamparter
f3dd45d108 lib: remove extra top-level ;
Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-11 15:49:49 -02:00
David Lamparter
c8a65463b2 lib: make atomic ops C++ compatible
C++ doesn't have ISO C11 stdatomic.h or "_Atomic inttype", so use
std::atomic instead to get the headers compatible.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-11 15:49:49 -02:00
David Lamparter
be566e4e45 lib: make union prefixptr C++-compatible
Add a no-op conversion constructor to tell C++ that union prefixptr
accepts any of its member types.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-11 15:49:49 -02:00
David Lamparter
cd2d58525e lib: revert table.h change for C++
This reverts the lib/table.h change from commit
049b31f7d810fd70069e3edbbd3fea6b5c7af98f.

Signed-off-by: David Lamparter <equinox@diac24.net>
2019-02-11 15:49:49 -02:00