summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospf6d/ospf6_lsa.c43
-rw-r--r--ospf6d/ospf6_lsa.h3
-rw-r--r--ospf6d/ospf6_route.c71
-rw-r--r--ospf6d/ospf6_route.h5
-rw-r--r--ospf6d/subdir.am1
5 files changed, 80 insertions, 43 deletions
diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c
index 1bc1ce9cdf..ac07704d2c 100644
--- a/ospf6d/ospf6_lsa.c
+++ b/ospf6d/ospf6_lsa.c
@@ -1021,6 +1021,30 @@ static char *ospf6_lsa_handler_name(const struct ospf6_lsa_handler *h)
return buf;
}
+DEFPY (debug_ospf6_lsa_all,
+ debug_ospf6_lsa_all_cmd,
+ "[no$no] debug ospf6 lsa all",
+ NO_STR
+ DEBUG_STR
+ OSPF6_STR
+ "Debug Link State Advertisements (LSAs)\n"
+ "Display for all types of LSAs\n")
+{
+ unsigned int i;
+ struct ospf6_lsa_handler *handler = NULL;
+
+ for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) {
+ handler = vector_slot(ospf6_lsa_handler_vector, i);
+ if (handler == NULL)
+ continue;
+ if (!no)
+ SET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_ALL);
+ else
+ UNSET_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_ALL);
+ }
+ return CMD_SUCCESS;
+}
+
DEFPY (debug_ospf6_lsa_aggregation,
debug_ospf6_lsa_aggregation_cmd,
"[no] debug ospf6 lsa aggregation",
@@ -1152,6 +1176,8 @@ DEFUN (no_debug_ospf6_lsa_type,
void install_element_ospf6_debug_lsa(void)
{
+ install_element(ENABLE_NODE, &debug_ospf6_lsa_all_cmd);
+ install_element(CONFIG_NODE, &debug_ospf6_lsa_all_cmd);
install_element(ENABLE_NODE, &debug_ospf6_lsa_hex_cmd);
install_element(ENABLE_NODE, &no_debug_ospf6_lsa_hex_cmd);
install_element(CONFIG_NODE, &debug_ospf6_lsa_hex_cmd);
@@ -1165,6 +1191,23 @@ int config_write_ospf6_debug_lsa(struct vty *vty)
{
unsigned int i;
const struct ospf6_lsa_handler *handler;
+ bool debug_all = true;
+
+ for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) {
+ handler = vector_slot(ospf6_lsa_handler_vector, i);
+ if (handler == NULL)
+ continue;
+ if (CHECK_FLAG(handler->lh_debug, OSPF6_LSA_DEBUG_ALL)
+ < OSPF6_LSA_DEBUG_ALL) {
+ debug_all = false;
+ break;
+ }
+ }
+
+ if (debug_all) {
+ vty_out(vty, "debug ospf6 lsa all\n");
+ return 0;
+ }
for (i = 0; i < vector_active(ospf6_lsa_handler_vector); i++) {
handler = vector_slot(ospf6_lsa_handler_vector, i);
diff --git a/ospf6d/ospf6_lsa.h b/ospf6d/ospf6_lsa.h
index c271965fe7..2316040694 100644
--- a/ospf6d/ospf6_lsa.h
+++ b/ospf6d/ospf6_lsa.h
@@ -28,6 +28,9 @@
#define OSPF6_LSA_DEBUG_ORIGINATE 0x02
#define OSPF6_LSA_DEBUG_EXAMIN 0x04
#define OSPF6_LSA_DEBUG_FLOOD 0x08
+#define OSPF6_LSA_DEBUG_ALL \
+ (OSPF6_LSA_DEBUG | OSPF6_LSA_DEBUG_ORIGINATE | OSPF6_LSA_DEBUG_EXAMIN \
+ | OSPF6_LSA_DEBUG_FLOOD)
#define OSPF6_LSA_DEBUG_AGGR 0x10
/* OSPF LSA Default metric values */
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 13003b4151..5f630828e7 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -37,6 +37,9 @@
#include "ospf6_interface.h"
#include "ospf6d.h"
#include "ospf6_zebra.h"
+#ifndef VTYSH_EXTRACT_PL
+#include "ospf6d/ospf6_route_clippy.c"
+#endif
DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_ROUTE, "OSPF6 route");
DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_ROUTE_TABLE, "OSPF6 route table");
@@ -1837,49 +1840,27 @@ void ospf6_brouter_show(struct vty *vty, struct ospf6_route *route)
OSPF6_PATH_TYPE_NAME(route->path.type), area);
}
-DEFUN (debug_ospf6_route,
- debug_ospf6_route_cmd,
- "debug ospf6 route <table|intra-area|inter-area|memory>",
- DEBUG_STR
- OSPF6_STR
- "Debug routes\n"
- "Debug route table calculation\n"
- "Debug intra-area route calculation\n"
- "Debug inter-area route calculation\n"
- "Debug route memory use\n"
- )
+DEFPY(debug_ospf6_route,
+ debug_ospf6_route_cmd,
+ "[no$no] debug ospf6 route <all|table|intra-area|inter-area|memory>",
+ NO_STR
+ DEBUG_STR
+ OSPF6_STR
+ "Debug routes\n"
+ "Debug for all types of route calculation\n"
+ "Debug route table calculation\n"
+ "Debug intra-area route calculation\n"
+ "Debug inter-area route calculation\n"
+ "Debug route memory use\n")
{
- int idx_type = 3;
+ int idx_type;
unsigned char level = 0;
- if (!strcmp(argv[idx_type]->text, "table"))
- level = OSPF6_DEBUG_ROUTE_TABLE;
- else if (!strcmp(argv[idx_type]->text, "intra-area"))
- level = OSPF6_DEBUG_ROUTE_INTRA;
- else if (!strcmp(argv[idx_type]->text, "inter-area"))
- level = OSPF6_DEBUG_ROUTE_INTER;
- else if (!strcmp(argv[idx_type]->text, "memory"))
- level = OSPF6_DEBUG_ROUTE_MEMORY;
- OSPF6_DEBUG_ROUTE_ON(level);
- return CMD_SUCCESS;
-}
-
-DEFUN (no_debug_ospf6_route,
- no_debug_ospf6_route_cmd,
- "no debug ospf6 route <table|intra-area|inter-area|memory>",
- NO_STR
- DEBUG_STR
- OSPF6_STR
- "Debug routes\n"
- "Debug route table calculation\n"
- "Debug intra-area route calculation\n"
- "Debug inter-area route calculation\n"
- "Debug route memory use\n")
-{
- int idx_type = 4;
- unsigned char level = 0;
+ idx_type = ((no) ? 4 : 3);
- if (!strcmp(argv[idx_type]->text, "table"))
+ if (!strcmp(argv[idx_type]->text, "all"))
+ level = OSPF6_DEBUG_ROUTE_ALL;
+ else if (!strcmp(argv[idx_type]->text, "table"))
level = OSPF6_DEBUG_ROUTE_TABLE;
else if (!strcmp(argv[idx_type]->text, "intra-area"))
level = OSPF6_DEBUG_ROUTE_INTRA;
@@ -1887,12 +1868,20 @@ DEFUN (no_debug_ospf6_route,
level = OSPF6_DEBUG_ROUTE_INTER;
else if (!strcmp(argv[idx_type]->text, "memory"))
level = OSPF6_DEBUG_ROUTE_MEMORY;
- OSPF6_DEBUG_ROUTE_OFF(level);
+
+ if (no)
+ OSPF6_DEBUG_ROUTE_OFF(level);
+ else
+ OSPF6_DEBUG_ROUTE_ON(level);
return CMD_SUCCESS;
}
int config_write_ospf6_debug_route(struct vty *vty)
{
+ if (IS_OSPF6_DEBUG_ROUTE(ALL) == OSPF6_DEBUG_ROUTE_ALL) {
+ vty_out(vty, "debug ospf6 route all\n");
+ return 0;
+ }
if (IS_OSPF6_DEBUG_ROUTE(TABLE))
vty_out(vty, "debug ospf6 route table\n");
if (IS_OSPF6_DEBUG_ROUTE(INTRA))
@@ -1908,7 +1897,5 @@ int config_write_ospf6_debug_route(struct vty *vty)
void install_element_ospf6_debug_route(void)
{
install_element(ENABLE_NODE, &debug_ospf6_route_cmd);
- install_element(ENABLE_NODE, &no_debug_ospf6_route_cmd);
install_element(CONFIG_NODE, &debug_ospf6_route_cmd);
- install_element(CONFIG_NODE, &no_debug_ospf6_route_cmd);
}
diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h
index 54baaee638..e29439b95e 100644
--- a/ospf6d/ospf6_route.h
+++ b/ospf6d/ospf6_route.h
@@ -33,7 +33,10 @@ extern unsigned char conf_debug_ospf6_route;
#define OSPF6_DEBUG_ROUTE_TABLE 0x01
#define OSPF6_DEBUG_ROUTE_INTRA 0x02
#define OSPF6_DEBUG_ROUTE_INTER 0x04
-#define OSPF6_DEBUG_ROUTE_MEMORY 0x80
+#define OSPF6_DEBUG_ROUTE_MEMORY 0x08
+#define OSPF6_DEBUG_ROUTE_ALL \
+ (OSPF6_DEBUG_ROUTE_TABLE | OSPF6_DEBUG_ROUTE_INTRA \
+ | OSPF6_DEBUG_ROUTE_INTER | OSPF6_DEBUG_ROUTE_MEMORY)
#define OSPF6_DEBUG_ROUTE_ON(level) (conf_debug_ospf6_route |= (level))
#define OSPF6_DEBUG_ROUTE_OFF(level) (conf_debug_ospf6_route &= ~(level))
#define IS_OSPF6_DEBUG_ROUTE(e) (conf_debug_ospf6_route & OSPF6_DEBUG_ROUTE_##e)
diff --git a/ospf6d/subdir.am b/ospf6d/subdir.am
index 5a4e4db69b..910c26b791 100644
--- a/ospf6d/subdir.am
+++ b/ospf6d/subdir.am
@@ -96,6 +96,7 @@ clippy_scan += \
ospf6d/ospf6_asbr.c \
ospf6d/ospf6_lsa.c \
ospf6d/ospf6_gr_helper.c \
+ ospf6d/ospf6_route.c \
# end
nodist_ospf6d_ospf6d_SOURCES = \