summaryrefslogtreecommitdiff
path: root/babeld
diff options
context:
space:
mode:
authorMatthieu Boutier <boutier@pps.jussieu.fr>2012-01-19 22:36:56 +0100
committerPaul Jakma <paul@quagga.net>2012-03-25 17:06:52 +0100
commitd3351d1ebf99591cf436035bb148e4ae0b351ffc (patch)
treef0e5286ec77fe2bab401343df6ce32e79a7b963b /babeld
parent1f39f466e439f217dcbae741ddc23a5340a05ec9 (diff)
babeld: add command: "show_babel_running_config".
Diffstat (limited to 'babeld')
-rw-r--r--babeld/babel_interface.c21
-rw-r--r--babeld/babel_main.c66
-rw-r--r--babeld/babel_main.h4
-rw-r--r--babeld/babeld.c7
-rw-r--r--babeld/babeld.h2
-rw-r--r--babeld/util.c4
-rw-r--r--babeld/util.h1
7 files changed, 105 insertions, 0 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index d4c84b35..3f580046 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -43,6 +43,7 @@ THE SOFTWARE.
#include "command.h"
#include "prefix.h"
#include "vector.h"
+#include "distribute.h"
#include "babel_main.h"
#include "util.h"
@@ -829,6 +830,24 @@ DEFUN (show_babel_database,
return CMD_SUCCESS;
}
+DEFUN (show_babel_running_config,
+ show_babel_running_config_cmd,
+ "show babel running-config",
+ SHOW_STR
+ IP_STR
+ "Babel information\n"
+ "Configuration information\n"
+ "No attributes\n")
+{
+ vty_out(vty, " -- Babel running configuration --%s", VTY_NEWLINE);
+ show_babel_main_configuration(vty);
+ show_babeld_configuration(vty);
+ vty_out(vty, " -- ditribution lists --%s", VTY_NEWLINE);
+ config_show_distribute(vty);
+
+ return CMD_SUCCESS;
+}
+
void
babel_if_init ()
{
@@ -864,6 +883,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);
}
/* hooks: functions called respectively when struct interface is
diff --git a/babeld/babel_main.c b/babeld/babel_main.c
index 2ae8b917..0a958e60 100644
--- a/babeld/babel_main.c
+++ b/babeld/babel_main.c
@@ -527,3 +527,69 @@ babel_save_state_file(void)
close(fd);
}
}
+
+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"
+ "configuration file = %s%s"
+ "protocol informations:%s"
+ " multicast address = %s%s"
+ " port = %d%s"
+ "vty address = %s%s"
+ "vty port = %d%s"
+ "id = %s%s"
+ "idle time = %d%s"
+ "wireless hello interval = %d%s"
+ "wired hello interval = %d%s"
+ "idle hello interval = %d%s"
+ "parasitic = %s%s"
+ "split-horizon = %s%s"
+ "allow_duplicates = %s%s"
+ "kernel_metric = %d%s",
+ pidfile, VTY_NEWLINE,
+ state_file, VTY_NEWLINE,
+ babel_config_file ? babel_config_file : babel_config_default,
+ VTY_NEWLINE,
+ VTY_NEWLINE,
+ format_address(protocol_group), VTY_NEWLINE,
+ protocol_port, VTY_NEWLINE,
+ babel_vty_addr ? babel_vty_addr : "None",
+ VTY_NEWLINE,
+ babel_vty_port, VTY_NEWLINE,
+ format_eui64(myid), VTY_NEWLINE,
+ idle_time, VTY_NEWLINE,
+ wireless_hello_interval, VTY_NEWLINE,
+ wired_hello_interval, VTY_NEWLINE,
+ idle_hello_interval, VTY_NEWLINE,
+ format_bool(parasitic), VTY_NEWLINE,
+ format_bool(split_horizon), VTY_NEWLINE,
+ format_bool(allow_duplicates), VTY_NEWLINE,
+ kernel_metric, VTY_NEWLINE);
+}
diff --git a/babeld/babel_main.h b/babeld/babel_main.h
index 2bacfabf..a21a5274 100644
--- a/babeld/babel_main.h
+++ b/babeld/babel_main.h
@@ -36,6 +36,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
+#include "vty.h"
+
extern struct timeval babel_now; /* current time */
extern struct thread_master *master; /* quagga's threads handler */
extern int debug;
@@ -52,3 +54,5 @@ extern unsigned char protocol_group[16];
extern int protocol_socket;
extern int kernel_socket;
extern int max_request_hopcount;
+
+void show_babel_main_configuration (struct vty *vty);
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 3dc35b5d..9f2ab5d9 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -764,3 +764,10 @@ redistribute_filter(const unsigned char *prefix, unsigned short plen,
return babel_filter_redistribute(&p, NULL);
}
+
+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.h b/babeld/babeld.h
index 87b4de7b..29bc5e8f 100644
--- a/babeld/babeld.h
+++ b/babeld/babeld.h
@@ -41,6 +41,7 @@ THE SOFTWARE.
#define BABEL_BABELD_H
#include <zebra.h>
+#include "vty.h"
#define INFINITY ((unsigned short)(~0))
@@ -131,6 +132,7 @@ 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 */
diff --git a/babeld/util.c b/babeld/util.c
index f1ac0f15..514e0ff3 100644
--- a/babeld/util.c
+++ b/babeld/util.c
@@ -298,6 +298,10 @@ format_eui64(const unsigned char *eui)
return buf[i];
}
+const char *format_bool(const int b) {
+ return b ? "true" : "false";
+}
+
int
parse_address(const char *address, unsigned char *addr_r, int *af_r)
{
diff --git a/babeld/util.h b/babeld/util.h
index 4e7635f6..d64169b0 100644
--- a/babeld/util.h
+++ b/babeld/util.h
@@ -111,6 +111,7 @@ unsigned char *mask_prefix(unsigned char *restrict ret,
const char *format_address(const unsigned char *address);
const char *format_prefix(const unsigned char *address, unsigned char prefix);
const char *format_eui64(const unsigned char *eui);
+const char *format_bool(const int b);
int parse_address(const char *address, unsigned char *addr_r, int *af_r);
int parse_net(const char *ifp, unsigned char *prefix_r, unsigned char *plen_r,
int *af_r);