All of lore.kernel.org
 help / color / mirror / Atom feed
* libnetfilter_conntrack question
@ 2007-03-12  1:56 Phil Dibowitz
  2007-03-12  6:40 ` Phil Dibowitz
  2007-03-12 10:14 ` Pablo Neira Ayuso
  0 siblings, 2 replies; 16+ messages in thread
From: Phil Dibowitz @ 2007-03-12  1:56 UTC (permalink / raw)
  To: netfilter-devel

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

Hey folks,

I've been playing with libnetfilter_conntrack, and I quite like where the
interface has come.

I'm having a bit of a problem though, apparently understanding the
nfct_conntrack struct, however.

I have a bit of sample code that registers a callback and then calls
nfct_dump_conntrack_table(). My callback is essentially just:

sprintf(buf,"%s:%d %s:%d %d",
                inet_ntoa(ct->tuple[NFCT_DIR_ORIGINAL].src),
                ct->tuple[NFCT_DIR_ORIGINAL].l4src,
                inet_ntoa(ct->tuple[NFCT_DIR_ORIGINAL].dst),
                ct->tuple[NFCT_DIR_ORIGINAL].l4dst,
                ct->tuple[NFCT_DIR_ORIGINAL].protonum);

The problem is... I always get the same thing for src and dst and sometimes
for l4src/l4dst

In the example above, I get every connection is listed as going from some
internal machine to *itself* but to/from different ports:

If I do ORIGINAL for src and REPLY for dst everything is going from some
internal IP to the same internal IP on the *same port*.

If I set them all to REPLY, I get mostly external IPs with a few internal
IPs, but again, it's all from some IP to that *same* IP.

I even tried ORIGINAL with src and REPLY as src for the destination on a
whim which also gave me all internal addresses.

I've yet to figure out how to pull the source and destination for a given
nfct_conntrack struct.

For what it's worth, I'm using libnetfilter_conntrack 0.0.31 on a 2.6.15.6
kernel (yes, I know, it's a bit old). /proc/net/ip_conntrack shows more
expected data - source and destinations being different.

Any help would be appreciated, thanks.
-- 
Phil Dibowitz                             phil@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Never write it in C if you can do it in 'awk';
 Never do it in 'awk' if 'sed' can handle it;
 Never use 'sed' when 'tr' can do the job;
 Never invoke 'tr' when 'cat' is sufficient;
 Avoid using 'cat' whenever possible" -- Taylor's Laws of Programming



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

end of thread, other threads:[~2007-03-16  8:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-12  1:56 libnetfilter_conntrack question Phil Dibowitz
2007-03-12  6:40 ` Phil Dibowitz
2007-03-12 10:14 ` Pablo Neira Ayuso
2007-03-13  7:40   ` Phil Dibowitz
2007-03-13  9:41     ` Pablo Neira Ayuso
2007-03-13 18:34       ` Phil Dibowitz
2007-03-14  7:19       ` NFCT_Q_DUMP problem Phil Dibowitz
2007-03-14 13:17         ` Pablo Neira Ayuso
2007-03-14 16:11           ` Phil Dibowitz
2007-03-15 11:50             ` Pablo Neira Ayuso
2007-03-15  0:45         ` Patrick McHardy
2007-03-15  0:54           ` Phil Dibowitz
2007-03-15  5:21       ` libnetfilter_conntrack question Phil Dibowitz
2007-03-15 11:36         ` Pablo Neira Ayuso
2007-03-16  8:44           ` Phil Dibowitz
2007-03-16  8:58             ` Patrick McHardy

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.