diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-12-06 18:28:17 +0200 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-12-06 21:39:15 +0200 |
| commit | 8ccee4b8ccfd7a583e54a5394f079ed0efb226cf (patch) | |
| tree | 661cbabf0e06642dd76e0c4344b37a1cee2eb2b2 /bgpd/bgp_addpath.c | |
| parent | 4d65410c54c5b3036641dbb53cb742b56d426b7a (diff) | |
bgpd: Adopt addpath functionality for labeled-unicast
The same as for RIB, labeled-unicast allocations should live in
unicast space.
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'bgpd/bgp_addpath.c')
| -rw-r--r-- | bgpd/bgp_addpath.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/bgpd/bgp_addpath.c b/bgpd/bgp_addpath.c index d822f6e330..9784943b4c 100644 --- a/bgpd/bgp_addpath.c +++ b/bgpd/bgp_addpath.c @@ -111,6 +111,9 @@ void bgp_addpath_free_info_data(struct bgp_addpath_info_data *d, uint32_t bgp_addpath_id_for_peer(struct peer *peer, afi_t afi, safi_t safi, struct bgp_addpath_info_data *d) { + if (safi == SAFI_LABELED_UNICAST) + safi = SAFI_UNICAST; + if (peer->addpath_type[afi][safi] < BGP_ADDPATH_MAX) return d->addpath_tx_id[peer->addpath_type[afi][safi]]; else @@ -182,6 +185,9 @@ static void bgp_addpath_flush_type_rn(struct bgp *bgp, afi_t afi, safi_t safi, { struct bgp_path_info *pi; + if (safi == SAFI_LABELED_UNICAST) + safi = SAFI_UNICAST; + idalloc_drain_pool( bgp->tx_addpath.id_allocators[afi][safi][addpath_type], &(dest->tx_addpath.free_ids[addpath_type])); @@ -210,6 +216,9 @@ static void bgp_addpath_flush_type(struct bgp *bgp, afi_t afi, safi_t safi, { struct bgp_dest *dest, *ndest; + if (safi == SAFI_LABELED_UNICAST) + safi = SAFI_UNICAST; + for (dest = bgp_table_top(bgp->rib[afi][safi]); dest; dest = bgp_route_next(dest)) { if (safi == SAFI_MPLS_VPN) { @@ -251,6 +260,7 @@ static void bgp_addpath_populate_path(struct id_alloc *allocator, * and afi/safi combination. Since we won't waste the time computing addpath IDs * for unused strategies, the first time a peer is configured to use a strategy, * we have to backfill the data. + * In labeled-unicast, addpath allocations SHOULD be done in unicast SAFI. */ static void bgp_addpath_populate_type(struct bgp *bgp, afi_t afi, safi_t safi, enum bgp_addpath_strat addpath_type) @@ -259,6 +269,9 @@ static void bgp_addpath_populate_type(struct bgp *bgp, afi_t afi, safi_t safi, char buf[200]; struct id_alloc *allocator; + if (safi == SAFI_LABELED_UNICAST) + safi = SAFI_UNICAST; + snprintf(buf, sizeof(buf), "Addpath ID Allocator %s:%d/%d", bgp_addpath_names(addpath_type)->config_name, (int)afi, (int)safi); @@ -357,11 +370,15 @@ void bgp_addpath_set_peer_type(struct peer *peer, afi_t afi, safi_t safi, enum bgp_addpath_strat addpath_type) { struct bgp *bgp = peer->bgp; - enum bgp_addpath_strat old_type = peer->addpath_type[afi][safi]; + enum bgp_addpath_strat old_type; struct listnode *node, *nnode; struct peer *tmp_peer; struct peer_group *group; + if (safi == SAFI_LABELED_UNICAST) + safi = SAFI_UNICAST; + + old_type = peer->addpath_type[afi][safi]; if (addpath_type == old_type) return; @@ -431,6 +448,9 @@ void bgp_addpath_update_ids(struct bgp *bgp, struct bgp_dest *bn, afi_t afi, struct bgp_path_info *pi; struct id_alloc_pool **pool_ptr; + if (safi == SAFI_LABELED_UNICAST) + safi = SAFI_UNICAST; + for (i = 0; i < BGP_ADDPATH_MAX; i++) { struct id_alloc *alloc = bgp->tx_addpath.id_allocators[afi][safi][i]; |
