From: Alan Ezust <alan.ezust@presinet.com>
To: netfilter@lists.netfilter.org
Subject: Re: conntrack -E -i not allowed?
Date: Thu, 2 Nov 2006 11:11:15 -0800 [thread overview]
Message-ID: <200611021111.19134.alan.ezust@presinet.com> (raw)
In-Reply-To: <200611011043.53370.alan.ezust@presinet.com>
[-- Attachment #1: Type: text/plain, Size: 3386 bytes --]
Conntrack uses the following structures, but there is no documentation about
what these structures are for, or where they are used:
// nf_conntrack.h (kernel headers)
struct nf_conn - for the *data member, what kind of structures get stored
there?
nf_conntrack_tuple, nf_conntrack_expect
// nf_conntrack_tuple.h
nf_conntrack_tuple_hash - a linked list of tuples? Where is the code that
inserts/removes elements from this hash?
nf_conntrack_tuple - this contains the information to distingusih a
connection - is this the main structure? What is its relationship to the
nfct_tuple?
// libnetfilter_conntrack.h:31
nfct_handle - /* Harald says: "better for encapsulation" ;) */
This comment is not helpful, just annoying. I'd like to see a proper
description of this structure and a short line or two summarizing where/why
it is used. is this for a single connection, or the conntrack system?
nfct_conntrack - seems to be the main structure used by
libnfnetlink The array of tuples is used to store table
data (?)
Other types i'd like to see proper API docs for:
nfct_tuple
nfct_callback
Anyway, the reason I am delving into this code now is that I am trying patch
conntrack so that when you do conntrack -E -i, it gives you the ctid in the
output lines.
I ran conntrack in a debugger and it keeps bringing me into the
nfnl_parse_attr method via libnetfilter_conntrack.c line 526.
Debugging it, and inspecting the "nfa" structure,
It seems to be an array of struct nfattr objects.
These nfattr structs have 2 fields, a length and a type.
It describes, I assume, which fields need to be extracted from the tuplehash.
This nfa structure is extracted from the struct nlmsghdr which was passed to
nfct_conntrack_netlink_handler. So this struct doesn't contain the right
information in it to tell parse_attr to to put a ctid record into its tb.
All this is called indirectly from nfnl_listen, which gets the nlmsghdr from
callback_handler, which gets it from nfct_conntrack_netlink_handler. But my
debugger isn't showing me where that function was called from (perhaps
because it's coming from the kernel?)
So I think my question is, where is that struct nlmsghdr created that is being
passed to the nfct_conntrack_netlink_handler, and where would be the right
place to add an element to it so that there is a ctid. If that was done,
would that be sufficient to get the ctid into the logline, or is there more
to it than that?
Gads, tracing through this code gives me a headache.
On Wednesday 01 November 2006 10:43, Alan Ezust wrote:
> I'm trying to get conntrack -E to show me events, with conntrack IDs.
> At the moment, the ctid is not showing up in the output.
>
> $ conntrack -E -i
> conntrack v1.00beta2: Illegal option `-i' with this command
>
>
> [NEW] udp 17 30 src=10.10.100.100 dst=204.174.64.1 sport=4536
> dport=53 packets=1 bytes=67 [UNREPLIED] src=204.174.64.1 dst=10.10.100.100
> sport=53 dport=4536 packets=0 bytes=0
>
> Is there a trick to getting the ctids to be sent to the output of this?
>
> conntrack -L -i seems to work, showing me the id. Personally, I think
> conntrack should always output the id.
--
Alan Ezust www.presinet.com
Presinet, inc alan.ezust@presinet.com
Victoria, BC,Canada
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2006-11-02 19:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-01 18:43 conntrack -E -i not allowed? Alan Ezust
2006-11-02 19:11 ` Alan Ezust [this message]
2006-11-07 12:40 ` Pablo Neira Ayuso
2006-11-07 18:37 ` Alan Ezust
2006-11-08 19:29 ` Pablo Neira Ayuso
2006-11-09 16:52 ` Alan Ezust
2006-11-09 17:10 ` Pablo Neira Ayuso
2006-11-09 20:54 ` Alan Ezust
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=200611021111.19134.alan.ezust@presinet.com \
--to=alan.ezust@presinet.com \
--cc=netfilter@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.