0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 20:58:44 +00:00

Merge commit 'b20b6a9ad204f2648ed3d62720435bb21dfb947c' into thread-next

This commit is contained in:
Maria Matejka 2023-10-11 22:26:41 +02:00
commit 2cbf7c48ad
3 changed files with 19 additions and 14 deletions

View File

@ -1667,6 +1667,9 @@ bgp_defer_bucket(struct bgp_channel *bc, struct bgp_bucket *b)
void
bgp_withdraw_bucket(struct bgp_channel *bc, struct bgp_bucket *b)
{
if (b->bmp)
return;
struct bgp_proto *p = (void *) bc->c.proto;
struct bgp_pending_tx *c = bc->ptx;
struct bgp_bucket *wb = bgp_get_withdraw_bucket(c);
@ -1817,6 +1820,10 @@ bgp_free_prefix(struct bgp_pending_tx *c, struct bgp_prefix *px)
void
bgp_done_prefix(struct bgp_channel *c, struct bgp_prefix *px, struct bgp_bucket *buck)
{
/* BMP hack */
if (buck->bmp)
return;
/* Cleanup: We're called from bucket senders. */
ASSERT_DIE(px->cur == buck);
rem_node(&px->buck_node_xx);

View File

@ -424,7 +424,8 @@ struct bgp_bucket {
struct bgp_bucket *next; /* Node in bucket hash table */
list prefixes; /* Prefixes to send in this bucket (struct bgp_prefix) */
u32 hash; /* Hash over extended attributes */
u32 px_uc; /* How many prefixes are linking this bucket */
u32 px_uc:31; /* How many prefixes are linking this bucket */
u32 bmp:1; /* Temporary bucket for BMP encoding */
ea_list eattrs[0]; /* Per-bucket extended attributes */
};
@ -463,7 +464,6 @@ struct bgp_write_state {
int as4_session;
int add_path;
int mpls;
int sham;
eattr *mp_next_hop;
const adata *mpls_labels;

View File

@ -2403,9 +2403,6 @@ bgp_create_update_bmp(struct bgp_channel *c, byte *buf, struct bgp_bucket *buck,
byte *res = NULL;
/* FIXME: must be a bit shorter */
struct lp_state tmpp;
lp_save(tmp_linpool, &tmpp);
struct bgp_caps *peer = p->conn->remote_caps;
const struct bgp_af_caps *rem = bgp_find_af_caps(peer, c->afi);
@ -2417,7 +2414,6 @@ bgp_create_update_bmp(struct bgp_channel *c, byte *buf, struct bgp_bucket *buck,
.as4_session = 1,
.add_path = c->add_path_rx,
.mpls = c->desc->mpls,
.sham = 1,
};
if (!update)
@ -2433,8 +2429,6 @@ bgp_create_update_bmp(struct bgp_channel *c, byte *buf, struct bgp_bucket *buck,
bgp_create_mp_reach(&s, buck, buf, end);
}
lp_restore(tmp_linpool, &tmpp);
return res;
}
@ -2460,17 +2454,19 @@ bgp_bmp_encode_rte(struct bgp_channel *c, byte *buf, const net_addr *n,
uint bucket_size = sizeof(struct bgp_bucket) + ea_size;
uint prefix_size = sizeof(struct bgp_prefix) + n->length;
/* Sham bucket */
struct bgp_bucket *b = alloca(bucket_size);
*b = (struct bgp_bucket) { };
struct lp_state tmpp;
lp_save(tmp_linpool, &tmpp);
/* Temporary bucket */
struct bgp_bucket *b = tmp_allocz(bucket_size);
b->bmp = 1;
init_list(&b->prefixes);
if (attrs)
memcpy(b->eattrs, attrs, ea_size);
/* Sham prefix */
struct bgp_prefix *px = alloca(prefix_size);
*px = (struct bgp_prefix) { };
/* Temporary prefix */
struct bgp_prefix *px = tmp_allocz(prefix_size);
px->path_id = src->private_id;
net_copy(px->net, n);
add_tail(&b->prefixes, &px->buck_node);
@ -2480,6 +2476,8 @@ bgp_bmp_encode_rte(struct bgp_channel *c, byte *buf, const net_addr *n,
if (end)
bgp_bmp_prepare_bgp_hdr(buf, end - buf, PKT_UPDATE);
lp_restore(tmp_linpool, &tmpp);
return end;
}