mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 02:01:55 +00:00
Merge commit 'b20b6a9ad204f2648ed3d62720435bb21dfb947c' into thread-next
This commit is contained in:
commit
2cbf7c48ad
@ -1667,6 +1667,9 @@ bgp_defer_bucket(struct bgp_channel *bc, struct bgp_bucket *b)
|
|||||||
void
|
void
|
||||||
bgp_withdraw_bucket(struct bgp_channel *bc, struct bgp_bucket *b)
|
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_proto *p = (void *) bc->c.proto;
|
||||||
struct bgp_pending_tx *c = bc->ptx;
|
struct bgp_pending_tx *c = bc->ptx;
|
||||||
struct bgp_bucket *wb = bgp_get_withdraw_bucket(c);
|
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
|
void
|
||||||
bgp_done_prefix(struct bgp_channel *c, struct bgp_prefix *px, struct bgp_bucket *buck)
|
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. */
|
/* Cleanup: We're called from bucket senders. */
|
||||||
ASSERT_DIE(px->cur == buck);
|
ASSERT_DIE(px->cur == buck);
|
||||||
rem_node(&px->buck_node_xx);
|
rem_node(&px->buck_node_xx);
|
||||||
|
@ -424,7 +424,8 @@ struct bgp_bucket {
|
|||||||
struct bgp_bucket *next; /* Node in bucket hash table */
|
struct bgp_bucket *next; /* Node in bucket hash table */
|
||||||
list prefixes; /* Prefixes to send in this bucket (struct bgp_prefix) */
|
list prefixes; /* Prefixes to send in this bucket (struct bgp_prefix) */
|
||||||
u32 hash; /* Hash over extended attributes */
|
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 */
|
ea_list eattrs[0]; /* Per-bucket extended attributes */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -463,7 +464,6 @@ struct bgp_write_state {
|
|||||||
int as4_session;
|
int as4_session;
|
||||||
int add_path;
|
int add_path;
|
||||||
int mpls;
|
int mpls;
|
||||||
int sham;
|
|
||||||
|
|
||||||
eattr *mp_next_hop;
|
eattr *mp_next_hop;
|
||||||
const adata *mpls_labels;
|
const adata *mpls_labels;
|
||||||
|
@ -2403,9 +2403,6 @@ bgp_create_update_bmp(struct bgp_channel *c, byte *buf, struct bgp_bucket *buck,
|
|||||||
byte *res = NULL;
|
byte *res = NULL;
|
||||||
/* FIXME: must be a bit shorter */
|
/* FIXME: must be a bit shorter */
|
||||||
|
|
||||||
struct lp_state tmpp;
|
|
||||||
lp_save(tmp_linpool, &tmpp);
|
|
||||||
|
|
||||||
struct bgp_caps *peer = p->conn->remote_caps;
|
struct bgp_caps *peer = p->conn->remote_caps;
|
||||||
const struct bgp_af_caps *rem = bgp_find_af_caps(peer, c->afi);
|
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,
|
.as4_session = 1,
|
||||||
.add_path = c->add_path_rx,
|
.add_path = c->add_path_rx,
|
||||||
.mpls = c->desc->mpls,
|
.mpls = c->desc->mpls,
|
||||||
.sham = 1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!update)
|
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);
|
bgp_create_mp_reach(&s, buck, buf, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
lp_restore(tmp_linpool, &tmpp);
|
|
||||||
|
|
||||||
return res;
|
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 bucket_size = sizeof(struct bgp_bucket) + ea_size;
|
||||||
uint prefix_size = sizeof(struct bgp_prefix) + n->length;
|
uint prefix_size = sizeof(struct bgp_prefix) + n->length;
|
||||||
|
|
||||||
/* Sham bucket */
|
struct lp_state tmpp;
|
||||||
struct bgp_bucket *b = alloca(bucket_size);
|
lp_save(tmp_linpool, &tmpp);
|
||||||
*b = (struct bgp_bucket) { };
|
|
||||||
|
/* Temporary bucket */
|
||||||
|
struct bgp_bucket *b = tmp_allocz(bucket_size);
|
||||||
|
b->bmp = 1;
|
||||||
init_list(&b->prefixes);
|
init_list(&b->prefixes);
|
||||||
|
|
||||||
if (attrs)
|
if (attrs)
|
||||||
memcpy(b->eattrs, attrs, ea_size);
|
memcpy(b->eattrs, attrs, ea_size);
|
||||||
|
|
||||||
/* Sham prefix */
|
/* Temporary prefix */
|
||||||
struct bgp_prefix *px = alloca(prefix_size);
|
struct bgp_prefix *px = tmp_allocz(prefix_size);
|
||||||
*px = (struct bgp_prefix) { };
|
|
||||||
px->path_id = src->private_id;
|
px->path_id = src->private_id;
|
||||||
net_copy(px->net, n);
|
net_copy(px->net, n);
|
||||||
add_tail(&b->prefixes, &px->buck_node);
|
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)
|
if (end)
|
||||||
bgp_bmp_prepare_bgp_hdr(buf, end - buf, PKT_UPDATE);
|
bgp_bmp_prepare_bgp_hdr(buf, end - buf, PKT_UPDATE);
|
||||||
|
|
||||||
|
lp_restore(tmp_linpool, &tmpp);
|
||||||
|
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user