summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorRuss White <russ@riw.us>2025-01-28 12:20:43 -0500
committerGitHub <noreply@github.com>2025-01-28 12:20:43 -0500
commite82788de4665b5b6a9bc8a9e5af9224d90984a50 (patch)
treefcf5e2a70513e480894b4a49a4b23a172cdb1200 /bgpd
parent3bdb561d1cdffee5c789da3722234fb04cc5028c (diff)
parent0fd5ba93e342f254423569071480d5078020db8e (diff)
Merge pull request #17802 from askorichenko/test-fix-table-map
bgpd: fix table-map option
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_zebra.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 179404a2ce..1669aabc60 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -1674,11 +1674,23 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi)
for (dest = bgp_table_top(table); dest; dest = bgp_route_next(dest))
for (pi = bgp_dest_get_bgp_path_info(dest); pi; pi = pi->next)
if (CHECK_FLAG(pi->flags, BGP_PATH_SELECTED) &&
- (pi->type == ZEBRA_ROUTE_BGP
- && (pi->sub_type == BGP_ROUTE_NORMAL
- || pi->sub_type == BGP_ROUTE_IMPORTED)))
- bgp_zebra_route_install(dest, pi, bgp, true,
- NULL, false);
+ (pi->type == ZEBRA_ROUTE_BGP && (pi->sub_type == BGP_ROUTE_NORMAL ||
+ pi->sub_type == BGP_ROUTE_IMPORTED))) {
+ bool is_add = true;
+
+ if (bgp->table_map[afi][safi].name) {
+ struct attr local_attr = *pi->attr;
+ struct bgp_path_info local_info = *pi;
+
+ local_info.attr = &local_attr;
+
+ is_add = bgp_table_map_apply(bgp->table_map[afi][safi].map,
+ bgp_dest_get_prefix(dest),
+ &local_info);
+ }
+
+ bgp_zebra_route_install(dest, pi, bgp, is_add, NULL, false);
+ }
}
/* Announce routes of any bgp subtype of a table to zebra */