1 # Maintainer: Ronald van Haren <ronald.archlinux.org>
2 # Contributor: Thomas Baechler <thomas@archlinux.org>
5 pkgname=(iptables iptables-nft)
9 pkgdesc='Linux kernel packet control tool'
12 url='https://www.netfilter.org/projects/iptables/index.html'
13 depends=(libnftnl libpcap libnfnetlink libnetfilter_conntrack bash)
14 makedepends=(linux-api-headers)
15 backup=(etc/ethertypes etc/iptables/{ip,ip6}tables.rules)
16 source=(https://www.netfilter.org/projects/iptables/files/$pkgbase-$pkgver.tar.bz2{,.sig}
17 empty.rules simple_firewall.rules empty-{filter,mangle,nat,raw,security}.rules
18 {arp,eb,ip,ip6}tables.service iptables-{legacy,nft}-flush
19 iptables-format-security.patch::https://git.netfilter.org/iptables/patch/?id=b72eb12e
20 iptables-apply-default-path.patch)
21 sha1sums=('98783621a5e58ff55f83b1350523f3de41af621d'
23 '83b3363878e3660ce23b2ad325b53cbd6c796ecf'
24 'f085a71f467e4d7cb2cf094d9369b0bcc4bab6ec'
25 'd9f9f06b46b4187648e860afa0552335aafe3ce4'
26 'c45b738b5ec4cfb11611b984c21a83b91a2d58f3'
27 '1694d79b3e6e9d9d543f6a6e75fed06066c9a6c6'
28 '7db53bb882f62f6c677cc8559cff83d8bae2ef73'
29 'ebbd1424a1564fd45f455a81c61ce348f0a14c2e'
30 '95b0ee26f03132a948fea9f2136b2e2e6a4b40fe'
31 'b668ba50d55030c68431a95756bc1f291d74b2b2'
32 '8d66d21fa4cbfe2a80478301af94ba54f65e4ea0'
33 '9cec592787e32451f58fa608ea057870e07aa704'
34 'd10af7780d1634778d898c709e2d950aa1561856'
35 '15c1684f3e671f4d0ede639a7c9c08e1a841511c'
36 'df4b0a31dfa01cff65926d439ab1475f246d4e74'
37 '454d0a6d3bca14b8702e7c5e2672f5bc0c832b85')
38 validpgpkeys=('C09DB2063F1D7034BA6152ADAB4655A126D292E4'
39 '37D964ACC04981C75500FB9BD55D978A8A1420E4') # Netfilter Core Team
46 rm include/linux/types.h
48 ln -rs libiptc/linux_list.h include/libiptc
49 patch -p1 -i ../iptables-format-security.patch # Fix build with -Werror=format-security
52 patch -p0 -i ../iptables-apply-default-path.patch
57 ../$pkgbase-$pkgver/configure \
61 --libexecdir=/usr/lib \
62 --enable-bpf-compiler \
66 sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' -i libtool
71 pkgdesc+=' (using legacy interface)'
75 package_iptables-nft() {
76 pkgdesc+=' (using nft interface)'
78 provides=(iptables arptables ebtables)
79 conflicts=(iptables arptables ebtables)
80 backup+=(etc/{arp,eb}tables.conf)
84 install -Dt "$pkgdir/usr/lib/systemd/system" -m644 {arp,eb}tables.service
85 touch "$pkgdir"/etc/{arp,eb}tables.conf
89 DESTDIR="$pkgdir" make -C build install
91 for _x in {arp,eb,ip,ip6}tables{,-restore,-save} iptables-xml; do
92 if [[ $1 = nft || $_x = ip* ]]; then
93 ln -sf xtables-$1-multi "$pkgdir/usr/bin/$_x"
95 rm "$pkgdir/usr/bin/$_x"
99 install -Dt "$pkgdir/usr/lib/systemd/system" -m644 {ip,ip6}tables.service
100 install -D iptables-$1-flush "$pkgdir/usr/lib/systemd/scripts/iptables-flush"
102 install -Dm644 empty.rules "$pkgdir/etc/iptables/iptables.rules"
103 install -Dm644 empty.rules "$pkgdir/etc/iptables/ip6tables.rules"
104 install -Dt "$pkgdir/usr/share/iptables" -m644 *.rules
105 ln -srt "$pkgdir/etc/iptables" "$pkgdir"/usr/share/iptables/{empty,simple_firewall}.rules