diff options
-rw-r--r-- | include/netlink.h | 3 | ||||
-rw-r--r-- | src/netlink.c | 36 | ||||
-rw-r--r-- | src/run.c | 8 |
3 files changed, 5 insertions, 42 deletions
diff --git a/include/netlink.h b/include/netlink.h index 9d67165..0df0cbb 100644 --- a/include/netlink.h +++ b/include/netlink.h @@ -7,9 +7,6 @@ struct nf_conntrack; struct nfct_handle; struct nfct_handle *nl_init_event_handler(void); -struct nfct_handle *nl_init_dump_handler(void); -struct nfct_handle *nl_init_request_handler(void); -struct nfct_handle *nl_init_resync_handler(void); struct nlif_handle *nl_init_interface_handler(void); int nl_send_resync(struct nfct_handle *h); diff --git a/src/netlink.c b/src/netlink.c index a9e3d2d..78cc466 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -79,42 +79,6 @@ struct nfct_handle *nl_init_event_handler(void) return h; } -struct nfct_handle *nl_init_dump_handler(void) -{ - struct nfct_handle *h; - - /* open dump netlink socket */ - h = nfct_open(CONNTRACK, 0); - if (h == NULL) - return NULL; - - return h; -} - -struct nfct_handle *nl_init_resync_handler(void) -{ - struct nfct_handle *h; - - h = nfct_open(CONNTRACK, 0); - if (h == NULL) - return NULL; - - fcntl(nfct_fd(h), F_SETFL, O_NONBLOCK); - - return h; -} - -struct nfct_handle *nl_init_request_handler(void) -{ - struct nfct_handle *h; - - h = nfct_open(CONNTRACK, 0); - if (h == NULL) - return NULL; - - return h; -} - struct nlif_handle *nl_init_interface_handler(void) { struct nlif_handle *h; @@ -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)); |