Linux Netfilter discussions
 help / color / mirror / Atom feed
* how to add packet or byte couters to connection tracking module
@ 2003-02-20 18:04 Xuan Chen
  2003-02-20 18:33 ` Patrick Schaaf
  2003-02-21  0:49 ` Patrick McHardy
  0 siblings, 2 replies; 4+ messages in thread
From: Xuan Chen @ 2003-02-20 18:04 UTC (permalink / raw)
  To: netfilter, netfilter-devel

Hi,

I want to add a packet or byte counter to the connection tracking module 
in netfilter. That is, I want to track how many packets and bytes having 
been sent through one connection. Where should I start? Any examples will 
be very helpful!

btw, is there a search engine on netfilter's web page? I think that's 
really helpful if people want to search for previous work and discussions.

Thanks,
-chen

-- 
Xuan Chen
USC/ISI



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

* Re: how to add packet or byte couters to connection tracking module
  2003-02-20 18:04 how to add packet or byte couters to connection tracking module Xuan Chen
@ 2003-02-20 18:33 ` Patrick Schaaf
  2003-02-26 17:36   ` Harald Welte
  2003-02-21  0:49 ` Patrick McHardy
  1 sibling, 1 reply; 4+ messages in thread
From: Patrick Schaaf @ 2003-02-20 18:33 UTC (permalink / raw)
  To: Xuan Chen; +Cc: netfilter, netfilter-devel

> I want to add a packet or byte counter to the connection tracking module 
> in netfilter. That is, I want to track how many packets and bytes having 
> been sent through one connection. Where should I start?

1) Get the kernel source code.

2) Get enough RAM to hold the full kernel source code, and your normal apps.
   To test whether you have enough RAM, use 'vmstat' to see whether you
   start swapping on this command:
	find /usr/src/linux -type f | grep -l 'struct ip_conntrack'

3) you are set up for work with the kernel. "grep for this" is the
   basic navigation aid. Now that you have found the include file
   (they end in '.h') where 'struct ip_conntrack' is defined,
   add the neccessary counter fields to it.

4) Study the other files the find/grep above found, especially the files
   with 'conntrack' in their names. Add the counter updates to the
   relevant files.

5) Provide ways for userlevel to access those counters. I would be
   interested to hear about the access methods you imagine.

6) Test. Test. Test.

> Any examples will be very helpful!

A concrete example, would mean writing the code. I hope you persist
and implement and share your code, because if you do, we will have
an example. I hope my six step program, above, helps you along a bit.
 
> btw, is there a search engine on netfilter's web page? I think that's 
> really helpful if people want to search for previous work and discussions.

I'm sure that google has it indexed fully; use the advanced search
features, there, to restrict any search to a particular domain.
An example URL, searching for "byte counters" on www.netfilter.org,
would be:

	http://www.google.com/search?q=+site%3Awww.netfilter.org+byte+counters

best regards
  Patrick


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

* Re: how to add packet or byte couters to connection tracking module
  2003-02-20 18:04 how to add packet or byte couters to connection tracking module Xuan Chen
  2003-02-20 18:33 ` Patrick Schaaf
@ 2003-02-21  0:49 ` Patrick McHardy
  1 sibling, 0 replies; 4+ messages in thread
From: Patrick McHardy @ 2003-02-21  0:49 UTC (permalink / raw)
  To: Xuan Chen; +Cc: netfilter

Xuan Chen wrote:

>Hi,
>
>I want to add a packet or byte counter to the connection tracking module 
>in netfilter. That is, I want to track how many packets and bytes having 
>been sent through one connection. Where should I start? Any examples will 
>be very helpful!
>
>btw, is there a search engine on netfilter's web page? I think that's 
>really helpful if people want to search for previous work and discussions.
>
>Thanks,
>-chen
>
>  
>

http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=conntrack+match+bytes+per+connection&btnG=Google+Search
Doesn't apply clean to 2.4.20 iirc, but very easy to fix.

Patrick



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

* Re: how to add packet or byte couters to connection tracking module
  2003-02-20 18:33 ` Patrick Schaaf
@ 2003-02-26 17:36   ` Harald Welte
  0 siblings, 0 replies; 4+ messages in thread
From: Harald Welte @ 2003-02-26 17:36 UTC (permalink / raw)
  To: Patrick Schaaf; +Cc: Xuan Chen, netfilter, netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

On Thu, Feb 20, 2003 at 07:33:40PM +0100, Patrick Schaaf wrote:
> > I want to add a packet or byte counter to the connection tracking module 
> > in netfilter. That is, I want to track how many packets and bytes having 
> > been sent through one connection. Where should I start?
> 
> 1) Get the kernel source code.
> 
> [...] 

*lol*

> 5) Provide ways for userlevel to access those counters. I would be
>    interested to hear about the access methods you imagine.

ctnetlink should do the trick.

> best regards
>   Patrick

-- 
- Harald Welte <laforge@netfilter.org>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

end of thread, other threads:[~2003-02-26 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-20 18:04 how to add packet or byte couters to connection tracking module Xuan Chen
2003-02-20 18:33 ` Patrick Schaaf
2003-02-26 17:36   ` Harald Welte
2003-02-21  0:49 ` Patrick McHardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox