All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesse Peng <jesse@deansoft.com.tw>
To: Henrik Nordstrom <hno@marasystems.com>
Cc: pablo neira <pablo@eurodev.net>, netfilter-devel@lists.netfilter.org
Subject: Re: ip_conntrack_get
Date: Tue, 09 Dec 2003 11:58:34 +0800	[thread overview]
Message-ID: <3FD5486A.6060007@deansoft.com.tw> (raw)
In-Reply-To: Pine.LNX.4.44.0311120051400.14633-100000@filer.marasystems.com

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

Henrik Nordstrom wrote:

>>I also don't understand the way ctinfo is calculate. This stuff...
>>
>>403 <http://lxr.linux.no/source/net/ipv4/netfilter/ip_conntrack_core.c#L403>         *//* ctinfo is the index of the nfct inside the conntrack *//*
>>404 <http://lxr.linux.no/source/net/ipv4/netfilter/ip_conntrack_core.c#L404>         *ctinfo = nfct - ct->infos;
>>    
>>
>
>Neither do I.. but then I have never needed to care as ip_conntrack_get()  
>and the conntrack core does a good job of hiding the magics in that area.. 
>it is probably quite simple reasons behind this odd looking construct.
>
>Regards
>Henrik
>
>
>  
>
Execuse me for the late response,for I thought my colleague would taken 
the responsibility. As I think, just same as me, Pablo must be very 
interested in learning netfilter ;)!

while a new ip_conntrack cache initiates, every member 
infos[i](nf_ct_info structure) then be charged with the same address 
value pointing to the ip_conntrack cache's begining address(it's the 
address of its first member nf_conntrack structure naming ct_general also).

code reference:ip_conntrack_core.c ->init_conntrack ->
for (i=0; i < IP_CT_NUMBER; i++)
conntrack->infos[i].master = &conntrack->ct_general;

either the first packet which initiates the ip_conntrack initiation or 
any subsequent packets belonging to this connection, after 
resolve_normal_ct, will get its member pointer structure nf_ct_info 
naming nfct burned the address pointing to the concerning infos[i](the i 
is right the ctinfo we figure out during resolve_normal_ct, as you know, 
which indecates the relation this packet with its belonging connection).

code reference:ip_conntrack_core.c ->resolve_normal_ct ->
skb->nfct = &h->ctrack->infos[*ctinfo];

ok! now with the address of info[i] the pskb get, we can figure out two 
things.First, following the pointer to its address, with the value it 
keeps, we get the address of the ip_conntrack.Second,following the 
ip_conntrack we can get the address of infos[0],then with 
infos[i]-infos[0](nfct-ct->infos),we get the i, which is right the 
*ctinfo we wanna know!

code reference:ip_conntrack_core.c ->__ip_conntrack_get ->
struct ip_conntrack *ct
= (struct ip_conntrack *)nfct->master; 
-------------------------------------->first

/* ctinfo is the index of the nfct inside the conntrack */
*ctinfo = nfct - ct->infos; -------------------------------------->second

I don't know if this answer your question? if not, it's time to improve 
my English expression ;)!



[-- Attachment #2: Type: text/html, Size: 3464 bytes --]

  reply	other threads:[~2003-12-09  3:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-11 23:06 ip_conntrack_get pablo neira
2003-11-11 23:55 ` ip_conntrack_get Henrik Nordstrom
2003-12-09  3:58   ` Jesse Peng [this message]
2003-12-09  8:51     ` ip_conntrack_get Henrik Nordstrom
2003-12-09  9:48       ` ip_conntrack_get Jesse Peng

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=3FD5486A.6060007@deansoft.com.tw \
    --to=jesse@deansoft.com.tw \
    --cc=hno@marasystems.com \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=pablo@eurodev.net \
    /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.