]> git.puffer.fish Git - mirror/frr.git/commitdiff
ospfd: Fix a variant of the ospf redistribute command
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 2 May 2017 13:47:16 +0000 (09:47 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 2 May 2017 17:56:41 +0000 (13:56 -0400)
Fix 'redistribute (ospf|table) ....' command

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

index b4c456e0aa8532a62d09bb3ef2ee4be3d417dae3..776cf21ae3c0f24b84fa5328d7a80c6d1e4d5ba1 100644 (file)
@@ -7160,7 +7160,7 @@ DEFUN (no_ospf_redistribute_source,
 
 DEFUN (ospf_redistribute_instance_source,
        ospf_redistribute_instance_source_cmd,
-       "redistribute <ospf|table> (1-65535) [<metric (0-16777214)|metric-type (1-2)|route-map WORD>]",
+       "redistribute <ospf|table> (1-65535) {<metric (0-16777214)|metric-type (1-2)|route-map WORD>}",
        REDIST_STR
        "Open Shortest Path First\n"
        "Non-main Kernel Routing Table\n"
@@ -7176,7 +7176,7 @@ DEFUN (ospf_redistribute_instance_source,
   VTY_DECLVAR_CONTEXT(ospf, ospf);
   int idx_ospf_table = 1;
   int idx_number = 2;
-  int idx_redist_param = 3;
+  int idx = 3;
   int source;
   int type = -1;
   int metric = -1;
@@ -7208,19 +7208,21 @@ DEFUN (ospf_redistribute_instance_source,
     }
 
   /* Get metric value. */
-  if (strcmp (argv[idx_redist_param]->arg, "metric") == 0)
-    if (!str2metric (argv[idx_redist_param+1]->arg, &metric))
+  if (argv_find (argv, argc, "metric", &idx))
+    if (!str2metric (argv[idx+1]->arg, &metric))
       return CMD_WARNING;
 
+  idx = 3;
   /* Get metric type. */
-  if (strcmp (argv[idx_redist_param]->arg, "metric-type") == 0)
-    if (!str2metric_type (argv[idx_redist_param+1]->arg, &type))
+  if (argv_find (argv, argc, "metric-type", &idx))
+    if (!str2metric_type (argv[idx+1]->arg, &type))
       return CMD_WARNING;
 
   red = ospf_redist_add(ospf, source, instance);
 
-  if (strcmp (argv[idx_redist_param]->arg, "route-map") == 0)
-    ospf_routemap_set (red, argv[idx_redist_param+1]->arg);
+  idx = 3;
+  if (argv_find (argv, argc, "route-map", &idx))
+    ospf_routemap_set (red, argv[idx+1]->arg);
   else
     ospf_routemap_unset (red);
 
@@ -7229,7 +7231,7 @@ DEFUN (ospf_redistribute_instance_source,
 
 DEFUN (no_ospf_redistribute_instance_source,
        no_ospf_redistribute_instance_source_cmd,
-       "no redistribute <ospf|table> (1-65535) [<metric (0-16777214)|metric-type (1-2)|route-map WORD>]",
+       "no redistribute <ospf|table> (1-65535) {<metric (0-16777214)|metric-type (1-2)|route-map WORD>}",
        NO_STR
        REDIST_STR
        "Open Shortest Path First\n"