Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: optimal route reflection #11159

Merged
merged 9 commits into from
Oct 12, 2022
43 changes: 43 additions & 0 deletions bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ unsigned long conf_bgp_debug_graceful_restart;
unsigned long conf_bgp_debug_evpn_mh;
unsigned long conf_bgp_debug_bfd;
unsigned long conf_bgp_debug_cond_adv;
unsigned long conf_bgp_debug_optimal_route_reflection;

unsigned long term_bgp_debug_as4;
unsigned long term_bgp_debug_neighbor_events;
Expand All @@ -92,6 +93,7 @@ unsigned long term_bgp_debug_graceful_restart;
unsigned long term_bgp_debug_evpn_mh;
unsigned long term_bgp_debug_bfd;
unsigned long term_bgp_debug_cond_adv;
unsigned long term_bgp_debug_optimal_route_reflection;

struct list *bgp_debug_neighbor_events_peers = NULL;
struct list *bgp_debug_keepalive_peers = NULL;
Expand Down Expand Up @@ -2044,6 +2046,33 @@ DEFPY (debug_bgp_evpn_mh,
return CMD_SUCCESS;
}

DEFPY (debug_bgp_optimal_route_reflection,
debug_bgp_optimal_route_reflection_cmd,
"[no$no] debug bgp optimal-route-reflection",
NO_STR
DEBUG_STR
BGP_STR
BGP_ORR_DEBUG)
{
if (vty->node == CONFIG_NODE) {
if (no)
DEBUG_OFF(optimal_route_reflection, ORR);
else
DEBUG_ON(optimal_route_reflection, ORR);
} else {
if (no) {
TERM_DEBUG_OFF(optimal_route_reflection, ORR);
vty_out(vty,
"BGP Optimal Route Reflection debugging is off\n");
} else {
TERM_DEBUG_ON(optimal_route_reflection, ORR);
vty_out(vty,
"BGP Optimal Route Reflection debugging is on\n");
}
}
return CMD_SUCCESS;
}

DEFUN (debug_bgp_labelpool,
debug_bgp_labelpool_cmd,
"debug bgp labelpool",
Expand Down Expand Up @@ -2182,6 +2211,7 @@ DEFUN (no_debug_bgp,
TERM_DEBUG_OFF(evpn_mh, EVPN_MH_RT);
TERM_DEBUG_OFF(bfd, BFD_LIB);
TERM_DEBUG_OFF(cond_adv, COND_ADV);
TERM_DEBUG_OFF(optimal_route_reflection, ORR);

vty_out(vty, "All possible debugging has been turned off\n");

Expand Down Expand Up @@ -2278,6 +2308,10 @@ DEFUN_NOSH (show_debugging_bgp,
vty_out(vty,
" BGP conditional advertisement debugging is on\n");

if (BGP_DEBUG(optimal_route_reflection, ORR))
vty_out(vty,
" BGP Optimal Route Reflection debugging is on\n");

cmd_show_lib_debugs(vty);

return CMD_SUCCESS;
Expand Down Expand Up @@ -2414,6 +2448,11 @@ static int bgp_config_write_debug(struct vty *vty)
write++;
}

if (CONF_BGP_DEBUG(optimal_route_reflection, ORR)) {
vty_out(vty, "debug bgp optimal-route-reflection\n");
write++;
}

return write;
}

Expand Down Expand Up @@ -2546,6 +2585,10 @@ void bgp_debug_init(void)
/* debug bgp conditional advertisement */
install_element(ENABLE_NODE, &debug_bgp_cond_adv_cmd);
install_element(CONFIG_NODE, &debug_bgp_cond_adv_cmd);

/* debug bgp optimal route reflection */
install_element(ENABLE_NODE, &debug_bgp_optimal_route_reflection_cmd);
install_element(CONFIG_NODE, &debug_bgp_optimal_route_reflection_cmd);
}

