Skip to content

Commit

Permalink
bgpd : Adding Bgp GR Global & Per Neighbor FSM changes
Browse files Browse the repository at this point in the history
 * Added FSM for peer and global configuration for graceful restart
 * Added debug option BGP_GRACEFUL_RESTART for logs specific to
      graceful restart processing

Signed-off-by: Biswajit Sadhu <[email protected]>
  • Loading branch information
bisdhdh committed Oct 23, 2019
1 parent 0d5f344 commit 63146c8
Show file tree
Hide file tree
Showing 5 changed files with 636 additions and 6 deletions.
55 changes: 54 additions & 1 deletion bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ unsigned long conf_bgp_debug_vpn;
unsigned long conf_bgp_debug_flowspec;
unsigned long conf_bgp_debug_labelpool;
unsigned long conf_bgp_debug_pbr;
unsigned long conf_bgp_debug_graceful_restart;

unsigned long term_bgp_debug_as4;
unsigned long term_bgp_debug_neighbor_events;
Expand All @@ -80,6 +81,7 @@ unsigned long term_bgp_debug_vpn;
unsigned long term_bgp_debug_flowspec;
unsigned long term_bgp_debug_labelpool;
unsigned long term_bgp_debug_pbr;
unsigned long term_bgp_debug_graceful_restart;

struct list *bgp_debug_neighbor_events_peers = NULL;
struct list *bgp_debug_keepalive_peers = NULL;
Expand Down Expand Up @@ -1644,6 +1646,23 @@ DEFUN (debug_bgp_zebra,
return CMD_SUCCESS;
}

DEFUN (debug_bgp_graceful_restart,
debug_bgp_graceful_restart_cmd,
"debug bgp graceful-restart",
DEBUG_STR
BGP_STR
GR_DEBUG)
{
if (vty->node == CONFIG_NODE) {
DEBUG_ON(graceful_restart, GRACEFUL_RESTART);
} else {
TERM_DEBUG_ON(graceful_restart, GRACEFUL_RESTART);
vty_out(vty, "BGP Graceful Restart debugging is on\n");
}
return CMD_SUCCESS;
}


DEFUN (debug_bgp_zebra_prefix,
debug_bgp_zebra_prefix_cmd,
"debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
Expand Down Expand Up @@ -1702,6 +1721,23 @@ DEFUN (no_debug_bgp_zebra,
return CMD_SUCCESS;
}

DEFUN (no_debug_bgp_graceful_restart,
no_debug_bgp_graceful_restart_cmd,
"no debug bgp graceful-restart",
DEBUG_STR
BGP_STR
GR_DEBUG
NO_STR)
{
if (vty->node == CONFIG_NODE) {
DEBUG_OFF(graceful_restart, GRACEFUL_RESTART);
} else {
TERM_DEBUG_OFF(graceful_restart, GRACEFUL_RESTART);
vty_out(vty, "BGP Graceful Restart debugging is off\n");
}
return CMD_SUCCESS;
}

DEFUN (no_debug_bgp_zebra_prefix,
no_debug_bgp_zebra_prefix_cmd,
"no debug bgp zebra prefix <A.B.C.D/M|X:X::X:X/M>",
Expand Down Expand Up @@ -2039,6 +2075,8 @@ DEFUN (no_debug_bgp,
TERM_DEBUG_OFF(labelpool, LABELPOOL);
TERM_DEBUG_OFF(pbr, PBR);
TERM_DEBUG_OFF(pbr, PBR_ERROR);
TERM_DEBUG_OFF(graceful_restart, GRACEFUL_RESTART);

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

return CMD_SUCCESS;
Expand Down Expand Up @@ -2094,7 +2132,11 @@ DEFUN_NOSH (show_debugging_bgp,

if (BGP_DEBUG(zebra, ZEBRA))
bgp_debug_list_print(vty, " BGP zebra debugging is on",
bgp_debug_zebra_prefixes);
bgp_debug_zebra_prefixes);

if (BGP_DEBUG(graceful_restart, GRACEFUL_RESTART))
vty_out(vty,
" BGP graceful-restart debugging is on");

if (BGP_DEBUG(allow_martians, ALLOW_MARTIANS))
vty_out(vty, " BGP allow martian next hop debugging is on\n");
Expand Down Expand Up @@ -2229,6 +2271,11 @@ static int bgp_config_write_debug(struct vty *vty)
vty_out(vty, "debug bgp pbr error\n");
write++;
}

if (CONF_BGP_DEBUG(graceful_restart, GRACEFUL_RESTART)) {
vty_out(vty, "debug bgp graceful-restart\n");
write++;
}
return write;
}

Expand Down Expand Up @@ -2262,6 +2309,9 @@ void bgp_debug_init(void)
install_element(ENABLE_NODE, &debug_bgp_bestpath_prefix_cmd);
install_element(CONFIG_NODE, &debug_bgp_bestpath_prefix_cmd);

install_element(ENABLE_NODE, &debug_bgp_graceful_restart_cmd);
install_element(CONFIG_NODE, &debug_bgp_graceful_restart_cmd);

/* debug bgp updates (in|out) */
install_element(ENABLE_NODE, &debug_bgp_update_direct_cmd);
install_element(CONFIG_NODE, &debug_bgp_update_direct_cmd);
Expand Down Expand Up @@ -2327,6 +2377,9 @@ void bgp_debug_init(void)
install_element(ENABLE_NODE, &no_debug_bgp_bestpath_prefix_cmd);
install_element(CONFIG_NODE, &no_debug_bgp_bestpath_prefix_cmd);

install_element(ENABLE_NODE, &no_debug_bgp_graceful_restart_cmd);
install_element(CONFIG_NODE, &no_debug_bgp_graceful_restart_cmd);

install_element(ENABLE_NODE, &debug_bgp_vpn_cmd);
install_element(CONFIG_NODE, &debug_bgp_vpn_cmd);
install_element(ENABLE_NODE, &no_debug_bgp_vpn_cmd);
Expand Down
1 change: 0 additions & 1 deletion bgpd/bgp_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ extern unsigned long term_bgp_debug_labelpool;
extern unsigned long term_bgp_debug_pbr;
extern unsigned long term_bgp_debug_graceful_restart;


extern struct list *bgp_debug_neighbor_events_peers;
extern struct list *bgp_debug_keepalive_peers;
extern struct list *bgp_debug_update_in_peers;
Expand Down
Loading

0 comments on commit 63146c8

Please sign in to comment.