diff options
author | Maria Matejka <mq@ucw.cz> | 2022-11-07 10:28:01 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-11-07 10:28:01 +0100 |
commit | 7bbd0b5a3b670cfbe72df21054465b71a632962f (patch) | |
tree | 5b1ca17e997224af1f5837b5ef2b1900366ea1dd /conf | |
parent | 40bae8e1b788a535466ac673629fc93b6a258576 (diff) | |
parent | 37b644413723670928f6b54f2abe0c852eb0b652 (diff) |
Merge commit '37b64441' into thread-next
Diffstat (limited to 'conf')
-rw-r--r-- | conf/cf-lex.l | 8 | ||||
-rw-r--r-- | conf/conf.c | 9 | ||||
-rw-r--r-- | conf/conf.h | 9 | ||||
-rw-r--r-- | conf/flowspec.Y | 2 |
4 files changed, 19 insertions, 9 deletions
diff --git a/conf/cf-lex.l b/conf/cf-lex.l index 04e0b3a5..7ce457fe 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -736,7 +736,7 @@ cf_lex_symbol(const char *data) static void cf_lex_init_kh(void) { - HASH_INIT(kw_hash, &root_pool, KW_ORDER); + HASH_INIT(kw_hash, config_pool, KW_ORDER); struct keyword *k; for (k=keyword_list; k->name; k++) @@ -864,7 +864,7 @@ cf_push_soft_scope(void) if (conf_this_scope->soft_scopes < 0xfe) conf_this_scope->soft_scopes++; else - cf_push_scope(NULL); + cf_push_block_scope(); } /** @@ -878,7 +878,7 @@ cf_pop_soft_scope(void) if (conf_this_scope->soft_scopes) conf_this_scope->soft_scopes--; else - cf_pop_scope(); + cf_pop_block_scope(); } /** @@ -893,7 +893,7 @@ cf_swap_soft_scope(void) if (conf_this_scope->soft_scopes) { conf_this_scope->soft_scopes--; - cf_push_scope(NULL); + cf_push_block_scope(); } } diff --git a/conf/conf.c b/conf/conf.c index 17424402..f27147e5 100644 --- a/conf/conf.c +++ b/conf/conf.c @@ -61,6 +61,7 @@ static jmp_buf conf_jmpbuf; struct config *config, *new_config; +pool *config_pool; static struct config *old_config; /* Old configuration */ static struct config *future_config; /* New config held here if recon requested during recon */ @@ -89,7 +90,7 @@ int undo_available; /* Undo was not requested from last reconfiguration */ struct config * config_alloc(const char *name) { - pool *p = rp_new(&root_pool, "Config"); + pool *p = rp_new(config_pool, "Config"); linpool *l = lp_new_default(p); struct config *c = lp_allocz(l, sizeof(struct config)); @@ -489,10 +490,12 @@ config_timeout(timer *t UNUSED) void config_init(void) { - config_event = ev_new(&root_pool); + config_pool = rp_new(&root_pool, "Configurations"); + + config_event = ev_new(config_pool); config_event->hook = config_done; - config_timer = tm_new(&root_pool); + config_timer = tm_new(config_pool); config_timer->hook = config_timeout; } diff --git a/conf/conf.h b/conf/conf.h index ffefa519..ce4a3c5a 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -96,7 +96,7 @@ void order_shutdown(int gr); /* Pools */ - +extern pool *config_pool; extern linpool *cfg_mem; #define cfg_alloc(size) lp_alloc(cfg_mem, size) @@ -137,6 +137,7 @@ struct sym_scope { uint slots; /* Variable slots */ byte active; /* Currently entered */ + byte block; /* No independent stack frame */ byte soft_scopes; /* Number of soft scopes above */ }; @@ -232,6 +233,12 @@ void cf_pop_scope(void); void cf_push_soft_scope(void); void cf_pop_soft_scope(void); +static inline void cf_push_block_scope(void) +{ cf_push_scope(NULL); conf_this_scope->block = 1; } + +static inline void cf_pop_block_scope(void) +{ ASSERT(conf_this_scope->block); cf_pop_scope(); } + char *cf_symbol_class_name(struct symbol *sym); /* Parser */ diff --git a/conf/flowspec.Y b/conf/flowspec.Y index dbdbdda5..102fed45 100644 --- a/conf/flowspec.Y +++ b/conf/flowspec.Y @@ -180,7 +180,7 @@ flow6_opts: flow_builder_init: { if (this_flow == NULL) - this_flow = flow_builder_init(&root_pool); + this_flow = flow_builder_init(config_pool); /* FIXME: This should be allocated from tmp in future */ else flow_builder_clear(this_flow); }; |