]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: vpn route-map config should be kept, except if vrf list is on
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 9 Oct 2018 14:05:04 +0000 (16:05 +0200)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Thu, 11 Oct 2018 06:42:18 +0000 (08:42 +0200)
When executing vpn route-map config for importation, the running-config
records vrf import route-map instead. Actually, this is a problem when
restarting configuring when using vpn route-map. The choice is done to
move to vrf format, when at least one import list is created for vrfs.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
bgpd/bgp_vty.c

index e705a714e954bd2abdd1f4e7f6d987e2a2b330fb..026cfbe2c53428f0d0da83a7dbc2369764e7a488 100644 (file)
@@ -12282,11 +12282,16 @@ void bgp_vpn_policy_config_write_afi(struct vty *vty, struct bgp *bgp,
 {
        int indent = 2;
 
-       if (bgp->vpn_policy[afi].rmap_name[BGP_VPN_POLICY_DIR_FROMVPN])
-               vty_out(vty, "%*simport vrf route-map %s\n", indent, "",
-                       bgp->vpn_policy[afi]
+       if (bgp->vpn_policy[afi].rmap_name[BGP_VPN_POLICY_DIR_FROMVPN]) {
+               if (listcount(bgp->vpn_policy[afi].import_vrf))
+                       vty_out(vty, "%*simport vrf route-map %s\n", indent, "",
+                               bgp->vpn_policy[afi]
                                .rmap_name[BGP_VPN_POLICY_DIR_FROMVPN]);
-
+               else
+                       vty_out(vty, "%*sroute-map vpn import %s\n", indent, "",
+                               bgp->vpn_policy[afi]
+                               .rmap_name[BGP_VPN_POLICY_DIR_FROMVPN]);
+       }
        if (CHECK_FLAG(bgp->af_flags[afi][SAFI_UNICAST],
                       BGP_CONFIG_VRF_TO_VRF_IMPORT)
            || CHECK_FLAG(bgp->af_flags[afi][SAFI_UNICAST],