netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How to modify conntrack accounting?
@ 2013-04-02 19:11 Ed W
  2013-04-02 20:46 ` Eric Leblond
  0 siblings, 1 reply; 5+ messages in thread
From: Ed W @ 2013-04-02 19:11 UTC (permalink / raw)
  To: netfilter-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-03  9:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-02 19:11 How to modify conntrack accounting? Ed W
2013-04-02 20:46 ` Eric Leblond
2013-04-02 22:45   ` Ed W
2013-04-03  9:05     ` Eric Leblond
2013-04-03  9:58       ` Ed W

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).