From 5163796ab0f772d8f3bc8473e92d401d67cbe6bd Mon Sep 17 00:00:00 2001 From: Vadim Kochan Date: Tue, 5 Jan 2016 21:42:40 +0200 Subject: flowtop: Use one nfct handle for dump & refresh flows Simplify dump & flows refreshing via one nfct handle, which is enough. Signed-off-by: Vadim Kochan Signed-off-by: Tobias Klauser --- flowtop.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/flowtop.c b/flowtop.c index cc5ffa2..4c15c06 100644 --- a/flowtop.c +++ b/flowtop.c @@ -1615,7 +1615,6 @@ static void collector_dump_flows(void) static void *collector(void *null __maybe_unused) { - struct nfct_handle *ct_update; struct nfct_handle *ct_event; struct pollfd poll_fd[1]; @@ -1631,12 +1630,6 @@ static void *collector(void *null __maybe_unused) nfct_callback_register(ct_event, NFCT_T_ALL, flow_event_cb, NULL); - ct_update = nfct_open(CONNTRACK, NF_NETLINK_CONNTRACK_UPDATE); - if (!ct_update) - panic("Cannot create a nfct handle: %s\n", strerror(errno)); - - nfct_callback_register(ct_update, NFCT_T_ALL, flow_event_cb, NULL); - poll_fd[0].fd = nfct_fd(ct_event); poll_fd[0].events = POLLIN; @@ -1644,10 +1637,6 @@ static void *collector(void *null __maybe_unused) panic("Cannot set non-blocking socket: fcntl(): %s\n", strerror(errno)); - if (fcntl(nfct_fd(ct_update), F_SETFL, O_NONBLOCK) == -1) - panic("Cannot set non-blocking socket: fcntl(): %s\n", - strerror(errno)); - rcu_register_thread(); collector_dump_flows(); @@ -1666,7 +1655,7 @@ static void *collector(void *null __maybe_unused) collector_dump_flows(); } - collector_refresh_flows(ct_update); + collector_refresh_flows(ct_event); status = poll(poll_fd, 1, 0); if (status < 0) { @@ -1688,7 +1677,6 @@ static void *collector(void *null __maybe_unused) spinlock_destroy(&flow_list.lock); nfct_close(ct_event); - nfct_close(ct_update); pthread_exit(NULL); } -- cgit v1.2.3-54-g00ecf