netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: netfilter-devel@vger.kernel.org
Subject: ip(6)tables-save: Allow chain selection
Date: Sat,  1 Oct 2011 17:19:28 +0200	[thread overview]
Message-ID: <1317482370-14982-1-git-send-email-richard@nod.at> (raw)

This patch set adds a switch to iptables-save to select
a specific chain to be saved.

Sometimes it's useful to save only one chain.
E.g. When some rules are added dynamically by daemons like
OpenVPN or strongSwan and the base rule set is generated by
a bash script.

Consider this trivial script:
---8<---
#!/bin/sh

# save only the DYN_OVPN chain
iptables-save -t filter -C DYN_OVPN > /tmp/dyn-rules

iptables -F
iptables -X

iptables -A INPUT -s 1.2.3.4 -j ACCEPT
# much more rules...
iptables -A INPUT ... -j ACCEPT

# OpenVPN can insert here rules which get not lost in case
# the base rule set gets modified and reloaded.
iptables -N DYN_OVPN
iptables -A INPUT -i tun+ -j DYN_OVPN

# restore DYN_OVPN chain
iptables-restore -n < /tmp/dyn-rules
rm -f /tmp/dyn-rules
--->8---

[PATCH 1/2] iptables-save: Allow chain selection
[PATCH 2/2] ip6tables-save: Allow chain selection

             reply	other threads:[~2011-10-01 15:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-01 15:19 Richard Weinberger [this message]
2011-10-01 15:19 ` [PATCH 1/2] iptables-save: Allow chain selection Richard Weinberger
2011-10-01 15:19 ` [PATCH 2/2] ip6tables-save: " Richard Weinberger
2011-10-01 19:13 ` ip(6)tables-save: " Jan Engelhardt
2011-10-01 19:21   ` Richard Weinberger

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=1317482370-14982-1-git-send-email-richard@nod.at \
    --to=richard@nod.at \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).