0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 01:31:55 +00:00

Added `show route for <prefix-or-ipa>' which looks up route leading to

given network.
This commit is contained in:
Martin Mares 2000-05-13 11:42:42 +00:00
parent 56d6c530eb
commit 9449c91ab2
3 changed files with 12 additions and 3 deletions

1
TODO
View File

@ -10,7 +10,6 @@ Core
- filters: user defined attributes?
- cli: show tables?
- cli: show where is routed given IP address?
- client: Ctrl-R eats one more enter
- client: paging?

View File

@ -22,7 +22,7 @@ CF_DECLS
CF_KEYWORDS(ROUTER, ID, PROTOCOL, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS)
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
CF_KEYWORDS(PRIMARY, STATS, COUNT)
CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR)
CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
RIP, OSPF, OSPF_EXT, OSPF_IA, OSPF_BOUNDARY, BGP, PIPE)
@ -256,6 +256,13 @@ r_args:
$$->prefix = $2.addr;
$$->pxlen = $2.len;
}
| r_args FOR prefix_or_ipa {
$$ = $1;
if ($$->pxlen != 256) cf_error("Only one prefix expected");
$$->prefix = $3.addr;
$$->pxlen = $3.len;
$$->show_for = 1;
}
| r_args TABLE SYM {
$$ = $1;
if ($3->class != SYM_TABLE) cf_error("%s is not a table", $3->name);

View File

@ -846,7 +846,10 @@ rt_show(struct rt_show_data *d)
}
else
{
n = fib_find(&d->table->fib, &d->prefix, d->pxlen);
if (d->show_for)
n = fib_route(&d->table->fib, d->prefix, d->pxlen);
else
n = fib_find(&d->table->fib, &d->prefix, d->pxlen);
if (n)
{
rt_show_net(this_cli, n, d);