Skip to content

Commit

Permalink
pathd:support srv6 te policy
Browse files Browse the repository at this point in the history
Signed-off-by: guozhongfeng.gzf <[email protected]>
  • Loading branch information
guoguojia2021 committed Dec 4, 2024
1 parent 7659ef7 commit 46f8c69
Show file tree
Hide file tree
Showing 14 changed files with 777 additions and 234 deletions.
17 changes: 13 additions & 4 deletions bgpd/bgp_mplsvpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,10 +1246,14 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,

if (leak_update_nexthop_valid(to_bgp, bn, new_attr, afi, safi,
source_bpi, bpi, bgp_orig, p,
debug))
debug)) {
bgp_path_info_set_flag(bn, bpi, BGP_PATH_VALID);
else
if (CHECK_FLAG(bpi->flags, BGP_PATH_SRV6_TE))
SET_FLAG(bpi->flags, BGP_PATH_SRV6_TE_VALID);
} else {
bgp_path_info_unset_flag(bn, bpi, BGP_PATH_VALID);
UNSET_FLAG(bpi->flags, BGP_PATH_SRV6_TE_VALID);
}

/* Process change. */
bgp_aggregate_increment(to_bgp, p, bpi, afi, safi);
Expand Down Expand Up @@ -1307,10 +1311,14 @@ leak_update(struct bgp *to_bgp, struct bgp_dest *bn,
new->extra->vrfleak->nexthop_orig = *nexthop_orig;

if (leak_update_nexthop_valid(to_bgp, bn, new_attr, afi, safi,
source_bpi, new, bgp_orig, p, debug))
source_bpi, new, bgp_orig, p, debug)) {
bgp_path_info_set_flag(bn, new, BGP_PATH_VALID);
else
if (CHECK_FLAG(new->flags, BGP_PATH_SRV6_TE))
SET_FLAG(new->flags, BGP_PATH_SRV6_TE_VALID);
} else {
bgp_path_info_unset_flag(bn, new, BGP_PATH_VALID);
UNSET_FLAG(new->flags, BGP_PATH_SRV6_TE_VALID);
}

bgp_aggregate_increment(to_bgp, p, new, afi, safi);
bgp_path_info_add(bn, new);
Expand Down Expand Up @@ -2686,6 +2694,7 @@ void vpn_leak_no_retain(struct bgp *to_bgp, struct bgp *vpn_from, afi_t afi)
continue;

bgp_unlink_nexthop(bpi);
bgp_unlink_te_nexthop(bpi);
bgp_rib_remove(bn, bpi, bpi->peer, afi, safi);
}
}
Expand Down
4 changes: 3 additions & 1 deletion bgpd/bgp_nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ bool bnc_existing_for_prefix(struct bgp_nexthop_cache *bnc)
frr_each (bgp_nexthop_cache, bnc->tree, bnc_tmp) {
if (bnc_tmp == bnc)
continue;
if (prefix_cmp(&bnc->prefix, &bnc_tmp->prefix) == 0)
if (prefix_cmp(&bnc->prefix, &bnc_tmp->prefix) == 0
&& (bnc->srte_color == bnc_tmp->srte_color))
return true;
}
return false;
Expand Down Expand Up @@ -125,6 +126,7 @@ static void bgp_nexthop_cache_reset(struct bgp_nexthop_cache_head *tree)
bgp_mplsvpn_path_nh_label_bind_unlink(path);

path_nh_map(path, bnc, false);
path_tenh_map(path, bnc, false);
}

bnc_free(bnc);
Expand Down
Loading

0 comments on commit 46f8c69

Please sign in to comment.