All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Fabian Hugelshofer <hugelshofer2006@gmx.ch>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/3] set SEEN_REPLY before destroying conntrack on TCP RST
Date: Tue, 27 May 2008 16:48:52 +0200	[thread overview]
Message-ID: <483C1F54.6040505@trash.net> (raw)
In-Reply-To: <483C1B9D.5060705@gmx.ch>

Fabian Hugelshofer wrote:
> Patrick McHardy wrote:
>> Fabian Hugelshofer wrote:
>>> On Thu, 2008-05-22 at 10:13 +0100, Fabian Hugelshofer wrote:
>>>> If a connection fails with a TCP reset, the conntrack is destroyed 
>>>> immediately. This patch sets the SEEN_REPLY bit before destroying 
>>>> the conntrack.
>>>
>>> This updated version also increments the accounting counters.
>>
>> Thanks, but this needs to be changed slightly.
> [...]
>> I think a better way is to encapsulate the del_timer/timeout.function
>> calls in a nf_ct_kill() function and perform accounting there.
>> Since all manual invocations of timeout.function are/should be
>> performed only while handling packets (that are usually not
>> accounted), this seems like the right way.
> 
> Ok, I see. But for accounting ctinfo and skbuf are required. I'll 
> include them in the argument list of nf_ct_kill() and update the 
> function invocations, ok? Or should I introduce an nf_ct_kill_acct()?

All callers in my patch want the accounting, so a seperate function
would make this one useless. So I'd go with adding a struct sk_buff *
argument, even though its not particulary pretty :)

> I just did another test where my SEEN_REPLY patch was not applied. 
> Surprisingly the SEEN_REPLY bit was set in the destroy events. I am 
> afraid, but I have to assume, that I did not evaluate the bahavior 
> carefully enough. Probably I confused the accounting, no status and no 
> related packets issues.
> 
> Unless a race condition might be thinkable, we should leave the 
> SEEN_REPLY patch. If it is possible, that the timeout function 
> immediately triggers the destroy event to be exported over netlink, then 
> the patch is still necessary. I don't see things detailed enough to 
> judge this. If it is necessary, should it be included in nf_ct_kill()?

Right, I missed this as well. The connection killing only removes
the timer, but the packet will still be handled as a valid packet.
So nf_conntrack_core sets the SEEN_REPLY bit, before destroying it
when the final refcount (from the packet) is released. Thanks for
noticing this :)
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2008-05-27 14:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22  9:13 [PATCH 2/3] set SEEN_REPLY before destroying conntrack on TCP RST Fabian Hugelshofer
2008-05-26 18:25 ` Fabian Hugelshofer
2008-05-27  4:53   ` Patrick McHardy
2008-05-27 14:33     ` Fabian Hugelshofer
2008-05-27 14:48       ` Patrick McHardy [this message]
2008-05-27 22:55         ` [PATCH 2/3] accounting on ct kill (was: set SEEN_REPLY before destroying conntrack on TCP RST) Fabian Hugelshofer
2008-05-28  4:07           ` [PATCH 2/3] accounting on ct kill Patrick McHardy
2008-05-28  8:36             ` Fabian Hugelshofer
2008-06-10  9:22               ` 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=483C1F54.6040505@trash.net \
    --to=kaber@trash.net \
    --cc=hugelshofer2006@gmx.ch \
    --cc=netfilter-devel@vger.kernel.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.