public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Tobias DiPasquale <codeslinger@gmail•com>
To: Patrick McHardy <kaber@trash•net>
Cc: netdev <netdev@oss•sgi.com>,
	linux-net <linux-net@vger•kernel.org>,
	netfilter <netfilter-devel@lists•netfilter.org>
Subject: Re: deleting a conntrack record
Date: Thu, 17 Jun 2004 19:03:38 -0400	[thread overview]
Message-ID: <876ef97a04061716031a0e6000@mail.gmail.com> (raw)
In-Reply-To: <40D1C9FB.1070802@trash.net>

On Thu, 17 Jun 2004 18:42:35 +0200, Patrick McHardy <kaber@trash•net> wrote:
> In fact you shouldn't use ip_ct_selective_cleanup at all but destroy 
> it yourself. You already have a reference, so there is no need to 
> iterate through the entire hash.

In case anyone is interested, as a followup, the above advice works
perfectly. The code now looks like this:

<code>
static int delete_ct_record( u_int32_t src, u_int16_t sport, u_int32_t
dst, u_int16_t dport)
{
      struct ip_conntrack_tuple tuple;
      struct ip_conntrack_tuple_hash *h;

      memset( &tuple, 0, sizeof( tuple));
      tuple.src.ip = src;
      tuple.src.u.tcp.port = sport;
      tuple.dst.ip = dst;
      tuple.dst.u.tcp.port = dport;
      tuple.dst.protonum = IPPROTO_TCP;
      h = ip_conntrack_find_get( &tuple, NULL);
      if (!h)
              return -ENOENT;
      if (del_timer( &h->ctrack->timeout))
              h->ctrack->timeout.function( (unsigned long)h->ctrack);
      ip_conntrack_put( h->ctrack);
      return 1;
}
</code>

As well, the kill_ct_record() function has been removed as it is now
useless. Thanks for all the help, Patrick especially. :)

-- 
[ Tobias DiPasquale ]
0x636f6465736c696e67657240676d61696c2e636f6d

      reply	other threads:[~2004-06-17 23:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-17 15:07 deleting a conntrack record Tobias DiPasquale
2004-06-17 16:02 ` Patrick McHardy
2004-06-17 16:17   ` Tobias DiPasquale
2004-06-17 16:42     ` Patrick McHardy
2004-06-17 23:03       ` Tobias DiPasquale [this message]

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=876ef97a04061716031a0e6000@mail.gmail.com \
    --to=codeslinger@gmail$(echo .)com \
    --cc=kaber@trash$(echo .)net \
    --cc=linux-net@vger$(echo .)kernel.org \
    --cc=netdev@oss$(echo .)sgi.com \
    --cc=netfilter-devel@lists$(echo .)netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox