]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Fix v6 nexthop-vrf and nexthop confusion
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 30 Jan 2018 05:15:45 +0000 (00:15 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 30 Jan 2018 05:15:45 +0000 (00:15 -0500)
The v6 code had the same issue with how it handled
nexthop-vrf and nexthop when it was entered on the
same line.  This fixes that issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/zebra_vty.c

index f0be862221de01cfed28d8da9073c4d4b5311dd8..62869b7eec9b59831c84ca9b1900066c8379b494 100644 (file)
@@ -2013,17 +2013,21 @@ DEFPY(ipv6_route_address_interface,
        struct zebra_vrf *zvrf;
        struct zebra_vrf *nh_zvrf;
 
-       nh_zvrf = zebra_vrf_lookup_by_name(nexthop_vrf);
-       if (!nh_zvrf) {
-               vty_out(vty, "%% nexthop vrf %s is not defined\n",
-                       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;
        }
 
-       zvrf = zebra_vrf_lookup_by_name(vrf);
+       if (nexthop_vrf)
+               nh_zvrf = zebra_vrf_lookup_by_name(nexthop_vrf);
+       else
+               nh_zvrf = zvrf;
+
        if (!nh_zvrf) {
                vty_out(vty, "%% nexthop vrf %s is not defined\n",
-                       vrf);
+                       nexthop_vrf);
                return CMD_WARNING_CONFIG_FAILED;
        }
 
@@ -2104,17 +2108,21 @@ DEFPY(ipv6_route,
        struct zebra_vrf *zvrf;
        struct zebra_vrf *nh_zvrf;
 
-       nh_zvrf = zebra_vrf_lookup_by_name(nexthop_vrf);
-       if (!nh_zvrf) {
-               vty_out(vty, "%% nexthop vrf %s is not defined\n",
-                       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;
        }
 
-       zvrf = zebra_vrf_lookup_by_name(vrf);
+       if (nexthop_vrf)
+               nh_zvrf = zebra_vrf_lookup_by_name(nexthop_vrf);
+       else
+               nh_zvrf = zvrf;
+
        if (!nh_zvrf) {
                vty_out(vty, "%% nexthop vrf %s is not defined\n",
-                       vrf);
+                       nexthop_vrf);
                return CMD_WARNING_CONFIG_FAILED;
        }