]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Fix static route helper function
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Oct 2016 04:08:34 +0000 (04:08 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 6 Oct 2016 04:08:34 +0000 (04:08 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
zebra/zebra_vty.c

index d755562759fad0e840c5768e26507863826b72f9..b3164839fab3a54d0b18c5b0d0060792c7472587 100644 (file)
@@ -312,25 +312,25 @@ zebra_vty_ip_route_tdv_helper (int argc, struct cmd_token *argv[],
                               int idx_curr, char **tag,
                               char **distance, char **vrf)
 {
-  if (argc > idx_curr)
-    {
-      if (strmatch (argv[idx_curr]->text, "tag"))
-       {
-         *tag = argv[idx_curr]->arg;
-         idx_curr++;
-       }
-
-      if (strmatch (argv[idx_curr]->text, "vrf"))
-       {
-         *distance = NULL;
-         *vrf = argv[idx_curr]->arg;
-       }
-      else
-       {
-         *distance = argv[idx_curr]->arg;
-         *vrf = argv[++idx_curr]->arg;
-       }
-    }
+  *distance = NULL;
+  while (idx_curr < argc)
+  {
+    if (strmatch (argv[idx_curr]->text, "tag"))
+      {
+        *tag = argv[idx_curr+1]->arg;
+        idx_curr += 2;
+      }
+    else if (strmatch (argv[idx_curr]->text, "vrf"))
+      {
+        *vrf = argv[idx_curr+1]->arg;
+        idx_curr += 2;
+      }
+    else
+      {
+        *distance = argv[idx_curr]->arg;
+        idx_curr++;
+      }
+  }
 
   return;
 }