aboutsummaryrefslogtreecommitdiffstats
path: root/nest
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-06-13 10:51:03 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2023-09-12 15:36:46 +0200
commit51f2e7afaf069508685281e8c1b8bb1ceda79d8f (patch)
tree1e6c2fbb1bfa49b543033193adca354c04247e21 /nest
parent5951dfbd5ed21d973e7627740c069d6612d7b899 (diff)
downloadbird-51f2e7afaf069508685281e8c1b8bb1ceda79d8f.tar.gz
Conf: Symbol manipulation gets its context explicitly
Diffstat (limited to 'nest')
-rw-r--r--nest/config.Y8
-rw-r--r--nest/proto.c4
-rw-r--r--nest/rt-table.c6
3 files changed, 9 insertions, 9 deletions
diff --git a/nest/config.Y b/nest/config.Y
index 8aaf0128..82f63783 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -255,19 +255,19 @@ proto_start:
proto_name:
/* EMPTY */ {
- struct symbol *s = cf_default_name(this_proto->protocol->template, &this_proto->protocol->name_counter);
+ struct symbol *s = cf_default_name(new_config, this_proto->protocol->template, &this_proto->protocol->name_counter);
s->class = this_proto->class;
s->proto = this_proto;
this_proto->name = s->name;
}
| symbol {
- cf_define_symbol($1, this_proto->class, proto, this_proto);
+ cf_define_symbol(new_config, $1, this_proto->class, proto, this_proto);
this_proto->name = $1->name;
}
| FROM CF_SYM_KNOWN {
if (($2->class != SYM_TEMPLATE) && ($2->class != SYM_PROTO)) cf_error("Template or protocol name expected");
- struct symbol *s = cf_default_name(this_proto->protocol->template, &this_proto->protocol->name_counter);
+ struct symbol *s = cf_default_name(new_config, this_proto->protocol->template, &this_proto->protocol->name_counter);
s->class = this_proto->class;
s->proto = this_proto;
this_proto->name = s->name;
@@ -277,7 +277,7 @@ proto_name:
| symbol FROM CF_SYM_KNOWN {
if (($3->class != SYM_TEMPLATE) && ($3->class != SYM_PROTO)) cf_error("Template or protocol name expected");
- cf_define_symbol($1, this_proto->class, proto, this_proto);
+ cf_define_symbol(new_config, $1, this_proto->class, proto, this_proto);
this_proto->name = $1->name;
proto_copy_config(this_proto, $3->proto);
diff --git a/nest/proto.c b/nest/proto.c
index a5325705..bc7b7cc8 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -1269,8 +1269,8 @@ protos_commit(struct config *new, struct config *old, int force_reconfig, int ty
/* This is hack, we would like to share config, but we need to copy it now */
new_config = new;
cfg_mem = new->mem;
- conf_this_scope = new->root_scope;
- sym = cf_get_symbol(oc->name);
+ new->current_scope = new->root_scope;
+ sym = cf_get_symbol(new, oc->name);
proto_clone_config(sym, parsym->proto);
new_config = NULL;
cfg_mem = NULL;
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 23c4bbb2..742e2f05 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -2409,8 +2409,8 @@ rt_preconfig(struct config *c)
{
init_list(&c->tables);
- rt_new_table(cf_get_symbol("master4"), NET_IP4);
- rt_new_table(cf_get_symbol("master6"), NET_IP6);
+ rt_new_table(cf_get_symbol(c, "master4"), NET_IP4);
+ rt_new_table(cf_get_symbol(c, "master6"), NET_IP6);
}
void
@@ -2838,7 +2838,7 @@ rt_new_table(struct symbol *s, uint addr_type)
struct rtable_config *c = cfg_allocz(sizeof(struct rtable_config));
- cf_define_symbol(s, SYM_TABLE, table, c);
+ cf_define_symbol(new_config, s, SYM_TABLE, table, c);
c->name = s->name;
c->addr_type = addr_type;
c->gc_threshold = 1000;