diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-10-12 13:24:08 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2010-11-08 23:40:33 +0100 |
commit | b245e4092c5a7f09729e64868a42e13f48ac5db8 (patch) | |
tree | a31692d718120b9c17951e2e583c3a7d554602ab /src/expect/api.c | |
parent | 417dc5fb87ade355d699ea523de870abc6dd1657 (diff) |
src: allow to use nfct handler for conntrack and expectations at the same time
This patch re-works the callback handling to allow the use the same socket
to send/receive commands and listen to events of both conntrack and
expectation subsystems. Now you can register one callback for conntrack
and one for expectation with the same handler with no problems (before
this patch, this was not possible, you required two different handlers).
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expect/api.c')
-rw-r--r-- | src/expect/api.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/expect/api.c b/src/expect/api.c index d560178..35c8672 100644 --- a/src/expect/api.c +++ b/src/expect/api.c @@ -139,17 +139,17 @@ int nfexp_callback_register(struct nfct_handle *h, container->type = type; container->data = data; - h->nfnl_cb.call = __expect_callback; - h->nfnl_cb.data = container; - h->nfnl_cb.attr_count = CTA_EXPECT_MAX; + h->nfnl_cb_exp.call = __callback; + h->nfnl_cb_exp.data = container; + h->nfnl_cb_exp.attr_count = CTA_EXPECT_MAX; nfnl_callback_register(h->nfnlssh_exp, IPCTNL_MSG_EXP_NEW, - &h->nfnl_cb); + &h->nfnl_cb_exp); nfnl_callback_register(h->nfnlssh_exp, IPCTNL_MSG_EXP_DELETE, - &h->nfnl_cb); + &h->nfnl_cb_exp); return 0; } @@ -166,11 +166,11 @@ void nfexp_callback_unregister(struct nfct_handle *h) nfnl_callback_unregister(h->nfnlssh_exp, IPCTNL_MSG_EXP_DELETE); h->expect_cb = NULL; - free(h->nfnl_cb.data); + free(h->nfnl_cb_exp.data); - h->nfnl_cb.call = NULL; - h->nfnl_cb.data = NULL; - h->nfnl_cb.attr_count = 0; + h->nfnl_cb_exp.call = NULL; + h->nfnl_cb_exp.data = NULL; + h->nfnl_cb_exp.attr_count = 0; } /** @@ -214,17 +214,17 @@ int nfexp_callback_register2(struct nfct_handle *h, container->type = type; container->data = data; - h->nfnl_cb.call = __expect_callback; - h->nfnl_cb.data = container; - h->nfnl_cb.attr_count = CTA_EXPECT_MAX; + h->nfnl_cb_exp.call = __callback; + h->nfnl_cb_exp.data = container; + h->nfnl_cb_exp.attr_count = CTA_EXPECT_MAX; nfnl_callback_register(h->nfnlssh_exp, IPCTNL_MSG_EXP_NEW, - &h->nfnl_cb); + &h->nfnl_cb_exp); nfnl_callback_register(h->nfnlssh_exp, IPCTNL_MSG_EXP_DELETE, - &h->nfnl_cb); + &h->nfnl_cb_exp); return 0; } @@ -241,11 +241,11 @@ void nfexp_callback_unregister2(struct nfct_handle *h) nfnl_callback_unregister(h->nfnlssh_exp, IPCTNL_MSG_EXP_DELETE); h->expect_cb2 = NULL; - free(h->nfnl_cb.data); + free(h->nfnl_cb_exp.data); - h->nfnl_cb.call = NULL; - h->nfnl_cb.data = NULL; - h->nfnl_cb.attr_count = 0; + h->nfnl_cb_exp.call = NULL; + h->nfnl_cb_exp.data = NULL; + h->nfnl_cb_exp.attr_count = 0; } /** |