mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-15 13:31:54 +00:00
mrt compile fixup after rebase
This commit is contained in:
parent
0656ff59c2
commit
fb2b3836ea
@ -145,7 +145,7 @@ bgp_dump_message(struct bgp_conn *conn, byte *pkt, uint len)
|
||||
d.msg_len = len;
|
||||
d.add_path = bgp_estimate_add_path(conn->bgp, pkt, len);
|
||||
|
||||
mrt_dump_bgp_message(&d);
|
||||
mrt_dump_bgp_message(&d, conn->bgp->p.pool);
|
||||
}
|
||||
|
||||
void
|
||||
@ -157,7 +157,7 @@ bgp_dump_state_change(struct bgp_conn *conn, uint old, uint new)
|
||||
d.old_state = old;
|
||||
d.new_state = new;
|
||||
|
||||
mrt_dump_bgp_state_change(&d);
|
||||
mrt_dump_bgp_state_change(&d, conn->bgp->p.pool);
|
||||
}
|
||||
|
||||
static byte *
|
||||
|
@ -83,6 +83,13 @@ mrt_buffer_init(buffer *b, pool *pool, size_t n)
|
||||
b->end = b->start + n;
|
||||
}
|
||||
|
||||
static void
|
||||
mrt_buffer_free(buffer *b)
|
||||
{
|
||||
mb_free(b->start);
|
||||
b->start = b->pos = b->end = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
mrt_buffer_grow(buffer *b, size_t n)
|
||||
{
|
||||
@ -786,17 +793,12 @@ mrt_dump_cmd(struct mrt_dump_data *d)
|
||||
*/
|
||||
|
||||
static buffer *
|
||||
mrt_bgp_buffer(void)
|
||||
mrt_bgp_buffer(pool *p)
|
||||
{
|
||||
/* Static buffer for BGP4MP dump, TODO: change to use MRT protocol */
|
||||
static buffer b;
|
||||
|
||||
ASSERT(this_metaloop);
|
||||
log("loop in mrt %x, pool %i (main loop is %x, pool %i)", this_metaloop, this_metaloop->pool, &main_birdloop, main_birdloop.pool);
|
||||
ASSERT(this_metaloop->pool);
|
||||
if (!b.start)
|
||||
mrt_buffer_init(&b, this_metaloop->pool, 1024);
|
||||
static _Thread_local buffer b;
|
||||
|
||||
mrt_buffer_init(&b, p, 1024);
|
||||
return &b;
|
||||
}
|
||||
|
||||
@ -830,7 +832,7 @@ mrt_bgp_header(buffer *b, struct mrt_bgp_data *d)
|
||||
}
|
||||
|
||||
void
|
||||
mrt_dump_bgp_message(struct mrt_bgp_data *d)
|
||||
mrt_dump_bgp_message(struct mrt_bgp_data *d, pool *p)
|
||||
{
|
||||
const u16 subtypes[] = {
|
||||
MRT_BGP4MP_MESSAGE, MRT_BGP4MP_MESSAGE_AS4,
|
||||
@ -839,15 +841,16 @@ mrt_dump_bgp_message(struct mrt_bgp_data *d)
|
||||
MRT_BGP4MP_MESSAGE_LOCAL_ADDPATH, MRT_BGP4MP_MESSAGE_AS4_LOCAL_ADDPATH,
|
||||
};
|
||||
|
||||
buffer *b = mrt_bgp_buffer();
|
||||
buffer *b = mrt_bgp_buffer(p);
|
||||
mrt_init_message(b, MRT_BGP4MP, subtypes[d->as4 + 4*d->add_path]);
|
||||
mrt_bgp_header(b, d);
|
||||
mrt_put_data(b, d->message, d->msg_len);
|
||||
mrt_dump_message(b, rf_fileno(OBSREF_GET(config)->mrtdump_file));
|
||||
mrt_buffer_free(b);
|
||||
}
|
||||
|
||||
void
|
||||
mrt_dump_bgp_state_change(struct mrt_bgp_data *d)
|
||||
mrt_dump_bgp_state_change(struct mrt_bgp_data *d, pool *p)
|
||||
{
|
||||
/* Convert state from our BS_* values to values used in MRTDump */
|
||||
const u16 states[BS_MAX] = {1, 2, 3, 4, 5, 6, 1};
|
||||
@ -858,12 +861,13 @@ mrt_dump_bgp_state_change(struct mrt_bgp_data *d)
|
||||
/* Always use AS4 mode for STATE_CHANGE */
|
||||
d->as4 = 1;
|
||||
|
||||
buffer *b = mrt_bgp_buffer();
|
||||
buffer *b = mrt_bgp_buffer(p);
|
||||
mrt_init_message(b, MRT_BGP4MP, MRT_BGP4MP_STATE_CHANGE_AS4);
|
||||
mrt_bgp_header(b, d);
|
||||
mrt_put_u16(b, states[d->old_state]);
|
||||
mrt_put_u16(b, states[d->new_state]);
|
||||
mrt_dump_message(b, rf_fileno(OBSREF_GET(config)->mrtdump_file));
|
||||
mrt_buffer_free(b);
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,12 +146,12 @@ struct mrt_bgp_data {
|
||||
|
||||
#ifdef CONFIG_MRT
|
||||
void mrt_dump_cmd(struct mrt_dump_data *d);
|
||||
void mrt_dump_bgp_message(struct mrt_bgp_data *d);
|
||||
void mrt_dump_bgp_state_change(struct mrt_bgp_data *d);
|
||||
void mrt_dump_bgp_message(struct mrt_bgp_data *d, pool *p);
|
||||
void mrt_dump_bgp_state_change(struct mrt_bgp_data *d, pool *p);
|
||||
void mrt_check_config(struct proto_config *C);
|
||||
#else
|
||||
static inline void mrt_dump_bgp_message(struct mrt_bgp_data *d UNUSED) { }
|
||||
static inline void mrt_dump_bgp_state_change(struct mrt_bgp_data *d UNUSED) { }
|
||||
static inline void mrt_dump_bgp_message(struct mrt_bgp_data *d UNUSED, pool *p UNUSED) { }
|
||||
static inline void mrt_dump_bgp_state_change(struct mrt_bgp_data *d UNUSED, pool *p UNUSED) { }
|
||||
#endif
|
||||
|
||||
#endif /* _BIRD_MRT_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user