summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_vty.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-01-29 21:18:28 +0100
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-01-29 21:18:28 +0100
commite65dfe7e566f35586b3372f68de825a91df812d5 (patch)
tree836fc5d516b715ae77532f1cdfb19ac09ffb2351 /zebra/zebra_vty.c
parentzebra: Fix to get correct nexthop-vrf (diff)
downloadfrr-e65dfe7e566f35586b3372f68de825a91df812d5.tar.xz
frr-e65dfe7e566f35586b3372f68de825a91df812d5.zip
zebra: Cleanup error handling of nexthop vrf and vrf
The error handling of the nexthop vrf and the vrf for what was specified on the cli was not as clean as it should have been. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'zebra/zebra_vty.c')
-rw-r--r--zebra/zebra_vty.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 7b5ab1ef5..f0be86222 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -475,20 +475,21 @@ DEFPY(ip_route_address_interface,
ifname = NULL;
}
- if (nexthop_vrf) {
+ zvrf = zebra_vrf_lookup_by_name(vrf);
+ if (!zvrf) {
+ vty_out(vty, "%% vrf %s is not defined\n",
+ vrf);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ if (nexthop_vrf)
nh_zvrf = zebra_vrf_lookup_by_name(nexthop_vrf);
- if (!nh_zvrf) {
- vty_out(vty, "%% nexthop vrf %s is not defined\n",
- nexthop_vrf);
- return CMD_WARNING_CONFIG_FAILED;
- }
- } else
- nh_zvrf = zebra_vrf_lookup_by_name(vrf);
+ else
+ nh_zvrf = zvrf;
- zvrf = zebra_vrf_lookup_by_name(vrf);
if (!nh_zvrf) {
vty_out(vty, "%% nexthop vrf %s is not defined\n",
- vrf);
+ nexthop_vrf);
return CMD_WARNING_CONFIG_FAILED;
}
@@ -582,23 +583,25 @@ DEFPY(ip_route,
ifname = NULL;
}
- if (nexthop_vrf) {
+ zvrf = zebra_vrf_lookup_by_name(vrf);
+ if (!zvrf) {
+ vty_out(vty, "%% vrf %s is not defined\n",
+ vrf);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ if (nexthop_vrf)
nh_zvrf = zebra_vrf_lookup_by_name(nexthop_vrf);
- if (!nh_zvrf) {
- vty_out(vty, "%% nexthop vrf %s is not defined\n",
- nexthop_vrf);
- return CMD_WARNING_CONFIG_FAILED;
- }
- } else
- nh_zvrf = zebra_vrf_lookup_by_name(vrf);
+ else
+ nh_zvrf = zvrf;
- zvrf = zebra_vrf_lookup_by_name(vrf);
if (!nh_zvrf) {
vty_out(vty, "%% nexthop vrf %s is not defined\n",
- vrf);
+ nexthop_vrf);
return CMD_WARNING_CONFIG_FAILED;
}
+
return zebra_static_route_leak(vty, zvrf, nh_zvrf,
AFI_IP, SAFI_UNICAST, no, prefix,
mask_str, NULL, gate_str, ifname, flag,