]> git.proxmox.com Git - mirror_frr.git/commitdiff
ospfd: resolve CHECK ME's
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 29 Sep 2016 01:26:55 +0000 (01:26 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 29 Sep 2016 01:26:55 +0000 (01:26 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
ospfd/ospf_bfd.c
ospfd/ospf_dump.c
ospfd/ospf_opaque.c
ospfd/ospf_ri.c
ospfd/ospf_routemap.c
ospfd/ospf_te.c

index ae4691efa990b59ac4ef9b062abbdc8ace0a6fd6..803dc923ead846f47d6068b1f0acd80df949e428 100644 (file)
@@ -407,25 +407,16 @@ DEFUN (ip_ospf_bfd_param,
   return CMD_SUCCESS;
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf bfd (2-255) (50-60000) (50-60000)",
- *     NO_STR
- *     "IP Information\n"
- *     "OSPF interface commands\n"
- *     "Enables BFD support\n"
- *     "Detect Multiplier\n"
- *     "Required min receive interval\n"
- *     "Desired min transmit interval\n"
- *
- */
 DEFUN (no_ip_ospf_bfd,
        no_ip_ospf_bfd_cmd,
-       "no ip ospf bfd",
+       "no ip ospf bfd [(2-255) (50-60000) (50-60000)]",
        NO_STR
        "IP Information\n"
        "OSPF interface commands\n"
-       "Disables BFD support\n")
+       "Disables BFD support\n"
+       "Detect Multiplier\n"
+       "Required min receive interval\n"
+       "Desired min transmit interval\n")
 {
   struct interface *ifp = (struct interface *)vty->index;
   struct ospf_if_params *params;
@@ -442,7 +433,6 @@ DEFUN (no_ip_ospf_bfd,
   return CMD_SUCCESS;
 }
 
-
 void
 ospf_bfd_init(void)
 {
index 9952513dcf895cdc6e7f6e8dbad0cd5c248eea2c..bf71c7be6a4b2f30b7e063ffb4476c9030e67282 100644 (file)
@@ -753,54 +753,69 @@ ospf_packet_dump (struct stream *s)
   stream_set_getp (s, gp);
 }
 
+DEFUN (debug_ospf_packet,
+       debug_ospf_packet_cmd,
+       "debug ospf [(1-65535)] packet <hello|dd|ls-request|ls-update|ls-ack|all> [<send [detail]|recv [detail]|detail>]",
+       DEBUG_STR
+       OSPF_STR
+       "Instance ID\n"
+       "OSPF packets\n"
+       "OSPF Hello\n"
+       "OSPF Database Description\n"
+       "OSPF Link State Request\n"
+       "OSPF Link State Update\n"
+       "OSPF Link State Acknowledgment\n"
+       "OSPF all packets\n"
+       "Packet sent\n"
+       "Detail Information\n"
+       "Packet received\n"
+       "Detail Information\n"
+       "Detail Information\n")
+{
+  int inst = (argv[2]->type == RANGE_TKN) ? 1 : 0;
+  int detail = strmatch (argv[argc - 1]->text, "detail");
+  int send = strmatch (argv[argc - (1+detail)]->text, "send");
+  int recv = strmatch (argv[argc - (1+detail)]->text, "recv");
+  char *packet = argv[3 + inst]->text;
+
+  if (inst) // user passed instance ID
+  {
+    if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10)))
+      return CMD_SUCCESS;
+  }
 
-/*
-   [no] debug ospf [<1-65535>] packet (hello|dd|ls-request|ls-update|ls-ack|all)
-                          [send|recv [detail]]
-*/
-static int
-debug_ospf_packet_common (struct vty *vty, int arg_base, int argc,
-                          struct cmd_token **argv)
-{
   int type = 0;
   int flag = 0;
   int i;
 
-  assert (argc > arg_base + 0);
-
   /* Check packet type. */
-  if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0)
+  if (strmatch (packet, "hello"))
     type = OSPF_DEBUG_HELLO;
-  else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0)
+  else if (strmatch (packet, "dd"))
     type = OSPF_DEBUG_DB_DESC;
-  else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0)
+  else if (strmatch (packet, "ls-request"))
     type = OSPF_DEBUG_LS_REQ;
-  else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0)
+  else if (strmatch (packet, "ls-update"))
     type = OSPF_DEBUG_LS_UPD;
-  else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0)
+  else if (strmatch (packet, "ls-ack"))
     type = OSPF_DEBUG_LS_ACK;
-  else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0)
+  else if (strmatch (packet, "all"))
     type = OSPF_DEBUG_ALL;
 
-  /* Default, both send and recv. */
-  if (argc == arg_base + 1)
-    flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV;
-
-  /* send or recv. */
-  if (argc >= arg_base + 2)
-    {
-      if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0)
-       flag = OSPF_DEBUG_SEND;
-      else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0)
-       flag = OSPF_DEBUG_RECV;
-      else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0)
-       flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
-    }
-
-  /* detail. */
-  if (argc == arg_base + 3)
-    if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0)
-      flag |= OSPF_DEBUG_DETAIL;
+  /* Cases:
+   * (none)      = send + recv
+   * detail      = send + recv + detail
+   * recv        = recv
+   * send        = send
+   * recv detail = recv + detail
+   * send detail = send + detail
+   */
+  if (!send && !recv)
+    send = recv = 1;
+
+  flag |= (send) ? OSPF_DEBUG_SEND : 0;
+  flag |= (recv) ? OSPF_DEBUG_RECV : 0;
+  flag |= (detail) ? OSPF_DEBUG_DETAIL : 0;
 
   for (i = 0; i < 5; i++)
     if (type & (0x01 << i))
