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 <dslice@cumulusnetworks.com>
Reviewed-by: CCR-7358
This commit is contained in:
Don Slice 2018-04-10 15:00:18 +00:00 committed by Donald Sharp
parent 0fb8d6e639
commit e49840c895

View File

@ -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,