mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-31 08:35:45 +00:00
babeld: justify "running-config" meaning in CLI
The primary focus of this commit is to make "show running-config" command display more current configuration, including some of the bits previously seen in the output of "show babel running-config". Besides that, the following commands were renamed for consistency with the syntax of other components: "debug *" to "debug babel *" (and moved to top level) "show babel running-config" to "show babel parameters" * babel_interface.c * show_babel_running_config(): rename to show_babel_parameters(), update syntax pattern, don't call show_babeld_configuration() * babel_if_init(): update respectively * babel_enable_if_config_write(): new VTY helper for static babel_enable_if * babel_interface.h: add extern declaration * babel_main.c: unset all debug options by default * show_babel_main_configuration(): remove debug options decoder * babel_zebra.c * babel_debug(): rename to debug_babel(), update syntax pattern * no_babel_debug(): rename to no_debug_babel(), update syntax pattern * babelz_zebra_init(): update respectively * debug_babel_config_write() new VTY helper for static debug_type * babel_zebra.h: add extern declaration * babeld.c * babel_config_write(): add the code to output "debug babel *", "router babel", "redistribute *" and "network *" statements * show_babeld_configuration(): dismiss * babeld.h: remove extern declaration * babeld.texi: update for renamed commands * babeld.conf.sample: idem, add debug statements block
This commit is contained in:
parent
ce590ecd85
commit
a14ef5eecc
@ -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 *
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
log stdout
|
||||
|
@ -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 */
|
||||
|
@ -109,7 +109,7 @@ Specify which kind of routes should be redistributed into Babel.
|
||||
@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
|
||||
@ -117,8 +117,8 @@ state. They are mostly useful for troubleshooting.
|
||||
@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
|
||||
|
Loading…
Reference in New Issue
Block a user