Merge bgpd changeset 1176 from Zebra repository by Rivo Nurges.
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index e9d81de..510e296 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -173,8 +173,11 @@
IPV4_ADDR_COPY (&peer->local_id, id);
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_RID_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
return 0;
}
@@ -205,8 +208,11 @@
LIST_LOOP (bgp->peer, peer, nn)
{
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_RID_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
return 0;
@@ -233,8 +239,11 @@
continue;
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_CLID_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
return 0;
}
@@ -258,8 +267,11 @@
continue;
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_CLID_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
return 0;
}
@@ -313,8 +325,12 @@
{
peer->local_as = as;
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_CONFED_ID_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
+
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -329,8 +345,11 @@
if (peer_sort (peer) == BGP_PEER_EBGP)
peer->local_as = as;
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_CONFED_ID_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -355,8 +374,12 @@
{
peer->local_as = bgp->as;
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_CONFED_ID_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
+
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -415,8 +438,11 @@
{
peer->local_as = bgp->as;
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_CONFED_PEER_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -468,8 +494,11 @@
{
peer->local_as = bgp->confed_id;
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_CONFED_PEER_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -587,6 +616,7 @@
/* Clear neighbor maximum-prefix */
peer->pmax[afi][safi] = 0;
+ peer->pmax_threshold[afi][safi] = MAXIMUM_PREFIX_THRESHOLD_DEFAULT;
}
/* peer global config reset */
@@ -792,8 +822,11 @@
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_REMOTE_AS_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -948,8 +981,11 @@
}
}
else
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_AF_ACTIVATE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
}
}
@@ -1004,12 +1040,18 @@
peer->pcount[afi][safi] = 0;
}
else
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
else
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
}
return 0;
@@ -1038,6 +1080,7 @@
/* Withdraw all information from routing table. We can not use
BGP_EVENT_ADD (peer, BGP_Stop) at here. Because the event is
executed after peer structure is deleted. */
+ peer->last_reset = PEER_DOWN_NEIGHBOR_DELETE;
bgp_stop (peer);
bgp_fsm_change_status (peer, Idle);
@@ -1254,6 +1297,7 @@
/* maximum-prefix */
peer->pmax[afi][safi] = conf->pmax[afi][safi];
+ peer->pmax_threshold[afi][safi] = conf->pmax_threshold[afi][safi];
/* allowas-in */
peer->allowas_in[afi][safi] = conf->allowas_in[afi][safi];
@@ -1562,8 +1606,11 @@
peer_group2peer_config_copy (group, peer, afi, safi);
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_RMAP_BIND;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
@@ -1597,8 +1644,11 @@
}
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_RMAP_UNBIND;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
@@ -1924,6 +1974,9 @@
/* Action when the flag is changed. */
enum peer_change_type type;
+
+ /* Peer down cause */
+ u_char peer_down;
};
struct peer_flag_action peer_flag_action_list[] =
@@ -2042,8 +2095,19 @@
CAPABILITY_ACTION_UNSET : CAPABILITY_ACTION_SET);
}
else
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ if (flag == PEER_FLAG_NO_ROUTE_REFRESH_CAP)
+ peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+ else if (flag == PEER_FLAG_DYNAMIC_CAPABILITY)
+ peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+ else if (flag == PEER_FLAG_PASSIVE)
+ peer->last_reset = PEER_DOWN_PASSIVE_CHANGE;
+ else if (flag == PEER_FLAG_ENFORCE_MULTIHOP)
+ peer->last_reset = PEER_DOWN_MULTIHOP_CHANGE;
+
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
}
else
BGP_EVENT_ADD (peer, BGP_Stop);
@@ -2216,7 +2280,19 @@
if (! set && flag == PEER_FLAG_SOFT_RECONFIG)
bgp_clear_adj_in (peer, afi, safi);
else
- peer_change_action (peer, afi, safi, action.type);
+ {
+ if (flag == PEER_FLAG_REFLECTOR_CLIENT)
+ peer->last_reset = PEER_DOWN_RR_CLIENT_CHANGE;
+ else if (flag == PEER_FLAG_RSERVER_CLIENT)
+ peer->last_reset = PEER_DOWN_RS_CLIENT_CHANGE;
+ else if (flag == PEER_FLAG_ORF_PREFIX_SM)
+ peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+ else if (flag == PEER_FLAG_ORF_PREFIX_RM)
+ peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+
+ peer_change_action (peer, afi, safi, action.type);
+ }
+
}
/* Peer group member updates. */
@@ -2245,7 +2321,18 @@
if (! set && flag == PEER_FLAG_SOFT_RECONFIG)
bgp_clear_adj_in (peer, afi, safi);
else
- peer_change_action (peer, afi, safi, action.type);
+ {
+ if (flag == PEER_FLAG_REFLECTOR_CLIENT)
+ peer->last_reset = PEER_DOWN_RR_CLIENT_CHANGE;
+ else if (flag == PEER_FLAG_RSERVER_CLIENT)
+ peer->last_reset = PEER_DOWN_RS_CLIENT_CHANGE;
+ else if (flag == PEER_FLAG_ORF_PREFIX_SM)
+ peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+ else if (flag == PEER_FLAG_ORF_PREFIX_RM)
+ peer->last_reset = PEER_DOWN_CAPABILITY_CHANGE;
+
+ peer_change_action (peer, afi, safi, action.type);
+ }
}
}
}
@@ -2385,8 +2472,11 @@
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
return 0;
@@ -2414,8 +2504,11 @@
peer->update_if = XSTRDUP (MTYPE_PEER_UPDATE_SOURCE, ifname);
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -2448,8 +2541,11 @@
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
return 0;
@@ -2476,8 +2572,11 @@
peer->update_source = sockunion_dup (su);
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -2524,8 +2623,11 @@
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
return 0;
@@ -2551,8 +2653,11 @@
}
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -2995,8 +3100,11 @@
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
@@ -3013,8 +3121,11 @@
UNSET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND);
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -3040,8 +3151,11 @@
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
{
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
@@ -3055,8 +3169,11 @@
UNSET_FLAG (peer->flags, PEER_FLAG_LOCAL_AS_NO_PREPEND);
if (peer->status == Established)
- bgp_notify_send (peer, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ {
+ peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE;
+ bgp_notify_send (peer, BGP_NOTIFY_CEASE,
+ BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ }
else
BGP_EVENT_ADD (peer, BGP_Stop);
}
@@ -3720,7 +3837,7 @@
int
peer_maximum_prefix_set (struct peer *peer, afi_t afi, safi_t safi,
- u_int32_t max, int warning)
+ u_int32_t max, u_char threshold, int warning)
{
struct peer_group *group;
struct listnode *nn;
@@ -3730,6 +3847,7 @@
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX);
peer->pmax[afi][safi] = max;
+ peer->pmax_threshold[afi][safi] = threshold;
if (warning)
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING);
else
@@ -3746,6 +3864,7 @@
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX);
peer->pmax[afi][safi] = max;
+ peer->pmax_threshold[afi][safi] = threshold;
if (warning)
SET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING);
else
@@ -3779,12 +3898,14 @@
UNSET_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING);
peer->pmax[afi][safi] = peer->group->conf->pmax[afi][safi];
+ peer->pmax_threshold[afi][safi] = peer->group->conf->pmax_threshold[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;
if (! CHECK_FLAG (peer->sflags, PEER_STATUS_GROUP))
return 0;
@@ -3798,6 +3919,7 @@
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;
}
return 0;
}
@@ -4266,12 +4388,17 @@
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX))
if (! peer->af_group[afi][safi]
|| g_peer->pmax[afi][safi] != peer->pmax[afi][safi]
+ || g_peer->pmax_threshold[afi][safi] != peer->pmax_threshold[afi][safi]
|| 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%s%s",
- addr, peer->pmax[afi][safi],
- CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_MAX_PREFIX_WARNING)
- ? " warning-only" : "", 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");
+ vty_out (vty, "%s", VTY_NEWLINE);
+ }
/* Route server client. */
if (CHECK_FLAG (peer->af_flags[afi][safi], PEER_FLAG_RSERVER_CLIENT)
@@ -4460,25 +4587,22 @@
vty_out (vty, " bgp cluster-id %s%s", inet_ntoa (bgp->cluster_id),
VTY_NEWLINE);
- /* Confederation Information */
+ /* Confederation identifier*/
if (CHECK_FLAG (bgp->config, BGP_CONFIG_CONFEDERATION))
+ vty_out (vty, " bgp confederation identifier %i%s", bgp->confed_id,
+ VTY_NEWLINE);
+
+ /* Confederation peer */
+ if (bgp->confed_peers_cnt > 0)
{
- vty_out (vty, " bgp confederation identifier %i%s", bgp->confed_id,
- VTY_NEWLINE);
- if (bgp->confed_peers_cnt > 0)
- {
- int i;
+ int i;
- vty_out (vty, " bgp confederation peers");
+ vty_out (vty, " bgp confederation peers");
- for (i = 0; i < bgp->confed_peers_cnt; i++)
- {
- vty_out(vty, " ");
- vty_out(vty, "%d", bgp->confed_peers[i]);
- }
+ for (i = 0; i < bgp->confed_peers_cnt; i++)
+ vty_out(vty, " %d", bgp->confed_peers[i]);
- vty_out (vty, "%s", VTY_NEWLINE);
- }
+ vty_out (vty, "%s", VTY_NEWLINE);
}
/* BGP enforce-first-as. */