All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Dibowitz <phil@ipom.com>
To: netfilter-devel@lists.netfilter.org
Subject: libnetfilter_conntrack question
Date: Sun, 11 Mar 2007 18:56:31 -0700	[thread overview]
Message-ID: <45F4B34F.3020007@ipom.com> (raw)

[-- 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 --]

             reply	other threads:[~2007-03-12  1:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-12  1:56 Phil Dibowitz [this message]
2007-03-12  6:40 ` libnetfilter_conntrack question 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

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=45F4B34F.3020007@ipom.com \
    --to=phil@ipom.com \
    --cc=netfilter-devel@lists.netfilter.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.