From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Westphal Subject: Re: per flow stats collection using libnetfilter_conntrack Date: Thu, 9 Mar 2017 10:40:38 +0100 Message-ID: <20170309094038.GB17668@breakpoint.cc> References: <3bbe482c-863f-2b29-e3fd-522b0079ddbb@akamai.com> <20170227221258.GA30877@breakpoint.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Florian Westphal , netfilter-devel@vger.kernel.org To: Tarun Khanna Return-path: Received: from Chamillionaire.breakpoint.cc ([146.0.238.67]:41054 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753165AbdCIJky (ORCPT ); Thu, 9 Mar 2017 04:40:54 -0500 Content-Disposition: inline In-Reply-To: Sender: netfilter-devel-owner@vger.kernel.org List-ID: Tarun Khanna wrote: > On 02/27/2017 05:12 PM, Florian Westphal wrote: > >Tarun Khanna wrote: > >>Is it possible to register for callbacks so that a user application is > >>updated on a regular basis when the packet or bytes counts change for flows? > >No, update to packet/byte count doesn't trigger an event (it would > >trigger too often). > > I was hoping if there was an option to set a timeout, so that an update > would trigger every 5 seconds for flows where the counters have changed. No, there is no such feature at the moment. > I have an application that needs to keep track of per flow stats for all tcp > flows destined to port 80. The best way I have found so far is to call > nfct_query regularly and to go through each flow returned to retrieve the > counters. Would that be the best way to do it? Its your only option right now. If you need a periodic update feature we'll need to think about how to best make this. We now have a periodic gc worker in conntrack so we could probably do this without re-adding a per-conntrack timer.