mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 16:57:43 +00:00
bgpd: BGP-LU use implicit-null in some cases
In some cases where bgp is at the mpls edge, where it has a BGP-LU peer downstream but an IP peer upstream, it can advertise the IMPLICIT_NULL label instead of a per-prefix label. Signed-off-by: Mark Stapp <mstapp@nvidia.com>
This commit is contained in:
parent
01236d7aa7
commit
bb2ca6927f
@ -244,6 +244,10 @@ void bgp_reg_dereg_for_label(struct bgp_dest *dest, struct bgp_path_info *pi,
|
|||||||
|
|
||||||
p = bgp_dest_get_prefix(dest);
|
p = bgp_dest_get_prefix(dest);
|
||||||
|
|
||||||
|
if (BGP_DEBUG(labelpool, LABELPOOL))
|
||||||
|
zlog_debug("%s: %pFX: %s ", __func__, p,
|
||||||
|
(reg ? "reg" : "dereg"));
|
||||||
|
|
||||||
if (reg) {
|
if (reg) {
|
||||||
assert(pi);
|
assert(pi);
|
||||||
/*
|
/*
|
||||||
|
@ -2711,6 +2711,28 @@ static void bgp_process_evpn_route_injection(struct bgp *bgp, afi_t afi,
|
|||||||
bgp_evpn_withdraw_type5_route(bgp, p, afi, safi);
|
bgp_evpn_withdraw_type5_route(bgp, p, afi, safi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Utility to determine whether a particular path_info should use
|
||||||
|
* the IMPLICIT_NULL label. This is pretty specialized: it's only called
|
||||||
|
* in a path where we basically _know_ this is a BGP-LU route.
|
||||||
|
*/
|
||||||
|
static bool bgp_lu_need_imp_null(const struct bgp_path_info *new_select)
|
||||||
|
{
|
||||||
|
/* Certain types get imp null; so do paths where the nexthop is
|
||||||
|
* not labeled.
|
||||||
|
*/
|
||||||
|
if (new_select->sub_type == BGP_ROUTE_STATIC
|
||||||
|
|| new_select->sub_type == BGP_ROUTE_AGGREGATE
|
||||||
|
|| new_select->sub_type == BGP_ROUTE_REDISTRIBUTE)
|
||||||
|
return true;
|
||||||
|
else if (new_select->extra == NULL ||
|
||||||
|
!bgp_is_valid_label(&new_select->extra->label[0]))
|
||||||
|
/* TODO -- should be configurable? */
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* old_select = The old best path
|
* old_select = The old best path
|
||||||
* new_select = the new best path
|
* new_select = the new best path
|
||||||
@ -2802,11 +2824,7 @@ static void bgp_process_main_one(struct bgp *bgp, struct bgp_dest *dest,
|
|||||||
* implicit-null for local routes, aggregate
|
* implicit-null for local routes, aggregate
|
||||||
* and redistributed routes
|
* and redistributed routes
|
||||||
*/
|
*/
|
||||||
if (new_select->sub_type == BGP_ROUTE_STATIC
|
if (bgp_lu_need_imp_null(new_select)) {
|
||||||
|| new_select->sub_type
|
|
||||||
== BGP_ROUTE_AGGREGATE
|
|
||||||
|| new_select->sub_type
|
|
||||||
== BGP_ROUTE_REDISTRIBUTE) {
|
|
||||||
if (CHECK_FLAG(
|
if (CHECK_FLAG(
|
||||||
dest->flags,
|
dest->flags,
|
||||||
BGP_NODE_REGISTERED_FOR_LABEL)
|
BGP_NODE_REGISTERED_FOR_LABEL)
|
||||||
|
Loading…
Reference in New Issue
Block a user