bgpd: If route-map does not exist DENY for redistribute statements
Upon usage of a route-map statement in bgp, if the route-map does not exist
it turns into a implicit ALLOW, this causes issues in a wide variety
of scenarios.
Without this fix:
!
router bgp 100
bgp router-id 10.0.2.15
redistribute static route-map FOOEY
!
ip route 33.33.33.33/32 eth1
ip route 44.44.44.44/32 eth1
!
Now look at show ip bgp:
show ip bgp:
Network Next Hop Metric LocPrf Weight Path
*> 33.33.33.33/32 0.0.0.0 0 32768 ?
*> 44.44.44.44/32 0.0.0.0 0 32768 ?
With this fix:
show ip bgp:
Network Next Hop Metric LocPrf Weight Path
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 4db2e3e..316fa5a 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -5460,7 +5460,7 @@
attr_new.med = bgp->redist_metric[afi][type];
/* Apply route-map. */
- if (bgp->rmap[afi][type].map)
+ if (bgp->rmap[afi][type].name)
{
info.peer = bgp->peer_self;
info.attr = &attr_new;