/* Return true if this prefix is on the per_prefix_list of prefixes to debug
Expand Down
3 changes: 3 additions & 0 deletions bgpd/bgp_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ extern unsigned long conf_bgp_debug_graceful_restart;
extern unsigned long conf_bgp_debug_evpn_mh;
extern unsigned long conf_bgp_debug_bfd;
extern unsigned long conf_bgp_debug_cond_adv;
extern unsigned long conf_bgp_debug_optimal_route_reflection;

extern unsigned long term_bgp_debug_as4;
extern unsigned long term_bgp_debug_neighbor_events;
Expand All @@ -100,6 +101,7 @@ extern unsigned long term_bgp_debug_graceful_restart;
extern unsigned long term_bgp_debug_evpn_mh;
extern unsigned long term_bgp_debug_bfd;
extern unsigned long term_bgp_debug_cond_adv;
extern unsigned long term_bgp_debug_optimal_route_reflection;

extern struct list *bgp_debug_neighbor_events_peers;
extern struct list *bgp_debug_keepalive_peers;
Expand Down Expand Up @@ -138,6 +140,7 @@ struct bgp_debug_filter {
#define BGP_DEBUG_PBR_ERROR 0x02
#define BGP_DEBUG_EVPN_MH_ES 0x01
#define BGP_DEBUG_EVPN_MH_RT 0x02
#define BGP_DEBUG_ORR 0x01

#define BGP_DEBUG_PACKET_SEND 0x01
#define BGP_DEBUG_PACKET_SEND_DETAIL 0x02
Expand Down
3 changes: 3 additions & 0 deletions bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,9 @@ void bgp_fsm_change_status(struct peer *peer, int status)
&& bgp_update_delay_applicable(peer->bgp))
bgp_update_delay_process_status_change(peer);

/* BGP ORR : Update Active Root */
bgp_peer_update_orr_active_roots(peer);

if (bgp_debug_neighbor_events(peer))
zlog_debug("%s went from %s to %s", peer->host,
lookup_msg(bgp_status_msg, peer->ostatus, NULL),
Expand Down
2 changes: 2 additions & 0 deletions bgpd/bgp_fsm.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,6 @@ const char *print_peer_gr_cmd(enum peer_gr_command pr_gr_cmd);
const char *print_global_gr_mode(enum global_mode gl_mode);
const char *print_global_gr_cmd(enum global_gr_command gl_gr_cmd);
int bgp_peer_reg_with_nht(struct peer *peer);

extern void bgp_peer_update_orr_active_roots(struct peer *peer);
#endif /* _QUAGGA_BGP_FSM_H */
4 changes: 4 additions & 0 deletions bgpd/bgp_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ DEFINE_MTYPE(BGPD, BGP_EVPN_VRF_IMPORT_RT, "BGP EVPN VRF Import RT");

DEFINE_MTYPE(BGPD, BGP_SRV6_L3VPN, "BGP prefix-sid srv6 l3vpn servcie");
DEFINE_MTYPE(BGPD, BGP_SRV6_VPN, "BGP prefix-sid srv6 vpn service");

DEFINE_MTYPE(BGPD, BGP_SRV6_SID, "BGP srv6 segment-id");
DEFINE_MTYPE(BGPD, BGP_SRV6_FUNCTION, "BGP srv6 function");
DEFINE_MTYPE(BGPD, EVPN_REMOTE_IP, "BGP EVPN Remote IP hash entry");

DEFINE_MTYPE(BGPD, BGP_NOTIFICATION, "BGP Notification Message");
DEFINE_MTYPE(BGPD, BGP_ORR_GROUP, "BGP Optimal Route Reflection Group");
DEFINE_MTYPE(BGPD, BGP_ORR_GROUP_NAME,
"BGP Optimal Route Reflection Group Name");
2 changes: 2 additions & 0 deletions bgpd/bgp_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,7 @@ DECLARE_MTYPE(BGP_SRV6_FUNCTION);
DECLARE_MTYPE(EVPN_REMOTE_IP);

DECLARE_MTYPE(BGP_NOTIFICATION);
DECLARE_MTYPE(BGP_ORR_GROUP);
DECLARE_MTYPE(BGP_ORR_GROUP_NAME);

#endif /* _QUAGGA_BGP_MEMORY_H */
Loading