summaryrefslogtreecommitdiffstats
path: root/src/rule.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rule.c')
-rw-r--r--src/rule.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/rule.c b/src/rule.c
index ee510fe0..b0b64ffe 100644
--- a/src/rule.c
+++ b/src/rule.c
@@ -122,7 +122,8 @@ static int cache_init_objects(struct netlink_ctx *ctx, enum cmd_ops cmd)
return 0;
}
-static int cache_init(enum cmd_ops cmd, struct list_head *msgs)
+static int cache_init(struct mnl_socket *nf_sock, enum cmd_ops cmd,
+ struct list_head *msgs)
{
struct handle handle = {
.family = NFPROTO_UNSPEC,
@@ -132,6 +133,7 @@ static int cache_init(enum cmd_ops cmd, struct list_head *msgs)
memset(&ctx, 0, sizeof(ctx));
init_list_head(&ctx.list);
+ ctx.nf_sock = nf_sock;
ctx.msgs = msgs;
ret = cache_init_tables(&ctx, &handle);
@@ -146,19 +148,20 @@ static int cache_init(enum cmd_ops cmd, struct list_head *msgs)
static bool cache_initialized;
-int cache_update(enum cmd_ops cmd, struct list_head *msgs)
+int cache_update(struct mnl_socket *nf_sock, enum cmd_ops cmd,
+ struct list_head *msgs)
{
int ret;
if (cache_initialized)
return 0;
replay:
- netlink_genid_get();
- ret = cache_init(cmd, msgs);
+ netlink_genid_get(nf_sock);
+ ret = cache_init(nf_sock, cmd, msgs);
if (ret < 0) {
cache_release();
if (errno == EINTR) {
- netlink_restart();
+ netlink_restart(nf_sock);
goto replay;
}
return -1;