@@ -814,91 +829,10 @@ debug_ospf_packet_common (struct vty *vty, int arg_base, int argc,
   return CMD_SUCCESS;
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "OSPF packets\n"
- *     "OSPF Hello\n"
- *     "OSPF Database Description\n"
- *     "OSPF Link State Request\n"
- *     "OSPF Link State Update\n"
- *     "OSPF Link State Acknowledgment\n"
- *     "OSPF all packets\n"
- *     "Packet sent\n"
- *     "Packet received\n"
- *     "Detail Information\n"
- *
- * "debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "OSPF packets\n"
- *     "OSPF Hello\n"
- *     "OSPF Database Description\n"
- *     "OSPF Link State Request\n"
- *     "OSPF Link State Update\n"
- *     "OSPF Link State Acknowledgment\n"
- *     "OSPF all packets\n"
- *     "Packet sent\n"
- *     "Packet received\n"
- *     "Detail information\n"
- *
- */
-DEFUN (debug_ospf_packet,
-       debug_ospf_packet_all_cmd,
-       "debug ospf packet <hello|dd|ls-request|ls-update|ls-ack|all>",
-       DEBUG_STR
-       OSPF_STR
-       "OSPF packets\n"
-       "OSPF Hello\n"
-       "OSPF Database Description\n"
-       "OSPF Link State Request\n"
-       "OSPF Link State Update\n"
-       "OSPF Link State Acknowledgment\n"
-       "OSPF all packets\n")
-{
-  return (debug_ospf_packet_common(vty, 0, argc, argv));
-}
-
-
-       
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "Instance ID\n"
- *     "OSPF packets\n"
- *     "OSPF Hello\n"
- *     "OSPF Database Description\n"
- *     "OSPF Link State Request\n"
- *     "OSPF Link State Update\n"
- *     "OSPF Link State Acknowledgment\n"
- *     "OSPF all packets\n"
- *     "Packet sent\n"
- *     "Packet received\n"
- *     "Detail information\n"
- *
- * "debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "Instance ID\n"
- *     "OSPF packets\n"
- *     "OSPF Hello\n"
- *     "OSPF Database Description\n"
- *     "OSPF Link State Request\n"
- *     "OSPF Link State Update\n"
- *     "OSPF Link State Acknowledgment\n"
- *     "OSPF all packets\n"
- *     "Packet sent\n"
- *     "Packet received\n"
- *     "Detail Information\n"
- *
- */
-DEFUN (debug_ospf_instance_packet,
-       debug_ospf_instance_packet_all_cmd,
-       "debug ospf (1-65535) packet <hello|dd|ls-request|ls-update|ls-ack|all>",
+DEFUN (no_debug_ospf_packet,
+       no_debug_ospf_packet_cmd,
+       "no debug ospf [(1-65535)] packet <hello|dd|ls-request|ls-update|ls-ack|all> [<send [detail]|recv [detail]|detail>]",
+       NO_STR
        DEBUG_STR
        OSPF_STR
        "Instance ID\n"
@@ -908,63 +842,57 @@ DEFUN (debug_ospf_instance_packet,
        "OSPF Link State Request\n"
        "OSPF Link State Update\n"
        "OSPF Link State Acknowledgment\n"
-       "OSPF all packets\n")
-{
-  int idx_number = 2;
-  u_short instance = 0;
-
-  VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
-  if (!ospf_lookup_instance (instance))
-    return CMD_SUCCESS;
-
-  return (debug_ospf_packet_common(vty, 1, argc, argv));
-}
-
-
+       "OSPF all packets\n"
+       "Packet sent\n"
+       "Detail Information\n"
+       "Packet received\n"
+       "Detail Information\n"
+       "Detail Information\n")
+{
+  int inst = (argv[3]->type == RANGE_TKN) ? 1 : 0;
+  int detail = strmatch (argv[argc - 1]->text, "detail");
+  int send = strmatch (argv[argc - (1+detail)]->text, "send");
+  int recv = strmatch (argv[argc - (1+detail)]->text, "recv");
+  char *packet = argv[4 + inst]->text;
+
+  if (inst) // user passed instance ID
+  {
+    if (!ospf_lookup_instance (strtoul (argv[3]->arg, NULL, 10)))
+      return CMD_SUCCESS;
+  }
 
-static int
-no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc,
-                             struct cmd_token **argv)
-{
   int type = 0;
   int flag = 0;
   int i;
 
-  assert (argc > arg_base + 0);
-
   /* Check packet type. */
-  if (strncmp (argv[arg_base + 0]->arg, "h", 1) == 0)
+  if (strmatch (packet, "hello"))
     type = OSPF_DEBUG_HELLO;
-  else if (strncmp (argv[arg_base + 0]->arg, "d", 1) == 0)
+  else if (strmatch (packet, "dd"))
     type = OSPF_DEBUG_DB_DESC;
-  else if (strncmp (argv[arg_base + 0]->arg, "ls-r", 4) == 0)
+  else if (strmatch (packet, "ls-request"))
     type = OSPF_DEBUG_LS_REQ;
-  else if (strncmp (argv[arg_base + 0]->arg, "ls-u", 4) == 0)
+  else if (strmatch (packet, "ls-update"))
     type = OSPF_DEBUG_LS_UPD;
-  else if (strncmp (argv[arg_base + 0]->arg, "ls-a", 4) == 0)
+  else if (strmatch (packet, "ls-ack"))
     type = OSPF_DEBUG_LS_ACK;
-  else if (strncmp (argv[arg_base + 0]->arg, "a", 1) == 0)
+  else if (strmatch (packet, "all"))
     type = OSPF_DEBUG_ALL;
 
-  /* Default, both send and recv. */
-  if (argc == arg_base + 1)
-    flag = OSPF_DEBUG_SEND | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL ;
-
-  /* send or recv. */
-  if (argc == arg_base + 2)
-    {
-      if (strncmp (argv[arg_base + 1]->arg, "s", 1) == 0)
-       flag = OSPF_DEBUG_SEND | OSPF_DEBUG_DETAIL;
-      else if (strncmp (argv[arg_base + 1]->arg, "r", 1) == 0)
-       flag = OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
-      else if (strncmp (argv[arg_base + 1]->arg, "d", 1) == 0)
-       flag = OSPF_DEBUG_DETAIL | OSPF_DEBUG_RECV | OSPF_DEBUG_DETAIL;
-    }
-
-  /* detail. */
-  if (argc == arg_base + 3)
-    if (strncmp (argv[arg_base + 2]->arg, "d", 1) == 0)
-      flag = OSPF_DEBUG_DETAIL;
+  /* Cases:
+   * (none)      = send + recv
+   * detail      = send + recv + detail
+   * recv        = recv
+   * send        = send
+   * recv detail = recv + detail
+   * send detail = send + detail
+   */
+  if (!send && !recv)
+    send = recv = 1;
+
+  flag |= (send) ? OSPF_DEBUG_SEND : 0;
+  flag |= (recv) ? OSPF_DEBUG_RECV : 0;
+  flag |= (detail) ? OSPF_DEBUG_DETAIL : 0;
 
   for (i = 0; i < 5; i++)
     if (type & (0x01 << i))
@@ -985,135 +913,37 @@ no_debug_ospf_packet_common (struct vty *vty, int arg_base, int argc,
   return CMD_SUCCESS;
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
- *     NO_STR
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "OSPF packets\n"
- *     "OSPF Hello\n"
- *     "OSPF Database Description\n"
- *     "OSPF Link State Request\n"
- *     "OSPF Link State Update\n"
- *     "OSPF Link State Acknowledgment\n"
- *     "OSPF all packets\n"
- *     "Packet sent\n"
- *     "Packet received\n"
- *     "Detail Information\n"
- *
- * "no debug ospf packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
- *     NO_STR
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "OSPF packets\n"
- *     "OSPF Hello\n"
- *     "OSPF Database Description\n"
- *     "OSPF Link State Request\n"
- *     "OSPF Link State Update\n"
- *     "OSPF Link State Acknowledgment\n"
- *     "OSPF all packets\n"
- *     "Packet sent\n"
- *     "Packet received\n"
- *     "Detail Information\n"
- *
- */
-DEFUN (no_debug_ospf_packet,
-       no_debug_ospf_packet_all_cmd,
-       "no debug ospf packet <hello|dd|ls-request|ls-update|ls-ack|all>",
-       NO_STR
-       DEBUG_STR
-       OSPF_STR
-       "OSPF packets\n"
-       "OSPF Hello\n"
-       "OSPF Database Description\n"
-       "OSPF Link State Request\n"
-       "OSPF Link State Update\n"
-       "OSPF Link State Acknowledgment\n"
-       "OSPF all packets\n")
-{
-  return no_debug_ospf_packet_common(vty, 0, argc, argv);
-}
-
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv|detail)",
- *     NO_STR
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "Instance ID\n"
- *     "OSPF packets\n"
- *     "OSPF Hello\n"
- *     "OSPF Database Description\n"
- *     "OSPF Link State Request\n"
- *     "OSPF Link State Update\n"
- *     "OSPF Link State Acknowledgment\n"
- *     "OSPF all packets\n"
- *     "Packet sent\n"
- *     "Packet received\n"
- *     "Detail Information\n"
- *
- * "no debug ospf <1-65535> packet (hello|dd|ls-request|ls-update|ls-ack|all) (send|recv) (detail|)",
- *     NO_STR
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "Instance ID\n"
- *     "OSPF packets\n"
- *     "OSPF Hello\n"
- *     "OSPF Database Description\n"
- *     "OSPF Link State Request\n"
- *     "OSPF Link State Update\n"
- *     "OSPF Link State Acknowledgment\n"
- *     "OSPF all packets\n"
- *     "Packet sent\n"
- *     "Packet received\n"
- *     "Detail Information\n"
- *
- */
-DEFUN (no_debug_ospf_instance_packet,
-       no_debug_ospf_instance_packet_all_cmd,
-       "no debug ospf (1-65535) packet <hello|dd|ls-request|ls-update|ls-ack|all>",
-       NO_STR
+DEFUN (debug_ospf_ism,
+       debug_ospf_ism_cmd,
+       "debug ospf [(1-65535)] ism [<status|events|timers>]",
        DEBUG_STR
        OSPF_STR
        "Instance ID\n"
-       "OSPF packets\n"
-       "OSPF Hello\n"
-       "OSPF Database Description\n"
-       "OSPF Link State Request\n"
-       "OSPF Link State Update\n"
-       "OSPF Link State Acknowledgment\n"
-       "OSPF all packets\n")
+       "OSPF Interface State Machine\n"
+       "ISM Status Information\n"
+       "ISM Event Information\n"
+       "ISM TImer Information\n")
 {
-  int idx_number = 3;
-  u_short instance = 0;
-
-  VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
-  if (!ospf_lookup_instance (instance))
-    return CMD_SUCCESS;
-
-  return (no_debug_ospf_packet_common(vty, 1, argc, argv));
-}
-
-
+  int inst = (argv[2]->type == RANGE_TKN);
+  char *dbgparam = (argc == 4 + inst) ? argv[argc - 1]->text : NULL;
 
+  if (inst) // user passed instance ID
+  {
+    if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10)))
+      return CMD_SUCCESS;
+  }
 
