summaryrefslogtreecommitdiffstats
path: root/babeld
diff options
context:
space:
mode:
authorMatthieu Boutier <boutier@pps.jussieu.fr>2012-01-18 16:39:29 +0100
committerPaul Jakma <paul@quagga.net>2012-03-25 18:06:52 +0200
commit297a55ba1ce58b281b825400abeca6c32b99db52 (patch)
treecdeeb45d82ed83f6db0bf3920ea7be14f55f94fa /babeld
parentbabeld: avoid segfault (bug 706). (diff)
downloadfrr-297a55ba1ce58b281b825400abeca6c32b99db52.tar.xz
frr-297a55ba1ce58b281b825400abeca6c32b99db52.zip
babeld: add command: "show_babel_neighbour".
Diffstat (limited to 'babeld')
-rw-r--r--babeld/babel_interface.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index edfa2b40d..bd32d2632 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -51,6 +51,7 @@ THE SOFTWARE.
#include "message.h"
#include "route.h"
#include "babel_zebra.h"
+#include "neighbour.h"
static int babel_enable_if_lookup (const char *ifname);
@@ -727,6 +728,51 @@ DEFUN (show_babel_interface,
return CMD_SUCCESS;
}
+static void
+show_babel_neighbour_sub (struct vty *vty, struct neighbour *neigh)
+{
+ vty_out (vty,
+ "Neighbour %s dev %s reach %04x rxcost %d txcost %d %s.%s",
+ format_address(neigh->address),
+ neigh->ifp->name,
+ neigh->reach,
+ neighbour_rxcost(neigh),
+ neigh->txcost,
+ if_up(neigh->ifp) ? "" : " (down)",
+ VTY_NEWLINE);
+}
+
+DEFUN (show_babel_neighbour,
+ show_babel_neighbour_cmd,
+ "show babel neighbour [INTERFACE]",
+ SHOW_STR
+ IP_STR
+ "Babel information\n"
+ "Print neighbours\n"
+ "Interface name\n")
+{
+ struct neighbour *neigh;
+ struct interface *ifp;
+
+ if (argc == 0) {
+ FOR_ALL_NEIGHBOURS(neigh) {
+ show_babel_neighbour_sub(vty, neigh);
+ }
+ return CMD_SUCCESS;
+ }
+ if ((ifp = if_lookup_by_name (argv[0])) == NULL)
+ {
+ vty_out (vty, "No such interface name%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ FOR_ALL_NEIGHBOURS(neigh) {
+ if(ifp->ifindex == neigh->ifp->ifindex) {
+ show_babel_neighbour_sub(vty, neigh);
+ }
+ }
+ return CMD_SUCCESS;
+}
+
void
babel_if_init ()
{
@@ -758,6 +804,8 @@ babel_if_init ()
/* "show babel ..." commands */
install_element (VIEW_NODE, &show_babel_interface_cmd);
install_element (ENABLE_NODE, &show_babel_interface_cmd);
+ install_element(VIEW_NODE, &show_babel_neighbour_cmd);
+ install_element(ENABLE_NODE, &show_babel_neighbour_cmd);
}
/* hooks: functions called respectively when struct interface is