path: root/src/rt.c
diff options
authorPablo Neira Ayuso <>2019-08-08 00:30:28 +0200
committerPablo Neira Ayuso <>2019-08-08 12:03:57 +0200
commit45cb29a2ada4edfc2b547fe023d923ce0299a61d (patch)
treef47fb5792e1d6cfaad2ef7efe83fc37c2833b927 /src/rt.c
parenta805eab34e34aaf2f08c607e770ec0b8df992f4a (diff)
src: remove global symbol_table
Store symbol tables in context object instead. Use the nft_ctx object to store the dynamic symbol table. Pass it on to the parse_ctx object so this can be accessed from the parse routines. This dynamic symbol table is also accesible from the output_ctx object for print routines. Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'src/rt.c')
1 files changed, 6 insertions, 7 deletions
diff --git a/src/rt.c b/src/rt.c
index cdd5e9d8..b19c44d6 100644
--- a/src/rt.c
+++ b/src/rt.c
@@ -24,27 +24,26 @@
#include <rule.h>
#include <json.h>
-static struct symbol_table *realm_tbl;
-void realm_table_rt_init(void)
+void realm_table_rt_init(struct nft_ctx *ctx)
- realm_tbl = rt_symbol_table_init("/etc/iproute2/rt_realms");
+ ctx->output.tbl.realm = rt_symbol_table_init("/etc/iproute2/rt_realms");
-void realm_table_rt_exit(void)
+void realm_table_rt_exit(struct nft_ctx *ctx)
- rt_symbol_table_free(realm_tbl);
+ rt_symbol_table_free(ctx->output.tbl.realm);
static void realm_type_print(const struct expr *expr, struct output_ctx *octx)
- return symbolic_constant_print(realm_tbl, expr, true, octx);
+ return symbolic_constant_print(octx->tbl.realm, expr, true, octx);
static struct error_record *realm_type_parse(struct parse_ctx *ctx,
const struct expr *sym,
struct expr **res)
- return symbolic_constant_parse(ctx, sym, realm_tbl, res);
+ return symbolic_constant_parse(ctx, sym, ctx->tbl->realm, res);
const struct datatype realm_type = {