summaryrefslogtreecommitdiff
path: root/nest/rt-show.c
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2021-12-02 02:22:30 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2022-02-06 23:27:13 +0100
commitea97b8905197180bee5244bce378d03e4b741d88 (patch)
treeaccbe414077899b866d3829170dd53d84f96dc32 /nest/rt-show.c
parent836a87b8acd5da40bde6b89702090c6616e06dfb (diff)
Nest: Implement 'show route in <addr>' command
Implement 'show route in <addr>' command, which shows all routes in networks that are subnets of given network. Currently limited to IP network types.
Diffstat (limited to 'nest/rt-show.c')
-rw-r--r--nest/rt-show.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/nest/rt-show.c b/nest/rt-show.c
index 7691878d..b8c818f8 100644
--- a/nest/rt-show.c
+++ b/nest/rt-show.c
@@ -255,12 +255,17 @@ rt_show_cont(struct cli *c)
FIB_ITERATE_START(fib, it, net, n)
{
+ if ((d->addr_mode == RSD_ADDR_IN) && (!net_in_netX(n->n.addr, d->addr)))
+ goto next;
+
if (!max--)
{
FIB_ITERATE_PUT(it);
return;
}
rt_show_net(c, n, d);
+
+ next:;
}
FIB_ITERATE_END;
@@ -402,7 +407,7 @@ rt_show(struct rt_show_data *d)
rt_show_prepare_tables(d);
- if (!d->addr)
+ if (!d->addr || (d->addr_mode == RSD_ADDR_IN))
{
WALK_LIST(tab, d->tables)
rt_lock_table(tab->table);
@@ -420,7 +425,7 @@ rt_show(struct rt_show_data *d)
d->tab = tab;
d->kernel = rt_show_get_kernel(d);
- if (d->show_for)
+ if (d->addr_mode == RSD_ADDR_FOR)
n = net_route(tab->table, d->addr);
else
n = net_find(tab->table, d->addr);