mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-23 02:01:55 +00:00
BIRD Client: show route
iterates through all routing tables
This commit is contained in:
parent
0c6dfe5236
commit
c845c4895f
@ -299,6 +299,7 @@ struct rtable_config *rt_new_table(struct symbol *s, uint addr_type);
|
|||||||
struct rt_show_data {
|
struct rt_show_data {
|
||||||
net_addr *addr;
|
net_addr *addr;
|
||||||
rtable *table;
|
rtable *table;
|
||||||
|
u8 all_tables; /* Iterate through all routing tables */
|
||||||
struct filter *filter;
|
struct filter *filter;
|
||||||
int verbose;
|
int verbose;
|
||||||
struct fib_iterator fit;
|
struct fib_iterator fit;
|
||||||
|
@ -2593,6 +2593,15 @@ rt_show_cont(struct cli *c)
|
|||||||
rt_show_net(c, n, d);
|
rt_show_net(c, n, d);
|
||||||
}
|
}
|
||||||
FIB_ITERATE_END;
|
FIB_ITERATE_END;
|
||||||
|
|
||||||
|
/* If we iterate through all routing tables then jump on next routing table */
|
||||||
|
if (d->all_tables && NODE_VALID(NODE_NEXT(d->table)))
|
||||||
|
{
|
||||||
|
d->table = NODE_NEXT(d->table);
|
||||||
|
FIB_ITERATE_INIT(&d->fit, &d->table->fib);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (d->stats)
|
if (d->stats)
|
||||||
cli_printf(c, 14, "%d of %d routes for %d networks", d->show_counter, d->rt_counter, d->net_counter);
|
cli_printf(c, 14, "%d of %d routes for %d networks", d->show_counter, d->rt_counter, d->net_counter);
|
||||||
else
|
else
|
||||||
@ -2629,10 +2638,18 @@ rt_show(struct rt_show_data *d)
|
|||||||
{
|
{
|
||||||
net *n;
|
net *n;
|
||||||
|
|
||||||
|
if (EMPTY_LIST(routing_tables)) {
|
||||||
|
cli_msg(0, "");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Default is either a master table or a table related to a respective protocol */
|
/* Default is either a master table or a table related to a respective protocol */
|
||||||
if (!d->table && d->export_protocol) d->table = rt_show_get_table(d->export_protocol);
|
if (!d->table && d->export_protocol) d->table = rt_show_get_table(d->export_protocol);
|
||||||
if (!d->table && d->show_protocol) d->table = rt_show_get_table(d->show_protocol);
|
if (!d->table && d->show_protocol) d->table = rt_show_get_table(d->show_protocol);
|
||||||
if (!d->table) d->table = config->def_tables[NET_IP4]->table; /* FIXME: iterate through all tables ? */
|
if (!d->table) {
|
||||||
|
d->all_tables = 1;
|
||||||
|
d->table = HEAD(routing_tables);
|
||||||
|
}
|
||||||
|
|
||||||
/* Filtered routes are neither exported nor have sensible ordering */
|
/* Filtered routes are neither exported nor have sensible ordering */
|
||||||
if (d->filtered && (d->export_mode || d->primary_only))
|
if (d->filtered && (d->export_mode || d->primary_only))
|
||||||
|
Loading…
Reference in New Issue
Block a user