Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Hal Moroff <hmoroff@teltone.com>
Cc: netfilter@vger.kernel.org
Subject: Re: libnetfilter_conntrack
Date: Sat, 05 Jan 2008 16:14:51 +0100	[thread overview]
Message-ID: <477F9EEB.8080001@netfilter.org> (raw)
In-Reply-To: <1C795E2FCD154E46979DDDD5374B5ABE01C7CB18@TTMAIL2.teltone.com>

Hal Moroff wrote:
> I have a firewall application that creates/deletes iptable (netfilter) rules dynamically in response to client requests.
> 
> In other words, a client negotiates with my application and I agree to open a route from that client to a device behind the firewall.  At a certain time later my application closes that route by removing the rule.
> 
> The problem is that TCP connections persist, so even though I remove the rule, the client (if already connected to the target device) can continue to use that connection.
> 
> I use 'cutter' to terminate the connection, and that works most of the time, however the connection remains listed in /proc/net/ip_conntrack, and that confuses my 'cutter' invocation if the same client opens the same route too soon.
> 
> I've set /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_{close,close_wait} to 0, and that doesn't seem to help.
> 
> I'm thinking that calling nfct_delete_conntrack() directly is my solution, however I'm not certain, and I'm also having trouble understanding how to fill in the arguments (and where to get the id required by the last argument).

You can use `conntrack' to delete entries. Have a look at the
conntrack-tools [1]. Also, you can have a look at the example files
inside libnetfilter_conntrack under utils. There's one that shows how to
do what you want. Please, make sure you use lastest version.

[1] http://people.netfilter.org/pablo/conntrack-tools/

-- 
"Los honestos son inadaptados sociales" -- Les Luthiers

      parent reply	other threads:[~2008-01-05 15:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-05  2:48 libnetfilter_conntrack Hal Moroff
2008-01-05 11:44 ` libnetfilter_conntrack G.W. Haywood
2008-01-05 15:14 ` Pablo Neira Ayuso [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=477F9EEB.8080001@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=hmoroff@teltone.com \
    --cc=netfilter@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox