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.xz{,.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-libxt_NAT.patch::https://git.netfilter.org/iptables/patch/?id=ed4082a7405a5838c205a34c1559e289949200cc
20 iptables-apply-default-path.patch)
21 sha256sums=('ef6639a43be8325a4f8ea68123ffac236cb696e8c78501b64e8106afb008c87f'
23 '630d774f089703c2c7370db6d7c188dae25d00c26feaa3d3de8eb52519033948'
24 '9e83d7ae39d31881790f814930d44acbaeab1520adb2fb4fcb80f0bbfab174b9'
25 '09b90da35c2c8cb0fbda63b300f06d2387a102ca53a40980ef0b49829e249528'
26 '92755648f456e235d17a8faeb5f46d27af66eb4db10ea4bac0abd3e35e2dae07'
27 '52bd70dff3e1e1a64127ad7ed86840834b79756c3bdb6947b7c6279ffe95dd48'
28 '5768a471c0559848635c39d270e456bfa5c43eda65f5f6f666fea2d277183a37'
29 '91161a73f323016a9efc5eabd16243d20f8ca2467995cf0eabfb95f845090121'
30 'dd1a867085900eec1f1d4e12f97a1f44707c717246f6787ed42d4225343920d6'
31 '82e09b4151d5c1dd0fc212189c670f8f29e8ec85e7e9cdc57f49dcea00d7e9ca'
32 '78f090812b5bb9aec597ce2cf757da1c58ec772c60bf55f10267f06459aefd9b'
33 'c37c69db5077a061fd72fc3b199712f1bed8688de8008f219223fadd6fa6c06f'
34 '40680b3c877926a2bac698ea58f52d1d4b3ab152ee68ccd7fa7ca51aeedc3b2d'
35 '6d3e7bdeebdaeaf83ed448f4d42a979c8c59fb5e919f6f860ed340c2c9afef1a'
36 '3784e61958cf96a8e5e04df885defadf1cd70caa1e9d6c6f144bdbc64441eabe'
37 '770ceaedce26d05eb1b9d0c4c65f5b8e92facd1dc0652a29c859336d6bc347f6')
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-libxt_NAT.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