diff options
Diffstat (limited to 'bgpd/bgp_packet.c')
| -rw-r--r-- | bgpd/bgp_packet.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 7613ccc7df..45752a8ab6 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -125,7 +125,7 @@ static void bgp_packet_add(struct peer *peer, struct stream *s) intmax_t delta; uint32_t holdtime; - frr_with_mutex(&peer->io_mtx) { + frr_with_mutex (&peer->io_mtx) { /* if the queue is empty, reset the "last OK" timestamp to * now, otherwise if we write another packet immediately * after it'll get confused @@ -2002,8 +2002,7 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size) gr_info->eor_required, "EOR RCV", gr_info->eor_received); - BGP_TIMER_OFF( - gr_info->t_select_deferral); + THREAD_OFF(gr_info->t_select_deferral); gr_info->eor_required = 0; gr_info->eor_received = 0; /* Best path selection */ @@ -2510,7 +2509,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size) return BGP_PACKET_NOOP; } - BGP_TIMER_OFF(peer->t_refresh_stalepath); + THREAD_OFF(peer->t_refresh_stalepath); SET_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_EORR_RECEIVED); UNSET_FLAG(peer->af_sflags[afi][safi], @@ -2621,6 +2620,14 @@ static int bgp_capability_msg_parse(struct peer *peer, uint8_t *pnt, "%s CAPABILITY has action: %d, code: %u, length %u", peer->host, action, hdr->code, hdr->length); + if (hdr->length < sizeof(struct capability_mp_data)) { + zlog_info( + "%pBP Capability structure is not properly filled out, expected at least %zu bytes but header length specified is %d", + peer, sizeof(struct capability_mp_data), + hdr->length); + return BGP_Stop; + } + /* Capability length check. */ if ((pnt + hdr->length + 3) > end) { zlog_info("%s Capability length error", peer->host); @@ -2777,7 +2784,7 @@ void bgp_process_packet(struct thread *thread) bgp_size_t size; char notify_data_length[2]; - frr_with_mutex(&peer->io_mtx) { + frr_with_mutex (&peer->io_mtx) { peer->curr = stream_fifo_pop(peer->ibuf); } @@ -2904,7 +2911,7 @@ void bgp_process_packet(struct thread *thread) if (fsm_update_result != FSM_PEER_TRANSFERRED && fsm_update_result != FSM_PEER_STOPPED) { - frr_with_mutex(&peer->io_mtx) { + frr_with_mutex (&peer->io_mtx) { // more work to do, come back later if (peer->ibuf->count > 0) thread_add_event( |
