summaryrefslogtreecommitdiff
path: root/bfdd/bfd.h
AgeCommit message (Collapse)Author
2025-03-03bfdd: Add BFD "log-session-changes" feature.Acee Lindem
Add the BFD "log-session-changes" via the YANG and northbound API. Also add the configured value to show and operational state. Signed-off-by: Acee Lindem <acee@lindem.com>
2025-02-05bfdd: Use pass by reference for bfd_key_deleteDonald Sharp
Coverity is pointing out that bfd_key_delete is passing by value instead of reference for a very large structure. Double plus not good. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-05bfdd: Use pass by reference instead of pass by value for a structDonald Sharp
The function bfd_key_lookup is currently sending by value for a now very large structure. Let's convert this over to pass by reference. This is noticed by coverity. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-23bfdd: enable sbfd sessionwumu.zsl
1) create socket to send sbfd packets 2) integrate sbfd logic with existing BFD Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23bfdd: add sbfd state machine functionswumu.zsl
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23bfdd: implement functions for sending sbfd pkts with SRv6 headerwumu.zsl
Two types of sbfd packets are supported: initiator packet and echo packet Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23bfdd: create a hash table for local sbfd reflector infowumu.zsl
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23bfdd: support sbfd session create and destroywumu.zsl
refactor bfd_session_create and bfd_session_destroy to support SBFD Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-22bfdd: add bfdname in bfd_keywumu.zsl
sbfd will use bfdname for key hash, We introduced a bfd-name for every sbfd session, normal BFD sessions can leave it as NULL. A unique bfd-name can be used to identify a sbfd session quickly. This is quite useful in our Srv6 deployment for path protection case. For example, if use the sbfd session to protect the SRv6 path A-B-D, we would assign the name 'path-a-b-d' or 'a-b-d' to the session. Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-07bfdd: add enum bfd_mode_type for different bfd typeswumu.zsl
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2024-11-12bfdd: disable echo socket when not using itRafael Zalamena
Lets avoid a performance penalty in forwarding when not using the BFD echo feature. The echo socket uses raw packet capturing along with a BPF filter which causes performance issues. While here change code to use `-1` for closed sockets instead of valid FD number `0`. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-07-25bfdd: remove control socket obsolete codeRafael Zalamena
Let's remove the obsolete BFD control socket. If the functionality is needed then YANG/northbound notifications / getting should be used instead. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-07-16bfdd: changes for code maintainabilitysri-mohan1
these changes are for improving the code maintainability and readability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-04-15bfdd: fix BFD_GETCBITIgor Ryzhov
The macro should check C bit, not F bit. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-12Merge pull request #15697 from zmw12306/bfd_check_MflagIgor Ryzhov
bfdd: Add check for flag Multipoint (M)
2024-04-11bfdd: add check for flag Mzmw12306
Signed-off-by: zmw12306 <zmw12306@gmail.com>
2024-01-27build: nuke `BFDD_CONTROL_SOCKET`David Lamparter
This just unnecessarily complicates things by involving autoconf. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-28Merge pull request #14811 from donaldsharp/zebra_final_shutdown_finallyChristian Hopps
Zebra final shutdown finally
2023-11-21bfdd: Free zclient memory on shutdownDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-21*: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZDonald Sharp
INTERFACE_NAMSIZ is just a redefine of IFNAMSIZ and IFNAMSIZ is the standard for interface name length on all platforms that FRR currently compiles on. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-11Merge pull request #13675 from zmw12306/bfd_version_checkIgor Ryzhov
bfd:fix version bits check
2023-06-03bfdd: fix version bits check.zmw12306
The version of bfd pkt is represented by 3 bits in B[0]. Signed-off-by: zmw12306 <zmw12306@gmail.com>
2023-04-25bfd: fix missing Authentication in control pktzmw12306
According RFC 5880, add a simpilfed version handling authentication Signed-off-by: zmw12306 <zmw12306@gmail.com>
2023-03-24*: Convert `struct event_master` to `struct event_loop`Donald Sharp
Let's find a better name for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert struct thread_master to struct event_master and it's ilkDonald Sharp
Convert the `struct thread_master` to `struct event_master` across the code base. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
Effectively a massive search and replace of `struct thread` to `struct event`. Using the term `thread` gives people the thought that this event system is a pthread when it is not Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-08-02BFDD: Add RTT to BFD IPV4 Echo packet processinglynnemorrison
Add a send time into the BFD Echo packet. When the BFD Echo packet is received back store time it took in usec. When user issues a show bfd peer(s) command calculate and display minimum, average, and max time it took for the BFD Echo packet to be looped back. Signed-off-by: Lynne Morrison <lynne.morrison@ibm.com>
2022-06-27bfdd: add IPv4 BFD Echo support that matches RFClynnemorrison
Modify the existing BFD Echo code to send an Echo message that will be looped in the peers forwarding plane. The existing Echo code only works with other FRR implementations because the Echo packet must go up to BFD to be turned around and forwarded back to the local router. The new BFD Echo code sets the src/dst IP of the packet to be the local router's IP and sets the dest MAC to be the peers MAC address. The peer receives the packet and because it is not it's IP address it forwards it back to the local router. Signed-off-by: Lynne Morrison <lynne.morrison@ibm.com>
2022-05-04Merge pull request #11137 from opensourcerouting/if-name-len-fixesDonald Sharp
*: standardize interface name maximum length
2022-05-02*: use FRR interface name definition everywhereRafael Zalamena
Don't rely on the OS interface name length definition and use the FRR definition instead. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-05-02bfdd: remove "local_address" of bfd sessionewlumpkin
The "local_address" of bfd is only used in `show bfd peers brief` for single hop sessions which are configured without "local address". Since it is set by destination address of received packet, not completely correct, so remove it. Signed-off-by: ewlumpkin <ewlumpkin@gmail.com> Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-04-19*: Fix spelling of overridenDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-23*: Change thread->func to return void instead of intDonald Sharp
The int return value is never used. Modify the code base to just return a void instead. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-12-21*: rework renaming the default VRFIgor Ryzhov
Currently, it is possible to rename the default VRF either by passing `-o` option to zebra or by creating a file in `/var/run/netns` and binding it to `/proc/self/ns/net`. In both cases, only zebra knows about the rename and other daemons learn about it only after they connect to zebra. This is a problem, because daemons may read their config before they connect to zebra. To handle this rename after the config is read, we have some special code in every single daemon, which is not very bad but not desirable in my opinion. But things are getting worse when we need to handle this in northbound layer as we have to manually rewrite the config nodes. This approach is already hacky, but still works as every daemon handles its own NB structures. But it is completely incompatible with the central management daemon architecture we are aiming for, as mgmtd doesn't even have a connection with zebra to learn from it. And it shouldn't have it, because operational state changes should never affect configuration. To solve the problem and simplify the code, I propose to expand the `-o` option to all daemons. By using the startup option, we let daemons know about the rename before they read their configs so we don't need any special code to deal with it. There's an easy way to pass the option to all daemons by using `frr_global_options` variable. Unfortunately, the second way of renaming by creating a file in `/var/run/netns` is incompatible with the new mgmtd architecture. Theoretically, we could force daemons to read their configs only after they connect to zebra, but it means adding even more code to handle a very specific use-case. And anyway this won't work for mgmtd as it doesn't have a connection with zebra. So I had to remove this option. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-10-14bfdd: cleanup vrf handling in packet receiveIgor Ryzhov
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>
2021-06-02bfdd: fix bfd key structureIgor Ryzhov
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>
2021-04-01bfdd: remove profiles when removing bfd nodeIgor Ryzhov
Fixes #8379. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-22Merge pull request #8121 from opensourcerouting/macro-cleanupDonatas Abraitis
*: require ISO C11 + semicolons after file-scope macros
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
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>
2021-03-16bfdd: separate echo rx/tx timersIgor Ryzhov
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>
2020-11-24bfdd: support connecting to BFD data planeRafael Zalamena
Add option to connect to a data plane server instead of receiving connections. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-11-24bfdd: distributed BFD show commandsRafael Zalamena
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>
2020-11-24bfdd: integrate distributed BFDRafael Zalamena
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>
2020-11-24bfdd: import distributed BFD implementationRafael Zalamena
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>
2020-08-11bfdd: implement minimum TTLRafael Zalamena
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>
2020-08-11bfdd: simplify and remove duplicated codeRafael Zalamena
Move the session configuration application logic to a single function. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-08-11bfdd: implement passive modeRafael Zalamena
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>
2020-05-29bfdd: don't update peers settings on shutdownRafael Zalamena
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>
2020-05-20bfdd: implement BFD session configuration profilesRafael Zalamena
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>