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))
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"
"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))
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);
}
}
/* 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)
{
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);
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);
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);
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);
}
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);
}
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",
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",
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)",
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)",
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>",
"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)",
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);
}