summaryrefslogtreecommitdiff
path: root/babeld
diff options
context:
space:
mode:
Diffstat (limited to 'babeld')
-rw-r--r--babeld/babel_interface.c27
-rw-r--r--babeld/babel_interface.h2
-rw-r--r--babeld/babel_main.c26
-rw-r--r--babeld/babel_zebra.c53
-rw-r--r--babeld/babel_zebra.h7
-rw-r--r--babeld/babeld.c28
-rw-r--r--babeld/babeld.conf.sample14
-rw-r--r--babeld/babeld.h1
8 files changed, 108 insertions, 50 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index 588fea70..404be7a2 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -877,9 +877,9 @@ DEFUN (show_babel_database,
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"
@@ -888,7 +888,6 @@ DEFUN (show_babel_running_config,
{
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);
@@ -931,8 +930,8 @@ babel_if_init ()
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
@@ -980,6 +979,22 @@ interface_config_write (struct vty *vty)
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 *
diff --git a/babeld/babel_interface.h b/babeld/babel_interface.h
index 579dc043..1761e3d9 100644
--- a/babeld/babel_interface.h
+++ b/babeld/babel_interface.h
@@ -41,6 +41,7 @@ THE SOFTWARE.
#include <zebra.h>
#include "zclient.h"
+#include "vty.h"
#define CONFIG_DEFAULT 0
#define CONFIG_NO 1
@@ -147,6 +148,7 @@ unsigned update_jitter(babel_interface_nfo *babel_ifp, int urgent);
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
diff --git a/babeld/babel_main.c b/babeld/babel_main.c
index 4cb2d83e..3d83091b 100644
--- a/babeld/babel_main.c
+++ b/babeld/babel_main.c
@@ -77,7 +77,7 @@ struct thread_master *master; /* quagga's threads handler */
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;
@@ -523,30 +523,6 @@ babel_save_state_file(void)
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"
diff --git a/babeld/babel_zebra.c b/babeld/babel_zebra.c
index ed6566f7..75a1e6a8 100644
--- a/babeld/babel_zebra.c
+++ b/babeld/babel_zebra.c
@@ -236,10 +236,11 @@ DEFUN (no_babel_redistribute_type,
#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"
@@ -264,11 +265,12 @@ DEFUN (babel_debug,
}
/* [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"
@@ -293,6 +295,39 @@ DEFUN (no_babel_debug,
}
#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)
{
@@ -313,8 +348,10 @@ 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
diff --git a/babeld/babel_zebra.h b/babeld/babel_zebra.h
index 1b623f01..99601aa7 100644
--- a/babeld/babel_zebra.h
+++ b/babeld/babel_zebra.h
@@ -36,8 +36,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
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
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 07dd92a3..9fea2e10 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -59,6 +59,7 @@ THE SOFTWARE.
#include "message.h"
#include "resend.h"
#include "babel_filter.h"
+#include "babel_zebra.h"
static int babel_init_routing_process(struct thread *thread);
@@ -92,7 +93,26 @@ static struct cmd_node cmd_babel_node =
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;
}
@@ -701,9 +721,3 @@ redistribute_filter(const unsigned char *prefix, unsigned short plen,
return 0;
}
-void
-show_babeld_configuration (struct vty *vty)
-{
- vty_out(vty, "babeld running process %s.%s",
- babel_routing_process ? "enable" : "disable", VTY_NEWLINE);
-}
diff --git a/babeld/babeld.conf.sample b/babeld/babeld.conf.sample
index e1585c1d..4eced433 100644
--- a/babeld/babeld.conf.sample
+++ b/babeld/babeld.conf.sample
@@ -1,13 +1,21 @@
+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
diff --git a/babeld/babeld.h b/babeld/babeld.h
index 29bc5e8f..3c473230 100644
--- a/babeld/babeld.h
+++ b/babeld/babeld.h
@@ -132,7 +132,6 @@ extern int redistribute_filter(const unsigned char *prefix, unsigned short plen,
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 */