path: root/include/rule.h
diff options
authorPablo Neira Ayuso <>2017-07-08 05:07:23 +0530
committerPablo Neira Ayuso <>2017-07-17 14:26:30 +0200
commite0146fa254496dc12187053cd0cd6e5d20eb6a43 (patch)
treee41f1d9b9ae20849fe281cf14c97e817c194b68a /include/rule.h
parentf63405f9203ce7a8464d585ad49ea67fb2c0bb3f (diff)
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 <>
Diffstat (limited to 'include/rule.h')
1 files changed, 4 insertions, 1 deletions
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);