All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonas Berlin <xkr47@outerspace.dyndns.org>
To: Charlie Brady <charlieb-netfilter-devel@budge.apana.org.au>
Cc: netfilter-devel@lists.netfilter.org
Subject: Re: [Patch] ip{, 6}tables-restore -n with existing user defined chain
Date: Thu, 19 May 2005 15:43:58 +0000	[thread overview]
Message-ID: <428CB43E.5060503@outerspace.dyndns.org> (raw)
In-Reply-To: <Pine.LNX.4.61.0505181157190.3744@e-smith.charlieb.ott.istop.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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:

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 INPUT1
  iptables -A INPUT1 ...
  ...
  iptables -N FOOBAR1
  iptables -A FOOBAR1...
  iptables -A INPUT1 ... -j FOOBAR1
  ...
  iptables -R INPUT 1 -j INPUT1
  # cleanup (could be replaced by some automatic loop finding all chains
  #          named something ending in "0")
  iptables -F INPUT0
  iptables -X INPUT0
  iptables -F FOOBAR0
  iptables -X FOOBAR0

It would probably be rather easy to create some wrappers that manage the
 versioning.. Also, two versions would be enough (0 and 1).

I might just go ahead and try something like this myself, actually.. :)

- --
- - xkr47
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFCjLQ7xyF48ZTvn+4RAhTbAKC5yYTZPxsEj9A3YH3RZZuv0TzQlACgytFN
T2G76lKiEO5cWBAQ/PKVmXA=
=W20U
-----END PGP SIGNATURE-----

  parent reply	other threads:[~2005-05-19 15:43 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 [this message]
2005-05-19 15:57   ` Charlie Brady
2005-05-19 16:04     ` Charlie Brady
2005-05-19 16:37   ` Carl-Daniel Hailfinger
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=428CB43E.5060503@outerspace.dyndns.org \
    --to=xkr47@outerspace.dyndns.org \
    --cc=charlieb-netfilter-devel@budge.apana.org.au \
    --cc=netfilter-devel@lists.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.