From: Ondrej Zajicek Date: Tue, 3 Dec 2024 18:00:05 +0000 (+0100) Subject: Merge commit '73e7d3f5cede2e72eb9e77d61424a8c443672c09' into thread-next X-Git-Tag: v3.0.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=723a0fe4243482a014667a3efc14f4484e4931fe;p=thirdparty%2Fbird.git Merge commit '73e7d3f5cede2e72eb9e77d61424a8c443672c09' into thread-next --- 723a0fe4243482a014667a3efc14f4484e4931fe diff --cc proto/bmp/bmp.c index 51b04f5d3,dc21ac090..19c187ed2 --- a/proto/bmp/bmp.c +++ b/proto/bmp/bmp.c @@@ -517,23 -498,22 +502,21 @@@ bmp_route_monitor_msg_serialize(struct static void bmp_peer_up_notif_msg_serialize(buffer *stream, const struct bmp_peer_hdr_info *peer, const ip_addr local_addr, const u16 local_port, const u16 remote_port, - const byte *sent_msg, const size_t sent_msg_length, - const byte *recv_msg, const size_t recv_msg_length) + const adata *sent_msg, const adata *recv_msg) { - const size_t data_size = - BMP_PER_PEER_HDR_SIZE + BMP_PEER_UP_NOTIF_MSG_FIX_SIZE + - BGP_HEADER_LENGTH + sent_msg->length + BGP_HEADER_LENGTH + recv_msg->length; - - bmp_buffer_need(stream, BMP_COMMON_HDR_SIZE + data_size); - bmp_common_hdr_serialize(stream, BMP_PEER_UP_NOTIF, data_size); - bmp_per_peer_hdr_serialize(stream, peer); + bmp_put_common_hdr(stream, BMP_PEER_UP_NOTIF, 0); + bmp_put_per_peer_hdr(stream, peer); + bmp_buffer_need(stream, BMP_PEER_UP_NOTIF_MSG_FIX_SIZE); bmp_put_ipa(stream, local_addr); bmp_put_u16(stream, local_port); bmp_put_u16(stream, remote_port); - bmp_put_bgp_hdr(stream, PKT_OPEN, BGP_HEADER_LENGTH + sent_msg_length); - bmp_put_data(stream, sent_msg, sent_msg_length); - bmp_put_bgp_hdr(stream, PKT_OPEN, BGP_HEADER_LENGTH + recv_msg_length); - bmp_put_data(stream, recv_msg, recv_msg_length); + bmp_put_bgp_hdr(stream, PKT_OPEN, BGP_HEADER_LENGTH + sent_msg->length); + bmp_put_data(stream, sent_msg->data, sent_msg->length); + bmp_put_bgp_hdr(stream, PKT_OPEN, BGP_HEADER_LENGTH + recv_msg->length); + bmp_put_data(stream, recv_msg->data, recv_msg->length); + + bmp_fix_common_hdr(stream); } static void @@@ -1042,22 -971,26 +1021,18 @@@ bmp_peer_down_(struct bmp_proto *p, ea_ bmp_remove_peer(p, bp); } -void -bmp_peer_down(const struct bgp_proto *bgp, - int err_class, int code, int subcode, const byte *data, int length) -{ - struct bmp_proto *p; node *n; - WALK_LIST2(p, n, bmp_proto_list, bmp_node) - bmp_peer_down_(p, bgp, err_class, code, subcode, data, length); -} static void - bmp_send_termination_msg(struct bmp_proto *p, - const enum bmp_term_reason reason) + bmp_send_termination_msg(struct bmp_proto *p, enum bmp_term_reason reason) { - const size_t term_msg_hdr_size = BMP_TERM_INFO_TYPE_SIZE - + BMP_TERM_INFO_LEN_FIELD_SIZE - + BMP_TERM_REASON_CODE_SIZE; - const size_t term_msg_size = BMP_COMMON_HDR_SIZE + term_msg_hdr_size; buffer stream = bmp_default_buffer(p); - bmp_buffer_need(&stream, term_msg_size); - bmp_common_hdr_serialize(&stream, BMP_TERM_MSG, term_msg_hdr_size); + bmp_put_common_hdr(&stream, BMP_TERM_MSG, 0); + bmp_buffer_need(&stream, 6); bmp_put_u16(&stream, BMP_TERM_INFO_REASON); - bmp_put_u16(&stream, BMP_TERM_REASON_CODE_SIZE); // 2-byte code indication the reason + bmp_put_u16(&stream, 2); // Length of the reason bmp_put_u16(&stream, reason); + bmp_fix_common_hdr(&stream); if (p->sk->tbuf) bmp_tx_buffer_free(p, SKIP_BACK(struct bmp_tx_buffer, data, p->sk->tbuf));