summaryrefslogtreecommitdiff
path: root/flowtop.c
diff options
context:
space:
mode:
authorVadim Kochan <vadim4j@gmail.com>2016-01-05 21:42:40 +0200
committerTobias Klauser <tklauser@distanz.ch>2016-01-12 09:16:11 +0100
commit5163796ab0f772d8f3bc8473e92d401d67cbe6bd (patch)
tree588c046a3894c89f8c244dd018fd730c842f4347 /flowtop.c
parent1248d8856a9f20caa601134b424c71b2c98e76b5 (diff)
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 <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'flowtop.c')
-rw-r--r--flowtop.c14
1 files changed, 1 insertions, 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);
}