Skip to content

Commit

Permalink
bgpd: export labels to pre-policy bmp
Browse files Browse the repository at this point in the history
Export labels to pre-policy BMP

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
  • Loading branch information
louis-6wind committed Oct 3, 2024
1 parent 842009f commit ddf0941
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ static void bmp_monitor(struct bmp *bmp, struct peer *peer, uint8_t flags,

static bool bmp_wrsync(struct bmp *bmp, struct pullwr *pullwr)
{
uint8_t bpi_num_labels;
uint8_t bpi_num_labels, adjin_num_labels;
afi_t afi;
safi_t safi;

Expand Down Expand Up @@ -1241,11 +1241,12 @@ static bool bmp_wrsync(struct bmp *bmp, struct pullwr *pullwr)
bpi_num_labels ? bpi->extra->labels->label : NULL,
bpi_num_labels);

if (adjin)
/* TODO: set label here when adjin supports labels */
bmp_monitor(bmp, adjin->peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE,
bn_p, prd, adjin->attr, afi, safi, adjin->uptime,
NULL, 0);
if (adjin) {
adjin_num_labels = adjin->labels ? adjin->labels->num_labels : 0;
bmp_monitor(bmp, adjin->peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE, bn_p, prd,
adjin->attr, afi, safi, adjin->uptime,
adjin_num_labels ? &adjin->labels->label[0] : NULL, adjin_num_labels);
}

if (bn)
bgp_dest_unlock_node(bn);
Expand Down Expand Up @@ -1382,7 +1383,7 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr)
struct peer *peer;
struct bgp_dest *bn = NULL;
bool written = false;
uint8_t bpi_num_labels;
uint8_t bpi_num_labels, adjin_num_labels;

bqe = bmp_pull(bmp);
if (!bqe)
Expand Down Expand Up @@ -1453,10 +1454,11 @@ static bool bmp_wrqueue(struct bmp *bmp, struct pullwr *pullwr)
if (adjin->peer == peer)
break;
}
/* TODO: set label here when adjin supports labels */
bmp_monitor(bmp, peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE,
&bqe->p, prd, adjin ? adjin->attr : NULL, afi, safi,
adjin ? adjin->uptime : monotime(NULL), NULL, 0);
adjin_num_labels = adjin && adjin->labels ? adjin->labels->num_labels : 0;
bmp_monitor(bmp, peer, 0, BMP_PEER_TYPE_GLOBAL_INSTANCE, &bqe->p, prd,
adjin ? adjin->attr : NULL, afi, safi,
adjin ? adjin->uptime : monotime(NULL),
adjin_num_labels ? &adjin->labels->label[0] : NULL, adjin_num_labels);
written = true;
}

Expand Down

0 comments on commit ddf0941

Please sign in to comment.