3 # source application-specific settings
4 [ -f /etc
/conf.d
/iptables
] && .
/etc
/conf.d
/iptables
6 # Set defaults if settings are missing
7 [ -z "$IP6TABLES" ] && IP6TABLES
=/usr
/sbin
/ip6tables
8 [ -z "$IP6TABLES_CONF" ] && IP6TABLES_CONF
=/etc
/iptables
/ip6tables.rules
15 if [ ! -f $IP6TABLES_CONF ]; then
16 echo "Cannot load iptables rules: $IP6TABLES_CONF is missing!" >&2
19 stat_busy
"Starting IP6 Tables"
20 if [ "$IPTABLES_FORWARD" = "1" ]; then
21 echo 1 >/proc
/sys
/net
/ipv
6/conf
/default
/forwarding
22 echo 1 >/proc
/sys
/net
/ipv
6/conf
/all
/forwarding
24 if ck_daemon ip6tables
; then
25 /usr
/sbin
/ip6tables-restore
< $IP6TABLES_CONF
37 stat_busy
"Stopping IP6 Tables"
38 echo 0 >/proc
/sys
/net
/ipv
6/conf
/all
/forwarding
39 echo 0 >/proc
/sys
/net
/ipv
6/conf
/default
/forwarding
40 if ! ck_daemon ip6tables
; then
42 for table
in $
(cat /proc
/net
/ip6_tables_names
); do
43 $IP6TABLES -t $table -F &>/dev
/null
&& \
44 $IP6TABLES -t $table -X &>/dev
/null
&& \
45 $IP6TABLES -t $table -Z &>/dev
/null
46 [ $?
-gt 0 ] && fail
=1
48 if [ $fail -gt 0 ]; then
53 for table
in filter mangle raw
; do
54 if grep -qw $table /proc
/net
/ip6_tables_names
; then
55 $IP6TABLES -t $table -P OUTPUT ACCEPT
58 for table
in filter mangle
; do
59 if grep -qw $table /proc
/net
/ip6_tables_names
; then
60 $IP6TABLES -t $table -P INPUT ACCEPT
61 $IP6TABLES -t $table -P FORWARD ACCEPT
64 for table
in mangle raw
; do
65 if grep -qw $table /proc
/net
/ip6_tables_names
; then
66 $IP6TABLES -t $table -P PREROUTING ACCEPT
69 for table
in mangle
; do
70 if grep -qw $table /proc
/net
/ip6_tables_names
; then
71 $IP6TABLES -t $table -P POSTROUTING ACCEPT
86 stat_busy
"Saving IP6 Tables"
87 /usr
/sbin
/ip6tables-save
>$IP6TABLES_CONF
95 echo "usage: $0 {start|stop|restart|save}"