summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSai Gomathi N <nsaigomathi@vmware.com>2022-03-27 22:15:36 -0700
committerSai Gomathi N <nsaigomathi@vmware.com>2022-05-18 03:31:33 -0700
commit60940ee26475e680d5672ea99eb4bd2bd65314ab (patch)
treeec066492f6aefe204ca3a04f06a870ceaef1be51
parentc51c7de263c0931004f31fa39a2e25237d318eac (diff)
pim6d: Add 'debug pimv6 packets'
Implementing pimv6 packets debug to information about packet generation for sending and about packet handling from a received packet. Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
-rw-r--r--pimd/pim6_cmd.c20
-rw-r--r--pimd/pim6_cmd.h5
-rw-r--r--pimd/pim_cmd.c55
-rw-r--r--pimd/pim_cmd_common.c39
-rw-r--r--pimd/pim_cmd_common.h4
5 files changed, 76 insertions, 47 deletions
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c
index 8d4107fc40..239e2d7b63 100644
--- a/pimd/pim6_cmd.c
+++ b/pimd/pim6_cmd.c
@@ -2064,6 +2064,24 @@ DEFPY (debug_pimv6_events,
return CMD_SUCCESS;
}
+DEFPY (debug_pimv6_packets,
+ debug_pimv6_packets_cmd,
+ "[no] debug pimv6 packets [<hello$hello|joins$joins|register$registers>]",
+ NO_STR
+ DEBUG_STR
+ DEBUG_PIMV6_STR
+ DEBUG_PIMV6_PACKETS_STR
+ DEBUG_PIMV6_HELLO_PACKETS_STR
+ DEBUG_PIMV6_J_P_PACKETS_STR
+ DEBUG_PIMV6_PIM_REG_PACKETS_STR)
+{
+ if (!no)
+ return pim_debug_pim_packets_cmd(hello, joins, registers, vty);
+ else
+ return pim_no_debug_pim_packets_cmd(hello, joins, registers,
+ vty);
+}
+
void pim_cmd_init(void)
{
if_cmd_init(pim_interface_config_write);
@@ -2179,9 +2197,11 @@ void pim_cmd_init(void)
install_element(ENABLE_NODE, &debug_pimv6_nht_cmd);
install_element(ENABLE_NODE, &debug_pimv6_nht_det_cmd);
install_element(ENABLE_NODE, &debug_pimv6_events_cmd);
+ install_element(ENABLE_NODE, &debug_pimv6_packets_cmd);
install_element(CONFIG_NODE, &debug_pimv6_cmd);
install_element(CONFIG_NODE, &debug_pimv6_nht_cmd);
install_element(CONFIG_NODE, &debug_pimv6_nht_det_cmd);
install_element(CONFIG_NODE, &debug_pimv6_events_cmd);
+ install_element(CONFIG_NODE, &debug_pimv6_packets_cmd);
}
diff --git a/pimd/pim6_cmd.h b/pimd/pim6_cmd.h
index 719ad7663c..7ace2bfeb6 100644
--- a/pimd/pim6_cmd.h
+++ b/pimd/pim6_cmd.h
@@ -47,6 +47,11 @@
#define CONF_SSMPINGD_STR "Enable ssmpingd operation\n"
#define DEBUG_PIMV6_STR "PIMv6 protocol activity\n"
#define DEBUG_PIMV6_EVENTS_STR "PIMv6 protocol events\n"
+#define DEBUG_PIMV6_PACKETS_STR "PIMv6 protocol packets\n"
+#define DEBUG_PIMV6_HELLO_PACKETS_STR "PIMv6 Hello protocol packets\n"
+#define DEBUG_PIMV6_J_P_PACKETS_STR "PIMv6 Join/Prune protocol packets\n"
+#define DEBUG_PIMV6_PIM_REG_PACKETS_STR \
+ "PIMv6 Register/Reg-Stop protocol packets\n"
void pim_cmd_init(void);
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index c4d01bb016..bfbe42086a 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -5606,58 +5606,21 @@ DEFPY (debug_pim_events,
return CMD_SUCCESS;
}
-DEFUN (debug_pim_packets,
+DEFPY (debug_pim_packets,
debug_pim_packets_cmd,
- "debug pim packets [<hello|joins|register>]",
- DEBUG_STR
+ "[no] debug pim packets [<hello$hello|joins$joins|register$registers>]",
+ NO_STR DEBUG_STR
DEBUG_PIM_STR
DEBUG_PIM_PACKETS_STR
DEBUG_PIM_HELLO_PACKETS_STR
DEBUG_PIM_J_P_PACKETS_STR
DEBUG_PIM_PIM_REG_PACKETS_STR)
{
- int idx = 0;
- if (argv_find(argv, argc, "hello", &idx)) {
- PIM_DO_DEBUG_PIM_HELLO;
- vty_out(vty, "PIM Hello debugging is on\n");
- } else if (argv_find(argv, argc, "joins", &idx)) {
- PIM_DO_DEBUG_PIM_J_P;
- vty_out(vty, "PIM Join/Prune debugging is on\n");
- } else if (argv_find(argv, argc, "register", &idx)) {
- PIM_DO_DEBUG_PIM_REG;
- vty_out(vty, "PIM Register debugging is on\n");
- } else {
- PIM_DO_DEBUG_PIM_PACKETS;
- vty_out(vty, "PIM Packet debugging is on \n");
- }
- return CMD_SUCCESS;
-}
-
-DEFUN (no_debug_pim_packets,
- no_debug_pim_packets_cmd,
- "no debug pim packets [<hello|joins|register>]",
- NO_STR
- DEBUG_STR
- DEBUG_PIM_STR
- DEBUG_PIM_PACKETS_STR
- DEBUG_PIM_HELLO_PACKETS_STR
- DEBUG_PIM_J_P_PACKETS_STR
- DEBUG_PIM_PIM_REG_PACKETS_STR)
-{
- int idx = 0;
- if (argv_find(argv, argc, "hello", &idx)) {
- PIM_DONT_DEBUG_PIM_HELLO;
- vty_out(vty, "PIM Hello debugging is off \n");
- } else if (argv_find(argv, argc, "joins", &idx)) {
- PIM_DONT_DEBUG_PIM_J_P;
- vty_out(vty, "PIM Join/Prune debugging is off \n");
- } else if (argv_find(argv, argc, "register", &idx)) {
- PIM_DONT_DEBUG_PIM_REG;
- vty_out(vty, "PIM Register debugging is off\n");
- } else
- PIM_DONT_DEBUG_PIM_PACKETS;
-
- return CMD_SUCCESS;
+ if (!no)
+ return pim_debug_pim_packets_cmd(hello, joins, registers, vty);
+ else
+ return pim_no_debug_pim_packets_cmd(hello, joins, registers,
+ vty);
}
@@ -7829,7 +7792,6 @@ void pim_cmd_init(void)
install_element(ENABLE_NODE, &no_debug_pim_nht_rp_cmd);
install_element(ENABLE_NODE, &debug_pim_events_cmd);
install_element(ENABLE_NODE, &debug_pim_packets_cmd);
- install_element(ENABLE_NODE, &no_debug_pim_packets_cmd);
install_element(ENABLE_NODE, &debug_pim_packetdump_send_cmd);
install_element(ENABLE_NODE, &no_debug_pim_packetdump_send_cmd);
install_element(ENABLE_NODE, &debug_pim_packetdump_recv_cmd);
@@ -7880,7 +7842,6 @@ void pim_cmd_init(void)
install_element(CONFIG_NODE, &no_debug_pim_nht_rp_cmd);
install_element(CONFIG_NODE, &debug_pim_events_cmd);
install_element(CONFIG_NODE, &debug_pim_packets_cmd);
- install_element(CONFIG_NODE, &no_debug_pim_packets_cmd);
install_element(CONFIG_NODE, &debug_pim_packetdump_send_cmd);
install_element(CONFIG_NODE, &no_debug_pim_packetdump_send_cmd);
install_element(CONFIG_NODE, &debug_pim_packetdump_recv_cmd);
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
index eda9f100b2..d5eb763df3 100644
--- a/pimd/pim_cmd_common.c
+++ b/pimd/pim_cmd_common.c
@@ -3698,3 +3698,42 @@ int pim_no_debug_pim_cmd(void)
PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV;
return CMD_SUCCESS;
}
+
+int pim_debug_pim_packets_cmd(const char *hello, const char *joins,
+ const char *registers, struct vty *vty)
+{
+ if (hello) {
+ PIM_DO_DEBUG_PIM_HELLO;
+ vty_out(vty, "PIM Hello debugging is on\n");
+ } else if (joins) {
+ PIM_DO_DEBUG_PIM_J_P;
+ vty_out(vty, "PIM Join/Prune debugging is on\n");
+ } else if (registers) {
+ PIM_DO_DEBUG_PIM_REG;
+ vty_out(vty, "PIM Register debugging is on\n");
+ } else {
+ PIM_DO_DEBUG_PIM_PACKETS;
+ vty_out(vty, "PIM Packet debugging is on\n");
+ }
+ return CMD_SUCCESS;
+}
+
+int pim_no_debug_pim_packets_cmd(const char *hello, const char *joins,
+ const char *registers, struct vty *vty)
+{
+ if (hello) {
+ PIM_DONT_DEBUG_PIM_HELLO;
+ vty_out(vty, "PIM Hello debugging is off\n");
+ } else if (joins) {
+ PIM_DONT_DEBUG_PIM_J_P;
+ vty_out(vty, "PIM Join/Prune debugging is off\n");
+ } else if (registers) {
+ PIM_DONT_DEBUG_PIM_REG;
+ vty_out(vty, "PIM Register debugging is off\n");
+ } else {
+ PIM_DONT_DEBUG_PIM_PACKETS;
+ vty_out(vty, "PIM Packet debugging is off\n");
+ }
+
+ return CMD_SUCCESS;
+}
diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h
index 3f30ac5b42..9644f84e0c 100644
--- a/pimd/pim_cmd_common.h
+++ b/pimd/pim_cmd_common.h
@@ -127,6 +127,10 @@ void clear_mroute(struct pim_instance *pim);
void clear_pim_statistics(struct pim_instance *pim);
int pim_debug_pim_cmd(void);
int pim_no_debug_pim_cmd(void);
+int pim_debug_pim_packets_cmd(const char *hello, const char *joins,
+ const char *registers, struct vty *vty);
+int pim_no_debug_pim_packets_cmd(const char *hello, const char *joins,
+ const char *registers, struct vty *vty);
/*
* Special Macro to allow us to get the correct pim_instance;