summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/erec.h6
-rw-r--r--include/expression.h3
-rw-r--r--include/mnl.h3
-rw-r--r--include/netlink.h18
-rw-r--r--include/nftables.h3
-rw-r--r--include/parser.h3
-rw-r--r--include/proto.h5
-rw-r--r--include/rule.h4
8 files changed, 31 insertions, 14 deletions
diff --git a/include/erec.h b/include/erec.h
index 36e0efa4..223cb12d 100644
--- a/include/erec.h
+++ b/include/erec.h
@@ -58,8 +58,10 @@ static inline void erec_queue(struct error_record *erec,
list_add_tail(&erec->list, queue);
}
-extern void erec_print(FILE *f, const struct error_record *erec);
-extern void erec_print_list(FILE *f, struct list_head *list);
+extern void erec_print(FILE *f, const struct error_record *erec,
+ unsigned int debug_mask);
+extern void erec_print_list(FILE *f, struct list_head *list,
+ unsigned int debug_mask);
struct eval_ctx;
diff --git a/include/expression.h b/include/expression.h
index 828dbaee..32d4423a 100644
--- a/include/expression.h
+++ b/include/expression.h
@@ -413,7 +413,8 @@ extern struct expr *list_expr_alloc(const struct location *loc);
extern struct expr *set_expr_alloc(const struct location *loc,
const struct set *set);
extern int set_to_intervals(struct list_head *msgs, struct set *set,
- struct expr *init, bool add);
+ struct expr *init, bool add,
+ unsigned int debug_mask);
extern void interval_map_decompose(struct expr *set);
extern struct expr *mapping_expr_alloc(const struct location *loc,
diff --git a/include/mnl.h b/include/mnl.h
index 72072f7f..3df71467 100644
--- a/include/mnl.h
+++ b/include/mnl.h
@@ -8,6 +8,7 @@
struct mnl_ctx {
struct mnl_socket *nf_sock;
unsigned int seqnum;
+ unsigned int debug_mask;
};
struct mnl_socket *netlink_open_sock(void);
@@ -97,7 +98,7 @@ int mnl_nft_obj_batch_del(struct nftnl_obj *nln, struct nftnl_batch *batch,
struct nftnl_ruleset *mnl_nft_ruleset_dump(struct mnl_socket *nf_sock,
uint32_t family, uint32_t seqnum);
-int mnl_nft_event_listener(struct mnl_socket *nf_sock,
+int mnl_nft_event_listener(struct mnl_ctx *ctx,
int (*cb)(const struct nlmsghdr *nlh, void *data),
void *cb_data);
diff --git a/include/netlink.h b/include/netlink.h
index 4bed0e0b..b395cf1c 100644
--- a/include/netlink.h
+++ b/include/netlink.h
@@ -19,6 +19,7 @@ struct netlink_parse_ctx {
struct rule *rule;
struct stmt *stmt;
struct expr *registers[1 + NFT_REG32_15 - NFT_REG32_00 + 1];
+ unsigned int debug_mask;
};
struct rule_pp_ctx {
@@ -39,6 +40,7 @@ extern const struct location netlink_location;
* @data: pointer to pass data to callback
* @seqnum: sequence number
* @octx: output context
+ * @debug_mask: display debugging information
* @cache: cache context
*/
struct netlink_ctx {
@@ -50,6 +52,7 @@ struct netlink_ctx {
uint32_t seqnum;
struct nftnl_batch *batch;
bool batch_supported;
+ unsigned int debug_mask;
struct output_ctx *octx;
struct nft_cache *cache;
};
@@ -176,11 +179,15 @@ extern int netlink_add_obj(struct netlink_ctx *ctx, const struct handle *h,
extern int netlink_delete_obj(struct netlink_ctx *ctx, const struct handle *h,
struct location *loc, uint32_t type);
-extern void netlink_dump_chain(const struct nftnl_chain *nlc);
-extern void netlink_dump_rule(const struct nftnl_rule *nlr);
-extern void netlink_dump_expr(const struct nftnl_expr *nle);
-extern void netlink_dump_set(const struct nftnl_set *nls);
-extern void netlink_dump_obj(struct nftnl_obj *nlo);
+extern void netlink_dump_chain(const struct nftnl_chain *nlc,
+ unsigned int debug_mask);
+extern void netlink_dump_rule(const struct nftnl_rule *nlr,
+ unsigned int debug_mask);
+extern void netlink_dump_expr(const struct nftnl_expr *nle,
+ unsigned int debug_mask);
+extern void netlink_dump_set(const struct nftnl_set *nls,
+ unsigned int debug_mask);
+extern void netlink_dump_obj(struct nftnl_obj *nlo, unsigned int debug_mask);
extern int netlink_batch_send(struct netlink_ctx *ctx, struct list_head *err_list);
@@ -207,6 +214,7 @@ struct netlink_mon_handler {
uint32_t format;
struct netlink_ctx *ctx;
const struct location *loc;
+ unsigned int debug_mask;
bool cache_needed;
struct nft_cache *cache;
};
diff --git a/include/nftables.h b/include/nftables.h
index 8858ad60..c992d302 100644
--- a/include/nftables.h
+++ b/include/nftables.h
@@ -42,13 +42,12 @@ struct nft_ctx {
const char *include_paths[INCLUDE_PATHS_MAX];
unsigned int num_include_paths;
unsigned int parser_max_errors;
+ unsigned int debug_mask;
struct output_ctx output;
bool check;
struct nft_cache cache;
};
-extern unsigned int debug_level;
-
enum nftables_exit_codes {
NFT_EXIT_SUCCESS = 0,
NFT_EXIT_FAILURE = 1,
diff --git a/include/parser.h b/include/parser.h
index df602682..0e266d60 100644
--- a/include/parser.h
+++ b/include/parser.h
@@ -32,7 +32,8 @@ struct parser_state {
struct mnl_socket;
extern void parser_init(struct mnl_socket *nf_sock, struct nft_cache *cache,
- struct parser_state *state, struct list_head *msgs);
+ struct parser_state *state, struct list_head *msgs,
+ unsigned int debug_level);
extern int nft_parse(struct nft_ctx *ctx, void *, struct parser_state *state);
extern void *scanner_init(struct parser_state *state);
diff --git a/include/proto.h b/include/proto.h
index 39aa4850..9a9f9255 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -130,6 +130,7 @@ extern const struct proto_desc *proto_dev_desc(uint16_t type);
/**
* struct proto_ctx - protocol context
*
+ * debug_mask: display debugging information
* @family: hook family
* @location: location of the relational expression defining the context
* @desc: protocol description for this layer
@@ -140,6 +141,7 @@ extern const struct proto_desc *proto_dev_desc(uint16_t type);
* through a dependency.
*/
struct proto_ctx {
+ unsigned int debug_mask;
unsigned int family;
struct {
struct location location;
@@ -148,7 +150,8 @@ struct proto_ctx {
} protocol[PROTO_BASE_MAX + 1];
};
-extern void proto_ctx_init(struct proto_ctx *ctx, unsigned int family);
+extern void proto_ctx_init(struct proto_ctx *ctx, unsigned int family,
+ unsigned int debug_mask);
extern void proto_ctx_update(struct proto_ctx *ctx, enum proto_bases base,
const struct location *loc,
const struct proto_desc *desc);
diff --git a/include/rule.h b/include/rule.h
index 10ac0e26..04da000f 100644
--- a/include/rule.h
+++ b/include/rule.h
@@ -470,6 +470,7 @@ extern void cmd_free(struct cmd *cmd);
* @set: current set
* @stmt: current statement
* @cache: cache context
+ * @debug_mask: debugging bitmask
* @ectx: expression context
* @pctx: payload context
*/
@@ -482,6 +483,7 @@ struct eval_ctx {
struct set *set;
struct stmt *stmt;
struct nft_cache *cache;
+ unsigned int debug_mask;
struct expr_ctx ectx;
struct proto_ctx pctx;
};
@@ -494,7 +496,7 @@ struct netlink_ctx;
extern int do_command(struct netlink_ctx *ctx, struct cmd *cmd);
extern int cache_update(struct mnl_socket *nf_sock, struct nft_cache *cache,
- enum cmd_ops cmd, struct list_head *msgs);
+ enum cmd_ops cmd, struct list_head *msgs, bool debug);
extern void cache_flush(struct list_head *table_list);
extern void cache_release(struct nft_cache *cache);