mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 02:37:00 +00:00
bgpd: Advertise FIB installed routes to bgp peers (Part 2)
* Added CLI command "[no] bgp suppress-fib-pending" to enable and disable suppress-fib-pending * Send ZEBRA_ROUTE_NOTIFY_REQUEST to zebra when "bgp suppress-fib-pending" is enabled or disabled * Define BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME which is the delay added to update group timer. * Added error codes Signed-off-by: kssoman <somanks@gmail.com>
This commit is contained in:
parent
77b38a4a7d
commit
c208c58670
@ -462,6 +462,18 @@ static struct log_ref ferr_bgp_err[] = {
|
||||
.description = "As part of normal collision detection for opening a connection to a peer, BGP has detected that the remote peer's router-id is the same as ours",
|
||||
.suggestion = "Change one of the two router-id's",
|
||||
},
|
||||
{
|
||||
.code = EC_BGP_INVALID_BGP_INSTANCE,
|
||||
.title = "BGP instance for the specifc vrf is invalid",
|
||||
.description = "Indicates that specified bgp instance is NULL",
|
||||
.suggestion = "Get log files from router and open an issue",
|
||||
},
|
||||
{
|
||||
.code = EC_BGP_INVALID_ROUTE,
|
||||
.title = "BGP route node is invalid",
|
||||
.description = "BGP route for the specified AFI/SAFI is NULL",
|
||||
.suggestion = "Get log files from router and open an issue",
|
||||
},
|
||||
{
|
||||
.code = END_FERR,
|
||||
}
|
||||
|
@ -99,6 +99,8 @@ enum bgp_log_refs {
|
||||
EC_BGP_INVALID_NEXTHOP_LENGTH,
|
||||
EC_BGP_DOPPELGANGER_CONFIG,
|
||||
EC_BGP_ROUTER_ID_SAME,
|
||||
EC_BGP_INVALID_BGP_INSTANCE,
|
||||
EC_BGP_INVALID_ROUTE,
|
||||
};
|
||||
|
||||
extern void bgp_error_init(void);
|
||||
|
@ -1514,6 +1514,20 @@ void cli_show_router_bgp_router_id(struct vty *vty, struct lyd_node *dnode,
|
||||
vty_out(vty, " bgp router-id %s\n", yang_dnode_get_string(dnode, NULL));
|
||||
}
|
||||
|
||||
DEFPY (bgp_suppress_fib_pending,
|
||||
bgp_suppress_fib_pending_cmd,
|
||||
"[no] bgp suppress-fib-pending",
|
||||
NO_STR
|
||||
BGP_STR
|
||||
"Advertise only routes that are programmed in kernel to peers\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(bgp, bgp);
|
||||
|
||||
bgp_suppress_fib_pending_set(bgp, !no);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/* BGP Cluster ID. */
|
||||
DEFUN_YANG(bgp_cluster_id,
|
||||
bgp_cluster_id_cmd,
|
||||
@ -16856,6 +16870,10 @@ int bgp_config_write(struct vty *vty)
|
||||
vty_out(vty, " bgp router-id %pI4\n",
|
||||
&bgp->router_id_static);
|
||||
|
||||
/* Suppress fib pending */
|
||||
if (CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING))
|
||||
vty_out(vty, " bgp suppress-fib-pending\n");
|
||||
|
||||
/* BGP log-neighbor-changes. */
|
||||
if (!!CHECK_FLAG(bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES)
|
||||
!= SAVE_BGP_LOG_NEIGHBOR_CHANGES)
|
||||
@ -17371,6 +17389,9 @@ void bgp_vty_init(void)
|
||||
install_element(BGP_NODE, &bgp_router_id_cmd);
|
||||
install_element(BGP_NODE, &no_bgp_router_id_cmd);
|
||||
|
||||
/* "bgp suppress-fib-pending" command */
|
||||
install_element(BGP_NODE, &bgp_suppress_fib_pending_cmd);
|
||||
|
||||
/* "bgp cluster-id" commands. */
|
||||
install_element(BGP_NODE, &bgp_cluster_id_cmd);
|
||||
install_element(BGP_NODE, &no_bgp_cluster_id_cmd);
|
||||
|
40
bgpd/bgpd.c
40
bgpd/bgpd.c
@ -109,6 +109,9 @@ struct community_list_handler *bgp_clist;
|
||||
|
||||
unsigned int multipath_num = MULTIPATH_NUM;
|
||||
|
||||
/* Number of bgp instances configured for suppress fib config */
|
||||
unsigned int bgp_suppress_fib_count;
|
||||
|
||||
static void bgp_if_finish(struct bgp *bgp);
|
||||
static void peer_drop_dynamic_neighbor(struct peer *peer);
|
||||
|
||||
@ -390,6 +393,43 @@ void bgp_router_id_static_set(struct bgp *bgp, struct in_addr id)
|
||||
true /* is config */);
|
||||
}
|
||||
|
||||
/* Set the suppress fib pending for the bgp configuration */
|
||||
void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
|
||||
{
|
||||
bool send_msg = false;
|
||||
|
||||
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
|
||||
return;
|
||||
|
||||
if (set) {
|
||||
SET_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING);
|
||||
/* Send msg to zebra for the first instance of bgp enabled
|
||||
* with suppress fib
|
||||
*/
|
||||
if (bgp_suppress_fib_count == 0)
|
||||
send_msg = true;
|
||||
bgp_suppress_fib_count++;
|
||||
} else {
|
||||
UNSET_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING);
|
||||
bgp_suppress_fib_count--;
|
||||
|
||||
/* Send msg to zebra if there are no instances enabled
|
||||
* with suppress fib
|
||||
*/
|
||||
if (bgp_suppress_fib_count == 0)
|
||||
send_msg = true;
|
||||
}
|
||||
/* Send route notify request to RIB */
|
||||
if (send_msg) {
|
||||
if (BGP_DEBUG(zebra, ZEBRA))
|
||||
zlog_debug("Sending ZEBRA_ROUTE_NOTIFY_REQUEST");
|
||||
|
||||
if (zclient)
|
||||
zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
|
||||
zclient, set);
|
||||
}
|
||||
}
|
||||
|
||||
/* BGP's cluster-id control. */
|
||||
int bgp_cluster_id_set(struct bgp *bgp, struct in_addr *cluster_id)
|
||||
{
|
||||
|
15
bgpd/bgpd.h
15
bgpd/bgpd.h
@ -455,11 +455,12 @@ struct bgp {
|
||||
#define BGP_FLAG_DELETE_IN_PROGRESS (1 << 22)
|
||||
#define BGP_FLAG_SELECT_DEFER_DISABLE (1 << 23)
|
||||
#define BGP_FLAG_GR_DISABLE_EOR (1 << 24)
|
||||
#define BGP_FLAG_EBGP_REQUIRES_POLICY (1 << 25)
|
||||
#define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1 << 26)
|
||||
#define BGP_FLAG_EBGP_REQUIRES_POLICY (1 << 25)
|
||||
#define BGP_FLAG_SHOW_NEXTHOP_HOSTNAME (1 << 26)
|
||||
|
||||
/* This flag is set if the instance is in administrative shutdown */
|
||||
#define BGP_FLAG_SHUTDOWN (1 << 27)
|
||||
#define BGP_FLAG_SHUTDOWN (1 << 27)
|
||||
#define BGP_FLAG_SUPPRESS_FIB_PENDING (1 << 28)
|
||||
|
||||
enum global_mode GLOBAL_GR_FSM[BGP_GLOBAL_GR_MODE]
|
||||
[BGP_GLOBAL_GR_EVENT_CMD];
|
||||
@ -712,6 +713,9 @@ struct afi_safi_info {
|
||||
#define BGP_SELECT_DEFER_DISABLE(bgp) \
|
||||
(CHECK_FLAG(bgp->flags, BGP_FLAG_SELECT_DEFER_DISABLE))
|
||||
|
||||
#define BGP_SUPPRESS_FIB_ENABLED(bgp) \
|
||||
(CHECK_FLAG(bgp->flags, BGP_FLAG_SUPPRESS_FIB_PENDING))
|
||||
|
||||
/* BGP peer-group support. */
|
||||
struct peer_group {
|
||||
/* Name of the peer-group. */
|
||||
@ -1507,6 +1511,9 @@ DECLARE_QOBJ_TYPE(peer)
|
||||
|| CHECK_FLAG((P)->sflags, PEER_STATUS_PREFIX_OVERFLOW) \
|
||||
|| CHECK_FLAG((P)->bgp->flags, BGP_FLAG_SHUTDOWN))
|
||||
|
||||
#define PEER_ROUTE_ADV_DELAY(peer) \
|
||||
CHECK_FLAG(peer->thread_flags, PEER_THREAD_SUBGRP_ADV_DELAY)
|
||||
|
||||
#define PEER_PASSWORD_MINLEN (1)
|
||||
#define PEER_PASSWORD_MAXLEN (80)
|
||||
|
||||
@ -1677,6 +1684,7 @@ struct bgp_nlri {
|
||||
#define BGP_DEFAULT_STALEPATH_TIME 360
|
||||
#define BGP_DEFAULT_SELECT_DEFERRAL_TIME 360
|
||||
#define BGP_DEFAULT_RIB_STALE_TIME 500
|
||||
#define BGP_DEFAULT_UPDATE_ADVERTISEMENT_TIME 1
|
||||
|
||||
/* BGP uptime string length. */
|
||||
#define BGP_UPTIME_LEN 25
|
||||
@ -1853,6 +1861,7 @@ extern int bgp_handle_socket(struct bgp *bgp, struct vrf *vrf,
|
||||
extern void bgp_router_id_zebra_bump(vrf_id_t, const struct prefix *);
|
||||
extern void bgp_router_id_static_set(struct bgp *, struct in_addr);
|
||||
|
||||
extern void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set);
|
||||
extern int bgp_cluster_id_set(struct bgp *, struct in_addr *);
|
||||
extern int bgp_cluster_id_unset(struct bgp *);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user