-static int
-debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
-{
   if (vty->node == CONFIG_NODE)
     {
-      if (argc == arg_base + 0)
+      if (!dbgparam)
        DEBUG_ON (ism, ISM);
-      else if (argc == arg_base + 1)
+      else
        {
-         if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
+          if (strmatch (dbgparam, "status"))
            DEBUG_ON (ism, ISM_STATUS);
-         else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
+          else if (strmatch (dbgparam, "events"))
            DEBUG_ON (ism, ISM_EVENTS);
-         else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
+          else if (strmatch (dbgparam, "timers"))
            DEBUG_ON (ism, ISM_TIMERS);
        }
 
@@ -1121,167 +951,70 @@ debug_ospf_ism_common (struct vty *vty, int arg_base, int argc, struct cmd_token
     }
 
   /* ENABLE_NODE. */
-  if (argc == arg_base + 0)
+  if (!dbgparam)
     TERM_DEBUG_ON (ism, ISM);
-  else if (argc == arg_base + 1)
+  else
     {
-      if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
-       TERM_DEBUG_ON (ism, ISM_STATUS);
-      else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
-       TERM_DEBUG_ON (ism, ISM_EVENTS);
-      else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
-       TERM_DEBUG_ON (ism, ISM_TIMERS);
+      if (strmatch (dbgparam, "status"))
+        TERM_DEBUG_ON (ism, ISM_STATUS);
+      else if (strmatch (dbgparam, "events"))
+        TERM_DEBUG_ON (ism, ISM_EVENTS);
+      else if (strmatch (dbgparam, "timers"))
+        TERM_DEBUG_ON (ism, ISM_TIMERS);
     }
-
-  return CMD_SUCCESS;
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "debug ospf ism (status|events|timers)",
- *     DEBUG_STR
- *     OSPF_STR
- *     "OSPF Interface State Machine\n"
- *     "ISM Status Information\n"
- *     "ISM Event Information\n"
- *     "ISM TImer Information\n"
- *
- */
-DEFUN (debug_ospf_ism,
-       debug_ospf_ism_cmd,
-       "debug ospf ism",
-       DEBUG_STR
-       OSPF_STR
-       "OSPF Interface State Machine\n")
-{
-  return debug_ospf_ism_common(vty, 0, argc, argv);
-}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "debug ospf <1-65535> ism (status|events|timers)",
- *     DEBUG_STR
- *     OSPF_STR
- *     "Instance ID\n"
- *     "OSPF Interface State Machine\n"
- *     "ISM Status Information\n"
- *     "ISM Event Information\n"
- *     "ISM TImer Information\n"
- *
- */
-DEFUN (debug_ospf_instance_ism,
-       debug_ospf_instance_ism_cmd,
-       "debug ospf (1-65535) ism",
+DEFUN (no_debug_ospf_ism,
+       no_debug_ospf_ism_cmd,
+       "no debug ospf [(1-65535)] ism [<status|events|timers>]",
        DEBUG_STR
        OSPF_STR
        "Instance ID\n"
-       "OSPF Interface State Machine\n")
+       "OSPF Interface State Machine\n"
+       "ISM Status Information\n"
+       "ISM Event Information\n"
+       "ISM TImer Information\n")
 {
-  int idx_number = 2;
-  u_short instance = 0;
-
-  VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
-  if (!ospf_lookup_instance (instance))
-    return CMD_SUCCESS;
-
-  return debug_ospf_ism_common(vty, 1, argc, argv);
-}
+  int inst = (argv[3]->type == RANGE_TKN);
+  char *dbgparam = (argc == 5 + inst) ? argv[argc - 1]->text : NULL;
 
+  if (inst) // user passed instance ID
+  {
+    if (!ospf_lookup_instance (strtoul (argv[2]->arg, NULL, 10)))
+      return CMD_SUCCESS;
+  }
 
-static int
-no_debug_ospf_ism_common(struct vty *vty, int arg_base, int argc,
-                         struct cmd_token **argv)
-{
   if (vty->node == CONFIG_NODE)
     {
-      if (argc == arg_base + 0)
+      if (!dbgparam)
        DEBUG_OFF (ism, ISM);
-      else if (argc == arg_base + 1)
+      else
        {
-         if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
+          if (strmatch (dbgparam, "status"))
            DEBUG_OFF (ism, ISM_STATUS);
-         else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
+          else if (strmatch (dbgparam, "events"))
            DEBUG_OFF (ism, ISM_EVENTS);
-         else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
+          else if (strmatch (dbgparam, "timers"))
            DEBUG_OFF (ism, ISM_TIMERS);
        }
+
       return CMD_SUCCESS;
     }
 
   /* ENABLE_NODE. */
-  if (argc == arg_base + 0)
+  if (!dbgparam)
     TERM_DEBUG_OFF (ism, ISM);
-  else if (argc == arg_base + 1)
+  else
     {
-      if (strncmp (argv[arg_base + 0]->arg, "s", 1) == 0)
-       TERM_DEBUG_OFF (ism, ISM_STATUS);
-      else if (strncmp (argv[arg_base + 0]->arg, "e", 1) == 0)
-       TERM_DEBUG_OFF (ism, ISM_EVENTS);
-      else if (strncmp (argv[arg_base + 0]->arg, "t", 1) == 0)
-       TERM_DEBUG_OFF (ism, ISM_TIMERS);
+      if (strmatch (dbgparam, "status"))
+        TERM_DEBUG_OFF (ism, ISM_STATUS);
+      else if (strmatch (dbgparam, "events"))
+        TERM_DEBUG_OFF (ism, ISM_EVENTS);
+      else if (strmatch (dbgparam, "timers"))
+        TERM_DEBUG_OFF (ism, ISM_TIMERS);
     }
-
-  return CMD_SUCCESS;
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no debug ospf ism (status|events|timers)",
- *     NO_STR
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "OSPF Interface State Machine\n"
- *     "ISM Status Information\n"
- *     "ISM Event Information\n"
- *     "ISM Timer Information\n"
- *
- */
-DEFUN (no_debug_ospf_ism,
-       no_debug_ospf_ism_cmd,
-       "no debug ospf ism",
-       NO_STR
-       DEBUG_STR
-       OSPF_STR
-       "OSPF Interface State Machine")
-{
-  return no_debug_ospf_ism_common(vty, 0, argc, argv);
-}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no debug ospf <1-65535> ism (status|events|timers)",
- *     NO_STR
- *     "Debugging functions\n"
- *     "OSPF information\n"
- *     "Instance ID\n"
- *     "OSPF Interface State Machine\n"
- *     "ISM Status Information\n"
- *     "ISM Event Information\n"
- *     "ISM Timer Information\n"
- *
- */
-DEFUN (no_debug_ospf_instance_ism,
-       no_debug_ospf_instance_ism_cmd,
-       "no debug ospf (1-65535) ism",
-       NO_STR
-       DEBUG_STR
-       OSPF_STR
-       "Instance ID\n"
-       "OSPF Interface State Machine")
-{
-  int idx_number = 3;
-  u_short instance = 0;
-
-  VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
-  if (!ospf_lookup_instance (instance))
-    return CMD_SUCCESS;
-
-  return no_debug_ospf_ism_common(vty, 1, argc, argv);
-}
-
-
 static int
 debug_ospf_nsm_common (struct vty *vty, int arg_base, int argc, struct cmd_token **argv)
 {
@@ -2355,15 +2088,16 @@ debug_init ()
   install_element (ENABLE_NODE, &no_debug_ospf_te_cmd);
 
   install_element (ENABLE_NODE, &show_debugging_ospf_instance_cmd);
-  install_element (ENABLE_NODE, &debug_ospf_instance_packet_all_cmd);
-  install_element (ENABLE_NODE, &debug_ospf_instance_ism_cmd);
+  install_element (ENABLE_NODE, &debug_ospf_packet_cmd);
+  install_element (ENABLE_NODE, &no_debug_ospf_packet_cmd);
+  install_element (ENABLE_NODE, &debug_ospf_ism_cmd);
+  install_element (ENABLE_NODE, &no_debug_ospf_ism_cmd);
+
   install_element (ENABLE_NODE, &debug_ospf_instance_nsm_cmd);
   install_element (ENABLE_NODE, &debug_ospf_instance_lsa_cmd);
   install_element (ENABLE_NODE, &debug_ospf_instance_zebra_cmd);
   install_element (ENABLE_NODE, &debug_ospf_instance_event_cmd);
   install_element (ENABLE_NODE, &debug_ospf_instance_nssa_cmd);
-  install_element (ENABLE_NODE, &no_debug_ospf_instance_packet_all_cmd);
-  install_element (ENABLE_NODE, &no_debug_ospf_instance_ism_cmd);
   install_element (ENABLE_NODE, &no_debug_ospf_instance_nsm_cmd);
   install_element (ENABLE_NODE, &no_debug_ospf_instance_lsa_cmd);
   install_element (ENABLE_NODE, &no_debug_ospf_instance_zebra_cmd);
@@ -2371,8 +2105,13 @@ debug_init ()
   install_element (ENABLE_NODE, &no_debug_ospf_instance_nssa_cmd);
   install_element (ENABLE_NODE, &no_debug_ospf_cmd);
 
-  install_element (CONFIG_NODE, &debug_ospf_packet_all_cmd);
+
+
+  install_element (CONFIG_NODE, &debug_ospf_packet_cmd);
+  install_element (CONFIG_NODE, &no_debug_ospf_packet_cmd);
   install_element (CONFIG_NODE, &debug_ospf_ism_cmd);
+  install_element (CONFIG_NODE, &no_debug_ospf_ism_cmd);
+
   install_element (CONFIG_NODE, &debug_ospf_nsm_cmd);
   install_element (CONFIG_NODE, &debug_ospf_lsa_cmd);
   install_element (CONFIG_NODE, &debug_ospf_zebra_cmd);
@@ -2388,15 +2127,11 @@ debug_init ()
   install_element (CONFIG_NODE, &no_debug_ospf_nssa_cmd);
   install_element (CONFIG_NODE, &no_debug_ospf_te_cmd);
 
-  install_element (CONFIG_NODE, &debug_ospf_instance_packet_all_cmd);
-  install_element (CONFIG_NODE, &debug_ospf_instance_ism_cmd);
   install_element (CONFIG_NODE, &debug_ospf_instance_nsm_cmd);
   install_element (CONFIG_NODE, &debug_ospf_instance_lsa_cmd);
   install_element (CONFIG_NODE, &debug_ospf_instance_zebra_cmd);
   install_element (CONFIG_NODE, &debug_ospf_instance_event_cmd);
   install_element (CONFIG_NODE, &debug_ospf_instance_nssa_cmd);
-  install_element (CONFIG_NODE, &no_debug_ospf_instance_packet_all_cmd);
-  install_element (CONFIG_NODE, &no_debug_ospf_instance_ism_cmd);
   install_element (CONFIG_NODE, &no_debug_ospf_instance_nsm_cmd);
   install_element (CONFIG_NODE, &no_debug_ospf_instance_lsa_cmd);
   install_element (CONFIG_NODE, &no_debug_ospf_instance_zebra_cmd);
index 9ffb50896f6d7caaf3d2a86f34e055433895121c..a1981be86db7074e818bd1d2fdc75dfdb16c59af 100644 (file)
@@ -763,13 +763,6 @@ out:
  * Followings are (vty) configuration functions for Opaque-LSAs handling.
  *------------------------------------------------------------------------*/
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ospf opaque-lsa",
- *     "OSPF specific commands\n"
- *     "Enable the Opaque-LSA capability (rfc2370)\n"
- *
- */
 DEFUN (capability_opaque,
        capability_opaque_cmd,
        "capability opaque",
@@ -793,15 +786,15 @@ DEFUN (capability_opaque,
   return CMD_SUCCESS;
 }
 
+DEFUN (ospf_opaque,
+       ospf_opaque_cmd,
+       "ospf opaque-lsa",
+       "OSPF specific commands\n"
+       "Enable the Opaque-LSA capability (rfc2370)\n")
+{
+  return capability_opaque (self, vty, argc, argv);
+}
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf opaque-lsa",
- *     NO_STR
- *     "OSPF specific commands\n"
- *     "Disable the Opaque-LSA capability (rfc2370)\n"
- *
- */
 DEFUN (no_capability_opaque,
        no_capability_opaque_cmd,
        "no capability opaque",
@@ -826,12 +819,23 @@ DEFUN (no_capability_opaque,
   return CMD_SUCCESS;
 }
 
+DEFUN (no_ospf_opaque,
+       no_ospf_opaque_cmd,
+       "no ospf opaque-lsa",
+       NO_STR
+       "OSPF specific commands\n"
+       "Enable the Opaque-LSA capability (rfc2370)\n")
+{
+  return no_capability_opaque (self, vty, argc, argv);
+}
 
 static void
 ospf_opaque_register_vty (void)
 {
   install_element (OSPF_NODE, &capability_opaque_cmd);
   install_element (OSPF_NODE, &no_capability_opaque_cmd);
+  install_element (OSPF_NODE, &ospf_opaque_cmd);
+  install_element (OSPF_NODE, &no_ospf_opaque_cmd);
   return;
 }
 
index d3875e373b176e900dbbc4d29b5956c9ad0df76f..151adadb9a218cd705d27c03fd6bed3101ce3fd3 100644 (file)
@@ -1174,21 +1174,16 @@ ospf_router_info_config_write_router (struct vty *vty)
  * Followings are vty command functions.
  *------------------------------------------------------------------------*/
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "router-info as",
- *     OSPF_RI_STR
- *     "Enable the Router Information functionality with AS flooding scope\n"
- *
- */
 DEFUN (router_info,
        router_info_area_cmd,
-       "router-info area A.B.C.D",
+       "router-info <as|area A.B.C.D>",
        OSPF_RI_STR
+       "Enable the Router Information functionality with AS flooding scope\n"
        "Enable the Router Information functionality with Area flooding scope\n"
        "OSPF area ID in IP format")
 {
   int idx_ipv4 = 2;
+  char *area = (argc == 3) ? argv[2]->arg : NULL;
 
   u_int8_t scope;
 
@@ -1196,14 +1191,9 @@ DEFUN (router_info,
     return CMD_SUCCESS;
 
   /* Check and get Area value if present */
-  if (argc == 1)
+  if (area)
     {
-      if (!inet_aton (argv[idx_ipv4]->arg, &OspfRI.area_id))
-        {
-          vty_out (vty, "Please specify Router Info Area by A.B.C.D%s",
-                   VTY_NEWLINE);
-          return CMD_WARNING;
-        }
+      inet_aton (area, &OspfRI.area_id);
       scope = OSPF_OPAQUE_AREA_LSA;
     }
   else
index e2a5f53fa61d1b3d462d283b1850af0faa0883f7..21dca9546ce2091cb3eda72beb35b6a2333760a2 100644 (file)
@@ -704,27 +704,19 @@ DEFUN (match_ip_nexthop,
   return ospf_route_match_add (vty, vty->index, "ip next-hop", argv[idx_acl]->arg);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no match ip next-hop (<1-199>|<1300-2699>|WORD)",
- *     NO_STR
- *     MATCH_STR
- *     IP_STR
- *     "Match next-hop address of route\n"
- *     "IP access-list number\n"
- *     "IP access-list number (expanded range)\n"
- *     "IP access-list name\n"
- *
- */
 DEFUN (no_match_ip_nexthop,
        no_match_ip_nexthop_cmd,
-       "no match ip next-hop",
+       "no match ip next-hop [<(1-199)|(1300-2699)|WORD>]",
        NO_STR
        MATCH_STR
        IP_STR
-       "Match next-hop address of route\n")
+       "Match next-hop address of route\n"
+       "IP access-list number\n"
+       "IP access-list number (expanded range)\n"
+       "IP access-list name\n")
 {
-  return ospf_route_match_delete (vty, vty->index, "ip next-hop", argv[4]->arg);
+  char *al = (argc == 5) ? argv[4]->arg : NULL;
+  return ospf_route_match_delete (vty, vty->index, "ip next-hop", al);
 }
 
 
@@ -742,28 +734,18 @@ DEFUN (match_ip_next_hop_prefix_list,
                               argv[idx_word]->arg);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no match ip next-hop prefix-list WORD",
- *     NO_STR
- *     MATCH_STR
- *     IP_STR
- *     "Match next-hop address of route\n"
- *     "Match entries of prefix-lists\n"
- *     "IP prefix-list name\n"
- *
- */
 DEFUN (no_match_ip_next_hop_prefix_list,
        no_match_ip_next_hop_prefix_list_cmd,
-       "no match ip next-hop prefix-list",
+       "no match ip next-hop prefix-list [WORD]",
        NO_STR
        MATCH_STR
        IP_STR
        "Match next-hop address of route\n"
-       "Match entries of prefix-lists\n")
+       "Match entries of prefix-lists\n"
+       "IP prefix-list name\n")
 {
-  return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list",
-                                 argv[5]->arg);
+  char *pl = (argc == 6) ? argv[5]->arg : NULL;
+  return ospf_route_match_delete (vty, vty->index, "ip next-hop prefix-list", pl);
 }
 
 
@@ -781,30 +763,21 @@ DEFUN (match_ip_address,
   return ospf_route_match_add (vty, vty->index, "ip address", argv[idx_acl]->arg);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no match ip address (<1-199>|<1300-2699>|WORD)",
- *     NO_STR
- *     MATCH_STR
- *     IP_STR
- *     "Match address of route\n"
- *     "IP access-list number\n"
- *     "IP access-list number (expanded range)\n"
- *     "IP access-list name\n"
- *
- */
 DEFUN (no_match_ip_address,
        no_match_ip_address_cmd,
-       "no match ip address",
+       "no match ip address [<(1-199)|(1300-2699)|WORD>]",
        NO_STR
        MATCH_STR
        IP_STR
-       "Match address of route\n")
+       "Match address of route\n"
+       "IP access-list number\n"
+       "IP access-list number (expanded range)\n"
+       "IP access-list name\n")
 {
-  return ospf_route_match_delete (vty, vty->index, "ip address", argv[4]->arg);
+  char *al = (argc == 5) ? argv[4]->arg : NULL;
+  return ospf_route_match_delete (vty, vty->index, "ip address", al);
 }
 
-
 DEFUN (match_ip_address_prefix_list,
        match_ip_address_prefix_list_cmd,
        "match ip address prefix-list WORD",
@@ -819,31 +792,20 @@ DEFUN (match_ip_address_prefix_list,
                               argv[idx_word]->arg);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no match ip address prefix-list WORD",
- *     NO_STR
- *     MATCH_STR
- *     IP_STR
- *     "Match address of route\n"
- *     "Match entries of prefix-lists\n"
- *     "IP prefix-list name\n"
- *
- */
 DEFUN (no_match_ip_address_prefix_list,
        no_match_ip_address_prefix_list_cmd,
-       "no match ip address prefix-list",
+       "no match ip address prefix-list [WORD]",
        NO_STR
        MATCH_STR
        IP_STR
        "Match address of route\n"
        "Match entries of prefix-lists\n")
+       "IP prefix-list name\n"
 {
-  return ospf_route_match_delete (vty, vty->index, "ip address prefix-list",
-                                 argv[5]->arg);
+  char *pl = (argc == 6) ? argv[5]->arg : NULL;
+  return ospf_route_match_delete (vty, vty->index, "ip address prefix-list", pl);
 }
 
-
 DEFUN (match_interface,
        match_interface_cmd,
        "match interface WORD",
@@ -855,26 +817,18 @@ DEFUN (match_interface,
   return ospf_route_match_add (vty, vty->index, "interface", argv[idx_word]->arg);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no match interface WORD",
- *     NO_STR
- *     MATCH_STR
- *     "Match first hop interface of route\n"
- *     "Interface name\n"
- *
- */
 DEFUN (no_match_interface,
        no_match_interface_cmd,
-       "no match interface",
+       "no match interface [INTERFACE]",
        NO_STR
        MATCH_STR
-       "Match first hop interface of route\n")
+       "Match first hop interface of route\n"
+       "Interface name\n")
 {
-  return ospf_route_match_delete (vty, vty->index, "interface", argv[3]->arg);
+  char *iface = (argc == 4) ? argv[3]->arg : NULL;
+  return ospf_route_match_delete (vty, vty->index, "interface", iface);
 }
 
-
 DEFUN (match_tag,
        match_tag_cmd,
        "match tag (1-65535)",
@@ -886,26 +840,18 @@ DEFUN (match_tag,
   return ospf_route_match_add (vty, vty->index, "tag", argv[idx_number]->arg);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no match tag <1-65535>",
- *     NO_STR
- *     MATCH_STR
- *     "Match tag of route\n"
- *     "Tag value\n"
- *
- */
 DEFUN (no_match_tag,
        no_match_tag_cmd,
-       "no match tag",
+       "no match tag [(1-65535)]",
        NO_STR
        MATCH_STR
-       "Match tag of route\n")
+       "Match tag of route\n"
+       "Tag value\n")
 {
-  return ospf_route_match_delete (vty, vty->index, "tag", argv[3]->arg);
+  char *tag = (argc == 4) ? argv[3]->arg : NULL;
+  return ospf_route_match_delete (vty, vty->index, "tag", tag);
 }
 
-
 DEFUN (set_metric,
        set_metric_cmd,
        "set metric (0-4294967295)",
@@ -917,26 +863,18 @@ DEFUN (set_metric,
   return ospf_route_set_add (vty, vty->index, "metric", argv[idx_number]->arg);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no set metric <0-4294967295>",
- *     NO_STR
- *     SET_STR
- *     "Metric value for destination routing protocol\n"
- *     "Metric value\n"
- *
- */
 DEFUN (no_set_metric,
        no_set_metric_cmd,
-       "no set metric",
+       "no set metric [(0-4294967295)]",
        NO_STR
        SET_STR
-       "Metric value for destination routing protocol\n")
+       "Metric value for destination routing protocol\n"
+       "Metric value\n")
 {
-  return ospf_route_set_delete (vty, vty->index, "metric", argv[3]->arg);
+  char *mval = (argc == 4) ? argv[3]->arg : NULL;
+  return ospf_route_set_delete (vty, vty->index, "metric", mval);
 }
 
-
 DEFUN (set_metric_type,
        set_metric_type_cmd,
        "set metric-type <type-1|type-2>",
@@ -945,36 +883,23 @@ DEFUN (set_metric_type,
        "OSPF[6] external type 1 metric\n"
        "OSPF[6] external type 2 metric\n")
 {
-  int idx_external = 2;
-  if (strcmp (argv[idx_external]->arg, "1") == 0)
-    return ospf_route_set_add (vty, vty->index, "metric-type", "type-1");
-  if (strcmp (argv[idx_external]->arg, "2") == 0)
-    return ospf_route_set_add (vty, vty->index, "metric-type", "type-2");
-
-  return ospf_route_set_add (vty, vty->index, "metric-type", argv[idx_external]->arg);
+  char *ext = argv[2]->text;
+  return ospf_route_set_add (vty, vty->index, "metric-type", ext);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no set metric-type (type-1|type-2)",
- *     NO_STR
- *     SET_STR
- *     "Type of metric for destination routing protocol\n"
- *     "OSPF[6] external type 1 metric\n"
- *     "OSPF[6] external type 2 metric\n"
- *
- */
 DEFUN (no_set_metric_type,
        no_set_metric_type_cmd,
-       "no set metric-type",
+       "no set metric-type [<type-1|type-2>]",
        NO_STR
        SET_STR
        "Type of metric for destination routing protocol\n")
+       "OSPF[6] external type 1 metric\n"
+       "OSPF[6] external type 2 metric\n"
 {
-  return ospf_route_set_delete (vty, vty->index, "metric-type", argv[3]->arg);
+  char *ext = (argc == 4) ? argv[3]->text : NULL;
+  return ospf_route_set_delete (vty, vty->index, "metric-type", ext);
 }
 
-
 DEFUN (set_tag,
        set_tag_cmd,
        "set tag (1-65535)",
@@ -986,23 +911,16 @@ DEFUN (set_tag,
   return ospf_route_set_add (vty, vty->index, "tag", argv[idx_number]->arg);
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no set tag <1-65535>",
- *     NO_STR
- *     SET_STR
- *     "Tag value for routing protocol\n"
- *     "Tag value\n"
- *
- */
 DEFUN (no_set_tag,
        no_set_tag_cmd,
-       "no set tag",
+       "no set tag [(1-65535)]",
        NO_STR
        SET_STR
-       "Tag value for routing protocol\n")
+       "Tag value for routing protocol\n"
+       "Tag value\n")
 {
-  return ospf_route_set_delete (vty, vty->index, "tag", argv[3]->arg);
+  char *tag = (argc == 4) ? argv[3]->arg : NULL;
+  return ospf_route_set_delete (vty, vty->index, "tag", tag);
 }
 
 
index 7994bddca1ec22d44331248609c9874ab76300ff..2044500f1ebe44839b6298c848194c8691aa1f9f 100644 (file)
@@ -2297,17 +2297,9 @@ DEFUN (ospf_mpls_te_on,
   return CMD_SUCCESS;
 }
 
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no mpls-te on",
- *     NO_STR
- *     MPLS_TE_STR
- *     "Disable the MPLS-TE functionality\n"
- *
- */
 DEFUN (no_ospf_mpls_te,
        no_ospf_mpls_te_cmd,
-       "no mpls-te",
+       "no mpls-tei [on]",
        NO_STR
        "Disable the MPLS-TE functionality\n")
 {