All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira <pablo@eurodev.net>
To: Chris Wilson <chris@netservers.co.uk>,
	Netfilter Development Mailinglist
	<netfilter-devel@lists.netfilter.org>
Subject: Re: conntrack match and locking
Date: Fri, 28 May 2004 14:06:30 +0200	[thread overview]
Message-ID: <40B72B46.9050908@eurodev.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0405271104570.27895@chris.camcom.co.uk>

Hi Chris,

Chris Wilson wrote:

>Is there some documentation which describes this process? I didn't find 
>anything in the netfilter hacking HOWTO.
>

no, only source code, have a look at netfilter-docbook patch which has 
comments about all functions used in ip_conntrack_core.c, but the 
current schema used is not documented.

> Are the conntrack entries 
>(original and reply) actually spin_locked, or just held in memory by the 
>reference?
>

Actually this is the process, when we read a conntrack from the 
conntrack table we read_lock the table and increase its refcount (see 
ip_conntrack_get). We don't lock a conntrack, we lock the table while 
reading the conntrack/tuples pair.

To write a conntrack, that is, we want to add/destroy/modify a conntrack 
, we write lock the table.

At this moment we lock the whole table, Joszef has some patches to make 
fine grain locking (instead of locking the whole table, per bucket 
locking) in pom-ng still in testing phase.

> If two packets are being processed at the same time on an SMP 
>machine, who holds what locks?
>  
>

As I told you, we only lock the table when reading/writing new entries, 
once we get the conntrack, we increase the refcount. Have also a look at 
ip_conntrack_put to understand the way refcounts are used when 
destroying a conntrack.

regards,
Pablo

  parent reply	other threads:[~2004-05-28 12:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-24 15:29 conntrack match and locking Chris Wilson
2004-05-26 16:06 ` Henrik Nordstrom
2004-05-27 10:11   ` Chris Wilson
2004-05-27 10:28     ` Henrik Nordstrom
2004-05-28 12:06     ` Pablo Neira [this message]
2004-05-28 12:39       ` Pablo Neira
2004-05-27  1:32 ` 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=40B72B46.9050908@eurodev.net \
    --to=pablo@eurodev.net \
    --cc=chris@netservers.co.uk \
    --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.