mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 17:51:53 +00:00
BMP: Silence some log messages
Hooks called from BGP to BMP should not log warning when BMP is not connected, that is not an error (and we do not want to flood logs with a ton of messages). Blocked sk_send() should not log warning, that is expected situation. Error during sk_send() is handled in error hook anyway.
This commit is contained in:
parent
2c7d2141ac
commit
976dec048a
@ -294,10 +294,9 @@ bmp_fire_tx(void *p_)
|
|||||||
mb_free(tx_data->data);
|
mb_free(tx_data->data);
|
||||||
rem_node((node *) tx_data);
|
rem_node((node *) tx_data);
|
||||||
mb_free(tx_data);
|
mb_free(tx_data);
|
||||||
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
|
||||||
(sk_send(p->sk, data_size) <= 0),
|
if (sk_send(p->sk, data_size) <= 0)
|
||||||
"Failed to send BMP packet"
|
return;
|
||||||
);
|
|
||||||
|
|
||||||
// BMP packets should be treat with lowest priority when scheduling sending
|
// BMP packets should be treat with lowest priority when scheduling sending
|
||||||
// packets to target. That's why we want to send max. 32 packets per event
|
// packets to target. That's why we want to send max. 32 packets per event
|
||||||
@ -641,7 +640,7 @@ bmp_route_monitor_update_in_pre_begin()
|
|||||||
{
|
{
|
||||||
struct bmp_proto *p = g_bmp;
|
struct bmp_proto *p = g_bmp;
|
||||||
|
|
||||||
if (!p)
|
if (!p || !p->started)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -651,11 +650,6 @@ bmp_route_monitor_update_in_pre_begin()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
|
||||||
!p->started,
|
|
||||||
"BMP instance not started yet"
|
|
||||||
);
|
|
||||||
|
|
||||||
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
||||||
!EMPTY_LIST(p->rt_table_in_pre_policy.update_msg_queue),
|
!EMPTY_LIST(p->rt_table_in_pre_policy.update_msg_queue),
|
||||||
"Previous BMP route monitoring update not finished yet"
|
"Previous BMP route monitoring update not finished yet"
|
||||||
@ -672,7 +666,7 @@ bmp_route_monitor_put_update_in_pre_msg(const byte *data, const size_t data_size
|
|||||||
{
|
{
|
||||||
struct bmp_proto *p = g_bmp;
|
struct bmp_proto *p = g_bmp;
|
||||||
|
|
||||||
if (!p)
|
if (!p || !p->started)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -682,11 +676,6 @@ bmp_route_monitor_put_update_in_pre_msg(const byte *data, const size_t data_size
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
|
||||||
!p->started,
|
|
||||||
"BMP instance not started yet"
|
|
||||||
);
|
|
||||||
|
|
||||||
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
||||||
!p->rt_table_in_pre_policy.update_in_progress,
|
!p->rt_table_in_pre_policy.update_in_progress,
|
||||||
"BMP route monitoring update not started yet"
|
"BMP route monitoring update not started yet"
|
||||||
@ -706,7 +695,7 @@ bmp_route_monitor_update_in_pre_commit(const struct bgp_proto *bgp)
|
|||||||
{
|
{
|
||||||
struct bmp_proto *p = g_bmp;
|
struct bmp_proto *p = g_bmp;
|
||||||
|
|
||||||
if (!p)
|
if (!p || !p->started)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -716,11 +705,6 @@ bmp_route_monitor_update_in_pre_commit(const struct bgp_proto *bgp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
|
||||||
(!p->started || EMPTY_LIST(p->rt_table_in_pre_policy.update_msg_queue)),
|
|
||||||
"BMP route monitoring update not started yet"
|
|
||||||
);
|
|
||||||
|
|
||||||
const struct birdsock *sk = bmp_get_birdsock(bgp);
|
const struct birdsock *sk = bmp_get_birdsock(bgp);
|
||||||
IF_PTR_IS_NULL_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
IF_PTR_IS_NULL_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
||||||
sk,
|
sk,
|
||||||
@ -768,7 +752,7 @@ bmp_route_monitor_update_in_pre_end()
|
|||||||
{
|
{
|
||||||
struct bmp_proto *p = g_bmp;
|
struct bmp_proto *p = g_bmp;
|
||||||
|
|
||||||
if (!p)
|
if (!p || !p->started)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -778,11 +762,6 @@ bmp_route_monitor_update_in_pre_end()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IF_COND_TRUE_PRINT_ERR_MSG_AND_RETURN_OPT_VAL(
|
|
||||||
(!p->started || EMPTY_LIST(p->rt_table_in_pre_policy.update_msg_queue)),
|
|
||||||
"BMP route monitoring update not started yet"
|
|
||||||
);
|
|
||||||
|
|
||||||
struct bmp_data_node *upd_msg;
|
struct bmp_data_node *upd_msg;
|
||||||
struct bmp_data_node *upd_msg_next;
|
struct bmp_data_node *upd_msg_next;
|
||||||
WALK_LIST_DELSAFE(upd_msg, upd_msg_next, p->rt_table_in_pre_policy.update_msg_queue)
|
WALK_LIST_DELSAFE(upd_msg, upd_msg_next, p->rt_table_in_pre_policy.update_msg_queue)
|
||||||
@ -791,6 +770,8 @@ bmp_route_monitor_update_in_pre_end()
|
|||||||
rem_node((node *) upd_msg);
|
rem_node((node *) upd_msg);
|
||||||
mb_free(upd_msg);
|
mb_free(upd_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->rt_table_in_pre_policy.update_in_progress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -878,17 +859,13 @@ bmp_peer_down(const struct bgp_proto *bgp, const int err_class, const byte *pkt,
|
|||||||
{
|
{
|
||||||
struct bmp_proto *p = g_bmp;
|
struct bmp_proto *p = g_bmp;
|
||||||
|
|
||||||
if (!p || !p->started)
|
if (!p)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bmp_peer_map_key key
|
struct bmp_peer_map_key key
|
||||||
= bmp_peer_map_key_create(bgp->remote_ip, bgp->remote_as);
|
= bmp_peer_map_key_create(bgp->remote_ip, bgp->remote_as);
|
||||||
if (!bmp_peer_map_get(&p->bgp_peers, key))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bmp_peer_map_remove(&p->peer_open_msg.tx_msg, key);
|
bmp_peer_map_remove(&p->peer_open_msg.tx_msg, key);
|
||||||
bmp_peer_map_remove(&p->peer_open_msg.rx_msg, key);
|
bmp_peer_map_remove(&p->peer_open_msg.rx_msg, key);
|
||||||
@ -896,6 +873,10 @@ bmp_peer_down(const struct bgp_proto *bgp, const int err_class, const byte *pkt,
|
|||||||
const size_t missing_bgp_hdr_size = BGP_MSG_HDR_MARKER_SIZE
|
const size_t missing_bgp_hdr_size = BGP_MSG_HDR_MARKER_SIZE
|
||||||
+ BGP_MSG_HDR_LENGTH_SIZE
|
+ BGP_MSG_HDR_LENGTH_SIZE
|
||||||
+ BGP_MSG_HDR_TYPE_SIZE;
|
+ BGP_MSG_HDR_TYPE_SIZE;
|
||||||
|
|
||||||
|
if (!p->started)
|
||||||
|
return;
|
||||||
|
|
||||||
buffer payload
|
buffer payload
|
||||||
= bmp_buffer_alloc(p->buffer_mpool, pkt_size + missing_bgp_hdr_size + 1);
|
= bmp_buffer_alloc(p->buffer_mpool, pkt_size + missing_bgp_hdr_size + 1);
|
||||||
if (pkt != NULL && pkt_size > 0)
|
if (pkt != NULL && pkt_size > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user