2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-06-12 16:59:11 +02:00
|
|
|
/**
|
|
|
|
* bgp_bfd.h: BGP BFD definitions and structures
|
|
|
|
*
|
|
|
|
* @copyright Copyright (C) 2015 Cumulus Networks, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _QUAGGA_BGP_BFD_H
|
|
|
|
#define _QUAGGA_BGP_BFD_H
|
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
#define PEER_IS_MULTIHOP(peer) \
|
|
|
|
((((peer)->sort == BGP_PEER_IBGP) && !(peer)->shared_network) \
|
|
|
|
|| is_ebgp_multihop_configured((peer)))
|
2015-06-12 16:59:11 +02:00
|
|
|
|
2023-03-07 20:14:41 +01:00
|
|
|
extern void bgp_bfd_init(struct event_loop *tm);
|
2015-06-12 16:59:11 +02:00
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
extern void bgp_bfd_peer_config_write(struct vty *vty, const struct peer *peer,
|
|
|
|
const char *addr);
|
2015-06-12 16:59:11 +02:00
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
/**
|
|
|
|
* Show BFD information helper.
|
|
|
|
*
|
|
|
|
* \param vty the VTY pointer.
|
|
|
|
* \param peer the BGP configuration pointer.
|
|
|
|
* \param use_json unused.
|
|
|
|
* \param json_neigh JSON object when called as JSON command.
|
|
|
|
*/
|
|
|
|
extern void bgp_bfd_show_info(struct vty *vty, const struct peer *peer,
|
|
|
|
json_object *json_neigh);
|
2015-06-12 16:59:11 +02:00
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
/**
|
|
|
|
* When called on a group it applies configuration to all peers in that group,
|
|
|
|
* otherwise just applies the configuration to a single peer.
|
|
|
|
*
|
|
|
|
* This function should be called when configuration changes either on group
|
|
|
|
* or peer.
|
|
|
|
*
|
|
|
|
* \param p the BGP peer pointer.
|
|
|
|
* \param pg the BGP group to copy configuration from (it is usually
|
|
|
|
* `p->group` exception when copying new group configuration
|
|
|
|
* see `peer_group2peer_config_copy` function case).
|
|
|
|
*/
|
|
|
|
extern void bgp_peer_config_apply(struct peer *p, struct peer_group *pg);
|
bgpd: reset bfd session when bgp comes up
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-03-12 14:04:30 +01:00
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
/**
|
|
|
|
* Allocates and configure BFD session for peer. If it is already configured,
|
|
|
|
* then it does nothing.
|
2021-03-23 16:19:20 +01:00
|
|
|
*
|
|
|
|
* Always call `bgp_peer_config_apply` afterwards if you need the changes
|
|
|
|
* immediately applied.
|
2021-02-26 20:50:51 +01:00
|
|
|
*/
|
|
|
|
extern void bgp_peer_configure_bfd(struct peer *p, bool manual);
|
2015-06-12 16:59:11 +02:00
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
/**
|
|
|
|
* Removes BFD configuration from either peer or peer group.
|
|
|
|
*/
|
|
|
|
extern void bgp_peer_remove_bfd_config(struct peer *p);
|
2015-06-12 16:59:11 +02:00
|
|
|
|
2021-02-26 20:50:51 +01:00
|
|
|
/**
|
|
|
|
* Special function to handle the case of changing source address. This
|
|
|
|
* happens when the peer/group is configured with `neigbor X update-source Y`.
|
|
|
|
*/
|
|
|
|
extern void bgp_peer_bfd_update_source(struct peer *p);
|
2016-09-08 19:03:30 +02:00
|
|
|
|
2015-06-12 16:59:11 +02:00
|
|
|
#endif /* _QUAGGA_BGP_BFD_H */
|