Revision 4d176e14

View differences:

doc/bird.sgml
351 351
	<tag>show symbols</tag>
352 352
	Show the list of symbols defined in the configuration (names of protocols, routing tables etc.).
353 353

  
354
	<tag>show route [[for] <m/prefix/|<m/IP/] [table <m/sym/] [filter <m/f/|where <m/c/] [(import|preimport) <m/p/] [<m/options/]</tag>
354
	<tag>show route [[for] <m/prefix/|<m/IP/] [table <m/sym/] [filter <m/f/|where <m/c/] [(import|preimport) <m/p/] [protocol <m/p/] [<m/options/]</tag>
355 355
	Show contents of a routing table (by default of the main one),
356 356
	that is routes, their metrics and (in case the <cf/all/ switch is given)
357 357
	all their attributes.
......
370 370
        that are imported to the specified protocol. With <cf/preimport/, the
371 371
	import filter of the protocol is skipped.
372 372

  
373
	<p>You can also select just routes added by a specific protocol.
374
	<cf>protocol <m/p/</cf>.
375

  
373 376
	<p>The <cf/stats/ switch requests showing of route statistics (the
374 377
	number of networks, number of routes before and after filtering). If
375 378
	you use <cf/count/ instead, only the statistics will be printed.
nest/config.Y
278 278
CF_CLI(SHOW INTERFACES SUMMARY,,, [[Show summary of network interfaces]])
279 279
{ if_show_summary(); } ;
280 280

  
281
CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [(import|preimport) <p>] [stats|count]]], [[Show routing table]])
281
CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [(import|preimport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
282 282
{ rt_show($3); } ;
283 283

  
284 284
r_args:
......
334 334
     $$->import_protocol = c->proto;
335 335
     $$->running_on_config = c->proto->cf->global;
336 336
   }
337
 | r_args PROTOCOL SYM {
338
     struct proto_config *c = (struct proto_config *) $3->def;
339
     $$ = $1;
340
     if ($$->show_protocol) cf_error("Protocol specified twice");
341
     if ($3->class != SYM_PROTO || !c->proto) cf_error("%s is not a protocol", $3->name);
342
     $$->show_protocol = c->proto;
343
     $$->running_on_config = c->proto->cf->global;
344
   }
337 345
 | r_args STATS {
338 346
     $$ = $1;
339 347
     $$->stats = 1;
nest/route.h
211 211
  struct filter *filter;
212 212
  int verbose;
213 213
  struct fib_iterator fit;
214
  struct proto *show_protocol;
214 215
  struct proto *import_protocol;
215 216
  int import_mode, primary_only;
216 217
  struct config *running_on_config;
nest/rt-table.c
979 979
      struct ea_list *tmpa, *old_tmpa;
980 980
      struct proto *p0 = e->attrs->proto;
981 981
      struct proto *p1 = d->import_protocol;
982
      struct proto *p2 = d->show_protocol;
982 983
      d->rt_counter++;
983 984
      ee = e;
984 985
      rte_update_lock();		/* We use the update buffer for filtering */
985 986
      old_tmpa = tmpa = p0->make_tmp_attrs ? p0->make_tmp_attrs(e, rte_update_pool) : NULL;
986 987
      ok = (d->filter == FILTER_ACCEPT || f_run(d->filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) <= F_ACCEPT);
988
      if (p2 && p2 != p0) ok = 0;
987 989
      if (ok && d->import_mode)
988 990
	{
989 991
	  int ic = (p1->import_control ? p1->import_control(p1, &e, &tmpa, rte_update_pool) : 0);

Also available in: Unified diff