From 0e02abfd5770062768eeb4c75061b7d2f656489d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 17 May 1999 20:14:52 +0000 Subject: 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. --- nest/config.Y | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'nest/config.Y') 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 idval %type imexport +%type 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 '}') -- cgit v1.2.3