netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Ferenc Wagner <wferi@niif.hu>
Cc: Jan Engelhardt <jengelh@medozas.de>,
	Changli Gao <xiaosuo@gmail.com>,
	netfilter-devel@vger.kernel.org, kadlec@blackhole.kfki.hu,
	kaber@trash.net, thomas.jarosch@intra2net.com
Subject: Re: [PATCH 0/2] [RFC] Extended accounting infrastructure for iptables
Date: Fri, 16 Dec 2011 14:08:53 +0100	[thread overview]
Message-ID: <20111216130853.GA21433@1984> (raw)
In-Reply-To: <871us5bn3t.fsf@tac.ki.iif.hu>

On Thu, Dec 15, 2011 at 09:23:34PM +0100, Ferenc Wagner wrote:
> Jan Engelhardt <jengelh@medozas.de> writes:
> 
> > On Wednesday 2011-12-14 15:52, Changli Gao wrote:
> >
> >> On Wed, Dec 14, 2011 at 9:30 PM, Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> >>
> >>> On Wed, Dec 14, 2011 at 09:12:52PM +0800, Changli Gao wrote:
> >>>>
> >>>> Why not use the counters of iptables instead?
> >>>>
> >>>> iptables-save -c
> >>>
> >>> If you want to obtain the sum of the counters that match some criteria,
> >>> you have to iterate over the whole list of existing rules, look for
> >>> matchings and update the counters.
> >>
> >> As I said in another thread, you can redirect the traffic to a
> >> separated chain, and use the counters of that chain.
> >
> > UDCs (user defined chains) don't have counters, though.
> 
> So put an empty rule into them.  The ip_ plugin of Munin uses this
> technique for quite some time.
> 
> >>> Moreover, if you have a large rule-set, polling periodically
> >>> iptables-save -c can be expensive.
> >>
> >> I got it. Thanks. Maybe we can index the entries in the kernel, and
> >> add a new interface to get the counters of a special entry with a
> >> entry ID.
> >
> > Relying on the rule number is a terrible idea (just like 
> > iptables-save|head -n5|tail -n1 would be). Unique persistend IDs are 
> > unfavorable as well; names, as used with xt_quota2/xt_NFACCT can be 
> > remembered much more easily.
> 
> Rule names could serve this, couldn't they?  And rules can be identified
> by -m comment if batch processing is required.

What you propose is hackish. You parse text-based outputs, which is
not the nice way to make things.

  parent reply	other threads:[~2011-12-16 13:09 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 11:00 [PATCH 0/2] [RFC] Extended accounting infrastructure for iptables pablo
2011-12-14 11:00 ` [PATCH 1/2] netfilter: add extended accounting infrastructure over nfnetlink pablo
2011-12-14 11:16   ` Eric Dumazet
2011-12-14 12:41     ` Pablo Neira Ayuso
2011-12-14 13:18       ` Eric Dumazet
2011-12-14 13:45         ` Eric Dumazet
2011-12-18  0:21           ` Pablo Neira Ayuso
2011-12-14 11:23   ` Patrick McHardy
2011-12-14 13:18     ` Pablo Neira Ayuso
2011-12-14 16:31       ` Patrick McHardy
2011-12-15 12:20         ` Pablo Neira Ayuso
2011-12-14 13:23   ` Changli Gao
2011-12-14 13:43   ` Jan Engelhardt
2011-12-14 16:50     ` Pablo Neira Ayuso
2011-12-14 18:30       ` Jozsef Kadlecsik
2011-12-14 23:06         ` Maciej Żenczykowski
2011-12-15 12:26         ` Pablo Neira Ayuso
2011-12-15 12:32           ` Jan Engelhardt
2011-12-14 13:49   ` Anand Raj Manickam
2011-12-14 13:54     ` Eric Dumazet
2011-12-14 11:00 ` [PATCH 2/2] netfilter: xtables: add NFACCT target to support extended accounting pablo
2011-12-14 13:12 ` [PATCH 0/2] [RFC] Extended accounting infrastructure for iptables Changli Gao
2011-12-14 13:30   ` Pablo Neira Ayuso
2011-12-14 13:37     ` Anand Raj Manickam
2011-12-14 14:52     ` Changli Gao
2011-12-14 15:59       ` Jan Engelhardt
2011-12-15 20:23         ` Ferenc Wagner
2011-12-15 21:01           ` Jan Engelhardt
2011-12-16 15:25             ` Ferenc Wagner
2011-12-17 18:05               ` Pablo Neira Ayuso
2011-12-16 13:08           ` Pablo Neira Ayuso [this message]
2011-12-14 19:29 ` Pete Holland
2011-12-15 13:22   ` Pablo Neira Ayuso

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=20111216130853.GA21433@1984 \
    --to=pablo@netfilter.org \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=thomas.jarosch@intra2net.com \
    --cc=wferi@niif.hu \
    --cc=xiaosuo@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).