summaryrefslogtreecommitdiffstats
path: root/iptables
diff options
context:
space:
mode:
authorMartin F. Krafft <madduck@debian.org>2009-09-22 21:07:13 +0200
committerJan Engelhardt <jengelh@medozas.de>2011-06-30 13:17:45 +0200
commit358650c0e280dad8c1292efbf856ac310004a52b (patch)
tree987da88af53b94286d59cc4093e379ef4df81bda /iptables
parent3c871010888e1479ef8fca2048485b979ec2661a (diff)
iptables-apply: select default rule file depending on call name
ip6tables-apply points to iptables-apply (which is good). Since iptables/ip6tables rule files are different, the reporter suggests that the DEFAULT_FILE variable should depend on whether iptables-apply or ip6tables-apply is run. References: http://bugs.debian.org/547734 Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
Diffstat (limited to 'iptables')
-rwxr-xr-xiptables/iptables-apply25
1 files changed, 13 insertions, 12 deletions
diff --git a/iptables/iptables-apply b/iptables/iptables-apply
index 5fec76b0..86b8d5a2 100755
--- a/iptables/iptables-apply
+++ b/iptables/iptables-apply
@@ -11,7 +11,6 @@ PROGNAME="${0##*/}";
VERSION=1.0
TIMEOUT=10
-DEFAULT_FILE=/etc/network/iptables
function blurb()
{
@@ -87,6 +86,19 @@ for opt in $OPTS; do
shift
done
+case "$PROGNAME" in
+ (*6*)
+ SAVE=ip6tables-save
+ RESTORE=ip6tables-restore
+ DEFAULT_FILE=/etc/network/ip6tables
+ ;;
+ (*)
+ SAVE=iptables-save
+ RESTORE=iptables-restore
+ DEFAULT_FILE=/etc/network/iptables
+ ;;
+esac
+
FILE="${1:-$DEFAULT_FILE}";
if [[ -z "$FILE" ]]; then
@@ -99,17 +111,6 @@ if [[ ! -r "$FILE" ]]; then
exit 2
fi
-case "${0##*/}" in
- (*6*)
- SAVE=ip6tables-save
- RESTORE=ip6tables-restore
- ;;
- (*)
- SAVE=iptables-save
- RESTORE=iptables-restore
- ;;
-esac
-
COMMANDS=(tempfile "$SAVE" "$RESTORE")
for cmd in "${COMMANDS[@]}"; do