From: Patrick McHardy <kaber@trash.net>
To: Joubert Berger <joubert@berger-family.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: possible ICMP accounting issue
Date: Tue, 04 Mar 2008 15:55:51 +0100 [thread overview]
Message-ID: <47CD62F7.30204@trash.net> (raw)
In-Reply-To: <82b0add70803030938q1638117cy9078ba884a5d3c6b@mail.gmail.com>
Joubert Berger wrote:
> I have been working on a very simple accounting package that I need and
> ran into something that might be a small problem. It deals with the reply
> packet for ICMP requests. They don't get added to the byte and packet
> counts:
>
> In the icmp_packet() function, we have:
> if (CTINFO2DIR(ctinfo) == IP_CT_DIR_REPLY) {
> if (atomic_dec_and_test(&ct->proto.icmp.count)
> && del_timer(&ct->timeout))
> ct->timeout.function((unsigned long)ct);
> } else {
> atomic_inc(&ct->proto.icmp.count);
> nf_conntrack_event_cache(IPCT
> _PROTOINFO_VOLATILE, skb);
> nf_ct_refresh_acct(ct, ctinfo, skb, nf_ct_icmp_timeout);
> }
> As you can see, the nf_ct_refresh_acct() is not called when it is a reply.
> Presumably because the connection tracking entry's timers are being
> deleted and the entry is getting ready to be flushed anyway (and of course you
> don't need to update timer if you are getting ready to remove it).
>
> But, the way I implemented my accounting package's reporting, I do it
> at the time that the
> connection tracking "destroy" function is called. So, this means
> that the reply packet is
> never included in my counts.
>
> I was going to add (plus appropriate locking):
> ct->counters[CTINFO2DIR(ctinfo)].packets++;
> ct->counters[CTINFO2DIR(ctinfo)].bytes +=
> skb->len - skb_network_offset(skb);
>
> Is this really an issue or is it just a problem for me, because of
> where I am collecting the
> accounting information?
I guess we need a new nf_ct_acct() function and should call
this before destruction (similar for TCP RST).
prev parent reply other threads:[~2008-03-04 14:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-03 17:38 possible ICMP accounting issue Joubert Berger
2008-03-04 14:55 ` Patrick McHardy [this message]
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=47CD62F7.30204@trash.net \
--to=kaber@trash.net \
--cc=joubert@berger-family.org \
--cc=netfilter-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.