Revision ea2ae6dd

View differences:

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

  
438
	<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>
438
	<tag>show route [[for] <m/prefix/|<m/IP/] [table <m/sym/] [filter <m/f/|where <m/c/] [(export|preexport) <m/p/] [protocol <m/p/] [<m/options/]</tag>
439 439
	Show contents of a routing table (by default of the main one),
440 440
	that is routes, their metrics and (in case the <cf/all/ switch is given)
441 441
	all their attributes.
......
450 450
	<p>You can also ask for printing only routes processed and accepted by
451 451
	a given filter (<cf>filter <m/name/</cf> or <cf>filter { <m/filter/ }
452 452
	</cf> or matching a given condition (<cf>where <m/condition/</cf>).
453
	The <cf/import/ and <cf/preimport/ switches ask for printing of entries
454
	that are imported to the specified protocol. With <cf/preimport/, the
455
	import filter of the protocol is skipped.
453
	The <cf/export/ and <cf/preexport/ switches ask for printing of entries
454
	that are exported to the specified protocol. With <cf/preexport/, the
455
	export filter of the protocol is skipped.
456 456

  
457 457
	<p>You can also select just routes added by a specific protocol.
458 458
	<cf>protocol <m/p/</cf>.
nest/config.Y
43 43
CF_KEYWORDS(ROUTER, ID, PROTOCOL, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
44 44
CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE, STATES, ROUTES, FILTERS)
45 45
CF_KEYWORDS(PASSWORD, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, INTERFACES)
46
CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREIMPORT, GENERATE)
46
CF_KEYWORDS(PRIMARY, STATS, COUNT, FOR, COMMANDS, PREEXPORT, GENERATE)
47 47

  
48 48
CF_ENUM(T_ENUM_RTS, RTS_, DUMMY, STATIC, INHERIT, DEVICE, STATIC_DEVICE, REDIRECT,
49 49
	RIP, OSPF, OSPF_IA, OSPF_EXT1, OSPF_EXT2, BGP, PIPE)
......
56 56
%type <r> rtable
57 57
%type <s> optsym
58 58
%type <ra> r_args
59
%type <i> echo_mask echo_size debug_mask debug_list debug_flag import_or_preimport
59
%type <i> echo_mask echo_size debug_mask debug_list debug_flag export_or_preexport
60 60
%type <t> proto_patt
61 61

  
62 62
CF_GRAMMAR
......
298 298
CF_CLI(SHOW INTERFACES SUMMARY,,, [[Show summary of network interfaces]])
299 299
{ if_show_summary(); } ;
300 300

  
301
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]])
301
CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [(export|preexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
302 302
{ rt_show($3); } ;
303 303

  
304 304
r_args:
......
344 344
     $$ = $1;
345 345
     $$->primary_only = 1;
346 346
   }
347
 | r_args import_or_preimport SYM {
347
 | r_args export_or_preexport SYM {
348 348
     struct proto_config *c = (struct proto_config *) $3->def;
349 349
     $$ = $1;
350
     if ($$->import_mode) cf_error("Protocol specified twice");
350
     if ($$->export_mode) cf_error("Protocol specified twice");
351 351
     if ($3->class != SYM_PROTO || !c->proto) cf_error("%s is not a protocol", $3->name);
352
     $$->import_mode = $2;
352
     $$->export_mode = $2;
353 353
     $$->primary_only = 1;
354
     $$->import_protocol = c->proto;
354
     $$->export_protocol = c->proto;
355 355
     $$->running_on_config = c->proto->cf->global;
356 356
   }
357 357
 | r_args PROTOCOL SYM {
......
372 372
   }
373 373
 ;
374 374

  
375
import_or_preimport:
376
   PREIMPORT { $$ = 1; }
377
 | IMPORT { $$ = 2; }
375
export_or_preexport:
376
   PREEXPORT { $$ = 1; }
377
 | EXPORT { $$ = 2; }
378 378
 ;
379 379

  
380 380
CF_CLI(SHOW SYMBOLS, optsym, [<symbol>], [[Show all known symbolic names]])
nest/route.h
212 212
  int verbose;
213 213
  struct fib_iterator fit;
214 214
  struct proto *show_protocol;
215
  struct proto *import_protocol;
216
  int import_mode, primary_only;
215
  struct proto *export_protocol;
216
  int export_mode, primary_only;
217 217
  struct config *running_on_config;
218 218
  int net_counter, rt_counter, show_counter;
219 219
  int stats, show_for;
nest/rt-table.c
978 978
    {
979 979
      struct ea_list *tmpa, *old_tmpa;
980 980
      struct proto *p0 = e->attrs->proto;
981
      struct proto *p1 = d->import_protocol;
981
      struct proto *p1 = d->export_protocol;
982 982
      struct proto *p2 = d->show_protocol;
983 983
      d->rt_counter++;
984 984
      ee = e;
......
986 986
      old_tmpa = tmpa = p0->make_tmp_attrs ? p0->make_tmp_attrs(e, rte_update_pool) : NULL;
987 987
      ok = (d->filter == FILTER_ACCEPT || f_run(d->filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) <= F_ACCEPT);
988 988
      if (p2 && p2 != p0) ok = 0;
989
      if (ok && d->import_mode)
989
      if (ok && d->export_mode)
990 990
	{
991 991
	  int ic = (p1->import_control ? p1->import_control(p1, &e, &tmpa, rte_update_pool) : 0);
992 992
	  if (ic < 0)
993 993
	    ok = 0;
994
	  else if (!ic && d->import_mode > 1)
994
	  else if (!ic && d->export_mode > 1)
995 995
	    {
996 996
	      if (p1->out_filter == FILTER_REJECT ||
997 997
		  p1->out_filter && f_run(p1->out_filter, &e, &tmpa, rte_update_pool, FF_FORCE_TMPATTR) > F_ACCEPT)
......
1033 1033
	  cli_printf(c, 8004, "Stopped due to reconfiguration");
1034 1034
	  goto done;
1035 1035
	}
1036
      if (d->import_protocol &&
1037
	  d->import_protocol->core_state != FS_HAPPY &&
1038
	  d->import_protocol->core_state != FS_FEEDING)
1036
      if (d->export_protocol &&
1037
	  d->export_protocol->core_state != FS_HAPPY &&
1038
	  d->export_protocol->core_state != FS_FEEDING)
1039 1039
	{
1040 1040
	  cli_printf(c, 8005, "Protocol is down");
1041 1041
	  goto done;

Also available in: Unified diff