X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=bgpd%2Fbgp_io.c;h=311f98001d2242384453a3aab76831d525e5e0d5;hb=95f91aa35e1dd29386453bb516c4ccb0de60ce74;hp=3882ff8b5677e1caa91b091e828f5ad041354dbd;hpb=db5bdc694ff5311ea5d1e8963442e989bbcebda6;p=mirror_frr.git diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c index 3882ff8b5..311f98001 100644 --- a/bgpd/bgp_io.c +++ b/bgpd/bgp_io.c @@ -35,6 +35,7 @@ #include "bgpd/bgp_io.h" #include "bgpd/bgp_debug.h" // for bgp_debug_neighbor_events, bgp_type_str +#include "bgpd/bgp_errors.h" // for expanded error reference information #include "bgpd/bgp_fsm.h" // for BGP_EVENT_ADD, bgp_event #include "bgpd/bgp_packet.h" // for bgp_notify_send_with_data, bgp_notify... #include "bgpd/bgpd.h" // for peer, BGP_MARKER_SIZE, bgp_master, bm @@ -174,12 +175,11 @@ static int bgp_process_reads(struct thread *thread) bool more = true; // whether we got more data bool fatal = false; // whether fatal error occurred bool added_pkt = false; // whether we pushed onto ->ibuf - bool header_valid = true; // whether header is valid /* clang-format on */ peer = THREAD_ARG(thread); - if (peer->fd < 0) + if (peer->fd < 0 || bm->terminating) return -1; struct frr_pthread *fpt = frr_pthread_get(PTHREAD_IO); @@ -214,10 +214,8 @@ static int bgp_process_reads(struct thread *thread) if (ringbuf_remain(ibw) < BGP_HEADER_SIZE) break; - /* validate header */ - header_valid = validate_header(peer); - - if (!header_valid) { + /* check that header is valid */ + if (!validate_header(peer)) { fatal = true; break; } @@ -404,8 +402,9 @@ static uint16_t bgp_read(struct peer *peer) SET_FLAG(status, BGP_IO_TRANS_ERR); /* Fatal error; tear down session */ } else if (nbytes < 0) { - zlog_err("%s [Error] bgp_read_packet error: %s", peer->host, - safe_strerror(errno)); + flog_err(BGP_ERR_UPDATE_RCV, + "%s [Error] bgp_read_packet error: %s", peer->host, + safe_strerror(errno)); if (peer->status == Established) { if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_MODE)) {