mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 00:18:53 +00:00
pimd: Add ability to debug pim Register packets
Allow the user to specify the ability to debug pim register packets. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
facebf0509
commit
9add3b8812
@ -3752,23 +3752,29 @@ DEFUN (debug_pim_packets,
|
||||
|
||||
DEFUN (debug_pim_packets_filter,
|
||||
debug_pim_packets_filter_cmd,
|
||||
"debug pim packets <hello|joins>",
|
||||
"debug pim packets <hello|joins|register>",
|
||||
DEBUG_STR
|
||||
DEBUG_PIM_STR
|
||||
DEBUG_PIM_PACKETS_STR
|
||||
DEBUG_PIM_HELLO_PACKETS_STR
|
||||
DEBUG_PIM_J_P_PACKETS_STR)
|
||||
DEBUG_PIM_J_P_PACKETS_STR
|
||||
DEBUG_PIM_PIM_REG_PACKETS_STR)
|
||||
{
|
||||
int idx_hello_join = 3;
|
||||
if (strncmp(argv[idx_hello_join]->arg,"h",1) == 0)
|
||||
if (strncmp(argv[idx_hello_join]->arg,"h",1) == 0)
|
||||
{
|
||||
PIM_DO_DEBUG_PIM_HELLO;
|
||||
vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE);
|
||||
vty_out (vty, "PIM Hello debugging is on%s", VTY_NEWLINE);
|
||||
}
|
||||
else if (strncmp(argv[idx_hello_join]->arg,"j",1) == 0)
|
||||
else if (strncmp(argv[idx_hello_join]->arg,"j",1) == 0)
|
||||
{
|
||||
PIM_DO_DEBUG_PIM_J_P;
|
||||
vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE);
|
||||
vty_out (vty, "PIM Join/Prune debugging is on%s", VTY_NEWLINE);
|
||||
}
|
||||
else if (strncmp(argv[idx_hello_join]->arg,"r",1) == 0)
|
||||
{
|
||||
PIM_DO_DEBUG_PIM_REG;
|
||||
vty_out (vty, "PIM Register debugging is on%s", VTY_NEWLINE);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
@ -3790,7 +3796,7 @@ DEFUN (no_debug_pim_packets,
|
||||
|
||||
DEFUN (no_debug_pim_packets_filter,
|
||||
no_debug_pim_packets_filter_cmd,
|
||||
"no debug pim packets <hello|joins>",
|
||||
"no debug pim packets <hello|joins|register>",
|
||||
NO_STR
|
||||
DEBUG_STR
|
||||
DEBUG_PIM_STR
|
||||
@ -3799,17 +3805,22 @@ DEFUN (no_debug_pim_packets_filter,
|
||||
DEBUG_PIM_J_P_PACKETS_STR)
|
||||
{
|
||||
int idx_hello_join = 4;
|
||||
if (strncmp(argv[idx_hello_join]->arg,"h",1) == 0)
|
||||
if (strncmp(argv[idx_hello_join]->arg,"h",1) == 0)
|
||||
{
|
||||
PIM_DONT_DEBUG_PIM_HELLO;
|
||||
vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE);
|
||||
}
|
||||
else if (strncmp(argv[idx_hello_join]->arg,"j",1) == 0)
|
||||
else if (strncmp(argv[idx_hello_join]->arg,"j",1) == 0)
|
||||
{
|
||||
PIM_DONT_DEBUG_PIM_J_P;
|
||||
vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
else if (strncmp (argv[idx_hello_join]->arg, "r", 1) == 0)
|
||||
{
|
||||
PIM_DONT_DEBUG_PIM_REG;
|
||||
vty_out (vty, "PIM Register debugging is off%s", VTY_NEWLINE);
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
#define DEBUG_PIM_PACKETS_STR "PIM protocol packets\n"
|
||||
#define DEBUG_PIM_HELLO_PACKETS_STR "PIM Hello protocol packets\n"
|
||||
#define DEBUG_PIM_J_P_PACKETS_STR "PIM Join/Prune protocol packets\n"
|
||||
#define DEBUG_PIM_PIM_REG_PACKETS_STR "PIM Register/Reg-Stop protocol packets\n"
|
||||
#define DEBUG_PIM_PACKETDUMP_STR "PIM packet dump\n"
|
||||
#define DEBUG_PIM_PACKETDUMP_SEND_STR "Dump sent packets\n"
|
||||
#define DEBUG_PIM_PACKETDUMP_RECV_STR "Dump received packets\n"
|
||||
|
@ -77,6 +77,12 @@ pim_register_stop_send (struct interface *ifp, struct prefix *sg,
|
||||
uint8_t *b1;
|
||||
struct prefix p;
|
||||
|
||||
if (PIM_DEBUG_PIM_REG)
|
||||
{
|
||||
zlog_debug ("Sending Register stop for %s to %s on %s",
|
||||
pim_str_sg_dump (sg), inet_ntoa(originator), ifp->name);
|
||||
}
|
||||
|
||||
memset (buffer, 0, 3000);
|
||||
b1 = (uint8_t *)buffer + PIM_MSG_REGISTER_STOP_LEN;
|
||||
|
||||
@ -120,9 +126,6 @@ pim_register_stop_recv (uint8_t *buf, int buf_size)
|
||||
struct prefix sg;
|
||||
int l;
|
||||
|
||||
if (PIM_DEBUG_PIM_PACKETDUMP_RECV)
|
||||
pim_pkt_dump ("Received Register Stop", buf, buf_size);
|
||||
|
||||
l = pim_parse_addr_group (&group, buf, buf_size);
|
||||
buf += l;
|
||||
buf_size -= l;
|
||||
@ -130,6 +133,13 @@ pim_register_stop_recv (uint8_t *buf, int buf_size)
|
||||
memset (&sg, 0, sizeof (struct prefix));
|
||||
sg.u.sg.src = source.u.prefix4;
|
||||
sg.u.sg.grp = group.u.prefix4;
|
||||
|
||||
if (PIM_DEBUG_PIM_REG)
|
||||
{
|
||||
zlog_debug ("Received Register stop for %s",
|
||||
pim_str_sg_dump (&sg));
|
||||
}
|
||||
|
||||
upstream = pim_upstream_find (&sg);
|
||||
if (!upstream)
|
||||
{
|
||||
@ -162,6 +172,13 @@ pim_register_send (const uint8_t *buf, int buf_size, struct pim_rpf *rpg, int nu
|
||||
struct pim_interface *pinfo;
|
||||
struct interface *ifp;
|
||||
|
||||
if (PIM_DEBUG_PIM_REG)
|
||||
{
|
||||
char rp_str[100];
|
||||
strcpy (rp_str, inet_ntoa (rpg->rpf_addr));
|
||||
zlog_debug ("Sending %sRegister Packet to %s", null_register ? "NULL " : "", rp_str);
|
||||
}
|
||||
|
||||
ifp = rpg->source_nexthop.interface;
|
||||
pinfo = (struct pim_interface *)ifp->info;
|
||||
if (!pinfo) {
|
||||
@ -257,6 +274,14 @@ pim_register_recv (struct interface *ifp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (PIM_DEBUG_PIM_REG)
|
||||
{
|
||||
char src_str[100];
|
||||
|
||||
pim_inet4_dump ("<src?>", src_addr, src_str, sizeof (src_str));
|
||||
zlog_debug ("Received Register message from %s on %s", src_str, ifp->name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Please note this is not drawn to get the correct bit/data size
|
||||
*
|
||||
|
@ -108,6 +108,11 @@ pim_debug_config_write (struct vty *vty)
|
||||
++writes;
|
||||
}
|
||||
|
||||
if (PIM_DEBUG_PIM_REG) {
|
||||
vty_out (vty, "debug pim packets register%s", VTY_NEWLINE);
|
||||
++writes;
|
||||
}
|
||||
|
||||
if (PIM_DEBUG_STATIC) {
|
||||
vty_out (vty, "debug pim static%s", VTY_NEWLINE);
|
||||
++writes;
|
||||
|
@ -69,6 +69,7 @@
|
||||
#define PIM_MASK_PIM_HELLO (1 << 14)
|
||||
#define PIM_MASK_PIM_J_P (1 << 15)
|
||||
#define PIM_MASK_STATIC (1 << 16)
|
||||
#define PIM_MASK_PIM_REG (1 << 17)
|
||||
|
||||
const char *const PIM_ALL_SYSTEMS;
|
||||
const char *const PIM_ALL_ROUTERS;
|
||||
@ -135,6 +136,7 @@ extern int32_t qpim_register_probe_time;
|
||||
#define PIM_DEBUG_MROUTE (qpim_debugs & PIM_MASK_MROUTE)
|
||||
#define PIM_DEBUG_PIM_HELLO (qpim_debugs & PIM_MASK_PIM_HELLO)
|
||||
#define PIM_DEBUG_PIM_J_P (qpim_debugs & PIM_MASK_PIM_J_P)
|
||||
#define PIM_DEBUG_PIM_REG (qpim_debugs & PIM_MASK_PIM_REG)
|
||||
#define PIM_DEBUG_STATIC (qpim_debugs & PIM_MASK_STATIC)
|
||||
|
||||
#define PIM_DEBUG_EVENTS (qpim_debugs & (PIM_MASK_PIM_EVENTS | PIM_MASK_IGMP_EVENTS))
|
||||
@ -155,6 +157,7 @@ extern int32_t qpim_register_probe_time;
|
||||
#define PIM_DO_DEBUG_MROUTE (qpim_debugs |= PIM_MASK_MROUTE)
|
||||
#define PIM_DO_DEBUG_PIM_HELLO (qpim_debugs |= PIM_MASK_PIM_HELLO)
|
||||
#define PIM_DO_DEBUG_PIM_J_P (qpim_debugs |= PIM_MASK_PIM_J_P)
|
||||
#define PIM_DO_DEBUG_PIM_REG (qpim_debugs |= PIM_MASK_PIM_REG)
|
||||
#define PIM_DO_DEBUG_STATIC (qpim_debugs |= PIM_MASK_STATIC)
|
||||
|
||||
#define PIM_DONT_DEBUG_PIM_EVENTS (qpim_debugs &= ~PIM_MASK_PIM_EVENTS)
|
||||
@ -171,6 +174,7 @@ extern int32_t qpim_register_probe_time;
|
||||
#define PIM_DONT_DEBUG_MROUTE (qpim_debugs &= ~PIM_MASK_MROUTE)
|
||||
#define PIM_DONT_DEBUG_PIM_HELLO (qpim_debugs &= ~PIM_MASK_PIM_HELLO)
|
||||
#define PIM_DONT_DEBUG_PIM_J_P (qpim_debugs &= ~PIM_MASK_PIM_J_P)
|
||||
#define PIM_DONT_DEBUG_PIM_REG (qpim_debugs &= ~PIM_MASK_PIM_REG)
|
||||
#define PIM_DONT_DEBUG_STATIC (qpim_debugs &= ~PIM_MASK_STATIC)
|
||||
|
||||
void pim_init(void);
|
||||
|
Loading…
Reference in New Issue
Block a user