All of lore.kernel.org
 help / color / mirror / Atom feed
From: pablo neira <pablo@eurodev.net>
To: netfilter-devel@lists.netfilter.org
Subject: ip_conntrack_get
Date: Wed, 12 Nov 2003 00:06:11 +0100	[thread overview]
Message-ID: <3FB16B63.8070603@eurodev.net> (raw)

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 <http://lxr.linux.no/source/net/ipv4/netfilter/ip_conntrack_core.c#L398> __ip_conntrack_get <http://lxr.linux.no/ident?i=__ip_conntrack_get>(struct nf_ct_info <http://lxr.linux.no/ident?i=nf_ct_info> *nfct, enum ip_conntrack_info <http://lxr.linux.no/ident?i=ip_conntrack_info> *ctinfo)
399 <http://lxr.linux.no/source/net/ipv4/netfilter/ip_conntrack_core.c#L399> {
400 <http://lxr.linux.no/source/net/ipv4/netfilter/ip_conntrack_core.c#L400>         struct ip_conntrack <http://lxr.linux.no/ident?i=ip_conntrack> *ct
401 <http://lxr.linux.no/source/net/ipv4/netfilter/ip_conntrack_core.c#L401>                 = (struct ip_conntrack <http://lxr.linux.no/ident?i=ip_conntrack> *)nfct->master <http://lxr.linux.no/ident?i=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 <http://lxr.linux.no/source/include/linux/skbuff.h#L92> struct nf_ct_info <http://lxr.linux.no/ident?i=nf_ct_info> {
93 <http://lxr.linux.no/source/include/linux/skbuff.h#L93>         struct nf_conntrack <http://lxr.linux.no/ident?i=nf_conntrack> *master <http://lxr.linux.no/ident?i=master>;
94 <http://lxr.linux.no/source/include/linux/skbuff.h#L94> };

And the definition of nf_conntrack is:

87 <http://lxr.linux.no/source/include/linux/skbuff.h#L87> struct nf_conntrack <http://lxr.linux.no/ident?i=nf_conntrack> {
88 <http://lxr.linux.no/source/include/linux/skbuff.h#L88>         atomic_t <http://lxr.linux.no/ident?i=atomic_t> use;
89 <http://lxr.linux.no/source/include/linux/skbuff.h#L89>         void (*destroy)(struct nf_conntrack <http://lxr.linux.no/ident?i=nf_conntrack> *);
90 <http://lxr.linux.no/source/include/linux/skbuff.h#L90> };

Actually nf_conntrack doesn't look like ip_conntrack structure anyway.

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;


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

             reply	other threads:[~2003-11-11 23:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-11 23:06 pablo neira [this message]
2003-11-11 23:55 ` ip_conntrack_get Henrik Nordstrom
2003-12-09  3:58   ` ip_conntrack_get Jesse Peng
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=3FB16B63.8070603@eurodev.net \
    --to=pablo@eurodev.net \
    --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.