]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: withdraw default route when route-map has no match
authorAlexander Chernavin <achernavin@netgate.com>
Tue, 25 Aug 2020 11:10:47 +0000 (07:10 -0400)
committerDonatas Abraitis <donatas.abraitis@gmail.com>
Tue, 22 Jun 2021 20:29:00 +0000 (23:29 +0300)
If you advertise a default route (via default-originate) only if some
prefix is present in the BGP RIB (route-map specified) and this prefix
becomes unavailable, the default route keeps being advertised.

With this change, when we iterate over the BGP RIB to check if we can
advertise the default route, skip unavailable prefixes.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
bgpd/bgp_updgrp_adv.c

index 26dda8ebda449453b5aaec77d78251f5848f6f22..9025ae15c18b641623b55cd69ddc1ac8bf06b293 100644 (file)
@@ -760,6 +760,9 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
                 */
                for (rn = bgp_table_top(bgp->rib[afi][safi]); rn;
                     rn = bgp_route_next(rn)) {
+                       if (!bgp_node_has_bgp_path_info_data(rn))
+                               continue;
+
                        ret = route_map_apply(peer->default_rmap[afi][safi].map,
                                              &rn->p, RMAP_BGP, &bpi_rmap);