From e0146fa254496dc12187053cd0cd6e5d20eb6a43 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 8 Jul 2017 05:07:23 +0530 Subject: include: Pass nf_sock where needed as parameter This socket should not be global, it is also hidden in many layers of code. Expose it as function parameters to decouple the netlink socket handling logic from the command parsing, evaluation and bytecode generation. Joint work with Varsha Rao. Signed-off-by: Varsha Rao Signed-off-by: Pablo Neira Ayuso --- include/rule.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/rule.h') diff --git a/include/rule.h b/include/rule.h index 24c73d85..ddad6d40 100644 --- a/include/rule.h +++ b/include/rule.h @@ -457,6 +457,7 @@ extern void cmd_free(struct cmd *cmd); /** * struct eval_ctx - evaluation context * + * @nf_sock: netlink socket (for caching) * @msgs: message queue * @cmd: current command * @table: current table @@ -467,6 +468,7 @@ extern void cmd_free(struct cmd *cmd); * @pctx: payload context */ struct eval_ctx { + struct mnl_socket *nf_sock; struct list_head *msgs; struct cmd *cmd; struct table *table; @@ -484,7 +486,8 @@ extern struct error_record *rule_postprocess(struct rule *rule); struct netlink_ctx; extern int do_command(struct netlink_ctx *ctx, struct cmd *cmd); -extern int cache_update(enum cmd_ops cmd, struct list_head *msgs); +extern int cache_update(struct mnl_socket *nf_sock, enum cmd_ops cmd, + struct list_head *msgs); extern void cache_flush(void); extern void cache_release(void); -- cgit v1.2.3