All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Netfilter Development Mailinglist <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCHv2] deliver events for conntracks created via ctnetlink
Date: Tue, 24 Jun 2008 17:54:17 +0200	[thread overview]
Message-ID: <486118A9.5030808@trash.net> (raw)
In-Reply-To: <4857A939.6050701@netfilter.org>

Pablo Neira Ayuso wrote:
> As for now, the creation and update of conntracks via ctnetlink do not
> propagate an event to userspace. This can result in inconsistent
> situations if several userspace processes modify the connection tracking
> table by means of ctnetlink at the same time. Specifically, using the
> conntrack command line tool and conntrackd at the same time can trigger
> unconsistencies.
> 
> This patch fixes this inconsistent situation. Note that the deletion
> does not suffer from this problem.
> 
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> 

Unfortunately all the change functions are deadlock prone,
they are called while holding the conntrack lock and
event delivery might trigger destruction of the conntrack
entry already in the cache, which takes the lock again.

Perhaps we can do all this much easier. Conntrack updates
over netlink are a lot more rare than events triggered
by packet processing. What do you think about just sending
the full entry on successful changes over ctnetlink?

A few minor nits:

> +			atomic_inc(&ct->ct_general.use);

Should be using nf_conntrack_get().

Also the patch adds newlines excessively, to a file already
containing about 20% empty lines. Things like

>  		ct->status |= IPS_SEQ_ADJUST;
> +
> +		nf_conntrack_event_cache_ct(IPCT_NATSEQADJ, ct);

or

>  	rcu_read_unlock();
>  
> +	nf_ct_deliver_cached_events(ct);
> +
> +	nf_ct_put(ct);
> +
>  	return 0;

don't aid readability.

  reply	other threads:[~2008-06-24 15:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 12:08 [PATCHv2] deliver events for conntracks created via ctnetlink Pablo Neira Ayuso
2008-06-24 15:54 ` Patrick McHardy [this message]
2008-06-24 16:11   ` Patrick McHardy
2008-06-24 17:19     ` Pablo Neira Ayuso
2008-06-24 17:28       ` Patrick McHardy
2008-06-24 16:51   ` Pablo Neira Ayuso

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=486118A9.5030808@trash.net \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@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.