ripd: resolve debug statements issue (bug 442)

...A nasty bug, if you forgot to disable debugging, stored the config
and reboot your machine - if you really depend on ripd, then the machine
will not fully come back on the network, because ripd fails.
This commit is contained in:
Andrew J. Schorr 2011-02-24 13:52:14 +03:00 committed by Denis Ovsienko
parent 6e22b9017e
commit 0fa0335316
2 changed files with 9 additions and 16 deletions

View File

@ -44,19 +44,16 @@ DEFUN (show_debugging_rip,
{ {
if (IS_RIP_DEBUG_SEND && IS_RIP_DEBUG_RECV) if (IS_RIP_DEBUG_SEND && IS_RIP_DEBUG_RECV)
{ {
vty_out (vty, " RIP packet%s debugging is on%s", vty_out (vty, " RIP packet debugging is on%s",
IS_RIP_DEBUG_DETAIL ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
} }
else else
{ {
if (IS_RIP_DEBUG_SEND) if (IS_RIP_DEBUG_SEND)
vty_out (vty, " RIP packet send%s debugging is on%s", vty_out (vty, " RIP packet send debugging is on%s",
IS_RIP_DEBUG_DETAIL ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
else else
vty_out (vty, " RIP packet receive%s debugging is on%s", vty_out (vty, " RIP packet receive debugging is on%s",
IS_RIP_DEBUG_DETAIL ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
} }
} }
@ -105,11 +102,12 @@ DEFUN (debug_rip_packet_direct,
rip_debug_packet |= RIP_DEBUG_SEND; rip_debug_packet |= RIP_DEBUG_SEND;
if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
rip_debug_packet |= RIP_DEBUG_RECV; rip_debug_packet |= RIP_DEBUG_RECV;
rip_debug_packet &= ~RIP_DEBUG_DETAIL;
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (debug_rip_packet_detail, /* N.B. the "detail" modifier is a no-op. we leave this command
for legacy compatibility. */
DEFUN_DEPRECATED (debug_rip_packet_detail,
debug_rip_packet_detail_cmd, debug_rip_packet_detail_cmd,
"debug rip packet (recv|send) detail", "debug rip packet (recv|send) detail",
DEBUG_STR DEBUG_STR
@ -124,7 +122,6 @@ DEFUN (debug_rip_packet_detail,
rip_debug_packet |= RIP_DEBUG_SEND; rip_debug_packet |= RIP_DEBUG_SEND;
if (strncmp ("recv", argv[0], strlen (argv[0])) == 0) if (strncmp ("recv", argv[0], strlen (argv[0])) == 0)
rip_debug_packet |= RIP_DEBUG_RECV; rip_debug_packet |= RIP_DEBUG_RECV;
rip_debug_packet |= RIP_DEBUG_DETAIL;
return CMD_SUCCESS; return CMD_SUCCESS;
} }
@ -224,20 +221,17 @@ config_write_debug (struct vty *vty)
{ {
if (IS_RIP_DEBUG_SEND && IS_RIP_DEBUG_RECV) if (IS_RIP_DEBUG_SEND && IS_RIP_DEBUG_RECV)
{ {
vty_out (vty, "debug rip packet%s%s", vty_out (vty, "debug rip packet%s",
IS_RIP_DEBUG_DETAIL ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
write++; write++;
} }
else else
{ {
if (IS_RIP_DEBUG_SEND) if (IS_RIP_DEBUG_SEND)
vty_out (vty, "debug rip packet send%s%s", vty_out (vty, "debug rip packet send%s",
IS_RIP_DEBUG_DETAIL ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
else else
vty_out (vty, "debug rip packet recv%s%s", vty_out (vty, "debug rip packet recv%s",
IS_RIP_DEBUG_DETAIL ? " detail" : "",
VTY_NEWLINE); VTY_NEWLINE);
write++; write++;
} }

View File

@ -40,7 +40,6 @@
#define IS_RIP_DEBUG_PACKET (rip_debug_packet & RIP_DEBUG_PACKET) #define IS_RIP_DEBUG_PACKET (rip_debug_packet & RIP_DEBUG_PACKET)
#define IS_RIP_DEBUG_SEND (rip_debug_packet & RIP_DEBUG_SEND) #define IS_RIP_DEBUG_SEND (rip_debug_packet & RIP_DEBUG_SEND)
#define IS_RIP_DEBUG_RECV (rip_debug_packet & RIP_DEBUG_RECV) #define IS_RIP_DEBUG_RECV (rip_debug_packet & RIP_DEBUG_RECV)
#define IS_RIP_DEBUG_DETAIL (rip_debug_packet & RIP_DEBUG_DETAIL)
#define IS_RIP_DEBUG_ZEBRA (rip_debug_zebra & RIP_DEBUG_ZEBRA) #define IS_RIP_DEBUG_ZEBRA (rip_debug_zebra & RIP_DEBUG_ZEBRA)