]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Changed syntax of attaching filters to protocols to hopefully the final
authorMartin Mares <mj@ucw.cz>
Mon, 5 Apr 1999 20:15:31 +0000 (20:15 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 5 Apr 1999 20:15:31 +0000 (20:15 +0000)
version:

EXPORT <filter-spec> for outbound routes (i.e., those announced
by BIRD to the rest of the world).
IMPORT <filter-spec> for inbound routes (i.e., those imported
by BIRD from the rest of the world).

where <filter-spec> is one of:

ALL pass all routes
NONE drop all routes
FILTER <name> use named filter
FILTER { <filter> } use explicitly defined filter

For all protocols, the default is IMPORT ALL, EXPORT NONE. This includes
the kernel protocol, so that you need to add EXPORT ALL to get the previous
configuration of kernel syncer (as usually, see doc/bird.conf.example for
a bird.conf example :)).

doc/bird.conf.example
nest/config.Y
nest/proto.c

index f700f2fb0eb24d738aec0d13114f3974c7228008..c1bce7812609b31e685e6de51bdaf718ee208ac7 100644 (file)
@@ -27,8 +27,8 @@ protocol kernel {
        persist;                # Don't remove routes on bird shutdown
        scan time 20;           # Scan kernel routing table every 20 seconds
 #      async off;              # Netlink: Disable asynchronous events
-#      input filter sink;
-#      output filter okay;
+#      import none;            # Default is import all
+       export all;             # Default is export none
 }
 
 protocol device {
index c855f093c7dc0d38479928aad496e7c666a7192a..c535e9ecdd57306062f8c412c811e8d1a8e398fc 100644 (file)
@@ -17,9 +17,10 @@ void rt_dev_add_iface(char *);
 CF_DECLS
 
 CF_KEYWORDS(ROUTER, ID, PROTOCOL, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
-CF_KEYWORDS(INTERFACE, INPUT, OUTPUT, FILTER)
+CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE)
 
 %type <i> idval
+%type <f> imexport
 
 CF_GRAMMAR
 
@@ -67,8 +68,14 @@ proto_item:
  | DEBUG expr { this_proto->debug = $2; }
  | DEBUG ALL { this_proto->debug = ~0; }
  | DEBUG OFF { this_proto->debug = 0; }
- | INPUT FILTER filter { this_proto->in_filter = $3; }
- | OUTPUT FILTER filter { this_proto->out_filter = $3; }
+ | IMPORT imexport { this_proto->in_filter = $2; }
+ | EXPORT imexport { this_proto->out_filter = $2; }
+ ;
+
+imexport:
+   FILTER filter { $$ = $2; }
+ | ALL { $$ = FILTER_ACCEPT; }
+ | NONE { $$ = FILTER_REJECT; }
  ;
 
 /* Direct device route protocol */
index f230c8ef40b090fcc2a7de09bce9891f0006d5e7..ad4aa11d83a2ce3bfbbc41164e273bd7dd0db39f 100644 (file)
@@ -111,6 +111,7 @@ proto_config_new(struct protocol *pr, unsigned size)
   c->proto = pr;
   c->debug = pr->debug;
   c->name = pr->name;
+  c->out_filter = FILTER_REJECT;
   return c;
 }
 
@@ -247,9 +248,9 @@ protos_dump_all(void)
       debug("  protocol %s (pri=%d): state %s/%s\n", p->name, p->proto->priority,
            p_states[p->proto_state], c_states[p->core_state]);
       if (p->in_filter)
-       debug("\tInput filter: %s\n", p->in_filter->name);
-      if (p->out_filter)
-       debug("\tOutput filter: %s\n", p->out_filter->name);
+       debug("\tInput filter: %s\n", filter_name(p->in_filter));
+      if (p->out_filter != FILTER_REJECT)
+       debug("\tOutput filter: %s\n", filter_name(p->out_filter));
       if (p->disabled)
        debug("\tDISABLED\n");
       else if (p->proto->dump)