peer->last_reset = PEER_DOWN_RID_CHANGE;
- if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
}
/* EVPN uses router id in RD, update them */
peer->connection->status))
continue;
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
}
}
}
if (!BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
continue;
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
}
}
peer->last_reset = PEER_DOWN_CLID_CHANGE;
- if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
}
}
peer->last_reset = PEER_DOWN_CLID_CHANGE;
- if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
}
}
peer->connection->status)) {
peer->last_reset =
PEER_DOWN_CONFED_ID_CHANGE;
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
} else
bgp_session_reset_safe(peer, &nnode);
}
peer->connection->status)) {
peer->last_reset =
PEER_DOWN_CONFED_ID_CHANGE;
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
} else
bgp_session_reset_safe(peer, &nnode);
}
peer->last_reset = PEER_DOWN_CONFED_ID_CHANGE;
if (BGP_IS_VALID_STATE_FOR_NOTIF(
peer->connection->status))
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset_safe(peer, &nnode);
}
peer->connection->status)) {
peer->last_reset =
PEER_DOWN_CONFED_PEER_CHANGE;
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
} else
bgp_session_reset_safe(peer, &nnode);
}
peer->connection->status)) {
peer->last_reset =
PEER_DOWN_CONFED_PEER_CHANGE;
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
} else
bgp_session_reset_safe(peer, &nnode);
}
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
peer->last_reset = PEER_DOWN_REMOTE_AS_CHANGE;
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
}
false);
}
} else {
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
}
}
- if (peer->connection->status == OpenSent ||
- peer->connection->status == OpenConfirm)
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
+
/*
* If we are turning on a AFI/SAFI locally and we've
* started bringing a peer up, we need to tell
other = peer->doppelganger;
if (other && (other->connection->status == OpenSent ||
other->connection->status == OpenConfirm))
- bgp_notify_send(other->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(other->connection);
}
return 0;
bgp_clear_route(peer, afi, safi);
peer->pcount[afi][safi] = 0;
} else {
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
}
- } else {
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
- }
+ } else
+ peer_notify_config_change(peer->connection);
}
return false;
return 0;
}
+void peer_notify_config_change(struct peer_connection *connection)
+{
+ if (BGP_IS_VALID_STATE_FOR_NOTIF(connection->status))
+ bgp_notify_send(connection, BGP_NOTIFY_CEASE, BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+}
+
void peer_notify_unconfig(struct peer_connection *connection)
{
if (BGP_IS_VALID_STATE_FOR_NOTIF(connection->status))
peer->last_reset = PEER_DOWN_RMAP_BIND;
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
}
PEER_FLAG_CONFIG_NODE)))
peer_delete(peer->doppelganger);
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
} else if (type == peer_change_reset_in) {
if (CHECK_FLAG(peer->cap, PEER_CAP_REFRESH_RCV))
bgp_route_refresh_send(peer, afi, safi, 0, 0, 0,
PEER_FLAG_CONFIG_NODE)))
peer_delete(peer->doppelganger);
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
}
} else if (type == peer_change_reset_out) {
paf = peer_af_find(peer, afi, safi);
BGP_EVENT_ADD(peer->connection, BGP_Stop);
}
} else if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status)) {
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
} else
bgp_session_reset(peer);
}
if (peer->sort != BGP_PEER_IBGP) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(
peer->connection->status))
- bgp_notify_send(peer->connection,
- BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
member->ttl = group->conf->ttl;
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(member->connection);
else
bgp_session_reset(member);
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
if (member->connection->fd >= 0) {
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(member->connection);
else
bgp_session_reset(member);
}
peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(member->connection);
else
bgp_session_reset(member);
peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(member);
peer->last_reset = PEER_DOWN_UPDATE_SOURCE_CHANGE;
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(member->connection);
else
bgp_session_reset(member);
peer->last_reset = PEER_DOWN_LOCAL_AS_CHANGE;
/* Send notification or stop peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
BGP_EVENT_ADD(peer->connection, BGP_Stop);
/* Send notification or stop peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(member->connection);
else
bgp_session_reset(member);
}
peer->last_reset = PEER_DOWN_PASSWORD_CHANGE;
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
member->last_reset = PEER_DOWN_PASSWORD_CHANGE;
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(member->connection);
else
bgp_session_reset(member);
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
- bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(peer->connection);
else
bgp_session_reset(peer);
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
- bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,
- BGP_NOTIFY_CEASE_CONFIG_CHANGE);
+ peer_notify_config_change(member->connection);
else
bgp_session_reset(member);