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 sha1sums=('05ef75415cb7cb7641f51d51e74f3ea29cc31ab1'
21 '83b3363878e3660ce23b2ad325b53cbd6c796ecf'
22 'f085a71f467e4d7cb2cf094d9369b0bcc4bab6ec'
23 'd9f9f06b46b4187648e860afa0552335aafe3ce4'
24 'c45b738b5ec4cfb11611b984c21a83b91a2d58f3'
25 '1694d79b3e6e9d9d543f6a6e75fed06066c9a6c6'
26 '7db53bb882f62f6c677cc8559cff83d8bae2ef73'
27 'ebbd1424a1564fd45f455a81c61ce348f0a14c2e'
28 '95b0ee26f03132a948fea9f2136b2e2e6a4b40fe'
29 'b668ba50d55030c68431a95756bc1f291d74b2b2'
30 '8d66d21fa4cbfe2a80478301af94ba54f65e4ea0'
31 '9cec592787e32451f58fa608ea057870e07aa704'
32 'd10af7780d1634778d898c709e2d950aa1561856'
33 '15c1684f3e671f4d0ede639a7c9c08e1a841511c')
34 validpgpkeys=('C09DB2063F1D7034BA6152ADAB4655A126D292E4'
35 '37D964ACC04981C75500FB9BD55D978A8A1420E4') # Netfilter Core Team
42 rm include/linux/types.h
47 ../$pkgbase-$pkgver/configure \
51 --libexecdir=/usr/lib \
52 --enable-bpf-compiler \
56 sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' -i libtool
61 pkgdesc+=' (using legacy interface)'
65 package_iptables-nft() {
66 pkgdesc+=' (using nft interface)'
68 provides=(iptables arptables ebtables)
69 conflicts=(iptables arptables ebtables)
70 backup+=(etc/{arp,eb}tables.conf)
74 install -Dt "$pkgdir/usr/lib/systemd/system" -m644 {arp,eb}tables.service
75 touch "$pkgdir"/etc/{arp,eb}tables.conf
79 DESTDIR="$pkgdir" make -C build install
81 for _x in {arp,eb,ip,ip6}tables{,-restore,-save} iptables-apply iptables-xml; do
82 if [[ $1 = nft || $_x = ip* ]]; then
83 ln -sf xtables-$1-multi "$pkgdir/usr/bin/$_x"
85 rm "$pkgdir/usr/bin/$_x"
89 install -Dt "$pkgdir/usr/lib/systemd/system" -m644 {ip,ip6}tables.service
90 install -D iptables-$1-flush "$pkgdir/usr/lib/systemd/scripts/iptables-flush"
92 install -Dm644 empty.rules "$pkgdir/etc/iptables/iptables.rules"
93 install -Dm644 empty.rules "$pkgdir/etc/iptables/ip6tables.rules"
94 install -Dt "$pkgdir/usr/share/iptables" -m644 *.rules
95 ln -srt "$pkgdir/etc/iptables" "$pkgdir"/usr/share/iptables/{empty,simple_firewall}.rules