+ run ip46tables -A $chain -p tcp ! --syn -g bad-tcp
+}
+
+## commonrules CHAIN
+##
+## Add standard IP filtering rules to the CHAIN.
+commonrules () {
+ set -e
+ chain=$1
+
+ ## Pass fragments through, assuming that the eventual destination will sort
+ ## things out properly. Except for TCP, that is, which should never be
+ ## fragmented. This is an extra pain for ip6tables, which doesn't provide
+ ## a pleasant way to detect non-initial fragments.
+ run iptables -A $chain -p tcp -f -g tcp-fragment
+ run iptables -A $chain -f -j ACCEPT
+ run ip6tables -A $chain -p tcp -g tcp-fragment \
+ -m ipv6header --soft --header frag
+ run ip6tables -A $chain -j accept-non-init-frag