From mboxrd@z Thu Jan 1 00:00:00 1970 From: pablo neira Subject: ip_conntrack_get Date: Wed, 12 Nov 2003 00:06:11 +0100 Sender: netfilter-devel-admin@lists.netfilter.org Message-ID: <3FB16B63.8070603@eurodev.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Return-path: To: netfilter-devel@lists.netfilter.org Errors-To: netfilter-devel-admin@lists.netfilter.org List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: List-Id: netfilter-devel.vger.kernel.org Hi everyone, I've been for almost two weeks trying to understand netfilter code, at this point I'm trying to understand conntrack table code. I have a problem with how conntrack manages the ip_conntrack_info stuff. >>From ip_conntrack_core.c 398 __ip_conntrack_get (struct nf_ct_info *nfct, enum ip_conntrack_info *ctinfo) 399 { 400 struct ip_conntrack *ct 401 = (struct ip_conntrack *)nfct->master ; I don't understand that casting at the line 400th/401th. This is the definition of the structure nf_ct_info: >>From skbuff.h 92 struct nf_ct_info { 93 struct nf_conntrack *master ; 94 }; And the definition of nf_conntrack is: 87 struct nf_conntrack { 88 atomic_t use; 89 void (*destroy)(struct nf_conntrack *); 90 }; Actually nf_conntrack doesn't look like ip_conntrack structure anyway. I also don't understand the way ctinfo is calculate. This stuff... 403 *//* ctinfo is the index of the nfct inside the conntrack *//* 404 *ctinfo = nfct - ct->infos; Don't blame me if it's obvious for you, I'm just a guy trying to understand a really really nice piece of code. Thanks! cheers, Pablo