summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2008-12-11 18:35:03 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2008-12-11 18:35:03 +0100
commit98154b7d83d1493ba9c2d1b0a8e4b39b635e3082 (patch)
tree896a62636091f87696cbc91bb46f14708273edcd /include
parentdc544c894eddf90a77d49565673ea7eb216b3e44 (diff)
netlink: fix EILSEQ error messages due to process race condition
This patch fixes a race condition that triggers EILSEQ errors (wrong sequence message). The problems is triggered when the child process resets the timers at the same time that the parent process requests a resync. Since both the child and the parent process use the same descriptors, the sequence tracking code in libnfnetlink gets confused as it considers that it is receiving out of sequence netlink messages. This patch introduces internal handlers to commit and reset timers so that the parent and the child do not use the same descriptors to operate with the kernel. This patch changes the prototype of all nf_*_conntrack() functions. Now, the nfct handler is passed as first parameter, this change is required to fix this problem. The rest of the changes on the API is done for consistency. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/netlink.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/include/netlink.h b/include/netlink.h
index b44ef21..5feb3e9 100644
--- a/include/netlink.h
+++ b/include/netlink.h
@@ -11,15 +11,15 @@ struct nfct_handle *nl_init_dump_handler(void);
struct nfct_handle *nl_init_request_handler(void);
struct nfct_handle *nl_init_overrun_handler(void);
-int nl_overrun_request_resync(void);
+int nl_overrun_request_resync(struct nfct_handle *h);
void nl_resize_socket_buffer(struct nfct_handle *h);
-int nl_dump_conntrack_table(void);
-int nl_flush_conntrack_table(void);
-int nl_exist_conntrack(const struct nf_conntrack *ct);
-int nl_get_conntrack(const struct nf_conntrack *ct);
-int nl_create_conntrack(const struct nf_conntrack *ct);
-int nl_update_conntrack(const struct nf_conntrack *ct);
-int nl_destroy_conntrack(const struct nf_conntrack *ct);
+int nl_dump_conntrack_table(struct nfct_handle *h);
+int nl_flush_conntrack_table(struct nfct_handle *h);
+int nl_exist_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct);
+int nl_get_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct);
+int nl_create_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct);
+int nl_update_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct);
+int nl_destroy_conntrack(struct nfct_handle *h, const struct nf_conntrack *ct);
static inline int ct_is_related(const struct nf_conntrack *ct)
{