summaryrefslogtreecommitdiff
path: root/testing/iptables
diff options
context:
space:
mode:
Diffstat (limited to 'testing/iptables')
-rw-r--r--testing/iptables/0503-extension_cppflags.patch13
-rw-r--r--testing/iptables/ip6tables.service11
-rw-r--r--testing/iptables/iptables-1.4.12-fixresore.patch28
-rwxr-xr-xtesting/iptables/iptables-flush18
-rw-r--r--testing/iptables/iptables.service11
5 files changed, 81 insertions, 0 deletions
diff --git a/testing/iptables/0503-extension_cppflags.patch b/testing/iptables/0503-extension_cppflags.patch
new file mode 100644
index 000000000..0eb645731
--- /dev/null
+++ b/testing/iptables/0503-extension_cppflags.patch
@@ -0,0 +1,13 @@
+Index: b/extensions/GNUmakefile.in
+===================================================================
+--- a/extensions/GNUmakefile.in 2012-03-27 12:14:05.000000000 -0400
++++ b/extensions/GNUmakefile.in 2012-03-27 16:03:48.378790221 -0400
+@@ -21,7 +21,7 @@
+ kinclude_CPPFLAGS = @kinclude_CPPFLAGS@
+
+ AM_CFLAGS = ${regular_CFLAGS}
+-AM_CPPFLAGS = ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include ${kinclude_CPPFLAGS}
++AM_CPPFLAGS = ${CPPFLAGS} ${regular_CPPFLAGS} -I${top_builddir}/include -I${top_builddir} -I${top_srcdir}/include ${kinclude_CPPFLAGS}
+ AM_DEPFLAGS = -Wp,-MMD,$(@D)/.$(@F).d,-MT,$@
+ AM_LDFLAGS = @noundef_LDFLAGS@
+
diff --git a/testing/iptables/ip6tables.service b/testing/iptables/ip6tables.service
new file mode 100644
index 000000000..9a695f31e
--- /dev/null
+++ b/testing/iptables/ip6tables.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=IPv6 Packet Filtering Framework
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/ip6tables-restore /etc/iptables/ip6tables.rules
+ExecStop=/usr/lib/systemd/scripts/iptables-flush 6
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target
diff --git a/testing/iptables/iptables-1.4.12-fixresore.patch b/testing/iptables/iptables-1.4.12-fixresore.patch
new file mode 100644
index 000000000..94358f779
--- /dev/null
+++ b/testing/iptables/iptables-1.4.12-fixresore.patch
@@ -0,0 +1,28 @@
+diff -Nur iptables-1.4.12.2/iptables/ip6tables-restore.c iptables-1.4.12.2-fixrestore/iptables/ip6tables-restore.c
+--- iptables-1.4.12.2/iptables/ip6tables-restore.c 2012-01-03 02:19:09.000000000 +0900
++++ iptables-1.4.12.2-fixrestore/iptables/ip6tables-restore.c 2012-03-01 10:56:10.000000000 +0900
+@@ -380,9 +380,9 @@
+ quote_open = 0;
+ escaped = 0;
+ param_len = 0;
++ char param_buffer[1024];
+
+ for (curchar = parsestart; *curchar; curchar++) {
+- char param_buffer[1024];
+
+ if (quote_open) {
+ if (escaped) {
+diff -Nur iptables-1.4.12.2/iptables/iptables-restore.c iptables-1.4.12.2-fixrestore/iptables/iptables-restore.c
+--- iptables-1.4.12.2/iptables/iptables-restore.c 2012-01-03 02:19:09.000000000 +0900
++++ iptables-1.4.12.2-fixrestore/iptables/iptables-restore.c 2012-03-01 10:56:00.000000000 +0900
+@@ -377,9 +377,9 @@
+ quote_open = 0;
+ escaped = 0;
+ param_len = 0;
++ char param_buffer[1024];
+
+ for (curchar = parsestart; *curchar; curchar++) {
+- char param_buffer[1024];
+
+ if (quote_open) {
+ if (escaped) {
diff --git a/testing/iptables/iptables-flush b/testing/iptables/iptables-flush
new file mode 100755
index 000000000..e6fafe950
--- /dev/null
+++ b/testing/iptables/iptables-flush
@@ -0,0 +1,18 @@
+#!/bin/bash
+#
+# Usage: iptables-flush [6]
+#
+
+iptables=ip$1tables
+if ! type -p "$iptables"; then
+ echo "error: invalid argument"
+ exit 1
+fi
+
+while read -r table; do
+ tables+=("/var/lib/$iptables/empty-$table.rules")
+done <"/proc/net/ip$1_tables_names"
+
+if (( ${#tables[*]} )); then
+ cat "${tables[@]}" | "$iptables-restore"
+fi
diff --git a/testing/iptables/iptables.service b/testing/iptables/iptables.service
new file mode 100644
index 000000000..3084f53b7
--- /dev/null
+++ b/testing/iptables/iptables.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Packet Filtering Framework
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/iptables-restore /etc/iptables/iptables.rules
+ExecStop=/usr/lib/systemd/scripts/iptables-flush
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target