mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 05:18:47 +00:00
bgpd: fix some formatting in bgp_io.c
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
1588f6f441
commit
85145b6264
@ -478,52 +478,44 @@ static uint16_t bgp_read(struct peer *peer)
|
|||||||
|
|
||||||
nbytes = stream_read_try(peer->ibuf_work, peer->fd, readsize);
|
nbytes = stream_read_try(peer->ibuf_work, peer->fd, readsize);
|
||||||
|
|
||||||
if (nbytes <= 0) // handle errors
|
|
||||||
{
|
|
||||||
switch (nbytes) {
|
switch (nbytes) {
|
||||||
case -1: // fatal error; tear down the session
|
/* Fatal error; tear down session */
|
||||||
zlog_err("%s [Error] bgp_read_packet error: %s",
|
case -1:
|
||||||
peer->host, safe_strerror(errno));
|
zlog_err("%s [Error] bgp_read_packet error: %s", peer->host,
|
||||||
|
safe_strerror(errno));
|
||||||
|
|
||||||
if (peer->status == Established) {
|
if (peer->status == Established) {
|
||||||
if (CHECK_FLAG(peer->sflags,
|
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE)) {
|
||||||
PEER_STATUS_NSF_MODE)) {
|
peer->last_reset = PEER_DOWN_NSF_CLOSE_SESSION;
|
||||||
peer->last_reset =
|
SET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
|
||||||
PEER_DOWN_NSF_CLOSE_SESSION;
|
|
||||||
SET_FLAG(peer->sflags,
|
|
||||||
PEER_STATUS_NSF_WAIT);
|
|
||||||
} else
|
} else
|
||||||
peer->last_reset =
|
peer->last_reset = PEER_DOWN_CLOSE_SESSION;
|
||||||
PEER_DOWN_CLOSE_SESSION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
BGP_EVENT_ADD(peer, TCP_fatal_error);
|
||||||
SET_FLAG(status, BGP_IO_FATAL_ERR);
|
SET_FLAG(status, BGP_IO_FATAL_ERR);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0: // TCP session closed
|
/* Received EOF / TCP session closed */
|
||||||
|
case 0:
|
||||||
if (bgp_debug_neighbor_events(peer))
|
if (bgp_debug_neighbor_events(peer))
|
||||||
zlog_debug(
|
zlog_debug("%s [Event] BGP connection closed fd %d",
|
||||||
"%s [Event] BGP connection closed fd %d",
|
|
||||||
peer->host, peer->fd);
|
peer->host, peer->fd);
|
||||||
|
|
||||||
if (peer->status == Established) {
|
if (peer->status == Established) {
|
||||||
if (CHECK_FLAG(peer->sflags,
|
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE)) {
|
||||||
PEER_STATUS_NSF_MODE)) {
|
peer->last_reset = PEER_DOWN_NSF_CLOSE_SESSION;
|
||||||
peer->last_reset =
|
SET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
|
||||||
PEER_DOWN_NSF_CLOSE_SESSION;
|
|
||||||
SET_FLAG(peer->sflags,
|
|
||||||
PEER_STATUS_NSF_WAIT);
|
|
||||||
} else
|
} else
|
||||||
peer->last_reset =
|
peer->last_reset = PEER_DOWN_CLOSE_SESSION;
|
||||||
PEER_DOWN_CLOSE_SESSION;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BGP_EVENT_ADD(peer, TCP_connection_closed);
|
BGP_EVENT_ADD(peer, TCP_connection_closed);
|
||||||
SET_FLAG(status, BGP_IO_FATAL_ERR);
|
SET_FLAG(status, BGP_IO_FATAL_ERR);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case -2: // temporary error; come back later
|
/* EAGAIN or EWOULDBLOCK; come back later */
|
||||||
|
case -2:
|
||||||
SET_FLAG(status, BGP_IO_TRANS_ERR);
|
SET_FLAG(status, BGP_IO_TRANS_ERR);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -533,9 +525,6 @@ static uint16_t bgp_read(struct peer *peer)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called after we have read a BGP packet header. Validates marker, message
|
* Called after we have read a BGP packet header. Validates marker, message
|
||||||
* type and packet length. If any of these aren't correct, sends a notify.
|
* type and packet length. If any of these aren't correct, sends a notify.
|
||||||
|
Loading…
Reference in New Issue
Block a user