summaryrefslogtreecommitdiffstats
path: root/bfdd/bfd.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* bfdd: cleanup vrf handling in packet receiveIgor Ryzhov2021-10-141-1/+2
| | | | | | | | | | | We get the pointer to the interface on which the packet was received right at the beginning of bfd_recv_cb. So let's use this pointer and don't perform additional interface lookups. Also explain in more detail how we process VRF id with different backends. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* bfdd: fix bfd key structureIgor Ryzhov2021-06-021-3/+14
| | | | | | | | | | | | | There's a padding byte between "mhop" and "peer" fields in this structure. This structure is sometimes passed by value to functions and used in assignments. The standard doesn't guarantee that the padding bytes are copied on assignments. As this structure is used as a hash key, having this padding byte with unspecified value can lead to unwanted behavior. Fix the possible issue by making the "mhop" field to be 2 bytes. Also make the struct packed as a precaution for future changes. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* bfdd: remove profiles when removing bfd nodeIgor Ryzhov2021-04-011-0/+1
| | | | | | Fixes #8379. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* Merge pull request #8121 from opensourcerouting/macro-cleanupDonatas Abraitis2021-03-221-3/+3
|\ | | | | *: require ISO C11 + semicolons after file-scope macros
| * *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
* | bfdd: separate echo rx/tx timersIgor Ryzhov2021-03-161-2/+12
|/ | | | | | | | | | Currently there is a single interval for both RX and TX echo functions. This commit introduces separate RX and TX timers for echo packets. The main advantage is to be able to set the receive interval to zero when we don't want to receive echo packets from the remote system. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* bfdd: support connecting to BFD data planeRafael Zalamena2020-11-241-3/+4
| | | | | | | Add option to connect to a data plane server instead of receiving connections. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: distributed BFD show commandsRafael Zalamena2020-11-241-0/+12
| | | | | | | Show BFD sessions updated counters by asking the data plane for this information and show data plane statistics. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: integrate distributed BFDRafael Zalamena2020-11-241-0/+27
| | | | | | | | | | | | Add hooks in the correct places so the BFD daemon uses the data plane instead of the software packet sending implementation to monitor the session. This code also adds some handlers to support fallback to FRR BFD session handling, however since this complicates the code it won't work at the moment (the BFD sockets are disabled by default when using data plane). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: import distributed BFD implementationRafael Zalamena2020-11-241-0/+25
| | | | | | | | | | | | | | | | Distributed BFD is a term used for BFD implementations that do not run on the routing engine, instead it is run on a data plane (software or hardware based). The current code implements the basic communication between FRR BFD daemon with an external BFD data plane and defines the protocol format in the file `bfddp_packet.h`. To enable/use data plane you need to start BFD daemon with the command line `--dplaneaddr <type>:<address>`, then a socket will be opened to listen for incoming data plane connections. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: implement minimum TTLRafael Zalamena2020-08-121-1/+4
| | | | | | | | Initial BFD protocol implementation had a hard coded value of maximum 5 hops, now we have a configurable hop amount with a safe default of 1 hop. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: simplify and remove duplicated codeRafael Zalamena2020-08-111-0/+9
| | | | | | Move the session configuration application logic to a single function. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: implement passive modeRafael Zalamena2020-08-111-0/+11
| | | | | | | | | | | | | | | | | | The passive mode is briefly described in the RFC 5880 Bidirectional Forwarding Detection (BFD), Section 6.1. Overview: > A system may take either an Active role or a Passive role in session > initialization. A system taking the Active role MUST send BFD > Control packets for a particular session, regardless of whether it > has received any BFD packets for that session. A system taking the > Passive role MUST NOT begin sending BFD packets for a particular > session until it has received a BFD packet for that session, and thus > has learned the remote system's discriminator value. At least one > system MUST take the Active role (possibly both). The role that a > system takes is specific to the application of BFD, and is outside > the scope of this specification. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: don't update peers settings on shutdownRafael Zalamena2020-05-291-0/+6
| | | | | | | During the shutdown phase don't attempt to apply settings to peers as it is useless and will crash if the peer hash is gone. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: implement BFD session configuration profilesRafael Zalamena2020-05-201-0/+86
| | | | | | | | | | | | | | | | | | | Allow user to pre-configure peers with a profile. If a peer is using a profile any configuration made to the peer will take precedence over the profile configuration. In order to track the peer configuration we have now an extra copy of the peer configuration in `peer_profile` inside `struct bfd_session`. This information will help the profile functions to detect user configurations and avoid overriding what the user configured. This is especially important for peers created via other protocols where the default `shutdown` state is disabled (peers created manually are `shutdown` by default). Profiles can be used before they exist: if no profile exists then it will use the default configuration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: remove duplicated codeRafael Zalamena2020-05-151-0/+16
| | | | | | | Move echo/shutdown toggle code to a function and remove the duplicated logic. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: constify satostrRafael Zalamena2020-04-141-1/+1
| | | | | | Detect modifications to the `sockaddr_any` struct. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: add debug fine tuning capabilitiesRafael Zalamena2020-04-141-0/+19
| | | | | | | | | | | | 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>
* bfdd: use standard log macrosRafael Zalamena2020-04-101-8/+2
| | | | | | Remove old log_* macros and standardize on FRR's logging infrastructure. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: remove BFD_*_FLAG macrosRafael Zalamena2020-04-091-4/+0
| | | | | | Lets use what FRR provide us instead of implementing a new macros. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: remove logging shimDavid Lamparter2020-01-211-19/+12
| | | | | | This does exactly nothing, other than hiding format warnings... Signed-off-by: David Lamparter <equinox@diac24.net>
* bfdd: Adding new CLI, show bfd peers briefSumitAgarwal1232019-12-041-0/+2
| | | | | | Added new CLI to display all BFD peer in brief format Signed-off-by: Sayed Mohd Saquib <sayed.saquib@broadcom.com>
* *: generously apply constDavid Lamparter2019-12-021-2/+2
| | | | | | const const const your boat, merrily down the stream... Signed-off-by: David Lamparter <equinox@diac24.net>
* bfdd: bind VRF sockets to devicesRafael Zalamena2019-11-041-6/+6
| | | | | | | | 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>
* bfdd: split northbound callbacks into multiple filesRenato Westphal2019-10-301-31/+0
| | | | | | | | | | | | | | | | 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>
* Merge pull request #5197 from SumitAgarwal123/BFD_ADMIN_DOWNRafael Zalamena2019-10-291-2/+2
|\ | | | | bfdd: Handling local and remote admin-down
| * bfdd: Handling local and remote admin-downSumitAgarwal1232019-10-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | bfdd: simplify session observers codeRafael Zalamena2019-10-111-6/+2
|/ | | | | | | | 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>
* bfdd: update vrf name of bfd session if necessaryPhilippe Guibert2019-08-271-0/+1
| | | | | | | 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>
* bfdd: support global BFD resetRafael Zalamena2019-06-221-0/+1
| | | | | | | Add command 'no bfd' to remove all BFD sessions configuration and fix other daemon integration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: implement write_config using northboundRafael Zalamena2019-06-221-0/+23
| | | | | | | Move all the `show running-config` logic to the new northbound implementation. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: migrate session commands to northboundRafael Zalamena2019-06-221-4/+19
| | | | | | | | | | | 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>
* bfdd: export some private functionsRafael Zalamena2019-06-221-0/+6
| | | | | | | These functions are going to be used by the future northbound implementation to handle BFD sessions. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: use MTYPE_STATICDavid Lamparter2019-06-211-10/+5
| | | | | | | MTYPE definitions should be local to the file using them whereever possible. Also remove some superfluous ; Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* bfdd, lib, bgpd: add bfd cbit usagePhilippe Guibert2019-05-141-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | bfd cbit is a value carried out in bfd messages, that permit to keep or not, the independence between control plane and dataplane. In other words, while most of the cases plan to flush entries, when bfd goes down, there are some cases where that bfd event should be ignored. this is the case with non stop forwarding mechanisms where entries may be kept. this is the case for BGP, when graceful restart capability is used. If BFD event down happens, and bgp is in graceful restart mode, it is wished to ignore the BFD event while waiting for the remote router to restart. The changes take into account the following: - add a config flag across zebra layer so that daemon can set or not the cbit capability. - ability for daemons to read the remote bfd capability associated to a bfd notification. - in bfdd, according to the value, the cbit value is set - in bfdd, the received value is retrived and stored in the bfd session context. - by default, the local cbit announced to remote is set to 1 while preservation of the local path is not set. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfd: add bfdd_privs to the bglobal structurePhilippe Guibert2019-05-071-2/+2
| | | | | | | | this structure contains the bfdd_privs structure in charge of the privilege settings. The initialisation has moved a bit, in order that the preinit settings are done. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfdd: upon vrf enable/disable, update bs and obs listPhilippe Guibert2019-05-071-0/+2
| | | | | | | | parse observer list, and update bs context if vrf pointer is not yet populated. this is helpful for validation, but also will permit bfd to send notification to remote daemon. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfdd: register to interfaces from other vrfsPhilippe Guibert2019-05-071-0/+2
| | | | | | registration for new interfaces is done. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfdd: socket handling per vrf contextPhilippe Guibert2019-05-071-7/+14
| | | | | | sockets are created foreach network namespace context enabled. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfdd: add vrf frameworkPhilippe Guibert2019-05-071-0/+1
| | | | | | | vrf initialisation is done. hooks are installed. no specific action is done, except the vrf initialisation. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfdd: socket creation in a vrf can be donePhilippe Guibert2019-05-071-0/+2
| | | | | | vrf_socket() call is performed instead of socket() call. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* bfdd: move bfd_ses_[xx] to bfd_sess_[xx] like other routinesPhilippe Guibert2019-05-071-3/+3
| | | | | | | this is a change to be more consistent with function naming convention in bfd. a small change for 3 functions. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* Merge pull request #4155 from pguibert6WIND/bfd_increase_configRuss White2019-04-261-0/+1
|\ | | | | bfdd: avoid having bfd config inherited from operation context
| * bfdd: avoid having bfd config inherited from operation contextPhilippe Guibert2019-04-181-0/+1
| | | | | | | | | | | | | | | | | | there are cases where bfd sessions are created from remote daemons. in that case, the bfd daemon were appearing in both operational and configuration contexts of bfd. Change that by only keeping operational contexts. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
* | bfdd: fix UDP source port rangeRafael Zalamena2019-04-251-2/+2
|/ | | | | | | | | RFC 5881 Section 4 tells us that the BFD source port must be between 49152 and 65535 inclusive. Spotted by Lucian Cristian. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: don't enable sessions without local-addressRafael Zalamena2019-03-121-1/+5
| | | | | | | When the local-address configured by the peer doesn't exist, then we must observe the session until the mentioned address comes up. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: change session lookup data structureRafael Zalamena2019-03-121-34/+19
| | | | | | | | Use simplier data structure key to avoid having to do complex and error-prone key building (e.g. avoid expecting caller to know IPv6 scope id, interface index, vrf index etc...). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* *: Rename backet to bucketTim Bray2019-02-251-1/+1
| | | | | | Presume typo from original author Signed-off-by: Tim Bray <tim@kooky.org>
* bfdd: fix CI warningsRafael Zalamena2019-02-141-12/+14
| | | | | | | Fix a few checkpatch warnings and a clang analyzer warning of uninitialized variable. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* bfdd: header clean upRafael Zalamena2019-02-141-13/+4
| | | | | | Remove some unused definitions in the bfd daemon header. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>