summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorAlexander Skorichenko <askorichenko@netgate.com>2025-01-23 11:35:44 +0100
committerAlexander Skorichenko <askorichenko@netgate.com>2025-01-28 12:52:47 +0100
commit0fd5ba93e342f254423569071480d5078020db8e (patch)
tree7de18d8cbfa7fcd79d658a4df3ec27764dfadc00 /bgpd
parentee67699bd7e0175057ffab4c8c30c74b6c7cc844 (diff)
bgpd: fix table-map option
Schedule zebra to withdraw routes filtered out by a table-map. Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
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 8e8616c155..a963c9bd42 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 */