summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_vty.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 95abfcb9cb..4c4178495f 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -6676,20 +6676,18 @@ DEFPY (bgp_imexport_vrf,
vrf_bgp = bgp_lookup_by_name(import_name);
if (!vrf_bgp) {
- int32_t ret;
+ int32_t ret = 0;
as_t as = bgp->as;
if (strcmp(import_name, BGP_DEFAULT_NAME) == 0) {
vrf_bgp = bgp_get_default();
- if (!vrf_bgp) {
- bgp_type = BGP_INSTANCE_TYPE_DEFAULT;
- import_name = NULL;
- }
+ if (!vrf_bgp)
+ ret = bgp_get(&vrf_bgp, &as, NULL, BGP_INSTANCE_TYPE_DEFAULT);
+ } else {
+ /* Auto-create assuming the same AS */
+ ret = bgp_get(&vrf_bgp, &as, import_name, bgp_type);
}
- /* Auto-create assuming the same AS */
- ret = bgp_get(&vrf_bgp, &as, import_name, bgp_type);
-
if (ret) {
vty_out(vty,
"VRF %s is not configured as a bgp instance\n",