Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Grant Taylor <gtaylor@riverviewtech.net>
To: Mail List - Netfilter <netfilter@vger.kernel.org>
Subject: Re: Double rules for using NETFLOW?
Date: Thu, 03 Feb 2011 14:14:38 -0600	[thread overview]
Message-ID: <4D4B0CAE.5000105@riverviewtech.net> (raw)
In-Reply-To: <4D4A3A04.20505@linux.vnet.ibm.com>

On 02/02/11 23:15, Srinivasa T N wrote:
> But how will I have access to the counters from my user land app?

I'd be extremely surprised if there were APIs that you can use to query 
the kernel.  -  Though, I don't work on programming (like that) so I 
don't know first hand.

At the very least, you can find the counters via the output of the 
iptables command.  I.e. I can issue the following command:

    iptables -t filter -L FORWARD -n -v -x

This will give me a packet / byte count (-v) that is exact (-x) that 
have match various rules.  I.e. the above command produced the following 
output:

Chain FORWARD (policy DROP 0 packets, 0 bytes)
     pkts      bytes target     prot opt in     out     source 
      destination
  3783934 4488563274 ACCEPT     all  --  eth0   eth1    0.0.0.0/0 
      0.0.0.0/0           state RELATED,ESTABLISHED
  2632183 290464220 ACCEPT     all  --  eth1   eth0    0.0.0.0/0 
     0.0.0.0/0

If you are worried about knowing which rule you want to read the 
counters on, use the comment match extension that will allow you to put 
a comment / string to flag on in the output.  This will allow you to 
grep for that line of output.

There might even be some way via /proc or /sys to find what you are 
asking, but I don't know.



Grant. . . .

  reply	other threads:[~2011-02-03 20:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 10:01 Double rules for using NETFLOW? Srinivasa T N
2011-02-02 10:09 ` Giles Coochey
2011-02-02 17:56 ` Grant Taylor
2011-02-03  5:15   ` Srinivasa T N
2011-02-03 20:14     ` Grant Taylor [this message]
2011-02-04  5:02       ` Srinivasa T N

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D4B0CAE.5000105@riverviewtech.net \
    --to=gtaylor@riverviewtech.net \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox