chiark / gitweb /
functions.m4, local.m4: Handle fragments in a useful way.
[firewall] / functions.m4
index 80caf1db05a92502ea3fb49c4d79590ab73d0a97..85afc1083848a65b9f26bf63779d87f9ab751237 100644 (file)
@@ -126,6 +126,20 @@ conntrack () {
   run iptables -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.
+  run iptables -A $chain -p tcp -f -g tcp-fragment
+  run iptables -A $chain -f -j ACCEPT
+}
+
 ## allowservices CHAIN PROTO SERVICE ...
 ##
 ## Add rules to allow the SERVICES on the CHAIN.