struct peer *peer = connection->peer;
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Timer (start timer expire).", peer->host);
+ zlog_debug("%s [FSM] Timer (start timer expire for %s).", peer->host,
+ bgp_peer_get_connection_direction(connection));
EVENT_VAL(thread) = BGP_Start;
bgp_event(thread); /* bgp_event unlocks peer */
assert(!connection->t_read);
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Timer (connect timer (%us) expire)", peer->host,
- peer->v_connect);
+ zlog_debug("%s [FSM] Timer (connect timer (%us) expire for %s)", peer->host,
+ peer->v_connect, bgp_peer_get_connection_direction(connection));
if (CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER))
bgp_stop(connection);
struct peer *peer = connection->peer;
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Timer (holdtime timer expire)",
- peer->host);
+ zlog_debug("%s [FSM] Timer (holdtime timer expire for %s)", peer->host,
+ bgp_peer_get_connection_direction(connection));
/*
* Given that we do not have any expectation of ordering
struct peer *peer = connection->peer;
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Timer (routeadv timer expire)", peer->host);
+ zlog_debug("%s [FSM] Timer (routeadv timer expire for %s)", peer->host,
+ bgp_peer_get_connection_direction(connection));
peer->synctime = monotime(NULL);
struct peer *peer = connection->peer;
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Timer (DelayOpentimer expire)",
- peer->host);
+ zlog_debug("%s [FSM] Timer (DelayOpentimer expire for %s)", peer->host,
+ bgp_peer_get_connection_direction(connection));
EVENT_VAL(thread) = DelayOpen_timer_expired;
bgp_event(thread); /* bgp_event unlocks peer */
if (peer_dynamic_neighbor(peer) &&
!(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s (dynamic neighbor) deleted (%s)",
- peer->host, __func__);
+ zlog_debug("%s (dynamic neighbor) deleted (%s) for %s", __func__,
+ peer->host, bgp_peer_get_connection_direction(connection));
peer_delete(peer);
}
* stale routes from the neighbor that it is retaining.
*/
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%pBP Long-lived stale timer (%s) expired", peer,
- get_afi_safi_str(afi, safi, false));
+ zlog_debug("%pBP Long-lived stale timer (%s) expired for %s", peer,
+ get_afi_safi_str(afi, safi, false),
+ bgp_peer_get_connection_direction(peer->connection));
UNSET_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_LLGR_WAIT);
afi_t afi;
safi_t safi;
- if (bgp_debug_neighbor_events(peer)) {
- zlog_debug("%pBP graceful restart timer expired", peer);
- zlog_debug("%pBP graceful restart stalepath timer stopped",
- peer);
- }
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug("%pBP graceful restart timer expired and graceful restart stalepath timer stopped for %s",
+ peer, bgp_peer_get_connection_direction(connection));
FOREACH_AFI_SAFI (afi, safi) {
if (!peer->nsf[afi][safi])
continue;
if (bgp_debug_neighbor_events(peer))
- zlog_debug(
- "%pBP Long-lived stale timer (%s) started for %d sec",
- peer,
- get_afi_safi_str(afi, safi, false),
- peer->llgr[afi][safi].stale_time);
+ zlog_debug("%pBP Long-lived stale timer (%s) started for %d sec for %s",
+ peer, get_afi_safi_str(afi, safi, false),
+ peer->llgr[afi][safi].stale_time,
+ bgp_peer_get_connection_direction(connection));
SET_FLAG(peer->af_sflags[afi][safi],
PEER_STATUS_LLGR_WAIT);
safi_t safi;
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%pBP graceful restart stalepath timer expired",
- peer);
+ zlog_debug("%pBP graceful restart stalepath timer expired for %s", peer,
+ bgp_peer_get_connection_direction(connection));
/* NSF delete stale route */
FOREACH_AFI_SAFI_NSF (afi, safi)
if (bgp_debug_neighbor_events(peer)) {
struct vrf *vrf = vrf_lookup_by_id(bgp->vrf_id);
- zlog_debug("%s : vrf %s(%u), Status: %s established_peers %u", __func__,
+ zlog_debug("%s : vrf %s(%u), Status: %s established_peers %u for %s", __func__,
vrf ? vrf->name : "Unknown", bgp->vrf_id,
- lookup_msg(bgp_status_msg, status, NULL),
- bgp->established_peers);
+ lookup_msg(bgp_status_msg, status, NULL), bgp->established_peers,
+ bgp_peer_get_connection_direction(connection));
}
/* Set to router ID to the value provided by RIB if there are no peers
bgp_update_delay_process_status_change(peer);
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s fd %d went from %s to %s", peer->host,
- connection->fd,
+ zlog_debug("%s fd %d went from %s to %s for %s", peer->host, connection->fd,
lookup_msg(bgp_status_msg, connection->ostatus, NULL),
- lookup_msg(bgp_status_msg, connection->status, NULL));
+ lookup_msg(bgp_status_msg, connection->status, NULL),
+ bgp_peer_get_connection_direction(connection));
}
/* Flush the event queue and ensure the peer is shut down */
if (peer_dynamic_neighbor_no_nsf(peer) &&
!(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s (dynamic neighbor) deleted (%s)",
- peer->host, __func__);
+ zlog_debug("%s (dynamic neighbor) deleted (%s) for %s", __func__,
+ peer->host, bgp_peer_get_connection_direction(connection));
peer_delete(peer);
return BGP_FSM_FAILURE_AND_DELETE;
}
if (connection->t_gr_stale) {
EVENT_OFF(connection->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
- zlog_debug(
- "%pBP graceful restart stalepath timer stopped",
- peer);
+ zlog_debug("%pBP graceful restart stalepath timer stopped for %s",
+ peer, bgp_peer_get_connection_direction(connection));
}
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
if (bgp_debug_neighbor_events(peer)) {
- zlog_debug(
- "%pBP graceful restart timer started for %d sec",
- peer, peer->v_gr_restart);
- zlog_debug(
- "%pBP graceful restart stalepath timer started for %d sec",
- peer, peer->bgp->stalepath_time);
+ zlog_debug("%pBP graceful restart timer started for %d sec for %s",
+ peer, peer->v_gr_restart,
+ bgp_peer_get_connection_direction(connection));
+ zlog_debug("%pBP graceful restart stalepath timer started for %d sec for %s",
+ peer, peer->bgp->stalepath_time,
+ bgp_peer_get_connection_direction(connection));
}
BGP_TIMER_ON(connection->t_gr_restart,
bgp_graceful_restart_timer_expire,
EVENT_OFF(peer->t_refresh_stalepath);
if (bgp_debug_neighbor_events(peer))
- zlog_debug(
- "%pBP route-refresh restart stalepath timer stopped",
- peer);
+ zlog_debug("%pBP route-refresh restart stalepath timer stopped for %s",
+ peer, bgp_peer_get_connection_direction(connection));
}
/* If peer reset before receiving EOR, decrement EOR count and
gr_info->eor_required--;
if (BGP_DEBUG(update, UPDATE_OUT))
- zlog_debug("peer %s, EOR_required %d",
- peer->host,
- gr_info->eor_required);
+ zlog_debug("peer %s, EOR_required %d for %s", peer->host,
+ gr_info->eor_required,
+ bgp_peer_get_connection_direction(connection));
/* There is no pending EOR message */
if (gr_info->eor_required == 0) {
peer->resettime = peer->uptime = monotime(NULL);
if (BGP_DEBUG(update_groups, UPDATE_GROUPS))
- zlog_debug("%s remove from all update group",
- peer->host);
+ zlog_debug("%s remove from all update group for %s", peer->host,
+ bgp_peer_get_connection_direction(connection));
update_group_remove_peer_afs(peer);
/* Reset peer synctime */
if (connection->fd >= 0) {
close(connection->fd);
connection->fd = -1;
+ connection->dir = UNKNOWN;
}
/* Reset capabilities. */
if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s (dynamic neighbor) deleted (%s)",
- peer->host, __func__);
+ zlog_debug("%s (dynamic neighbor) deleted (%s) for %s", __func__,
+ peer->host, bgp_peer_get_connection_direction(connection));
peer_delete(peer);
return BGP_FSM_FAILURE;
}
if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s (dynamic neighbor) deleted (%s)",
- peer->host, __func__);
+ zlog_debug("%s (dynamic neighbor) deleted (%s) for %s", __func__,
+ peer->host, bgp_peer_get_connection_direction(connection));
peer_delete(peer);
return BGP_FSM_FAILURE;
}
return;
} else {
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [Event] Connect failed %d(%s)",
- peer->host, status, safe_strerror(status));
+ zlog_debug("%s [Event] Connect failed %d(%s) for connection %s", peer->host,
+ status, safe_strerror(status),
+ bgp_peer_get_connection_direction(connection));
BGP_EVENT_ADD(connection, TCP_connection_open_failed);
return;
}
if (bgp_debug_neighbor_events(peer)) {
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER))
- zlog_debug("%s open active, local address %pSU", peer->host,
- connection->su_local);
+ zlog_debug("%s open active, local address %pSU for %s", peer->host,
+ connection->su_local,
+ bgp_peer_get_connection_direction(connection));
else
- zlog_debug("%s passive open", peer->host);
+ zlog_debug("%s passive open for %s", peer->host,
+ bgp_peer_get_connection_direction(connection));
}
/* Send an open message */
if (bgp_debug_neighbor_events(peer)) {
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_ACCEPT_PEER))
- zlog_debug("%s open active, local address %pSU", peer->host,
- connection->su_local);
+ zlog_debug("%s open active, local address %pSU for %s", peer->host,
+ connection->su_local,
+ bgp_peer_get_connection_direction(connection));
else
- zlog_debug("%s passive open", peer->host);
+ zlog_debug("%s passive open for %s", peer->host,
+ bgp_peer_get_connection_direction(connection));
}
/* set the DelayOpenTime to the inital value */
peer->v_delayopen);
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] BGP OPEN message delayed for %d seconds",
- peer->host, peer->delayopen);
+ zlog_debug("%s [FSM] BGP OPEN message delayed for %d seconds for connection %s",
+ peer->host, peer->delayopen,
+ bgp_peer_get_connection_direction(connection));
return BGP_FSM_SUCCESS;
}
if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s (dynamic neighbor) deleted (%s)",
- peer->host, __func__);
+ zlog_debug("%s (dynamic neighbor) deleted (%s) for %s", __func__,
+ peer->host, bgp_peer_get_connection_direction(connection));
peer_delete(peer);
return BGP_FSM_FAILURE_AND_DELETE;
}
if (connection->su.sa.sa_family == AF_UNSPEC) {
if (bgp_debug_neighbor_events(peer))
- zlog_debug(
- "%s [FSM] Unable to get neighbor's IP address, waiting...",
- peer->host);
+ zlog_debug("%s [FSM] Unable to get neighbor's IP address, waiting... for %s",
+ peer->host, bgp_peer_get_connection_direction(connection));
peer->last_reset = PEER_DOWN_NBR_ADDR;
return BGP_FSM_FAILURE;
}
if (!bgp_peer_reg_with_nht(peer)) {
if (bgp_zebra_num_connects()) {
if (bgp_debug_neighbor_events(peer))
- zlog_debug(
- "%s [FSM] Waiting for NHT, no path to neighbor present",
- peer->host);
+ zlog_debug("%s [FSM] Waiting for NHT, no path to neighbor present for %s",
+ peer->host,
+ bgp_peer_get_connection_direction(connection));
peer->last_reset = PEER_DOWN_WAITING_NHT;
BGP_EVENT_ADD(connection, TCP_connection_open_failed);
return BGP_FSM_SUCCESS;
switch (status) {
case connect_error:
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Connect error", peer->host);
+ zlog_debug("%s [FSM] Connect error for %s", peer->host,
+ bgp_peer_get_connection_direction(connection));
BGP_EVENT_ADD(connection, TCP_connection_open_failed);
break;
case connect_success:
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Connect immediately success, fd %d",
- peer->host, connection->fd);
+ zlog_debug("%s [FSM] Connect immediately success, fd %d for %s", peer->host,
+ connection->fd, bgp_peer_get_connection_direction(connection));
BGP_EVENT_ADD(connection, TCP_connection_open);
break;
/* To check nonblocking connect, we wait until socket is
readable or writable. */
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Non blocking connect waiting result, fd %d",
- peer->host, connection->fd);
+ zlog_debug("%s [FSM] Non blocking connect waiting result, fd %d for %s",
+ peer->host, connection->fd,
+ bgp_peer_get_connection_direction(connection));
if (connection->fd < 0) {
flog_err(EC_BGP_FSM, "%s peer's fd is negative value %d",
__func__, peer->connection->fd);
struct peer *peer = connection->peer;
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s [FSM] Hold timer expire", peer->host);
+ zlog_debug("%s [FSM] Hold timer expire for %s", peer->host,
+ bgp_peer_get_connection_direction(connection));
/* RFC8538 updates RFC 4724 by defining an extension that permits
* the Graceful Restart procedures to be performed when the BGP
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
if (bgp_debug_neighbor_events(peer)) {
if (BGP_PEER_RESTARTING_MODE(peer))
- zlog_debug("%pBP BGP_RESTARTING_MODE", peer);
+ zlog_debug("%pBP BGP_RESTARTING_MODE %s", peer,
+ bgp_peer_get_connection_direction(connection));
else if (BGP_PEER_HELPER_MODE(peer))
- zlog_debug("%pBP BGP_HELPER_MODE", peer);
+ zlog_debug("%pBP BGP_HELPER_MODE %s", peer,
+ bgp_peer_get_connection_direction(connection));
}
FOREACH_AFI_SAFI_NSF (afi, safi) {
if (connection->t_gr_stale) {
EVENT_OFF(connection->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
- zlog_debug(
- "%pBP graceful restart stalepath timer stopped",
- peer);
+ zlog_debug("%pBP graceful restart stalepath timer stopped for %s",
+ peer, bgp_peer_get_connection_direction(connection));
}
}
if (connection->t_gr_restart) {
EVENT_OFF(connection->t_gr_restart);
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%pBP graceful restart timer stopped", peer);
+ zlog_debug("%pBP graceful restart timer stopped for %s", peer,
+ bgp_peer_get_connection_direction(connection));
}
/* Reset uptime, turn on keepalives, send current table. */
if (peer->t_llgr_stale[afi][safi]) {
EVENT_OFF(peer->t_llgr_stale[afi][safi]);
if (bgp_debug_neighbor_events(peer))
- zlog_debug(
- "%pBP Long-lived stale timer stopped for afi/safi: %d/%d",
- peer, afi, safi);
+ zlog_debug("%pBP Long-lived stale timer stopped for afi/safi: %d/%d for %s",
+ peer, afi, safi,
+ bgp_peer_get_connection_direction(connection));
}
if (CHECK_FLAG(peer->af_cap[afi][safi],
if (peer->doppelganger &&
(peer->doppelganger->connection->status != Deleted)) {
if (bgp_debug_neighbor_events(peer))
- zlog_debug(
- "[Event] Deleting stub connection for peer %s",
- peer->host);
+ zlog_debug("[Event] Deleting stub connection for peer %s for %s", peer->host,
+ bgp_peer_get_connection_direction(peer->doppelganger->connection));
if (peer->doppelganger->connection->status > Active)
bgp_notify_send(peer->doppelganger->connection,
next = FSM[connection->status - 1][event - 1].next_state;
if (bgp_debug_neighbor_events(peer) && connection->status != next)
- zlog_debug("%s [FSM] %s (%s->%s), fd %d", peer->host,
- bgp_event_str[event],
+ zlog_debug("%s [FSM] %s (%s->%s), fd %d for %s", peer->host, bgp_event_str[event],
lookup_msg(bgp_status_msg, connection->status, NULL),
- lookup_msg(bgp_status_msg, next, NULL),
- connection->fd);
+ lookup_msg(bgp_status_msg, next, NULL), connection->fd,
+ bgp_peer_get_connection_direction(connection));
peer->last_event = peer->cur_event;
peer->cur_event = event;