From 45cb29a2ada4edfc2b547fe023d923ce0299a61d Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 8 Aug 2019 00:30:28 +0200 Subject: 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 --- include/ct.h | 3 ++- include/datatype.h | 4 +--- include/meta.h | 2 -- include/nftables.h | 18 ++++++++---------- 4 files changed, 11 insertions(+), 16 deletions(-) (limited to 'include') diff --git a/include/ct.h b/include/ct.h index 063f8cdf..efb2d418 100644 --- a/include/ct.h +++ b/include/ct.h @@ -33,7 +33,8 @@ extern struct stmt *notrack_stmt_alloc(const struct location *loc); extern struct stmt *flow_offload_stmt_alloc(const struct location *loc, const char *table_name); extern const char *ct_dir2str(int dir); -extern const char *ct_label2str(unsigned long value); +extern const char *ct_label2str(const struct symbol_table *tbl, + unsigned long value); extern const struct datatype ct_dir_type; extern const struct datatype ct_state_type; diff --git a/include/datatype.h b/include/datatype.h index 018f013a..cf115158 100644 --- a/include/datatype.h +++ b/include/datatype.h @@ -238,9 +238,7 @@ extern void symbol_table_print(const struct symbol_table *tbl, struct output_ctx *octx); extern struct symbol_table *rt_symbol_table_init(const char *filename); -extern void rt_symbol_table_free(struct symbol_table *tbl); - -extern struct symbol_table *mark_tbl; +extern void rt_symbol_table_free(const struct symbol_table *tbl); extern const struct datatype invalid_type; extern const struct datatype verdict_type; diff --git a/include/meta.h b/include/meta.h index a49b4ff5..0fe95fd6 100644 --- a/include/meta.h +++ b/include/meta.h @@ -42,6 +42,4 @@ extern const struct datatype devgroup_type; extern const struct datatype pkttype_type; extern const struct datatype ifname_type; -extern struct symbol_table *devgroup_tbl; - #endif /* NFTABLES_META_H */ diff --git a/include/nftables.h b/include/nftables.h index 407d7613..ef737c83 100644 --- a/include/nftables.h +++ b/include/nftables.h @@ -184,19 +184,17 @@ struct input_descriptor { off_t line_offset; }; -void ct_label_table_init(void); -void mark_table_init(void); +void ct_label_table_init(struct nft_ctx *ctx); +void mark_table_init(struct nft_ctx *ctx); void gmp_init(void); -void realm_table_rt_init(void); -void devgroup_table_init(void); -void realm_table_meta_init(void); +void realm_table_rt_init(struct nft_ctx *ctx); +void devgroup_table_init(struct nft_ctx *ctx); void xt_init(void); -void ct_label_table_exit(void); -void mark_table_exit(void); -void realm_table_meta_exit(void); -void devgroup_table_exit(void); -void realm_table_rt_exit(void); +void ct_label_table_exit(struct nft_ctx *ctx); +void mark_table_exit(struct nft_ctx *ctx); +void devgroup_table_exit(struct nft_ctx *ctx); +void realm_table_rt_exit(struct nft_ctx *ctx); int nft_print(struct output_ctx *octx, const char *fmt, ...) __attribute__((format(printf, 2, 3))); -- cgit v1.2.3