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 --- src/parser_bison.y | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/parser_bison.y') diff --git a/src/parser_bison.y b/src/parser_bison.y index 74b2ac7b..87d898b8 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -35,7 +35,8 @@ #include "parser_bison.h" -void parser_init(struct parser_state *state, struct list_head *msgs) +void parser_init(struct mnl_socket *nf_sock, struct parser_state *state, + struct list_head *msgs) { memset(state, 0, sizeof(*state)); init_list_head(&state->cmds); @@ -43,6 +44,7 @@ void parser_init(struct parser_state *state, struct list_head *msgs) state->msgs = msgs; state->scopes[0] = scope_init(&state->top_scope, NULL); state->ectx.msgs = msgs; + state->ectx.nf_sock = nf_sock; } static void yyerror(struct location *loc, void *scanner, -- cgit v1.2.3