summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/cf-lex.l8
-rw-r--r--conf/conf.c9
-rw-r--r--conf/conf.h9
-rw-r--r--conf/flowspec.Y2
-rw-r--r--doc/bird.sgml7
-rw-r--r--filter/config.Y16
-rw-r--r--nest/cmds.c1
-rw-r--r--nest/config.Y2
8 files changed, 36 insertions, 18 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);
};
diff --git a/doc/bird.sgml b/doc/bird.sgml
index 8c882ee6..f8be53f6 100644
--- a/doc/bird.sgml
+++ b/doc/bird.sgml
@@ -1149,7 +1149,7 @@ This argument can be omitted if there exists only a single instance.
Show the list of symbols defined in the configuration (names of
protocols, routing tables etc.).
- <tag><label id="cli-show-route">show route [[for] <m/prefix/|<m/IP/] [table (<m/t/ | all)] [filter <m/f/|where <m/c/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [(stats|count)] [<m/options/]</tag>
+ <tag><label id="cli-show-route">show route [[for] <m/prefix/|<m/IP/] [table (<m/t/ | all)] [(import|export) table <m/p/.<m/c/] [filter <m/f/|where <m/c/] [(export|preexport|noexport) <m/p/] [protocol <m/p/] [(stats|count)] [<m/options/]</tag>
Show contents of specified routing tables, that is routes, their metrics
and (in case the <cf/all/ switch is given) all their attributes.
@@ -1169,6 +1169,11 @@ This argument can be omitted if there exists only a single instance.
Last, the set of default tables is used: <cf/master4/, <cf/master6/ and
each first table of any other network type.
+ <p>There are internal tables when <cf/(import|export) table/ options
+ are used for some channels. They can be selected explicitly with
+ <cf/(import|export) table/ switch, specifying protocol <m/p/ and
+ channel name <m/c/.
+
<p>You can also ask for printing only routes processed and accepted by
a given filter (<cf>filter <m/name/</cf> or <cf>filter { <m/filter/ }
</cf> or matching a given condition (<cf>where <m/condition/</cf>).
diff --git a/filter/config.Y b/filter/config.Y
index 5ba4f7e6..d20e4a04 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -38,9 +38,9 @@ f_new_var(struct sym_scope *s)
/*
* - A variable is an offset on vstack from vbase.
* - Vbase is set on filter start / function call.
- * - Scopes contain anonymous scopes (blocks) inside filter/function scope
+ * - Scopes contain (non-frame) block scopes inside filter/function scope
* - Each scope knows number of vars in that scope
- * - Offset is therefore a sum of 'slots' up to named scope
+ * - Offset is therefore a sum of 'slots' up to filter/function scope
* - New variables are added on top of vstk, so intermediate values cannot
* be there during FI_VAR_INIT. I.e. no 'var' inside 'term'.
* - Also, each f_line must always have its scope, otherwise a variable may
@@ -49,7 +49,7 @@ f_new_var(struct sym_scope *s)
int offset = s->slots++;
- while (!s->name)
+ while (s->block)
{
s = s->next;
ASSERT(s);
@@ -491,10 +491,12 @@ filter:
cf_assert_symbol($1, SYM_FILTER);
$$ = $1->filter;
}
- | filter_body {
+ | { cf_push_scope(NULL); } filter_body {
struct filter *f = cfg_alloc(sizeof(struct filter));
- *f = (struct filter) { .root = $1 };
+ *f = (struct filter) { .root = $2 };
$$ = f;
+
+ cf_pop_scope();
}
;
@@ -937,13 +939,13 @@ cmd:
}
| FOR {
/* Reserve space for walk data on stack */
- cf_push_scope(NULL);
+ cf_push_block_scope();
conf_this_scope->slots += 2;
} for_var IN
/* Parse term in the parent scope */
{ conf_this_scope->active = 0; } term { conf_this_scope->active = 1; }
DO cmd {
- cf_pop_scope();
+ cf_pop_block_scope();
$$ = f_new_inst(FI_FOR_INIT, $6, $3);
$$->next = f_new_inst(FI_FOR_NEXT, $3, $9);
}
diff --git a/nest/cmds.c b/nest/cmds.c
index 8a5bbdd4..6717be0c 100644
--- a/nest/cmds.c
+++ b/nest/cmds.c
@@ -118,6 +118,7 @@ cmd_show_memory(void)
print_size("Routing tables:", rmemsize(rt_table_pool));
print_size("Route attributes:", rmemsize(rta_pool));
print_size("Protocols:", rmemsize(proto_pool));
+ print_size("Current config:", rmemsize(config_pool));
struct resmem total = rmemsize(&root_pool);
#ifdef HAVE_MMAP
int pk = atomic_load_explicit(&pages_kept, memory_order_relaxed)
diff --git a/nest/config.Y b/nest/config.Y
index f2904882..dc174b7b 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -656,7 +656,7 @@ CF_CLI(SHOW INTERFACES SUMMARY,,, [[Show summary of network interfaces]])
{ if_show_summary(); } ;
CF_CLI_HELP(SHOW ROUTE, ..., [[Show routing table]])
-CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [filter <f>|where <cond>] [all] [primary] [filtered] [(export|preexport|noexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
+CF_CLI(SHOW ROUTE, r_args, [[[<prefix>|for <prefix>|for <ip>] [table <t>] [(import|export) table <p>.<c>] [filter <f>|where <cond>] [all] [primary] [filtered] [(export|preexport|noexport) <p>] [protocol <p>] [stats|count]]], [[Show routing table]])
{ rt_show($3); } ;
r_args: