]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Added `show route for <prefix-or-ipa>' which looks up route leading to
authorMartin Mares <mj@ucw.cz>
Sat, 13 May 2000 11:42:42 +0000 (11:42 +0000)
committerMartin Mares <mj@ucw.cz>
Sat, 13 May 2000 11:42:42 +0000 (11:42 +0000)
given network.

TODO
nest/config.Y
nest/rt-table.c

diff --git a/TODO b/TODO
index 2bf8eb3c59a50649cfeb662be6d3eb59f67b3e33..9581a482536c98afa06e1187f84001a9d3e9d040 100644 (file)
--- a/TODO
+++ b/TODO
@@ -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?
index f92c054152dd03500db91abc94363f1c0de6a067..1267100826008042e48e44b3b19baa8cf738d693 100644 (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);
index cfaa8937878e928dc62709f76b0372f9162219ea..7133ed49581a1300cc83c243b22e0ed46b329a07 100644 (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);