]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: add 'int idx_foo' argv index variables
authorDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 23 Sep 2016 19:56:31 +0000 (19:56 +0000)
committerDaniel Walton <dwalton@cumulusnetworks.com>
Fri, 23 Sep 2016 19:56:31 +0000 (19:56 +0000)
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
14 files changed:
ospf6d/ospf6_area.c
ospf6d/ospf6_asbr.c
ospf6d/ospf6_bfd.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_intra.c
ospf6d/ospf6_lsa.c
ospf6d/ospf6_message.c
ospf6d/ospf6_neighbor.c
ospf6d/ospf6_route.c
ospf6d/ospf6_spf.c
ospf6d/ospf6_top.c
ospf6d/ospf6_zebra.c
ospf6d/ospf6d.c
tools/argv_translator.py

index 1c1a524e48bb9524ca23be305b02316193133bc2..d67621d7c219637f5356a8b1f02a485ce56728fc 100644 (file)
@@ -468,18 +468,20 @@ DEFUN (area_range,
        "Specify IPv6 prefix\n"
        )
 {
+  int idx_ipv4 = 1;
+  int idx_ipv6_prefixlen = 3;
   int ret;
   struct ospf6_area *oa;
   struct prefix prefix;
   struct ospf6_route *range;
   u_int32_t cost = OSPF_AREA_RANGE_COST_UNSPEC;
 
-  OSPF6_CMD_AREA_GET (argv[1]->arg, oa);
+  OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, oa);
 
