From 6f8b54eefce259cb0320d9bfc4d9b990d81b7df9 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Fri, 30 Nov 2012 14:20:17 +0100 Subject: [PATCH] flowtop: first set empty filter, then overwrite Signed-off-by: Daniel Borkmann --- src/flowtop.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/flowtop.c b/src/flowtop.c index bb4d2c80..ce59e6bd 100644 --- a/src/flowtop.c +++ b/src/flowtop.c @@ -1058,6 +1058,10 @@ static void *collector(void *null) if (!filter) panic("Cannot create a nfct filter!\n"); + ret = nfct_filter_attach(nfct_fd(handle), filter); + if (ret < 0) + panic("Cannot attach filter to handle!\n"); + if (what & INCLUDE_UDP) nfct_filter_add_attr_u32(filter, NFCT_FILTER_L4PROTO, IPPROTO_UDP); if (what & INCLUDE_TCP) @@ -1087,6 +1091,8 @@ static void *collector(void *null) nfct_callback_register(handle, NFCT_T_ALL, collector_cb, NULL); + nfct_filter_destroy(filter); + collector_load_geoip(); flow_list_init(&flow_list); @@ -1102,7 +1108,6 @@ static void *collector(void *null) collector_destroy_geoip(); - nfct_filter_destroy(filter); nfct_close(handle); pthread_exit(0); -- 2.11.4.GIT