why counters in nf_conntrack not set in centos 6.x?
An application based on libnetfilter_conntrack and libnfnetlink failed to get counters in CentOS 6.x, but it works works fine with the same code in CentOS 5.x. How to enable the counter functionality? Sample code:
handle_conntrack_ = nfct_open(CONNTRACK, NF_NETLINK_CONNTRACK_DESTROY); nfct_callback_register(handle_conntrack_, NFCT_T_ALL, conntrack_callback, NULL);
static int conntrack_callback(enum nf_conntrack_msg_type type, struct nf_conntrack* ct, void* data)
{
struct __nfct_counters orig_counter = ct->counters[__DIR_ORIG];
struct __nfct_counters repl_counter = ct->counters[__DIR_REPL];
//in CentOS 6.x, orig_counter.packets,orig_counter.bytes,repl_counter.packets and repl_counter.bytes are not set(zero)
}OS and library version:
CentOS 6.4 x86_64
libnfnetlink-1.0.0
libnetfilter_conntrack-0.0.100