-  ret = str2prefix (argv[3]->arg, &prefix);
+  ret = str2prefix (argv[idx_ipv6_prefixlen]->arg, &prefix);
   if (ret != 1 || prefix.family != AF_INET6)
     {
-      vty_out (vty, "Malformed argument: %s%s", argv[3]->arg, VNL);
+      vty_out (vty, "Malformed argument: %s%s", argv[idx_ipv6_prefixlen]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -514,7 +516,7 @@ DEFUN (area_range,
 
   range->path.u.cost_config = cost;
 
-  zlog_debug ("%s: for prefix %s, flag = %x\n", __func__, argv[3]->arg, range->flag);
+  zlog_debug ("%s: for prefix %s, flag = %x\n", __func__, argv[idx_ipv6_prefixlen]->arg, range->flag);
   if (range->rnode == NULL)
     {
       ospf6_route_add (range, oa->range_table);
@@ -569,26 +571,27 @@ DEFUN (no_area_range,
        "Configured address range\n"
        "Specify IPv6 prefix\n")
 {
+  int idx_ipv4 = 2;
   int ret;
   struct ospf6_area *oa;
   struct prefix prefix;
   struct ospf6_route *range, *route;
 
-  OSPF6_CMD_AREA_GET (argv[2]->arg, oa);
+  OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, oa);
   argc--;
   argv++;
 
-  ret = str2prefix (argv[2]->arg, &prefix);
+  ret = str2prefix (argv[idx_ipv4]->arg, &prefix);
   if (ret != 1 || prefix.family != AF_INET6)
     {
-      vty_out (vty, "Malformed argument: %s%s", argv[2]->arg, VNL);
+      vty_out (vty, "Malformed argument: %s%s", argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
   range = ospf6_route_lookup (&prefix, oa->range_table);
   if (range == NULL)
     {
-      vty_out (vty, "Range %s does not exists.%s", argv[2]->arg, VNL);
+      vty_out (vty, "Range %s does not exists.%s", argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -677,21 +680,23 @@ DEFUN (area_filter_list,
        "Filter networks sent to this area\n"
        "Filter networks sent from this area\n")
 {
+  int idx_ipv4 = 1;
+  int idx_word = 4;
   struct ospf6_area *area;
   struct prefix_list *plist;
 
-  OSPF6_CMD_AREA_GET (argv[1]->arg, area);
+  OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, area);
   argc--;
   argv++;
 
-  plist = prefix_list_lookup (AFI_IP6, argv[1]->arg);
-  if (strncmp (argv[4]->arg, "in", 2) == 0)
+  plist = prefix_list_lookup (AFI_IP6, argv[idx_ipv4]->arg);
+  if (strncmp (argv[idx_word]->arg, "in", 2) == 0)
     {
       PREFIX_LIST_IN (area) = plist;
       if (PREFIX_NAME_IN (area))
        free (PREFIX_NAME_IN (area));
 
-      PREFIX_NAME_IN (area) = strdup (argv[1]->arg);
+      PREFIX_NAME_IN (area) = strdup (argv[idx_ipv4]->arg);
       ospf6_abr_reimport (area);
     }
   else
@@ -700,7 +705,7 @@ DEFUN (area_filter_list,
       if (PREFIX_NAME_OUT (area))
        free (PREFIX_NAME_OUT (area));
 
-      PREFIX_NAME_OUT (area) = strdup (argv[1]->arg);
+      PREFIX_NAME_OUT (area) = strdup (argv[idx_ipv4]->arg);
       ospf6_abr_enable_area (area);
     }
 
@@ -719,16 +724,18 @@ DEFUN (no_area_filter_list,
        "Filter networks sent to this area\n"
        "Filter networks sent from this area\n")
 {
+  int idx_ipv4 = 2;
+  int idx_word = 5;
   struct ospf6_area *area;
 
-  OSPF6_CMD_AREA_GET (argv[2]->arg, area);
+  OSPF6_CMD_AREA_GET (argv[idx_ipv4]->arg, area);
   argc--;
   argv++;
 
-  if (strncmp (argv[5]->arg, "in", 2) == 0)
+  if (strncmp (argv[idx_word]->arg, "in", 2) == 0)
     {
       if (PREFIX_NAME_IN (area))
-       if (strcmp (PREFIX_NAME_IN (area), argv[2]->arg) != 0)
+       if (strcmp (PREFIX_NAME_IN (area), argv[idx_ipv4]->arg) != 0)
          return CMD_SUCCESS;
 
       PREFIX_LIST_IN (area) = NULL;
@@ -741,7 +748,7 @@ DEFUN (no_area_filter_list,
   else
     {
       if (PREFIX_NAME_OUT (area))
-       if (strcmp (PREFIX_NAME_OUT (area), argv[2]->arg) != 0)
+       if (strcmp (PREFIX_NAME_OUT (area), argv[idx_ipv4]->arg) != 0)
          return CMD_SUCCESS;
 
       PREFIX_LIST_OUT (area) = NULL;
@@ -763,19 +770,21 @@ DEFUN (area_import_list,
        "Set the filter for networks from other areas announced to the specified one\n"
        "Name of the acess-list\n")
 {
+  int idx_ipv4 = 1;
+  int idx_name = 3;
   struct ospf6_area *area;
   struct access_list *list;
 
-  OSPF6_CMD_AREA_GET(argv[1]->arg, area);
+  OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area);
 
-  list = access_list_lookup (AFI_IP6, argv[3]->arg);
+  list = access_list_lookup (AFI_IP6, argv[idx_name]->arg);
 
   IMPORT_LIST (area) = list;
 
   if (IMPORT_NAME (area))
     free (IMPORT_NAME (area));
 
-  IMPORT_NAME (area) = strdup (argv[3]->arg);
+  IMPORT_NAME (area) = strdup (argv[idx_name]->arg);
   ospf6_abr_reimport (area);
 
   return CMD_SUCCESS; 
@@ -789,9 +798,10 @@ DEFUN (no_area_import_list,
        "Unset the filter for networks announced to other areas\n"
        "NAme of the access-list\n")
 {
+  int idx_ipv4 = 2;
   struct ospf6_area *area;
 
-  OSPF6_CMD_AREA_GET(argv[2]->arg, area);
+  OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area);
 
   IMPORT_LIST (area) = 0;
 
@@ -812,19 +822,21 @@ DEFUN (area_export_list,
        "Set the filter for networks announced to other areas\n"
        "Name of the acess-list\n")
 {
+  int idx_ipv4 = 1;
+  int idx_name = 3;
   struct ospf6_area *area;
   struct access_list *list;
 
-  OSPF6_CMD_AREA_GET(argv[1]->arg, area);
+  OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area);
 
-  list = access_list_lookup (AFI_IP6, argv[3]->arg);
+  list = access_list_lookup (AFI_IP6, argv[idx_name]->arg);
 
   EXPORT_LIST (area) = list;
 
   if (EXPORT_NAME (area))
     free (EXPORT_NAME (area));
 
-  EXPORT_NAME (area) = strdup (argv[3]->arg);
+  EXPORT_NAME (area) = strdup (argv[idx_name]->arg);
   ospf6_abr_enable_area (area);
 
   return CMD_SUCCESS; 
@@ -838,9 +850,10 @@ DEFUN (no_area_export_list,
        "Unset the filter for networks announced to other areas\n"
        "Name of the access-list\n")
 {
+  int idx_ipv4 = 2;
   struct ospf6_area *area;
 
-  OSPF6_CMD_AREA_GET(argv[2]->arg, area);
+  OSPF6_CMD_AREA_GET(argv[idx_ipv4]->arg, area);
 
   EXPORT_LIST (area) = 0;
 
@@ -899,6 +912,7 @@ DEFUN (show_ipv6_ospf6_area_spf_tree,
        "Shortest Path First caculation\n"
        "Show SPF tree\n")
 {
+  int idx_ipv4 = 4;
   u_int32_t area_id;
   struct ospf6_area *oa;
   struct ospf6_vertex *root;
@@ -909,15 +923,15 @@ DEFUN (show_ipv6_ospf6_area_spf_tree,
 
   ospf6_linkstate_prefix (ospf6->router_id, htonl (0), &prefix);
 
-  if (inet_pton (AF_INET, argv[4]->arg, &area_id) != 1)
+  if (inet_pton (AF_INET, argv[idx_ipv4]->arg, &area_id) != 1)
     {
-      vty_out (vty, "Malformed Area-ID: %s%s", argv[4]->arg, VNL);
+      vty_out (vty, "Malformed Area-ID: %s%s", argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
   oa = ospf6_area_lookup (area_id, ospf6);
   if (oa == NULL)
     {
-      vty_out (vty, "No such Area: %s%s", argv[4]->arg, VNL);
+      vty_out (vty, "No such Area: %s%s", argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -944,6 +958,8 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root,
        "Show SPF tree\n"
        "Specify root's router-id to calculate another router's SPF tree\n")
 {
+  int idx_ipv4 = 5;
+  int idx_ipv4_2 = 7;
   u_int32_t area_id;
   struct ospf6_area *oa;
   struct ospf6_vertex *root;
@@ -955,18 +971,18 @@ DEFUN (show_ipv6_ospf6_simulate_spf_tree_root,
 
   OSPF6_CMD_CHECK_RUNNING ();
 
-  inet_pton (AF_INET, argv[5]->arg, &router_id);
+  inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id);
   ospf6_linkstate_prefix (router_id, htonl (0), &prefix);
 
-  if (inet_pton (AF_INET, argv[7]->arg, &area_id) != 1)
+  if (inet_pton (AF_INET, argv[idx_ipv4_2]->arg, &area_id) != 1)
     {
-      vty_out (vty, "Malformed Area-ID: %s%s", argv[7]->arg, VNL);
+      vty_out (vty, "Malformed Area-ID: %s%s", argv[idx_ipv4_2]->arg, VNL);
       return CMD_SUCCESS;
     }
   oa = ospf6_area_lookup (area_id, ospf6);
   if (oa == NULL)
     {
-      vty_out (vty, "No such Area: %s%s", argv[7]->arg, VNL);
+      vty_out (vty, "No such Area: %s%s", argv[idx_ipv4_2]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -1002,9 +1018,10 @@ DEFUN (ospf6_area_stub,
        "OSPF6 area ID as a decimal value\n"
        "Configure OSPF6 area as stub\n")
 {
+  int idx_ipv4_number = 1;
   struct ospf6_area *area;
 
-  OSPF6_CMD_AREA_GET(argv[1]->arg, area);
+  OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area);
 
   if (!ospf6_area_stub_set (ospf6, area))
     {
@@ -1027,9 +1044,10 @@ DEFUN (ospf6_area_stub_no_summary,
        "Configure OSPF6 area as stub\n"
        "Do not inject inter-area routes into stub\n")
 {
+  int idx_ipv4_number = 1;
   struct ospf6_area *area;
 
-  OSPF6_CMD_AREA_GET(argv[1]->arg, area);
+  OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area);
 
   if (!ospf6_area_stub_set (ospf6, area))
     {
@@ -1052,9 +1070,10 @@ DEFUN (no_ospf6_area_stub,
        "OSPF6 area ID as a decimal value\n"
        "Configure OSPF6 area as stub\n")
 {
+  int idx_ipv4_number = 2;
   struct ospf6_area *area;
 
-  OSPF6_CMD_AREA_GET(argv[2]->arg, area);
+  OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area);
 
   ospf6_area_stub_unset (ospf6, area);
   ospf6_area_no_summary_unset (ospf6, area);
@@ -1072,9 +1091,10 @@ DEFUN (no_ospf6_area_stub_no_summary,
        "Configure OSPF6 area as stub\n"
        "Do not inject inter-area routes into area\n")
 {
+  int idx_ipv4_number = 2;
   struct ospf6_area *area;
 
-  OSPF6_CMD_AREA_GET(argv[2]->arg, area);
+  OSPF6_CMD_AREA_GET(argv[idx_ipv4_number]->arg, area);
 
   ospf6_area_stub_unset (ospf6, area);
   ospf6_area_no_summary_unset (ospf6, area);
index 143278b42b8f8aa84eb826ad2dee0629d1a523da..014320a2f8f46c167137c18aba8d9a2d9e18fb15 100644 (file)
@@ -667,14 +667,16 @@ DEFUN (ospf6_redistribute_routemap,
        "Route map name\n"
       )
 {
+  int idx_protocol = 1;
+  int idx_word = 3;
   int type;
 
-  type = proto_redistnum(AFI_IP6, argv[1]->arg);
+  type = proto_redistnum(AFI_IP6, argv[idx_protocol]->arg);
   if (type < 0 || type == ZEBRA_ROUTE_OSPF6)
     return CMD_WARNING;
 
   ospf6_asbr_redistribute_unset (type);
-  ospf6_asbr_routemap_set (type, argv[3]->arg);
+  ospf6_asbr_routemap_set (type, argv[idx_word]->arg);
   ospf6_asbr_redistribute_set (type);
   return CMD_SUCCESS;
 }
@@ -1019,8 +1021,9 @@ DEFUN (ospf6_routemap_match_address_prefixlist,
        "Match entries of prefix-lists\n"
        "IPv6 prefix-list name\n")
 {
+  int idx_word = 4;
   int ret = route_map_add_match ((struct route_map_index *) vty->index,
-                                 "ipv6 address prefix-list", argv[4]->arg);
+                                 "ipv6 address prefix-list", argv[idx_word]->arg);
   return route_map_command_status (vty, ret);
 }
 
@@ -1035,8 +1038,9 @@ DEFUN (ospf6_routemap_no_match_address_prefixlist,
        "Match entries of prefix-lists\n"
        "IPv6 prefix-list name\n")
 {
+  int idx_word = 5;
   int ret = route_map_delete_match ((struct route_map_index *) vty->index,
-                                    "ipv6 address prefix-list", argv[5]->arg);
+                                    "ipv6 address prefix-list", argv[idx_word]->arg);
   return route_map_command_status (vty, ret);
 }
 
@@ -1048,8 +1052,9 @@ DEFUN (ospf6_routemap_match_interface,
        "Match first hop interface of route\n"
        "Interface name\n")
 {
+  int idx_word = 2;
   return route_map_add_match ((struct route_map_index *) vty->index,
-                              "interface", argv[2]->arg);
+                              "interface", argv[idx_word]->arg);
 }
 
 /* "no match interface WORD" */
@@ -1084,8 +1089,9 @@ DEFUN (ospf6_routemap_set_metric_type,
        "OSPF6 external type 1 metric\n"
        "OSPF6 external type 2 metric\n")
 {
+  int idx_external = 2;
   int ret = route_map_add_set ((struct route_map_index *) vty->index,
-                               "metric-type", argv[2]->arg);
+                               "metric-type", argv[idx_external]->arg);
   return route_map_command_status (vty, ret);
 }
 
@@ -1099,8 +1105,9 @@ DEFUN (ospf6_routemap_no_set_metric_type,
        "OSPF6 external type 1 metric\n"
        "OSPF6 external type 2 metric\n")
 {
+  int idx_external = 3;
   int ret = route_map_delete_set ((struct route_map_index *) vty->index,
-                                  "metric-type", argv[3]->arg);
+                                  "metric-type", argv[idx_external]->arg);
   return route_map_command_status (vty, ret);
 }
 
@@ -1112,8 +1119,9 @@ DEFUN (set_metric,
        "Metric value\n"
        "Metric value\n")
 {
+  int idx_number = 2;
   int ret = route_map_add_set ((struct route_map_index *) vty->index,
-                               "metric", argv[2]->arg);
+                               "metric", argv[idx_number]->arg);
   return route_map_command_status (vty, ret);
 }
 
@@ -1154,8 +1162,9 @@ DEFUN (ospf6_routemap_set_forwarding,
        "Forwarding Address\n"
        "IPv6 Address\n")
 {
+  int idx_ipv6 = 2;
   int ret = route_map_add_set ((struct route_map_index *) vty->index,
-                               "forwarding-address", argv[2]->arg);
+                               "forwarding-address", argv[idx_ipv6]->arg);
   return route_map_command_status (vty, ret);
 }
 
@@ -1168,8 +1177,9 @@ DEFUN (ospf6_routemap_no_set_forwarding,
        "Forwarding Address\n"
        "IPv6 Address\n")
 {
+  int idx_ipv6 = 3;
   int ret = route_map_delete_set ((struct route_map_index *) vty->index,
-                                  "forwarding-address", argv[3]->arg);
+                                  "forwarding-address", argv[idx_ipv6]->arg);
   return route_map_command_status (vty, ret);
 }
 
index 29368cb9b6807baa1b2d1810ad850ae1e20c29b1..5d1eae3e3878b0afdbea7b14e5c070ca4af755ff 100644 (file)
@@ -354,6 +354,9 @@ DEFUN (ipv6_ospf6_bfd_param,
        "Required min receive interval\n"
        "Desired min transmit interval\n")
 {
+  int idx_number = 3;
+  int idx_number_2 = 4;
+  int idx_number_3 = 5;
   struct ospf6_interface *oi;
   struct interface *ifp;
   u_int32_t rx_val;
@@ -369,7 +372,7 @@ DEFUN (ipv6_ospf6_bfd_param,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  if ((ret = bfd_validate_param (vty, argv[3]->arg, argv[4]->arg, argv[5]->arg, &dm_val,
+  if ((ret = bfd_validate_param (vty, argv[idx_number]->arg, argv[idx_number_2]->arg, argv[idx_number_3]->arg, &dm_val,
                                  &rx_val, &tx_val)) != CMD_SUCCESS)
     return ret;
 
index 2b7d180a8f21ea836117d18f3d7b43b0807cedd8..e9d66419df6c9a4f7b49774ce1adc943ad4a9b12 100644 (file)
@@ -1006,15 +1006,16 @@ DEFUN (show_ipv6_ospf6_interface,
        IFNAME_STR
        )
 {
+  int idx_ifname = 4;
   struct interface *ifp;
   struct listnode *i;
 
   if (argc)
     {
-      ifp = if_lookup_by_name (argv[4]->arg);
+      ifp = if_lookup_by_name (argv[idx_ifname]->arg);
       if (ifp == NULL)
         {
-          vty_out (vty, "No such Interface: %s%s", argv[4]->arg,
+          vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg,
                    VNL);
           return CMD_WARNING;
         }
@@ -1068,20 +1069,21 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
        "Display connected prefixes to advertise\n"
        )
 {
+  int idx_ifname = 4;
   struct interface *ifp;
   struct ospf6_interface *oi;
 
-  ifp = if_lookup_by_name (argv[4]->arg);
+  ifp = if_lookup_by_name (argv[idx_ifname]->arg);
   if (ifp == NULL)
     {
-      vty_out (vty, "No such Interface: %s%s", argv[4]->arg, VNL);
+      vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL);
       return CMD_WARNING;
     }
 
   oi = ifp->info;
   if (oi == NULL)
     {
-      vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[4]->arg, VNL);
+      vty_out (vty, "OSPFv3 is not enabled on %s%s", argv[idx_ifname]->arg, VNL);
       return CMD_WARNING;
     }
 
@@ -1158,6 +1160,7 @@ DEFUN (ipv6_ospf6_ifmtu,
        "OSPFv3 Interface MTU\n"
        )
 {
+  int idx_number = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
   unsigned int ifmtu, iobuflen;
@@ -1172,7 +1175,7 @@ DEFUN (ipv6_ospf6_ifmtu,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  ifmtu = strtol (argv[3]->arg, NULL, 10);
+  ifmtu = strtol (argv[idx_number]->arg, NULL, 10);
 
   if (oi->ifmtu == ifmtu)
     return CMD_SUCCESS;
@@ -1266,6 +1269,7 @@ DEFUN (ipv6_ospf6_cost,
        "Outgoing metric of this interface\n"
        )
 {
+  int idx_number = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
   unsigned long int lcost;
@@ -1278,7 +1282,7 @@ DEFUN (ipv6_ospf6_cost,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  lcost = strtol (argv[3]->arg, NULL, 10);
+  lcost = strtol (argv[idx_number]->arg, NULL, 10);
 
   if (lcost > UINT32_MAX)
     {
@@ -1331,13 +1335,14 @@ DEFUN (auto_cost_reference_bandwidth,
        "Use reference bandwidth method to assign OSPF cost\n"
        "The reference bandwidth in terms of Mbits per second\n")
 {
+  int idx_number = 2;
   struct ospf6 *o = vty->index;
   struct ospf6_area *oa;
   struct ospf6_interface *oi;
   struct listnode *i, *j;
   u_int32_t refbw;
 
-  refbw = strtol (argv[2]->arg, NULL, 10);
+  refbw = strtol (argv[idx_number]->arg, NULL, 10);
   if (refbw < 1 || refbw > 4294967)
     {
       vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
@@ -1398,6 +1403,7 @@ DEFUN (ipv6_ospf6_hellointerval,
        SECONDS_STR
        )
 {
+  int idx_number = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
 
@@ -1409,7 +1415,7 @@ DEFUN (ipv6_ospf6_hellointerval,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  oi->hello_interval = strtol (argv[3]->arg, NULL, 10);
+  oi->hello_interval = strtol (argv[idx_number]->arg, NULL, 10);
   return CMD_SUCCESS;
 }
 
@@ -1423,6 +1429,7 @@ DEFUN (ipv6_ospf6_deadinterval,
        SECONDS_STR
        )
 {
+  int idx_number = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
 
@@ -1434,7 +1441,7 @@ DEFUN (ipv6_ospf6_deadinterval,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  oi->dead_interval = strtol (argv[3]->arg, NULL, 10);
+  oi->dead_interval = strtol (argv[idx_number]->arg, NULL, 10);
   return CMD_SUCCESS;
 }
 
@@ -1448,6 +1455,7 @@ DEFUN (ipv6_ospf6_transmitdelay,
        SECONDS_STR
        )
 {
+  int idx_number = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
 
@@ -1459,7 +1467,7 @@ DEFUN (ipv6_ospf6_transmitdelay,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  oi->transdelay = strtol (argv[3]->arg, NULL, 10);
+  oi->transdelay = strtol (argv[idx_number]->arg, NULL, 10);
   return CMD_SUCCESS;
 }
 
@@ -1473,6 +1481,7 @@ DEFUN (ipv6_ospf6_retransmitinterval,
        SECONDS_STR
        )
 {
+  int idx_number = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
 
@@ -1484,7 +1493,7 @@ DEFUN (ipv6_ospf6_retransmitinterval,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  oi->rxmt_interval = strtol (argv[3]->arg, NULL, 10);
+  oi->rxmt_interval = strtol (argv[idx_number]->arg, NULL, 10);
   return CMD_SUCCESS;
 }
 
@@ -1498,6 +1507,7 @@ DEFUN (ipv6_ospf6_priority,
        "Priority value\n"
        )
 {
+  int idx_number = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
 
@@ -1509,7 +1519,7 @@ DEFUN (ipv6_ospf6_priority,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  oi->priority = strtol (argv[3]->arg, NULL, 10);
+  oi->priority = strtol (argv[idx_number]->arg, NULL, 10);
 
   if (oi->area &&
       (oi->state == OSPF6_INTERFACE_DROTHER ||
@@ -1529,6 +1539,7 @@ DEFUN (ipv6_ospf6_instance,
        "Instance ID value\n"
        )
 {
+  int idx_number = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
 
@@ -1540,7 +1551,7 @@ DEFUN (ipv6_ospf6_instance,
     oi = ospf6_interface_create (ifp);
   assert (oi);
 
-  oi->instance_id = strtol (argv[3]->arg, NULL, 10);
+  oi->instance_id = strtol (argv[idx_number]->arg, NULL, 10);
   return CMD_SUCCESS;
 }
 
@@ -1664,6 +1675,7 @@ DEFUN (ipv6_ospf6_advertise_prefix_list,
        "Prefix list name\n"
        )
 {
+  int idx_word = 4;
   struct ospf6_interface *oi;
   struct interface *ifp;
 
@@ -1677,7 +1689,7 @@ DEFUN (ipv6_ospf6_advertise_prefix_list,
 
   if (oi->plist_name)
     XFREE (MTYPE_CFG_PLIST_NAME, oi->plist_name);
-  oi->plist_name = XSTRDUP (MTYPE_CFG_PLIST_NAME, argv[4]->arg);
+  oi->plist_name = XSTRDUP (MTYPE_CFG_PLIST_NAME, argv[idx_word]->arg);
 
   ospf6_interface_connected_route_update (oi->interface);
 
@@ -1748,6 +1760,7 @@ DEFUN (ipv6_ospf6_network,
        "Specify OSPF6 point-to-point network\n"
        )
 {
+  int idx_network = 3;
   struct ospf6_interface *oi;
   struct interface *ifp;
 
@@ -1760,14 +1773,14 @@ DEFUN (ipv6_ospf6_network,
   }
   assert (oi);
 
-  if (strncmp (argv[3]->arg, "b", 1) == 0)
+  if (strncmp (argv[idx_network]->arg, "b", 1) == 0)
     {
       if (oi->type == OSPF_IFTYPE_BROADCAST)
        return CMD_SUCCESS;
 
       oi->type = OSPF_IFTYPE_BROADCAST;
     }
-    else if (strncmp (argv[3]->arg, "point-to-p", 10) == 0)
+    else if (strncmp (argv[idx_network]->arg, "point-to-p", 10) == 0)
       {
        if (oi->type == OSPF_IFTYPE_POINTOPOINT) {
          return CMD_SUCCESS;
@@ -1977,6 +1990,7 @@ DEFUN (clear_ipv6_ospf6_interface,
        IFNAME_STR
        )
 {
+  int idx_ifname = 4;
   struct interface *ifp;
   struct listnode *node;
 
@@ -1987,9 +2001,9 @@ DEFUN (clear_ipv6_ospf6_interface,
     }
   else /* Interface name is specified. */
     {
-      if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL)
+      if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg)) == NULL)
         {
-          vty_out (vty, "No such Interface: %s%s", argv[4]->arg, VNL);
+          vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL);
           return CMD_WARNING;
         }
       ospf6_interface_clear (vty, ifp);
index 6ed46f5cd69b41bf511314a30c29d575e1399ad8..586bd77f75f2d2e629b67a95b9db10aef76b6399 100644 (file)
@@ -1730,8 +1730,9 @@ DEFUN (debug_ospf6_brouter_router,
        "Specify border-router's router-id\n"
       )
 {
+  int idx_ipv4 = 4;
   u_int32_t router_id;
-  inet_pton (AF_INET, argv[4]->arg, &router_id);
+  inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id);
   OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ON (router_id);
   return CMD_SUCCESS;
 }
@@ -1760,8 +1761,9 @@ DEFUN (debug_ospf6_brouter_area,
        "Specify Area-ID\n"
       )
 {
+  int idx_ipv4 = 4;
   u_int32_t area_id;
-  inet_pton (AF_INET, argv[4]->arg, &area_id);
+  inet_pton (AF_INET, argv[idx_ipv4]->arg, &area_id);
   OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_ON (area_id);
   return CMD_SUCCESS;
 }
index db34214e103b430c3606b78f093a7e692c113b82..a70e450f604eb0a0a304f2b595605349112ab4a0 100644 (file)
@@ -835,6 +835,7 @@ DEFUN (debug_ospf6_lsa_type,
        "Specify LS type as Hexadecimal\n"
       )
 {
+  int idx_lsa = 3;
   unsigned int i;
   struct ospf6_lsa_handler *handler = NULL;
 
@@ -845,9 +846,9 @@ DEFUN (debug_ospf6_lsa_type,
       handler = vector_slot (ospf6_lsa_handler_vector, i);
       if (handler == NULL)
         continue;
-      if (strncmp (argv[3]->arg, ospf6_lsa_handler_name(handler), strlen(argv[3]->arg)) == 0)
+      if (strncmp (argv[idx_lsa]->arg, ospf6_lsa_handler_name(handler), strlen(argv[idx_lsa]->arg)) == 0)
         break;
-      if (! strcasecmp (argv[3]->arg, handler->name))
+      if (! strcasecmp (argv[idx_lsa]->arg, handler->name))
         break;
       handler = NULL;
     }
@@ -892,6 +893,7 @@ DEFUN (no_debug_ospf6_lsa_type,
        "Specify LS type as Hexadecimal\n"
       )
 {
+  int idx_lsa = 4;
   u_int i;
   struct ospf6_lsa_handler *handler = NULL;
 
@@ -902,9 +904,9 @@ DEFUN (no_debug_ospf6_lsa_type,
       handler = vector_slot (ospf6_lsa_handler_vector, i);
       if (handler == NULL)
         continue;
-      if (strncmp (argv[4]->arg, ospf6_lsa_handler_name(handler), strlen(argv[4]->arg)) == 0)
+      if (strncmp (argv[idx_lsa]->arg, ospf6_lsa_handler_name(handler), strlen(argv[idx_lsa]->arg)) == 0)
         break;
-      if (! strcasecmp (argv[4]->arg, handler->name))
+      if (! strcasecmp (argv[idx_lsa]->arg, handler->name))
         break;
     }
 
index b2dd6b6ce20a633f51fb4ef25fed6a57d94e79b3..2cedc59ee5932355a94b043c47450fb5fdcd2f14 100644 (file)
@@ -2371,6 +2371,7 @@ DEFUN (debug_ospf6_message,
        "Debug All message\n"
        )
 {
+  int idx_packet = 3;
   unsigned char level = 0;
   int type = 0;
   int i;
@@ -2378,19 +2379,19 @@ DEFUN (debug_ospf6_message,
   assert (argc > 0);
 
   /* check type */
-  if (! strncmp (argv[3]->arg, "u", 1))
+  if (! strncmp (argv[idx_packet]->arg, "u", 1))
     type = OSPF6_MESSAGE_TYPE_UNKNOWN;
-  else if (! strncmp (argv[3]->arg, "h", 1))
+  else if (! strncmp (argv[idx_packet]->arg, "h", 1))
     type = OSPF6_MESSAGE_TYPE_HELLO;
-  else if (! strncmp (argv[3]->arg, "d", 1))
+  else if (! strncmp (argv[idx_packet]->arg, "d", 1))
     type = OSPF6_MESSAGE_TYPE_DBDESC;
-  else if (! strncmp (argv[3]->arg, "lsr", 3))
+  else if (! strncmp (argv[idx_packet]->arg, "lsr", 3))
     type = OSPF6_MESSAGE_TYPE_LSREQ;
-  else if (! strncmp (argv[3]->arg, "lsu", 3))
+  else if (! strncmp (argv[idx_packet]->arg, "lsu", 3))
     type = OSPF6_MESSAGE_TYPE_LSUPDATE;
-  else if (! strncmp (argv[3]->arg, "lsa", 3))
+  else if (! strncmp (argv[idx_packet]->arg, "lsa", 3))
     type = OSPF6_MESSAGE_TYPE_LSACK;
-  else if (! strncmp (argv[3]->arg, "a", 1))
+  else if (! strncmp (argv[idx_packet]->arg, "a", 1))
     type = OSPF6_MESSAGE_TYPE_ALL;
 
   if (argc == 1)
@@ -2449,6 +2450,7 @@ DEFUN (no_debug_ospf6_message,
        "Debug All message\n"
        )
 {
+  int idx_packet = 4;
   unsigned char level = 0;
   int type = 0;
   int i;
@@ -2456,19 +2458,19 @@ DEFUN (no_debug_ospf6_message,
   assert (argc > 0);
 
   /* check type */
-  if (! strncmp (argv[4]->arg, "u", 1))
+  if (! strncmp (argv[idx_packet]->arg, "u", 1))
     type = OSPF6_MESSAGE_TYPE_UNKNOWN;
-  else if (! strncmp (argv[4]->arg, "h", 1))
+  else if (! strncmp (argv[idx_packet]->arg, "h", 1))
     type = OSPF6_MESSAGE_TYPE_HELLO;
-  else if (! strncmp (argv[4]->arg, "d", 1))
+  else if (! strncmp (argv[idx_packet]->arg, "d", 1))
     type = OSPF6_MESSAGE_TYPE_DBDESC;
-  else if (! strncmp (argv[4]->arg, "lsr", 3))
+  else if (! strncmp (argv[idx_packet]->arg, "lsr", 3))
     type = OSPF6_MESSAGE_TYPE_LSREQ;
-  else if (! strncmp (argv[4]->arg, "lsu", 3))
+  else if (! strncmp (argv[idx_packet]->arg, "lsu", 3))
     type = OSPF6_MESSAGE_TYPE_LSUPDATE;
-  else if (! strncmp (argv[4]->arg, "lsa", 3))
+  else if (! strncmp (argv[idx_packet]->arg, "lsa", 3))
     type = OSPF6_MESSAGE_TYPE_LSACK;
-  else if (! strncmp (argv[4]->arg, "a", 1))
+  else if (! strncmp (argv[idx_packet]->arg, "a", 1))
     type = OSPF6_MESSAGE_TYPE_ALL;
 
   if (argc == 1)
index fbf0efed897eaeb58583670c3348173b91ae7e2b..76c3862eca30b370c8ee2fb52b4f8a9b8c0de5e2 100644 (file)
@@ -893,6 +893,7 @@ DEFUN (show_ipv6_ospf6_neighbor_one,
        "Specify Router-ID as IPv4 address notation\n"
       )
 {
+  int idx_ipv4 = 4;
   struct ospf6_neighbor *on;
   struct ospf6_interface *oi;
   struct ospf6_area *oa;
@@ -903,9 +904,9 @@ DEFUN (show_ipv6_ospf6_neighbor_one,
   OSPF6_CMD_CHECK_RUNNING ();
   showfunc = ospf6_neighbor_show_detail;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &router_id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id)) != 1)
     {
-      vty_out (vty, "Router-ID is not parsable: %s%s", argv[4]->arg,
+      vty_out (vty, "Router-ID is not parsable: %s%s", argv[idx_ipv4]->arg,
                VNL);
       return CMD_SUCCESS;
     }
index 8cf81969533eb597fca8e7732dae0a7ef57d7f37..bc4c951f13f4fb70f9155d79b4566d55f696dac9 100644 (file)
@@ -1573,15 +1573,16 @@ DEFUN (debug_ospf6_route,
        "Debug route memory use\n"
        )
 {
+  int idx_type = 3;
   unsigned char level = 0;
 
-  if (! strncmp (argv[3]->arg, "table", 5))
+  if (! strncmp (argv[idx_type]->arg, "table", 5))
     level = OSPF6_DEBUG_ROUTE_TABLE;
-  else if (! strncmp (argv[3]->arg, "intra", 5))
+  else if (! strncmp (argv[idx_type]->arg, "intra", 5))
     level = OSPF6_DEBUG_ROUTE_INTRA;
-  else if (! strncmp (argv[3]->arg, "inter", 5))
+  else if (! strncmp (argv[idx_type]->arg, "inter", 5))
     level = OSPF6_DEBUG_ROUTE_INTER;
-  else if (! strncmp (argv[3]->arg, "memor", 5))
+  else if (! strncmp (argv[idx_type]->arg, "memor", 5))
     level = OSPF6_DEBUG_ROUTE_MEMORY;
   OSPF6_DEBUG_ROUTE_ON (level);
   return CMD_SUCCESS;
@@ -1597,15 +1598,16 @@ DEFUN (no_debug_ospf6_route,
        "Debug intra-area route calculation\n"
        "Debug route memory use\n")
 {
+  int idx_type = 4;
   unsigned char level = 0;
 
-  if (! strncmp (argv[4]->arg, "table", 5))
+  if (! strncmp (argv[idx_type]->arg, "table", 5))
     level = OSPF6_DEBUG_ROUTE_TABLE;
-  else if (! strncmp (argv[4]->arg, "intra", 5))
+  else if (! strncmp (argv[idx_type]->arg, "intra", 5))
     level = OSPF6_DEBUG_ROUTE_INTRA;
-  else if (! strncmp (argv[4]->arg, "inter", 5))
+  else if (! strncmp (argv[idx_type]->arg, "inter", 5))
     level = OSPF6_DEBUG_ROUTE_INTER;
-  else if (! strncmp (argv[4]->arg, "memor", 5))
+  else if (! strncmp (argv[idx_type]->arg, "memor", 5))
     level = OSPF6_DEBUG_ROUTE_MEMORY;
   OSPF6_DEBUG_ROUTE_OFF (level);
   return CMD_SUCCESS;
index 80fb9041628947c4169dbc4be7c8102abb3defba..3aa653814b2a6fe86facdbb6a165df763f8c2635 100644 (file)
@@ -885,6 +885,9 @@ DEFUN (ospf6_timers_throttle_spf,
        "Initial hold time (msec) between consecutive SPF calculations\n"
        "Maximum hold time (msec)\n")
 {
+  int idx_number = 3;
+  int idx_number_2 = 4;
+  int idx_number_3 = 5;
   unsigned int delay, hold, max;
 
   if (argc != 3)
@@ -893,9 +896,9 @@ DEFUN (ospf6_timers_throttle_spf,
       return CMD_WARNING;
     }
 
-  VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[3]->arg, 0, 600000);
-  VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[4]->arg, 0, 600000);
-  VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[5]->arg, 0, 600000);
+  VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[idx_number]->arg, 0, 600000);
+  VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[idx_number_2]->arg, 0, 600000);
+  VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[idx_number_3]->arg, 0, 600000);
 
   return ospf6_timers_spf_set (vty, delay, hold, max);
 }
index 9c51b4ee7b0d5d3c5c429262c9b87b79a80030f9..5fef06d7ca155e0368dc3f09deda4cd5c44541ba 100644 (file)
@@ -324,16 +324,17 @@ DEFUN (ospf6_router_id,
        "Configure OSPF Router-ID\n"
        V4NOTATION_STR)
 {
+  int idx_ipv4 = 1;
   int ret;
   u_int32_t router_id;
   struct ospf6 *o;
 
   o = (struct ospf6 *) vty->index;
 
-  ret = inet_pton (AF_INET, argv[1]->arg, &router_id);
+  ret = inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id);
   if (ret == 0)
     {
-      vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[1]->arg, VNL);
+      vty_out (vty, "malformed OSPF Router-ID: %s%s", argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -404,6 +405,7 @@ DEFUN (ospf6_timers_lsa,
        "Minimum delay in receiving new version of a LSA\n"
        "Delay in milliseconds\n")
 {
+  int idx_number = 3;
   unsigned int minarrival;
   struct ospf6 *ospf = vty->index;
 
@@ -416,7 +418,7 @@ DEFUN (ospf6_timers_lsa,
       return CMD_WARNING;
     }
 
-  VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[3]->arg);
+  VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg);
 
   ospf->lsa_minarrival = minarrival;
 
@@ -471,6 +473,8 @@ DEFUN (ospf6_interface_area,
        "OSPF6 area ID in IPv4 address notation\n"
       )
 {
+  int idx_ifname = 1;
+  int idx_ipv4 = 3;
   struct ospf6 *o;
   struct ospf6_area *oa;
   struct ospf6_interface *oi;
@@ -480,7 +484,7 @@ DEFUN (ospf6_interface_area,
   o = (struct ospf6 *) vty->index;
 
   /* find/create ospf6 interface */
-  ifp = if_get_by_name (argv[1]->arg);
+  ifp = if_get_by_name (argv[idx_ifname]->arg);
   oi = (struct ospf6_interface *) ifp->info;
   if (oi == NULL)
     oi = ospf6_interface_create (ifp);
@@ -492,9 +496,9 @@ DEFUN (ospf6_interface_area,
     }
 
   /* parse Area-ID */
-  if (inet_pton (AF_INET, argv[3]->arg, &area_id) != 1)
+  if (inet_pton (AF_INET, argv[idx_ipv4]->arg, &area_id) != 1)
     {
-      vty_out (vty, "Invalid Area-ID: %s%s", argv[3]->arg, VNL);
+      vty_out (vty, "Invalid Area-ID: %s%s", argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -533,15 +537,17 @@ DEFUN (no_ospf6_interface_area,
        "OSPF6 area ID in IPv4 address notation\n"
        )
 {
+  int idx_ifname = 2;
+  int idx_ipv4 = 4;
   struct ospf6_interface *oi;
   struct ospf6_area *oa;
   struct interface *ifp;
   u_int32_t area_id;
 
-  ifp = if_lookup_by_name (argv[2]->arg);
+  ifp = if_lookup_by_name (argv[idx_ifname]->arg);
   if (ifp == NULL)
     {
-      vty_out (vty, "No such interface %s%s", argv[2]->arg, VNL);
+      vty_out (vty, "No such interface %s%s", argv[idx_ifname]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -553,16 +559,16 @@ DEFUN (no_ospf6_interface_area,
     }
 
   /* parse Area-ID */
-  if (inet_pton (AF_INET, argv[4]->arg, &area_id) != 1)
+  if (inet_pton (AF_INET, argv[idx_ipv4]->arg, &area_id) != 1)
     {
-      vty_out (vty, "Invalid Area-ID: %s%s", argv[4]->arg, VNL);
+      vty_out (vty, "Invalid Area-ID: %s%s", argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
   /* Verify Area */
   if (oi->area == NULL)
     {
-      vty_out (vty, "No such Area-ID: %s%s", argv[4]->arg, VNL);
+      vty_out (vty, "No such Area-ID: %s%s", argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
index 10b6b27a8bd99cbcbaca46f86629d18045cc55b1..6599fbc6ccf6813b8f2773446ac69d44058e13c3 100644 (file)
@@ -726,13 +726,14 @@ DEFUN (debug_ospf6_zebra_sendrecv,
        "Debug Receiving zebra\n"
       )
 {
+  int idx_send_recv = 3;
   unsigned char level = 0;
 
   if (argc)
     {
-      if (! strncmp (argv[3]->arg, "s", 1))
+      if (! strncmp (argv[idx_send_recv]->arg, "s", 1))
         level = OSPF6_DEBUG_ZEBRA_SEND;
-      else if (! strncmp (argv[3]->arg, "r", 1))
+      else if (! strncmp (argv[idx_send_recv]->arg, "r", 1))
         level = OSPF6_DEBUG_ZEBRA_RECV;
     }
   else
@@ -765,13 +766,14 @@ DEFUN (no_debug_ospf6_zebra_sendrecv,
        "Debug Receiving zebra\n"
       )
 {
+  int idx_send_recv = 4;
   unsigned char level = 0;
 
   if (argc)
     {
-      if (! strncmp (argv[4]->arg, "s", 1))
+      if (! strncmp (argv[idx_send_recv]->arg, "s", 1))
         level = OSPF6_DEBUG_ZEBRA_SEND;
-      else if (! strncmp (argv[4]->arg, "r", 1))
+      else if (! strncmp (argv[idx_send_recv]->arg, "r", 1))
         level = OSPF6_DEBUG_ZEBRA_RECV;
     }
   else
index 907cd118a5556ea83170505e18363b309e4d58ef..c72dde0acf8c5c0966355f4d5a3bbc786fe80bee 100644 (file)
@@ -364,6 +364,7 @@ DEFUN (show_ipv6_ospf6_database_id,
        "Specify Link state ID as IPv4 address notation\n"
       )
 {
+  int idx_ipv4 = 5;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -373,10 +374,10 @@ DEFUN (show_ipv6_ospf6_database_id,
 
   OSPF6_CMD_CHECK_RUNNING ();
 
-  if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1)
     {
       vty_out (vty, "Link State ID is not parsable: %s%s",
-               argv[5]->arg, VNL);
+               argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -461,6 +462,7 @@ DEFUN (show_ipv6_ospf6_database_router,
        "Specify Advertising Router as IPv4 address notation\n"
       )
 {
+  int idx_ipv4 = 6;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -470,10 +472,10 @@ DEFUN (show_ipv6_ospf6_database_router,
 
   OSPF6_CMD_CHECK_RUNNING ();
 
-  if ((inet_pton (AF_INET, argv[6]->arg, &adv_router)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1)
     {
       vty_out (vty, "Advertising Router is not parsable: %s%s",
-               argv[6]->arg, VNL);
+               argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -596,6 +598,7 @@ DEFUN (show_ipv6_ospf6_database_type_id,
        "Specify Link state ID as IPv4 address notation\n"
       )
 {
+  int idx_lsa = 4;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -610,10 +613,10 @@ DEFUN (show_ipv6_ospf6_database_type_id,
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
     {
       vty_out (vty, "Link state ID is not parsable: %s%s",
-               argv[4]->arg, VNL);
+               argv[idx_lsa]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -751,6 +754,7 @@ DEFUN (show_ipv6_ospf6_database_type_router,
        "Specify Advertising Router as IPv4 address notation\n"
       )
 {
+  int idx_lsa = 4;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -765,10 +769,10 @@ DEFUN (show_ipv6_ospf6_database_type_router,
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1)
     {
       vty_out (vty, "Advertising Router is not parsable: %s%s",
-               argv[4]->arg, VNL);
+               argv[idx_lsa]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -844,6 +848,7 @@ DEFUN (show_ipv6_ospf6_database_id_router,
        "Specify Advertising Router as IPv4 address notation\n"
       )
 {
+  int idx_ipv4 = 5;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -854,20 +859,20 @@ DEFUN (show_ipv6_ospf6_database_id_router,
 
   OSPF6_CMD_CHECK_RUNNING ();
 
-  if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1)
     {
       vty_out (vty, "Link state ID is not parsable: %s%s",
-               argv[5]->arg, VNL);
+               argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[5]->arg, &adv_router)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1)
     {
       vty_out (vty, "Advertising Router is not parsable: %s%s",
-               argv[5]->arg, VNL);
+               argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -930,6 +935,7 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
        "Specify Link state ID as IPv4 address notation\n"
       )
 {
+  int idx_ipv4 = 5;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -940,20 +946,20 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id,
 
   OSPF6_CMD_CHECK_RUNNING ();
 
-  if ((inet_pton (AF_INET, argv[5]->arg, &adv_router)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &adv_router)) != 1)
     {
       vty_out (vty, "Advertising Router is not parsable: %s%s",
-               argv[5]->arg, VNL);
+               argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[5]->arg, &id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_ipv4]->arg, &id)) != 1)
     {
       vty_out (vty, "Link state ID is not parsable: %s%s",
-               argv[5]->arg, VNL);
+               argv[idx_ipv4]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -1031,6 +1037,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_router,
        "Specify Advertising Router as IPv4 address notation\n"
       )
 {
+  int idx_lsa = 4;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -1046,20 +1053,20 @@ DEFUN (show_ipv6_ospf6_database_type_id_router,
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
     {
       vty_out (vty, "Link state ID is not parsable: %s%s",
-               argv[4]->arg, VNL);
+               argv[idx_lsa]->arg, VNL);
       return CMD_SUCCESS;
     }
 
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1)
     {
       vty_out (vty, "Advertising Router is not parsable: %s%s",
-               argv[4]->arg, VNL);
+               argv[idx_lsa]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -1155,6 +1162,7 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
        "Specify Link state ID as IPv4 address notation\n"
       )
 {
+  int idx_lsa = 4;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -1170,20 +1178,20 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id,
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &adv_router)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &adv_router)) != 1)
     {
       vty_out (vty, "Advertising Router is not parsable: %s%s",
-               argv[4]->arg, VNL);
+               argv[idx_lsa]->arg, VNL);
       return CMD_SUCCESS;
     }
 
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
     {
       vty_out (vty, "Link state ID is not parsable: %s%s",
-               argv[4]->arg, VNL);
+               argv[idx_lsa]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -1436,6 +1444,7 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
        "Specify Link state ID as IPv4 address notation\n"
       )
 {
+  int idx_lsa = 4;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -1451,10 +1460,10 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id,
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
     {
       vty_out (vty, "Link State ID is not parsable: %s%s",
-               argv[4]->arg, VNL);
+               argv[idx_lsa]->arg, VNL);
       return CMD_SUCCESS;
     }
 
@@ -1549,6 +1558,7 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
        "Display Self-originated LSAs\n"
       )
 {
+  int idx_lsa = 4;
   int level;
   struct listnode *i, *j;
   struct ospf6 *o = ospf6;
@@ -1564,10 +1574,10 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated,
   argc--;
   argv++;
 
-  if ((inet_pton (AF_INET, argv[4]->arg, &id)) != 1)
+  if ((inet_pton (AF_INET, argv[idx_lsa]->arg, &id)) != 1)
     {
       vty_out (vty, "Link State ID is not parsable: %s%s",
-               argv[4]->arg, VNL);
+               argv[idx_lsa]->arg, VNL);
       return CMD_SUCCESS;
     }
 
index f39457ab77bb3482916e68417b1c4c1a0f383c8b..0b23916e6f5b6be9ae6e6a30976956d5f42ef400 100755 (executable)
@@ -289,7 +289,7 @@ def get_token_index_variable_name(line_number, token):
     elif token == 'confed|missing-as-worst':
         return 'idx_med_knob'
 
-    elif token == 'both|send|receive':
+    elif token == 'both|send|receive' or token == 'send|recv':
         return 'idx_send_recv'
 
     elif token == 'both|extended|standard':
@@ -319,6 +319,24 @@ def get_token_index_variable_name(line_number, token):
     elif token == 'md5|clear':
         return 'idx_encryption'
 
+    elif token == 'type-1|type-2':
+        return 'idx_external'
+
+    elif token == 'table|intra-area|inter-area|memory':
+        return 'idx_type'
+
+    elif token == 'unknown|hello|dbdesc|lsreq|lsupdate|lsack|all':
+        return 'idx_packet'
+
+    elif token == 'router|network|inter-prefix|inter-router|as-external|link|intra-prefix|unknown' or token == 'intra-area|inter-area|external-1|external-2' or token == 'router|network|inter-prefix|inter-router|as-external|group-membership|type-7|link|intra-prefix':
+        return 'idx_lsa'
+
+    elif token == 'broadcast|point-to-point':
+        return 'idx_network'
+
+    elif token == 'A.B.C.D|(0-4294967295)':
+        return 'idx_ipv4_number'
+
     elif token == 'narrow|transition|wide':
         return 'idx_metric_style'