int
peer_maximum_prefix_set_vty (struct vty *vty, const char *ip_str, afi_t afi,
safi_t safi, const char *num_str,
- const char *threshold_str, int warning)
+ const char *threshold_str, int warning,
+ const char *restart_str)
{
int ret;
struct peer *peer;
u_int32_t max;
u_char threshold;
+ u_int16_t restart;
peer = peer_and_group_lookup_vty (vty, ip_str);
if (! peer)
else
threshold = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
- ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning);
+ if (restart_str)
+ restart = atoi (restart_str);
+ else
+ restart = 0;
+
+ ret = peer_maximum_prefix_set (peer, afi, safi, max, threshold, warning, restart);
return bgp_vty_return (vty, ret);
}
"maximum no. of prefix limit\n")
{
return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], NULL, 0);
+ bgp_node_safi (vty), argv[1], NULL, 0,
+ NULL);
}
DEFUN (neighbor_maximum_prefix_threshold,
"Threshold value (%) at which to generate a warning msg\n")
{
return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2], 0);
- }
+ bgp_node_safi (vty), argv[1], argv[2], 0,
+ NULL);
+}
DEFUN (neighbor_maximum_prefix_warning,
neighbor_maximum_prefix_warning_cmd,
"Only give warning message when limit is exceeded\n")
{
return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], NULL, 1);
+ bgp_node_safi (vty), argv[1], NULL, 1,
+ NULL);
}
DEFUN (neighbor_maximum_prefix_threshold_warning,
"Only give warning message when limit is exceeded\n")
{
return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
- bgp_node_safi (vty), argv[1], argv[2], 1);
- }
+ bgp_node_safi (vty), argv[1], argv[2], 1, NULL);
+}
+
+DEFUN (neighbor_maximum_prefix_restart,
+ neighbor_maximum_prefix_restart_cmd,
+ NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
+ NEIGHBOR_STR
+ NEIGHBOR_ADDR_STR2
+ "Maximum number of prefix accept from this peer\n"
+ "maximum no. of prefix limit\n"
+ "Restart bgp connection after limit is exceeded\n"
+ "Restart interval in minutes")
+{
+ return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
+ bgp_node_safi (vty), argv[1], NULL, 0, argv[2]);
+}
+
+DEFUN (neighbor_maximum_prefix_threshold_restart,
+ neighbor_maximum_prefix_threshold_restart_cmd,
+ NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
+ NEIGHBOR_STR
+ NEIGHBOR_ADDR_STR2
+ "Maximum number of prefix accept from this peer\n"
+ "maximum no. of prefix limit\n"
+ "Threshold value (%) at which to generate a warning msg\n"
+ "Restart bgp connection after limit is exceeded\n"
+ "Restart interval in minutes")
+{
+ return peer_maximum_prefix_set_vty (vty, argv[0], bgp_node_afi (vty),
+ bgp_node_safi (vty), argv[1], argv[2], 0, argv[3]);
+}
DEFUN (no_neighbor_maximum_prefix,
no_neighbor_maximum_prefix_cmd,
"maximum no. of prefix limit\n")
ALIAS (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_val2_cmd,
+ no_neighbor_maximum_prefix_threshold_cmd,
+ NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
+ NO_STR
+ NEIGHBOR_STR
+ NEIGHBOR_ADDR_STR2
+ "Maximum number of prefix accept from this peer\n"
+ "maximum no. of prefix limit\n"
+ "Threshold value (%) at which to generate a warning msg\n")
+
+ALIAS (no_neighbor_maximum_prefix,
+ no_neighbor_maximum_prefix_warning_cmd,
+ NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
+ NO_STR
+ NEIGHBOR_STR
+ NEIGHBOR_ADDR_STR2
+ "Maximum number of prefix accept from this peer\n"
+ "maximum no. of prefix limit\n"
+ "Only give warning message when limit is exceeded\n");
+
+ALIAS (no_neighbor_maximum_prefix,
+ no_neighbor_maximum_prefix_threshold_warning_cmd,
NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> warning-only",
NO_STR
NEIGHBOR_STR
"Maximum number of prefix accept from this peer\n"
"maximum no. of prefix limit\n"
"Threshold value (%) at which to generate a warning msg\n"
- "Only give warning message when limit is exceeded\n")
+ "Only give warning message when limit is exceeded\n");
ALIAS (no_neighbor_maximum_prefix,
- no_neighbor_maximum_prefix_val3_cmd,
- NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> warning-only",
+ no_neighbor_maximum_prefix_restart_cmd,
+ NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> restart <1-65535>",
NO_STR
NEIGHBOR_STR
NEIGHBOR_ADDR_STR2
"Maximum number of prefix accept from this peer\n"
"maximum no. of prefix limit\n"
- "Only give warning message when limit is exceeded\n")
+ "Restart bgp connection after limit is exceeded\n"
+ "Restart interval in minutes")
+
+ALIAS (no_neighbor_maximum_prefix,
+ no_neighbor_maximum_prefix_threshold_restart_cmd,
+ NO_NEIGHBOR_CMD2 "maximum-prefix <1-4294967295> <1-100> restart <1-65535>",
+ NO_STR
+ NEIGHBOR_STR
+ NEIGHBOR_ADDR_STR2
+ "Maximum number of prefix accept from this peer\n"
+ "maximum no. of prefix limit\n"
+ "Threshold value (%) at which to generate a warning msg\n"
+ "Restart bgp connection after limit is exceeded\n"
+ "Restart interval in minutes")
\f
/* "neighbor allowas-in" */
DEFUN (neighbor_allowas_in,
/* Maximum prefix */
if (CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
{
- vty_out (vty, " maximum limit %ld%s%s", p->pmax[afi][safi],
+ vty_out (vty, " Maximum prefixes allowed %ld%s%s", p->pmax[afi][safi],
CHECK_FLAG (p->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
- ? " (warning-only)" : "", VTY_NEWLINE);
- vty_out (vty, " Threshold for warning message %d%%%s", p->pmax_threshold [afi][safi],
- VTY_NEWLINE);
+ ? " (warning-only)" : "", VTY_NEWLINE);
+ vty_out (vty, " Threshold for warning message %d%%",
+ p->pmax_threshold[afi][safi]);
+ if (p->pmax_restart[afi][safi])
+ vty_out (vty, ", restart interval %d min", p->pmax_restart[afi][safi]);
+ vty_out (vty, "%s", VTY_NEWLINE);
}
vty_out (vty, "%s", VTY_NEWLINE);
if (CHECK_FLAG (p->sflags, PEER_STATUS_PREFIX_OVERFLOW))
{
vty_out (vty, " Peer had exceeded the max. no. of prefixes configured.%s", VTY_NEWLINE);
- vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
- p->host, VTY_NEWLINE);
+
+ if (p->t_pmax_restart)
+ vty_out (vty, " Reduce the no. of prefix from %s, will restart in %ld seconds%s",
+ p->host, thread_timer_remain_second (p->t_pmax_restart),
+ VTY_NEWLINE);
+ else
+ vty_out (vty, " Reduce the no. of prefix and clear ip bgp %s to restore peering%s",
+ p->host, VTY_NEWLINE);
}
/* EBGP Multihop */
install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_cmd);
install_element (BGP_NODE, &neighbor_maximum_prefix_warning_cmd);
install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_NODE, &neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_NODE, &no_neighbor_maximum_prefix_cmd);
install_element (BGP_NODE, &no_neighbor_maximum_prefix_val_cmd);
- install_element (BGP_NODE, &no_neighbor_maximum_prefix_val2_cmd);
- install_element (BGP_NODE, &no_neighbor_maximum_prefix_val3_cmd);
+ install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
+ install_element (BGP_NODE, &no_neighbor_maximum_prefix_warning_cmd);
+ install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_NODE, &no_neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_cmd);
install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_warning_cmd);
install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_IPV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_cmd);
install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
- install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val2_cmd);
- install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_val3_cmd);
+ install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
+ install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
+ install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_IPV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_cmd);
install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_cmd);
install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_warning_cmd);
install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_IPV4M_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_cmd);
install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val_cmd);
- install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val2_cmd);
- install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_val3_cmd);
+ install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
+ install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_warning_cmd);
+ install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_IPV4M_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_cmd);
install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_cmd);
install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_warning_cmd);
install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_IPV6_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_cmd);
install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val_cmd);
- install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val2_cmd);
- install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_val3_cmd);
+ install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
+ install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_warning_cmd);
+ install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_IPV6_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_cmd);
install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_cmd);
install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_warning_cmd);
install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_VPNV4_NODE, &neighbor_maximum_prefix_threshold_restart_cmd);
install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_cmd);
install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val_cmd);
- install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val2_cmd);
- install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_val3_cmd);
+ install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_cmd);
+ install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_warning_cmd);
+ install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_warning_cmd);
+ install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_restart_cmd);
+ install_element (BGP_VPNV4_NODE, &no_neighbor_maximum_prefix_threshold_restart_cmd);
/* "neighbor allowas-in" */
install_element (BGP_NODE, &neighbor_allowas_in_cmd);
BGP_TIMER_OFF (peer->t_keepalive);
BGP_TIMER_OFF (peer->t_asorig);
BGP_TIMER_OFF (peer->t_routeadv);
+ BGP_TIMER_OFF (peer->t_pmax_restart);
/* Delete from all peer list. */
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
/* maximum-prefix */
peer->pmax[afi][safi] = conf->pmax[afi][safi];
peer->pmax_threshold[afi][safi] = conf->pmax_threshold[afi][safi];
+ peer->pmax_restart[afi][safi] = conf->pmax_restart[afi][safi];
/* allowas-in */
peer->allowas_in[afi][safi] = conf->allowas_in[afi][safi];
{
if (CHECK_FLAG (peer->flags, flag))
{
+ UNSET_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
+ if (peer->t_pmax_restart)
+ {
+ BGP_TIMER_OFF (peer->t_pmax_restart);
+ if (BGP_DEBUG (events, EVENTS))
+ zlog_debug ("%s Maximum-prefix restart timer canceled",
+ peer->host);
+ }
+
if (peer->status == Established)
bgp_notify_send (peer, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_ADMIN_SHUTDOWN);
\f
int
peer_maximum_prefix_set (struct peer *peer, afi_t afi, safi_t safi,
- u_int32_t max, u_char threshold, int warning)
+ u_int32_t max, u_char threshold,
+ int warning, u_int16_t restart)
{
struct peer_group *group;
struct listnode *nn;
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX);
peer->pmax[afi][safi] = max;
peer->pmax_threshold[afi][safi] = threshold;
+ peer->pmax_restart[afi][safi] = restart;
if (warning)
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING);
else
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX);
peer->pmax[afi][safi] = max;
peer->pmax_threshold[afi][safi] = threshold;
+ peer->pmax_restart[afi][safi] = restart;
if (warning)
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING);
else
peer->pmax[afi][safi] = peer->group->conf->pmax[afi][safi];
peer->pmax_threshold[afi][safi] = peer->group->conf->pmax_threshold[afi][safi];
+ peer->pmax_restart[afi][safi] = peer->group->conf->pmax_restart[afi][safi];
return 0;
}
UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX);
UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING);
peer->pmax[afi][safi] = 0;
- peer->pmax_threshold[afi][safi] = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
+ peer->pmax_threshold[afi][safi] = 0;
+ peer->pmax_restart[afi][safi] = 0;
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
return 0;
UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX);
UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING);
peer->pmax[afi][safi] = 0;
- peer->pmax_threshold[afi][safi] = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
+ peer->pmax_threshold[afi][safi] = 0;
+ peer->pmax_restart[afi][safi] = 0;
}
return 0;
}
{
if (! CHECK_FLAG (peer->flags, PEER_FLAG_SHUTDOWN))
{
- UNSET_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
+ if (CHECK_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW))
+ {
+ UNSET_FLAG (peer->sflags, PEER_STATUS_PREFIX_OVERFLOW);
+ if (peer->t_pmax_restart)
+ {
+ BGP_TIMER_OFF (peer->t_pmax_restart);
+ if (BGP_DEBUG (events, EVENTS))
+ zlog_debug ("%s Maximum-prefix restart timer canceled",
+ peer->host);
+ }
+ BGP_EVENT_ADD (peer, BGP_Start);
+ return 0;
+ }
+
peer->v_start = BGP_INIT_START_TIMER;
if (peer->status == Established)
bgp_notify_send (peer, BGP_NOTIFY_CEASE,
|| CHECK_FLAG (g_peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
!= CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
{
- vty_out (vty, " neighbor %s maximum-prefix %ld", addr, peer->pmax[afi][safi]);
- if (peer->pmax_threshold[afi][safi] != MAXIMUM_PREFIX_THRESHOLD_DEFAULT)
- vty_out (vty, " %d", peer->pmax_threshold[afi][safi]);
- if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
- vty_out (vty, " warning-only");
- vty_out (vty, "%s", VTY_NEWLINE);
+ vty_out (vty, " neighbor %s maximum-prefix %ld", addr, peer->pmax[afi][safi]);
+ if (peer->pmax_threshold[afi][safi] != MAXIMUM_PREFIX_THRESHOLD_DEFAULT)
+ vty_out (vty, " %d", peer->pmax_threshold[afi][safi]);
+ if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING))
+ vty_out (vty, " warning-only");
+ if (peer->pmax_restart[afi][safi])
+ vty_out (vty, " restart %d", peer->pmax_restart[afi][safi]);
+ vty_out (vty, "%s", VTY_NEWLINE);
}
/* Route server client. */