summaryrefslogtreecommitdiff
path: root/testing/iptables/ip6tables
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-09-03 23:14:38 +0000
committerroot <root@rshg054.dnsready.net>2011-09-03 23:14:38 +0000
commit3b18be1752c9fd9fa74eb1314ca97dd61e9ce912 (patch)
tree695198e2351a85f6c3a8fe7ba53ba5e4a4ec2bdd /testing/iptables/ip6tables
parentb37ee9de1a430956d9e5958ebd9d7e0dbfc79327 (diff)
Sat Sep 3 23:14:38 UTC 2011
Diffstat (limited to 'testing/iptables/ip6tables')
-rwxr-xr-xtesting/iptables/ip6tables69
1 files changed, 69 insertions, 0 deletions
diff --git a/testing/iptables/ip6tables b/testing/iptables/ip6tables
new file mode 100755
index 000000000..2d119e3ed
--- /dev/null
+++ b/testing/iptables/ip6tables
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+# source application-specific settings
+[ -f /etc/conf.d/iptables ] && . /etc/conf.d/iptables
+
+# Set defaults if settings are missing
+[ -z "$IP6TABLES_CONF" ] && IP6TABLES_CONF=/etc/iptables/ip6tables.rules
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ if [ ! -f "$IP6TABLES_CONF" ]; then
+ echo "Cannot load ip6tables rules: $IP6TABLES_CONF is missing!" >&2
+ exit 1
+ fi
+ stat_busy "Starting IP6 Tables"
+ if [ "$IPTABLES_FORWARD" = "1" ]; then
+ echo 1 >/proc/sys/net/ipv6/conf/default/forwarding
+ echo 1 >/proc/sys/net/ipv6/conf/all/forwarding
+ fi
+ if ck_daemon ip6tables; then
+ /usr/sbin/ip6tables-restore < $IP6TABLES_CONF
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ip6tables
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping IP6 Tables"
+ if ! ck_daemon ip6tables; then
+ fail=0
+ for table in $(cat /proc/net/ip6_tables_names); do
+ ip6tables-restore < /var/lib/iptables/empty-$table.rules
+ [ $? -gt 0 ] && fail=1
+ done
+ if [ $fail -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ip6tables
+ stat_done
+ fi
+ else
+ stat_fail
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ save)
+ stat_busy "Saving IP6 Tables"
+ /usr/sbin/ip6tables-save >$IP6TABLES_CONF
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ stat_done
+ fi
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|save}"
+esac
+exit 0