return CMD_SUCCESS;
}
-DEFUN (show_babel_running_config,
- show_babel_running_config_cmd,
- "show babel running-config",
+DEFUN (show_babel_parameters,
+ show_babel_parameters_cmd,
+ "show babel parameters",
SHOW_STR
IP_STR
"Babel information\n"
{
vty_out(vty, " -- Babel running configuration --%s", VTY_NEWLINE);
show_babel_main_configuration(vty);
- show_babeld_configuration(vty);
vty_out(vty, " -- distribution lists --%s", VTY_NEWLINE);
config_show_distribute(vty);
install_element(ENABLE_NODE, &show_babel_neighbour_cmd);
install_element(VIEW_NODE, &show_babel_database_cmd);
install_element(ENABLE_NODE, &show_babel_database_cmd);
- install_element(VIEW_NODE, &show_babel_running_config_cmd);
- install_element(ENABLE_NODE, &show_babel_running_config_cmd);
+ install_element(VIEW_NODE, &show_babel_parameters_cmd);
+ install_element(ENABLE_NODE, &show_babel_parameters_cmd);
}
/* hooks: functions called respectively when struct interface is
return write;
}
+/* Output a "network" statement line for each of the enabled interfaces. */
+int
+babel_enable_if_config_write (struct vty * vty)
+{
+ unsigned int i, lines = 0;
+ char *str;
+
+ for (i = 0; i < vector_active (babel_enable_if); i++)
+ if ((str = vector_slot (babel_enable_if, i)) != NULL)
+ {
+ vty_out (vty, " network %s%s", str, VTY_NEWLINE);
+ lines++;
+ }
+ return lines;
+}
+
/* functions to allocate or free memory for a babel_interface_nfo, filling
needed fields */
static babel_interface_nfo *
#include <zebra.h>
#include "zclient.h"
+#include "vty.h"
#define CONFIG_DEFAULT 0
#define CONFIG_NO 1
int is_interface_ll_address(struct interface *ifp, const unsigned char *address);
/* Send retraction to all, and reset all interfaces statistics. */
void babel_interface_close_all(void);
+extern int babel_enable_if_config_write (struct vty *);
#endif
struct timeval babel_now; /* current time */
unsigned char myid[8]; /* unique id (mac address of an interface) */
-int debug = BABEL_DEBUG_COMMON;
+int debug = 0;
int default_wireless_hello_interval = -1;
int default_wired_hello_interval = -1;
void
show_babel_main_configuration (struct vty *vty)
{
-#ifdef NO_DEBUG
- vty_out(vty, "No debug.%s", VTY_NEWLINE);
-#else
- vty_out(vty, "Activated debug options:");
- if (debug == BABEL_DEBUG_ALL) {
- vty_out(vty, " all%s", VTY_NEWLINE);
- } else {
- vty_out(vty, "%s%s%s%s%s%s%s%s%s%s%s%s%s",
- debug & BABEL_DEBUG_COMMON ? VTY_NEWLINE : "",
- debug & BABEL_DEBUG_COMMON ? " common" : "",
- debug & BABEL_DEBUG_KERNEL ? VTY_NEWLINE : "",
- debug & BABEL_DEBUG_KERNEL ? " kernel" : "",
- debug & BABEL_DEBUG_FILTER ? VTY_NEWLINE : "",
- debug & BABEL_DEBUG_FILTER ? " filter" : "",
- debug & BABEL_DEBUG_TIMEOUT ? VTY_NEWLINE : "",
- debug & BABEL_DEBUG_TIMEOUT ? " timeout" : "",
- debug & BABEL_DEBUG_IF ? VTY_NEWLINE : "",
- debug & BABEL_DEBUG_IF ? " interface": "",
- debug & BABEL_DEBUG_ROUTE ? VTY_NEWLINE : "",
- debug & BABEL_DEBUG_ROUTE ? " route" : "",
- VTY_NEWLINE);
- }
-#endif
-
vty_out(vty,
"pid file = %s%s"
"state file = %s%s"
#ifndef NO_DEBUG
/* [Babel Command] */
-DEFUN (babel_debug,
- babel_debug_cmd,
- "debug (common|kernel|filter|timeout|interface|route|all)",
+DEFUN (debug_babel,
+ debug_babel_cmd,
+ "debug babel (common|kernel|filter|timeout|interface|route|all)",
"Enable debug messages for specific or all part.\n"
+ "Babel information\n"
"Common messages (default)\n"
"Kernel messages\n"
"Filter messages\n"
}
/* [Babel Command] */
-DEFUN (no_babel_debug,
- no_babel_debug_cmd,
- "no debug (common|kernel|filter|timeout|interface|route|all)",
+DEFUN (no_debug_babel,
+ no_debug_babel_cmd,
+ "no debug babel (common|kernel|filter|timeout|interface|route|all)",
NO_STR
"Disable debug messages for specific or all part.\n"
+ "Babel information\n"
"Common messages (default)\n"
"Kernel messages\n"
"Filter messages\n"
}
#endif /* NO_DEBUG */
+/* Output "debug" statement lines, if necessary. */
+int
+debug_babel_config_write (struct vty * vty)
+{
+#ifdef NO_DEBUG
+ return 0;
+#else
+ int i, lines = 0;
+
+ if (debug == BABEL_DEBUG_ALL)
+ {
+ vty_out (vty, "debug babel all%s", VTY_NEWLINE);
+ lines++;
+ }
+ else
+ for (i = 0; debug_type[i].str != NULL; i++)
+ if
+ (
+ debug_type[i].type != BABEL_DEBUG_ALL
+ && CHECK_FLAG (debug, debug_type[i].type)
+ )
+ {
+ vty_out (vty, "debug babel %s%s", debug_type[i].str, VTY_NEWLINE);
+ lines++;
+ }
+ if (lines)
+ {
+ vty_out (vty, "!%s", VTY_NEWLINE);
+ lines++;
+ }
+ return lines;
+#endif /* NO_DEBUG */
+}
void babelz_zebra_init(void)
{
install_node (&zebra_node, zebra_config_write);
install_element(BABEL_NODE, &babel_redistribute_type_cmd);
install_element(BABEL_NODE, &no_babel_redistribute_type_cmd);
- install_element(BABEL_NODE, &babel_debug_cmd);
- install_element(BABEL_NODE, &no_babel_debug_cmd);
+ install_element(ENABLE_NODE, &debug_babel_cmd);
+ install_element(ENABLE_NODE, &no_debug_babel_cmd);
+ install_element(CONFIG_NODE, &debug_babel_cmd);
+ install_element(CONFIG_NODE, &no_debug_babel_cmd);
}
static int
THE SOFTWARE.
*/
+#ifndef BABEL_ZEBRA_H
+#define BABEL_ZEBRA_H
+
+#include "vty.h"
extern struct zclient *zclient;
void babelz_zebra_init(void);
void babel_zebra_close_connexion(void);
+extern int debug_babel_config_write (struct vty *);
+
+#endif
#include "message.h"
#include "resend.h"
#include "babel_filter.h"
+#include "babel_zebra.h"
static int babel_init_routing_process(struct thread *thread);
static int
babel_config_write (struct vty *vty)
{
- return 0;
+ int lines = 0;
+ int i;
+
+ /* list enabled debug modes */
+ lines += debug_babel_config_write (vty);
+
+ if (!babel_routing_process)
+ return lines;
+ vty_out (vty, "router babel%s", VTY_NEWLINE);
+ /* list enabled interfaces */
+ lines = 1 + babel_enable_if_config_write (vty);
+ /* list redistributed protocols */
+ for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
+ if (i != zclient->redist_default && zclient->redist[i])
+ {
+ vty_out (vty, " redistribute %s%s", zebra_route_string (i), VTY_NEWLINE);
+ lines++;
+ }
+
+ return lines;
}
return 0;
}
-void
-show_babeld_configuration (struct vty *vty)
-{
- vty_out(vty, "babeld running process %s.%s",
- babel_routing_process ? "enable" : "disable", VTY_NEWLINE);
-}
+debug babel common
+!debug babel kernel
+!debug babel filter
+!debug babel timeout
+!debug babel interface
+!debug babel route
+!debug babel all
+
router babel
! network eth0
! redistribute kernel
! no redistribute static
!interface eth0
-! wired
-! wireless
+! babel wired
+! babel wireless
! babel split-horizon
! no babel split-horizon
! log file /var/log/quagga/babeld.log
-log stdout
\ No newline at end of file
+log stdout
unsigned int ifindex, int proto);
extern int resize_receive_buffer(int size);
extern void schedule_neighbours_check(int msecs, int override);
-extern void show_babeld_configuration (struct vty *vty);
#endif /* BABEL_BABELD_H */
@deffn {Command} {show babel database} {}
@deffnx {Command} {show babel interface} {}
@deffnx {Command} {show babel neighbour} {}
-@deffnx {Command} {show babel running-config} {}
+@deffnx {Command} {show babel parameters} {}
These commands dump various parts of @command{babeld}'s internal
state. They are mostly useful for troubleshooting.
@end deffn
@node Babel debugging commands, , Show Babel information, Babel
@section Babel debugging commands
-@deffn {Babel Command} {debug @var{kind}} {}
-@deffnx {Babel Command} {no debug @var{kind}} {}
+@deffn {Babel Command} {debug babel @var{kind}} {}
+@deffnx {Babel Command} {no debug babel @var{kind}} {}
Enable or disable debugging messages of a given kind. @var{kind} can
be one of @samp{common}, @samp{kernel}, @samp{filter}, @samp{timeout},
@samp{interface}, @samp{route} or @samp{all}. Note that if you have