From 1616f43507a7f8785a479ecf6ce905828a232f02 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Jul 2012 00:02:04 +0000 Subject: Fri Jul 27 00:02:04 UTC 2012 --- testing/iptables/0503-extension_cppflags.patch | 13 ++++++++ testing/iptables/PKGBUILD | 39 +++++++++++++++++------- testing/iptables/ip6tables.service | 11 +++++++ testing/iptables/iptables-1.4.12-fixresore.patch | 28 +++++++++++++++++ testing/iptables/iptables-flush | 18 +++++++++++ testing/iptables/iptables.service | 11 +++++++ 6 files changed, 109 insertions(+), 11 deletions(-) create mode 100644 testing/iptables/0503-extension_cppflags.patch create mode 100644 testing/iptables/ip6tables.service create mode 100644 testing/iptables/iptables-1.4.12-fixresore.patch create mode 100755 testing/iptables/iptables-flush create mode 100644 testing/iptables/iptables.service (limited to 'testing') 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/PKGBUILD b/testing/iptables/PKGBUILD index 5d61d0022..779edbdba 100644 --- a/testing/iptables/PKGBUILD +++ b/testing/iptables/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 162003 2012-06-18 08:49:36Z ronald $ +# $Id: PKGBUILD 164053 2012-07-25 06:40:02Z foutrelis $ # Maintainer: Ronald van Haren # Contributor: Thomas Baechler pkgname=iptables pkgver=1.4.14 -pkgrel=1 +pkgrel=3 pkgdesc='Linux kernel packet control tool' arch=('i686' 'x86_64') license=('GPL2') @@ -22,7 +22,12 @@ source=("http://www.iptables.org/projects/iptables/files/${pkgname}-${pkgver}.ta empty-mangle.rules empty-nat.rules empty-raw.rules - empty-security.rules) + empty-security.rules + 0503-extension_cppflags.patch + iptables-1.4.12-fixresore.patch + iptables.service + ip6tables.service + iptables-flush) backup=(etc/conf.d/iptables) sha1sums=('daf2972b81e52f562a644798013e946c88319ea3' '5bb6fa526665cdd728c26f0f282f5a51f220cf88' @@ -34,25 +39,31 @@ sha1sums=('daf2972b81e52f562a644798013e946c88319ea3' 'c45b738b5ec4cfb11611b984c21a83b91a2d58f3' '1694d79b3e6e9d9d543f6a6e75fed06066c9a6c6' '7db53bb882f62f6c677cc8559cff83d8bae2ef73' - 'ebbd1424a1564fd45f455a81c61ce348f0a14c2e') + 'ebbd1424a1564fd45f455a81c61ce348f0a14c2e' + '44626980a52e49f345a0b1e1ca03060f3a35763c' + '7c018d48445ae41c0b9f345747e54b94cb0997b3' + '5c4eb4ea88c302e8ff98f435a11dd59b00f4d8b9' + 'f1f16f44c6a5547b6f251d13007fe6585761e8b0' + 'e7abda09c61142121b6695928d3b71ccd8fdf73a') build() { cd "${srcdir}/${pkgname}-${pkgver}" - # http://bugs.archlinux.org/task/17046 - sed -i '87 i libxt_RATEEST.so: libxt_RATEEST.oo' extensions/GNUmakefile.in - sed -i '88 i \\t${AM_VERBOSE_CCLD} ${CCLD} ${AM_LDFLAGS} -lm -shared ${LDFLAGS} -o $@ $<;\n' extensions/GNUmakefile.in - # use system one rm include/linux/types.h + patch -Np1 -i ${srcdir}/0503-extension_cppflags.patch + + # Fix scope issue exposed by gcc 4.7 (patch by fryasu) + # http://bugzilla.netfilter.org/show_bug.cgi?id=774 + # (This will most likely be fixed in iptables 1.4.15) + patch -Np1 -i ${srcdir}/iptables-1.4.12-fixresore.patch + ./configure --prefix=/usr \ --libexecdir=/usr/lib/iptables --sysconfdir=/etc \ --with-xtlibdir=/usr/lib/iptables \ --enable-devel --enable-libipq \ - --enable-shared --enable-static -# build fails when not enabling static, see if we can remove it on next build -# 1.4.13 still fails + --enable-shared make } @@ -71,4 +82,10 @@ package() { mkdir -p "${pkgdir}"/var/lib/iptables install -m644 empty-{filter,mangle,nat,raw,security}.rules "${pkgdir}"/var/lib/iptables + + # install systemd files + install -Dm644 ${srcdir}/iptables.service ${pkgdir}/usr/lib/systemd/system/iptables.service + install -Dm644 ${srcdir}/ip6tables.service ${pkgdir}/usr/lib/systemd/system/ip6tables.service + install -Dm755 ${srcdir}/iptables-flush ${pkgdir}/usr/lib/systemd/scripts/iptables-flush } + 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 -- cgit v1.2.3-54-g00ecf