summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-02 11:18:32 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-06-02 11:18:32 -0700
commit6a57c45bef829c637fe0dcb2f23bb88a2241f35a (patch)
treea8ee8c8833db74fddb92bab1f0791243a602c901
parent2fa1fd76a2d270c0a4a96c8dd382a901e7ec81c5 (diff)
downloadquagga-6a57c45bef829c637fe0dcb2f23bb88a2241f35a.tar.bz2
quagga-6a57c45bef829c637fe0dcb2f23bb88a2241f35a.tar.xz
Add show ospf6 debuggging
Implement new ospf6 debugging command Bug 4188
-rw-r--r--ospf6d/ospf6_lsa.c4
-rw-r--r--ospf6d/ospf6_lsa.h1
-rw-r--r--ospf6d/ospf6_message.c15
-rw-r--r--ospf6d/ospf6_message.h1
-rw-r--r--ospf6d/ospf6d.c116
5 files changed, 127 insertions, 10 deletions
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index e8290b63..3111b631 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -708,8 +708,8 @@ ospf6_lsa_init (void)
}
-static char *
-ospf6_lsa_handler_name (struct ospf6_lsa_handler *h)
+const char *
+ospf6_lsa_handler_name (const struct ospf6_lsa_handler *h)
{
static char buf[64];
unsigned int i;
diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h
index fb0f27cd..989dfb57 100644
--- a/ospf6d/ospf6_lsa.h
+++ b/ospf6d/ospf6_lsa.h
@@ -223,6 +223,7 @@ extern void ospf6_lsa_show_summary (struct vty *vty, struct ospf6_lsa *lsa);
extern void ospf6_lsa_show_dump (struct vty *vty, struct ospf6_lsa *lsa);
extern void ospf6_lsa_show_internal (struct vty *vty, struct ospf6_lsa *lsa);
extern void ospf6_lsa_show (struct vty *vty, struct ospf6_lsa *lsa);
+extern const char *ospf6_lsa_handler_name (const struct ospf6_lsa_handler *h);
extern struct ospf6_lsa *ospf6_lsa_create (struct ospf6_lsa_header *header);
extern struct ospf6_lsa *ospf6_lsa_create_headeronly (struct ospf6_lsa_header *header);
diff --git a/ospf6d/ospf6_message.c b/ospf6d/ospf6_message.c
index c257092a..176e2244 100644
--- a/ospf6d/ospf6_message.c
+++ b/ospf6d/ospf6_message.c
@@ -2057,11 +2057,11 @@ ALIAS (no_debug_ospf6_message,
"Debug only receiving message\n"
)
+const char *ospf6_packet_type_str[] = {"unknown", "hello", "dbdesc",
+ "lsreq", "lsupdate", "lsack"};
int
config_write_ospf6_debug_message (struct vty *vty)
{
- const char *type_str[] = {"unknown", "hello", "dbdesc",
- "lsreq", "lsupdate", "lsack"};
unsigned char s = 0, r = 0;
int i;
@@ -2103,13 +2103,14 @@ config_write_ospf6_debug_message (struct vty *vty)
{
if (IS_OSPF6_DEBUG_MESSAGE (i, SEND) &&
IS_OSPF6_DEBUG_MESSAGE (i, RECV))
- vty_out (vty, "debug ospf6 message %s%s", type_str[i], VNL);
+ vty_out (vty, "debug ospf6 message %s%s",
+ ospf6_packet_type_str[i], VNL);
else if (IS_OSPF6_DEBUG_MESSAGE (i, SEND))
- vty_out (vty, "debug ospf6 message %s send%s", type_str[i],
- VNL);
+ vty_out (vty, "debug ospf6 message %s send%s",
+ ospf6_packet_type_str[i], VNL);
else if (IS_OSPF6_DEBUG_MESSAGE (i, RECV))
- vty_out (vty, "debug ospf6 message %s recv%s", type_str[i],
- VNL);
+ vty_out (vty, "debug ospf6 message %s recv%s",
+ ospf6_packet_type_str[i], VNL);
}
return 0;
diff --git a/ospf6d/ospf6_message.h b/ospf6d/ospf6_message.h
index ebb6308e..454a291a 100644
--- a/ospf6d/ospf6_message.h
+++ b/ospf6d/ospf6_message.h
@@ -47,6 +47,7 @@ extern unsigned char conf_debug_ospf6_message[];
#define OSPF6_MESSAGE_TYPE_CANONICAL(T) \
((T) > OSPF6_MESSAGE_TYPE_LSACK ? OSPF6_MESSAGE_TYPE_UNKNOWN : (T))
+extern const char *ospf6_packet_type_str[];
extern const char *ospf6_message_type_str[];
#define OSPF6_MESSAGE_TYPE_NAME(T) \
(ospf6_message_type_str[ OSPF6_MESSAGE_TYPE_CANONICAL (T) ])
diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c
index bb091d4f..80598da1 100644
--- a/ospf6d/ospf6d.c
+++ b/ospf6d/ospf6d.c
@@ -48,7 +48,9 @@
#include "ospf6_snmp.h"
#endif /*HAVE_SNMP*/
-char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
+const char ospf6_daemon_version[] = OSPF6_DAEMON_VERSION;
+
+extern vector ospf6_lsa_handler_vector;
struct route_node *
route_prev (struct route_node *node)
@@ -92,6 +94,117 @@ DEFUN (show_version_ospf6,
return CMD_SUCCESS;
}
+
+DEFUN (show_debugging_ospf6,
+ show_debugging_ospf6_cmd,
+ "show debugging ospf6",
+ SHOW_STR
+ DEBUG_STR
+ OSPF6_STR)
+{
+ int i;
+ char buf[INET6_ADDRSTRLEN];
+
+ vty_out (vty, "OSPF6 debugging status:%s", VNL);
+
+ if (IS_OSPF6_DEBUG_ABR)
+ vty_out (vty, " OSPF6 ABR debugging is on%s", VNL);
+
+ if (IS_OSPF6_DEBUG_ASBR)
+ vty_out (vty, " OSPF6 ASBR debugging is on%s", VNL);
+
+ if (IS_OSPF6_DEBUG_INTERFACE)
+ vty_out (vty, " OSPF6 Interface debugging is on%s", VNL);
+
+ if (IS_OSPF6_DEBUG_FLOODING)
+ vty_out (vty, " OSPF6 flooding debugging is on%s", VNL);
+
+ /* show packet debugging */
+ for (i = 0; i < 6; i++)
+ {
+ if (IS_OSPF6_DEBUG_MESSAGE (i, SEND) && IS_OSPF6_DEBUG_MESSAGE (i, RECV))
+ vty_out (vty, " OSPF6 packet %s debugging is on%s",
+ ospf6_packet_type_str[i], VNL);
+
+ else if (IS_OSPF6_DEBUG_MESSAGE (i, SEND))
+ vty_out (vty, " OSPF6 packet %s send debugging is on%s",
+ ospf6_packet_type_str[i], VNL);
+ else if (IS_OSPF6_DEBUG_MESSAGE (i, RECV))
+ vty_out (vty, " OSPF6 packet %s receive debugging is on%s",
+ ospf6_packet_type_str[i], VNL);
+ }
+
+ if (IS_OSPF6_DEBUG_SPF (PROCESS))
+ vty_out (vty, " OSPF6 SPF process debugging is on%s", VNL);
+ if (IS_OSPF6_DEBUG_SPF (TIME))
+ vty_out (vty, " OSPF6 SPF time debugging is on%s", VNL);
+ if (IS_OSPF6_DEBUG_SPF (DATABASE))
+ vty_out (vty, " OSPF6 SPF database debugging is on%s", VNL);
+
+ if (IS_OSPF6_DEBUG_ROUTE (TABLE))
+ vty_out (vty, " OSPF6 route table debugging is on%s", VNL);
+ if (IS_OSPF6_DEBUG_ROUTE (INTRA))
+ vty_out (vty, " OSPF6 route intra-area debugging is on%s", VNL);
+ if (IS_OSPF6_DEBUG_ROUTE (INTER))
+ vty_out (vty, " OSPF6 route inter-area debugging is on%s", VNL);
+ if (IS_OSPF6_DEBUG_ROUTE (MEMORY))
+ vty_out (vty, " OSPF6 route memory debugging is on%s", VNL);
+
+
+ /* Show neighbor debugging */
+ if (IS_OSPF6_DEBUG_NEIGHBOR (STATE) && IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
+ vty_out (vty, " OSPF6 neighbor debugging is on%s", VNL);
+ else if (IS_OSPF6_DEBUG_NEIGHBOR (STATE))
+ vty_out (vty, " OSPF6 neighbor state debugging is on%s", VNL);
+ else if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
+ vty_out (vty, " OSPF6 neighbor event debugging is on%s", VNL);
+
+ /* Show debug status for OSPF LSAs. */
+ for (i = 0; i < vector_active (ospf6_lsa_handler_vector); i++)
+ {
+ const struct ospf6_lsa_handler *handler
+ = vector_slot (ospf6_lsa_handler_vector, i);
+ if (handler == NULL)
+ continue;
+
+ if (CHECK_FLAG (handler->debug, OSPF6_LSA_DEBUG))
+ vty_out (vty, " OSPF6 LSA %s debugging is on%s",
+ ospf6_lsa_handler_name (handler), VNL);
+ if (CHECK_FLAG (handler->debug, OSPF6_LSA_DEBUG_ORIGINATE))
+ vty_out (vty, " OSPF6 LSA %s origination debugging is on%s",
+ ospf6_lsa_handler_name (handler), VNL);
+ if (CHECK_FLAG (handler->debug, OSPF6_LSA_DEBUG_EXAMIN))
+ vty_out (vty, " OSPF6 LSA %s examination debugging is on%s",
+ ospf6_lsa_handler_name (handler), VNL);
+ if (CHECK_FLAG (handler->debug, OSPF6_LSA_DEBUG_FLOOD))
+ vty_out (vty, " OSPF6 LSA %s flooding debugging is on%s",
+ ospf6_lsa_handler_name (handler), VNL);
+ }
+
+ /* Show debug status for brouter */
+ if (IS_OSPF6_DEBUG_BROUTER)
+ vty_out (vty, " OSPF6 border-router debugging is on%s", VNL);
+ if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER)
+ vty_out (vty, " OSPF6 border-routers router-id %s debugging is on%s",
+ inet_ntop (AF_INET, &conf_debug_ospf6_brouter_specific_router_id,
+ buf, sizeof (buf)), VNL);
+ if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_AREA)
+ vty_out (vty, " OSPF6 border-routers area-id %s debugging is on%s",
+ inet_ntop (AF_INET, &conf_debug_ospf6_brouter_specific_area_id,
+ buf, sizeof (buf)), VNL);
+
+
+ /* Show debug status for Zebra. */
+ if (IS_OSPF6_DEBUG_ZEBRA (SEND) && IS_OSPF6_DEBUG_ZEBRA (RECV))
+ vty_out (vty, " OSPF6 Zebra debugging is on%s", VNL);
+ else if (IS_OSPF6_DEBUG_ZEBRA (SEND))
+ vty_out (vty, " OSPF6 Zebra send debugging is on%s", VNL);
+ else if (IS_OSPF6_DEBUG_ZEBRA (RECV))
+ vty_out (vty, " OSPF6 Zebra recv debugging is on%s", VNL);
+
+ return CMD_SUCCESS;
+}
+
static struct cmd_node debug_node =
{
DEBUG_NODE,
@@ -1778,6 +1891,7 @@ ospf6_init (void)
install_node (&debug_node, config_write_ospf6_debug);
+ install_element (ENABLE_NODE, &show_debugging_ospf6_cmd);
install_element_ospf6_debug_message ();
install_element_ospf6_debug_lsa ();
install_element_ospf6_debug_interface ();