From e49840c895d67e1585357a9653e3ae72f0af08e8 Mon Sep 17 00:00:00 2001 From: Don Slice Date: Tue, 10 Apr 2018 15:00:18 +0000 Subject: [PATCH] bgpd: fix import vrf route-map issues Prior to this fix, the import vrf route-map command only worked if the route-map existed prior to the command. Additionally, if the import vrf route-map command was issued without an existing route-map, the imported prefixes were not removed. This fix resolves both of thes mis-behaviors. bgp-smoke run with same failures as base. Ticket: CM-20459 Signed-off-by: Don Slice Reviewed-by: CCR-7358 --- bgpd/bgp_vty.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4c4178495f..49b39d5ec2 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -6551,6 +6551,8 @@ DEFPY (af_route_map_vpn_imexport, MTYPE_ROUTE_MAP_NAME, rmap_str); bgp->vpn_policy[afi].rmap[dir] = route_map_lookup_by_name(rmap_str); + if (!bgp->vpn_policy[afi].rmap[dir]) + return CMD_SUCCESS; } else { if (bgp->vpn_policy[afi].rmap_name[dir]) XFREE(MTYPE_ROUTE_MAP_NAME, @@ -6629,6 +6631,8 @@ DEFPY(af_import_vrf_route_map, af_import_vrf_route_map_cmd, XSTRDUP(MTYPE_ROUTE_MAP_NAME, rmap_str); bgp->vpn_policy[afi].rmap[dir] = route_map_lookup_by_name(rmap_str); + if (!bgp->vpn_policy[afi].rmap[dir]) + return CMD_SUCCESS; } else { if (bgp->vpn_policy[afi].rmap_name[dir]) XFREE(MTYPE_ROUTE_MAP_NAME,