diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-02-05 21:28:02 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-02-05 21:28:02 +0100 |
commit | c3ef4d9b32ca653571f0976f73aaa99218a36db0 (patch) | |
tree | 26c70814dd827be0e1f2ecf6bfdfa5aff064908a /src/run.c | |
parent | 9a29b01005868fef138651e9bc831e179a767b89 (diff) |
netlink: refactorize several nl_init_*_handler() functions
This patch removes:
* nl_init_dump_handler()
* nl_init_request_handler()
* nl_init_resync_handler()
since they all look very similar.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/run.c')
-rw-r--r-- | src/run.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -33,6 +33,7 @@ #include <sys/wait.h> #include <string.h> #include <time.h> +#include <fcntl.h> void killer(int foo) { @@ -317,7 +318,7 @@ init(void) register_fd(nfct_fd(STATE(event)), STATE(fds)); } - STATE(dump) = nl_init_dump_handler(); + STATE(dump) = nfct_open(CONNTRACK, 0); if (STATE(dump) == NULL) { dlog(LOG_ERR, "can't open netlink handler: %s", strerror(errno)); @@ -331,7 +332,7 @@ init(void) return -1; } - STATE(resync) = nl_init_resync_handler(); + STATE(resync) = nfct_open(CONNTRACK, 0); if (STATE(resync)== NULL) { dlog(LOG_ERR, "can't open netlink handler: %s", strerror(errno)); @@ -343,9 +344,10 @@ init(void) STATE(mode)->resync, NULL); register_fd(nfct_fd(STATE(resync)), STATE(fds)); + fcntl(nfct_fd(STATE(resync)), F_SETFL, O_NONBLOCK); /* no callback, it does not do anything with the output */ - STATE(request) = nl_init_request_handler(); + STATE(request) = nfct_open(CONNTRACK, 0); if (STATE(request) == NULL) { dlog(LOG_ERR, "can't open netlink handler: %s", strerror(errno)); |