summaryrefslogtreecommitdiffstats
path: root/nest/config.Y
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-05-17 22:14:52 +0200
committerMartin Mares <mj@ucw.cz>1999-05-17 22:14:52 +0200
commit0e02abfd5770062768eeb4c75061b7d2f656489d (patch)
treec9ee70e3b8d7eff81ced44994b58e878d9edafdc /nest/config.Y
parent4107df1d1b7454a16e6f45ea55aae13b01c9f566 (diff)
downloadbird-0e02abfd5770062768eeb4c75061b7d2f656489d.tar
bird-0e02abfd5770062768eeb4c75061b7d2f656489d.zip
From now we support multiple tables. The master_table variable is
definitely gone. Both rte_update() and rte_discard() have an additional argument telling which table should they modify. Also, rte_update() no longer walks the whole protocol list -- each table has a list of all protocols connected to this table and having the rt_notify hook set. Each protocol can also freely decide (by calling proto_add_announce_hook) to connect to any other table, but it will be probably used only by the table-to-table protocol. The default debugging dumps now include all routing tables and also all their connections.
Diffstat (limited to 'nest/config.Y')
-rw-r--r--nest/config.Y29
1 files changed, 25 insertions, 4 deletions
diff --git a/nest/config.Y b/nest/config.Y
index c535e9e..667f435 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -17,16 +17,18 @@ void rt_dev_add_iface(char *);
CF_DECLS
CF_KEYWORDS(ROUTER, ID, PROTOCOL, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
-CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE)
+CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, TABLE)
%type <i> idval
%type <f> imexport
+%type <r> rtable
CF_GRAMMAR
/* Setting of router ID */
CF_ADDTO(conf, rtrid)
+
rtrid: ROUTER ID idval ';' {
new_config->router_id = $3;
}
@@ -37,6 +39,19 @@ idval:
| IPA { $$ = ipa_to_u32($1); }
;
+/* Creation of routing tables */
+
+CF_ADDTO(conf, newtab)
+
+newtab: TABLE SYM {
+ struct rtable_config *c = cfg_allocz(sizeof(struct rtable_config));
+ struct symbol *s = $2;
+ cf_define_symbol(s, SYM_TABLE, c);
+ c->name = s->name;
+ add_tail(&new_config->tables, &c->n);
+ }
+ ;
+
/* Definition of protocols */
CF_ADDTO(conf, proto)
@@ -51,9 +66,7 @@ proto_name:
this_proto->name = s->name;
}
| SYM {
- if ($1->class) cf_error("Symbol already defined");
- $1->class = SYM_PROTO;
- $1->def = this_proto;
+ cf_define_symbol($1, SYM_PROTO, this_proto);
this_proto->name = $1->name;
}
;
@@ -70,6 +83,7 @@ proto_item:
| DEBUG OFF { this_proto->debug = 0; }
| IMPORT imexport { this_proto->in_filter = $2; }
| EXPORT imexport { this_proto->out_filter = $2; }
+ | TABLE rtable { this_proto->table = $2; }
;
imexport:
@@ -78,6 +92,13 @@ imexport:
| NONE { $$ = FILTER_REJECT; }
;
+rtable:
+ SYM {
+ if ($1->class != SYM_TABLE) cf_error("Table name expected");
+ $$ = $1->def;
+ }
+ ;
+
/* Direct device route protocol */
CF_ADDTO(proto, dev_proto '}')