## Packets over the loopback interface are automatically trusted. All manner
## of weird stuff happens on lo, and it's best not to second-guess it.
-run iptables -t mangle -A in-classify -i lo -j ACCEPT
+run ip46tables -t mangle -A in-classify -i lo -j ACCEPT
## Local bootp packets have bizarre addresses. Don't block them just because
## of this.
-m addrtype --dst-type BROADCAST
run iptables -t mangle -A local-source -j RETURN \
-m addrtype --dst-type MULTICAST
-run iptables -t mangle -A local-source -g bad-source-address
+run ip6tables -t mangle -A local-source -j RETURN \
+ -d ff00::/8
+run ip46tables -t mangle -A local-source -g bad-source-address
run iptables -t mangle -A in-classify -j local-source \
-m addrtype --src-type LOCAL
+for addr in $host_6addrs; do
+ run ip6tables -t mangle -A in-classify -j local-source \
+ -s $addr
+done
m4_divert(41)m4_dnl
## Define the important networks.
m4_divert(46)m4_dnl
## Mark addresses reachable on non-default interfaces as not reachable on the
## default interface.
-trace "nets = $allnets"
+trace "nets = $allnets $allnets6"
for net in $allnets; do
case $net in
"$defaultiface":*)
;;
esac
done
+for net in $allnets6; do
+ case $net in
+ "$defaultiface":*)
+ ;;
+ *)
+ run ip6tables -t mangle -A in-$defaultiface \
+ -s ${net#*:} -g bad-source-address
+ ;;
+ esac
+done
## Fill in the black holes in the network.
for addr in \
do
run iptables -t mangle -A in-default -s $addr -g bad-source-address
done
+for addr in \
+ fc00::/7 \
+ 2001:0db8::/32
+do
+ run ip6tables -t mangle -A in-default -s $addr -g bad-source-address
+done
m4_divert(92)m4_dnl
## Put the final default decision on the in-default chain, and attach the
## classification chains to the PREROUTING hook.
-run iptables -t mangle -A in-$defaultiface -g mark-from-$defaultclass
-run iptables -t mangle -A PREROUTING -j in-classify
-run iptables -t mangle -A PREROUTING -j out-classify
+run ip46tables -t mangle -A in-$defaultiface -g mark-from-$defaultclass
+run ip46tables -t mangle -A PREROUTING -j in-classify
+run ip46tables -t mangle -A PREROUTING -j out-classify
## Now it's safe to let stuff through.
for i in PREROUTING INPUT FORWARD OUTPUT POSTROUTING; do
- run iptables -t mangle -P $i ACCEPT
+ run ip46tables -t mangle -P $i ACCEPT
done
m4_divert(-1)