netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ed W <lists@wildgooses.com>
To: netfilter-devel@vger.kernel.org
Subject: How to modify conntrack accounting?
Date: Tue, 02 Apr 2013 20:11:23 +0100	[thread overview]
Message-ID: <515B2D5B.8010807@wildgooses.com> (raw)

Hi, I have a requirement to account for "bytes I pay for" over some 
link, and conntrack very nearly gives me the right answer...  This link 
uses accounting somewhat like ATM, where the IP data is sliced into 
fixed size cells and you have to pay for the overhead per cell, plus the 
wasted space in the extra cell.

I look at the latest kernel sources and all the packet size accounting 
seems to be performed in: nf_conntrack_core.c / __nf_ct_refresh_acct() 
and __nf_ct_kill_acct().

I see several options:

1) Modify the accounting procedure in nf_conntrack_core.c so that 
certain connections will use a different accounting formula. However, 
how would I mark from userspace that a certain interface has this 
unusual accounting property?

2) Could/Should I produce a new netfilter module which operates per 
packet, looks up the connection object for a given packet, and then adds 
a "fudge" to the connection accounting number to correct for the effect 
of the odd packetisation? Presumably from userspace you would then 
simply create an iptables rule tagging packets out of a certain 
interface with "-m my_odd_accounting".

I don't yet know how to build option 2), but it seems appealing (anyone 
got any consultancy time and want to bill me to build it?)

I would appreciate feedback from those more knowledgeable? Given the 
small niche of the solution a modification to nf_conntrack_core.c is 
appealing, but I'm unsure how to indicate which are the peculiar 
interfaces, only userspace will know this.

Thanks for your thoughts/hints

Ed W

             reply	other threads:[~2013-04-02 19:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 19:11 Ed W [this message]
2013-04-02 20:46 ` How to modify conntrack accounting? Eric Leblond
2013-04-02 22:45   ` Ed W
2013-04-03  9:05     ` Eric Leblond
2013-04-03  9:58       ` Ed W

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=515B2D5B.8010807@wildgooses.com \
    --to=lists@wildgooses.com \
    --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 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).