All of lore.kernel.org
 help / color / mirror / Atom feed
From: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2005@gmx.net>
To: Jonas Berlin <xkr47@outerspace.dyndns.org>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: [Patch] ip{, 6}tables-restore -n with existing user defined chain
Date: Thu, 19 May 2005 18:37:23 +0200	[thread overview]
Message-ID: <428CC0C3.9000203@gmx.net> (raw)
In-Reply-To: <428CB43E.5060503@outerspace.dyndns.org>

Jonas Berlin schrieb:
> Quoting Charlie Brady on 2005-05-18 16:07 UTC:
> 
>>>I want to redefine an existing chain atomically. I can't do that with
>>>the iptables command, but can almost do it with iptables-restore -n.
>>>When I try, iptables barfs because the chain already exists. Duh! Yeah,
>>>I know it exists, but I want to redefine it.
> 
> 
> One option is to make a new version with a new name and then atomically
> replace jumps to the old version to use the new version:

What about atomic rename instead?


> original setup:
> 
>   iptables -N INPUT0
>   iptables -A INPUT0 ...
>   ...
>   iptables -N FOOBAR0
>   iptables -A FOOBAR0...
>   iptables -A INPUT0 ... -j FOOBAR0
>   ...
>   iptables -A INPUT -j INPUT0
> 
> switch to new:
> 
>   iptables -N tmp0
>   iptables -A tmp0 ...
>   ...
>   iptables -N tmp1
>   iptables -A tmp1...
>   iptables -A tmp0 ... -j tmp1
>   ...
iptables --exchange-names tmp0:INPUT0,tmp1:FOOBAR0

>   # cleanup (could be replaced by some automatic loop finding all chains
>   #          named something ending in "0")
>   iptables -F tmp0
>   iptables -X tmp0
>   iptables -F tmp1
>   iptables -X tmp1

What do you think?

Regards,
Carl-Daniel

  parent reply	other threads:[~2005-05-19 16:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-18 16:07 [Patch] ip{,6}tables-restore -n with existing user defined chain Charlie Brady
2005-05-19 14:14 ` [Patch] ip{, 6}tables-restore " Charlie Brady
2005-05-19 15:43 ` Jonas Berlin
2005-05-19 15:57   ` Charlie Brady
2005-05-19 16:04     ` Charlie Brady
2005-05-19 16:37   ` Carl-Daniel Hailfinger [this message]
2005-05-19 16:46     ` Charlie Brady
2005-06-11 16:12 ` Patrick McHardy
2005-06-12  9:56   ` Harald Welte
2005-06-12 13:38     ` Patrick McHardy
2005-06-12 15:20       ` Charlie Brady
2005-06-12 15:43         ` Patrick McHardy
2005-06-13  2:24           ` Charlie Brady

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=428CC0C3.9000203@gmx.net \
    --to=c-d.hailfinger.devel.2005@gmx.net \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=xkr47@outerspace.dyndns.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.