summaryrefslogtreecommitdiff
path: root/bgpd/bgp_bfd.c
AgeCommit message (Collapse)Author
2023-09-10bgpd: Move the peer->su to connection->suDonald Sharp
The sockunion is per connection. So let's move it over. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-10bgpd: Convert bgp_fsm_nht_update to take a connectionDonald Sharp
Convert this function over to using a connection. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-10bgpd: bgp_fsm_change_status/BGP_TIMER_ON and BGP_EVENT_ADDDonald Sharp
Modify bgp_fsm_change_status to be connection oriented and also make the BGP_TIMER_ON and BGP_EVENT_ADD macros connection oriented as well. Attempt to make peer_xfer_conn a bit more understandable because, frankly it was/is confusing. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-10bgpd: peer_established should be connection orientedDonald Sharp
The peer_established function should be connection oriented. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-09bgpd: bgp_notify_send use peer_connection instead of peerDonald Sharp
The bgp_notify_send function should use a peer_connection Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: Convert `struct peer_connection` to dynamically allocatedDonald Sharp
As part of the conversion to a `struct peer_connection` it will be desirable to have 2 pointers one for when we open a connection and one for when we receive a connection. Start this actual conversion over to this in `struct peer`. If this sounds confusing take a look at the bgp state machine for connections and how it resolves the processing of this router opening -vs- this router receiving an open. At some point in time the state machine decides that we are keeping one of the two connections. Future commits will allow us to untangle the peer/doppelganger duality with this abstraction. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-08-18bgpd: Move status and ostatus to `struct peer_connection`Donald Sharp
The status and ostatus are a function of the `struct peer_connection` move it into that data structure. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-04-01doc: Add missing rfc9384 to BGP supported RFC listDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.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 thread.[ch] to event.[ch]Donald Sharp
This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. 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>
2023-01-11bgpd: Don't warning twice for neighbor_bfd_check_controlplane_failureDonatas Abraitis
When the peer is not defined first. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-21bgpd: Replace zlog_info -> zlog_debug under BGP_DEBUG()Donatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-02bgpd: Add Notification CEASE BFD Down messageDonatas Abraitis
Related: https://datatracker.ietf.org/doc/html/draft-ietf-idr-bfd-subcode When BFD Down notification comes and BGP is configured to track on BFD events, send BGP Cease/BFD Down notification to the peer. If RFC 8538 is enabled (Notification support for Graceful-Restart), notification should be encapsulated into Hard Reset message. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2021-11-12bgpd: fix source-address for BFD sessions when using update-source IFNAMEIgor Ryzhov
When "update-source IFNAME" is used for the neighbor, p->update_source is set to NULL, so we can't use it as a source address and should use the address from p->su_local. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-04bgpd: update BFD config on update-source changeRafael Zalamena
Update BFD sessions when the update-source configuration is set so the session follows the new configured source address. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-07-14bgpd: fix crash during configuration removalRafael Zalamena
Test the BFD config pointer before trying to free the session as it might not exist. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-06-07bgpd: Convert to using peer_established(peer) functionDonald Sharp
We are inconsistently using peer_establiahed(peer) with sometimes using `peer->status == Established`. Just Convert over to using the function for consistency. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-04-22lib: remove enabled flag for bfd sessionsIgor Ryzhov
Currently this flag is only helpful in an extremely rare situation when the BFD session registration was unsuccessful and after that zebra is restarted. Let's remove this flag to simplify the API. If we ever want to solve the problem of unsuccessful registration/deregistration, this can be done using internal flags, without API modification. Also add the error log to help user understand why the BFD session is not working. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-04-09ospfd: fix crash on "show ip ospf neighbor detail"Igor Ryzhov
Fixes #8419. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-03-23bgpd: improve BFD with timers configurationRafael Zalamena
Move `bgp_peer_config_apply` outside `bgp_peer_configure_bfd` (and document it) so we only call the session installation once with one set of timers. It also makes all calls of that function equal (e.g. always calls `bgp_peer_config_apply` afterwards). Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-03-23bgpd: add debug option for BFDRafael Zalamena
Add new BGP debug option to enable BFD related debugging messages. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2021-03-23bgpd: rework BFD integrationRafael Zalamena
Remove old BFD API usage and replace it with the new one. Highlights: - More shared code: the daemon gets notified with callbacks instead of having to roll its own code to find the notified sessions. - Less code to integrate with BFD. - Remove hidden commands to configure single / multi hop. Use protocol data instead. BGP can determine if a peer is single/multi hop according to the following criteria: a. If the IP address is a link-local address (single hop) b. The network is shared with peer (single hop) c. BGP is configured for eBGP multi hop / TTL security (multi hop) - Respect the configuration hierarchy: a. Peer configuration take precendence over peer-group configuration. b. When peer group configuration is removed, reset peer BFD configurations to defaults (unless peer had specific configs). Example: neighbor foo peer-group neighbor foo bfd profile X neighbor 192.168.0.2 peer-group foo neighbor 192.168.0.2 bfd ! If peer-group is removed the profile configuration gets ! removed from peer 192.168.0.2, but BFD will still enabled ! because of the neighbor specific bfd configuration. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-10-26bgpd: Fix profiles compile issue when not using bfddDonald Sharp
When compiling w/ --enable-bfdd=no we get warnings about functions not being used. Add a #if check to include it as needed. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-22:* Convert prefix2str to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-09-17bgpd: rename bgp_fsm_event_updateQuentin Young
This function is poorly named; it's really used to allow the FSM to decide the next valid state based on whether a peer has valid / reachable nexthops as determined by NHT or BFD. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-07-21Merge pull request #6711 from GalaxyGorilla/bfd_isis_profilesQuentin Young
Add BFD profiles for IS-IS
2020-07-14*: un-split strings across linesDavid Lamparter
Remove mid-string line breaks, cf. workflow doc: .. [#tool_style_conflicts] For example, lines over 80 characters are allowed for text strings to make it possible to search the code for them: please see `Linux kernel style (breaking long lines and strings) <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_ and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
2020-07-10 *: add BFD profile support for IS-ISGalaxyGorilla
BFD profiles can now be used on the interface level like this: interface eth1 ip router isis 1 isis bfd isis bfd profile default Here the 'default' profile needs to be specified as usual in the bfdd configuration. Signed-off-by: GalaxyGorilla <sascha@netdef.org>
2020-07-02Merge pull request #6437 from opensourcerouting/bfd-profiles-bgpDonald Sharp
bfdd,bgpd: profiles integration support
2020-06-18bgpd: attempt to fix test convergence failureRafael Zalamena
Don't reset BFD peer on BGP session establishment. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-05-29bgpd: fix crash on daemon exitRafael Zalamena
Don't attempt to send BFD daemon a message to remove the peer registration on daemon exit, otherwise we'll access a dangling interface pointer and we'll crash. This crash was not previosly possible because the function that built the message was passing the interface pointer but not using it due to the exit condition. In `lib/bfd.c`: ``` void bfd_peer_sendmsg(struct zclient *zclient, struct bfd_info *bfd_info, int family, void *dst_ip, void *src_ip, char *if_name, int ttl, int multihop, int cbit, int command, int set_flag, vrf_id_t vrf_id) { struct bfd_session_arg args = {}; size_t addrlen; /* Individual reg/dereg messages are suppressed during shutdown. */ if (CHECK_FLAG(bfd_gbl.flags, BFD_GBL_FLAG_IN_SHUTDOWN)) { if (bfd_debug) zlog_debug( "%s: Suppressing BFD peer reg/dereg messages", __func__); return; } ``` Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-05-29bgpd: command to remove profile configurationRafael Zalamena
To remove a BFD profile without removing the BFD configuration just call `neighbor <A.B.C.D|X:X::X:X|WORD> bfd`. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-05-29bgpd: support BFD profiles configurationRafael Zalamena
Allow BGP to use the new API to configure BFD session profiles. Now it is possible to preconfigure BFD sessions without needing to create the peers. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-03-21bgpd: Convert lots of int type functions to bool/voidDonatas Abraitis
Some were converted to bool, where true/false status is needed. Converted to void only those, where the return status was only false or true. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-13bgpd: reset bfd session when bgp comes upPhilippe Guibert
This scenario has been seen against microtik virtual machine with bfd enabled. When remote microtik bgp reestablishes the bgp session after a bgp reset, the bgp establishment comes first, then bfd is initialising. The second point is true for microtik, but not for frrouting, as the frrouting, when receiving bfd down messages, is not at init state. Actually, bfd state is up, and sees the first bfd down packet from bfd as an issue. Consequently, the BGP session is cleared. The fix consists in resetting the BFD session, only if bfd status is considered as up, once BGP comes up. That permits to align state machines of both local and remote bfd. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-02-14bgpd: Print out vrf name as well as idDonald Sharp
The vrf_id is not enough context for people. Use the actual name of the vrf if you can. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-06bgpd: Replace bgp_flag_* to [UN]SET/CHECK_FLAG macrosDonatas Abraitis
Most of the code uses macros, thus let's keep the code unified. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2019-10-28bfdd: Handling local and remote admin-downSumitAgarwal123
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-05-14bgpd: add vty command to enable bfd control-plane-check-failurePhilippe Guibert
new vty command is added: neighbor XXX bfd check-control-plane-failure this command will enforce the check of bgp controlplane, when bfd detects changes in the dataplane. - at configuration, the cbit will be set if that command is executed - at flapping time, if the command is configured and remote cbit is set accordingly, then the bfd event will be ignored. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-05-14bfdd, lib, bgpd: add bfd cbit usagePhilippe Guibert
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>
2019-05-07bgp, ospfd, ospf6d, pimd, lib, isisd: add bfd_client_sendmsg vrf_idPhilippe Guibert
vrf_id parameter is added to the api of bfd_client_sendmsg(). this permits being registered to bfd from a separate vrf. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-05-06Merge pull request #4264 from pguibert6WIND/trace_bfdDonald Sharp
More traces for BFD clients
2019-05-06bgpd: add bfd event tracePhilippe Guibert
that bfd event trace is visible when 'debug bgp neighbor-event' is enabled. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-05-03*: use ZAPI_CALLBACK_ARGS macro for zapi handlersQuentin Young
This macro: - Marks ZAPI callbacks for readability - Standardizes argument names - Makes it simple to add ZAPI arguments in the future - Ensures proper types - Looks better - Shortens function declarations Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-04-18bgpd: improve reconnection mechanism by cancelling connect timersPhilippe Guibert
if bfd comes back up, and a bgp reconnection is in progress, theorically it should be necessary to wait for the end of the reconnection process. however, since that reconnection process may take some time, update the fsm by cancelling the connect timer. This done, one just have to call the start timer. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-04-18bgpd: improve bgp convergence, with bfd upPhilippe Guibert
Bgp periodically tries to reconnect, while the connection is down. When bfd event comes up, BGP is not aware that bfd connection is up, then BGP can not adapt its reconnection timer. The modification is here to force BGP to restart, when BFD event comes up, and BGP has not yet established. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-08-30bgpd/ospfd: make bgp and ospf json response a bit more consistentDon Slice
Problem reported that some bgp and ospf json commands did not return any json output at all if the bgp/ospf instance did not exist. Additionally, some bgp and ospf json commands did not return any json output if the instance existed but no neighbors were defined. This fix makes these commands more consistent in returning empty braces for json output and issue a message if not using json output. Additionally, made the flag "use_json" a bool to make it consistent since previously, it had been defined as an int, char, u_char, and bool at various places. Ticket: CM-21040 Signed-off-by: Don Slice <dslice@cumulusnetworks.com>