summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d86e3a110b6b7399b90e9a8b2ca7b17bbd9a41f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# Maintainer: Edward Pacman <edward@edward-p.xyz>

_pkgbase=iptables
pkgbase=iptables-fullconenat
pkgname=(iptables-fullconenat iptables-fullconenat-nft)
pkgver=1.8.7
pkgrel=3
epoch=1
pkgdesc='Linux kernel packet control tool with FULLCONENAT support.'
arch=(x86_64)
license=(GPL2)
url='https://www.netfilter.org/projects/iptables/index.html'
depends=(libnftnl libpcap libnfnetlink libnetfilter_conntrack bash)
makedepends=(linux-api-headers)
optdepends=("netfilter-fullconenat: kernel module for fullconenat")
provides=('iptables')
conflicts=(iptables)
install=${pkgbase}.install
backup=(etc/ethertypes etc/iptables/{ip,ip6}tables.rules)
source=(https://www.netfilter.org/projects/iptables/files/$_pkgbase-$pkgver.tar.bz2{,.sig}
        empty.rules simple_firewall.rules empty-{filter,mangle,nat,raw,security}.rules
        {arp,eb,ip,ip6}tables.service iptables-{legacy,nft}-flush
        "libipt_FULLCONENAT.c::https://raw.githubusercontent.com/llccd/netfilter-full-cone-nat/dev/libipt_FULLCONENAT.c"
        "libip6t_FULLCONENAT.c::https://raw.githubusercontent.com/llccd/netfilter-full-cone-nat/dev/libip6t_FULLCONENAT.c")
sha1sums=('05ef75415cb7cb7641f51d51e74f3ea29cc31ab1'
          'SKIP'
          '83b3363878e3660ce23b2ad325b53cbd6c796ecf'
          'f085a71f467e4d7cb2cf094d9369b0bcc4bab6ec'
          'd9f9f06b46b4187648e860afa0552335aafe3ce4'
          'c45b738b5ec4cfb11611b984c21a83b91a2d58f3'
          '1694d79b3e6e9d9d543f6a6e75fed06066c9a6c6'
          '7db53bb882f62f6c677cc8559cff83d8bae2ef73'
          'ebbd1424a1564fd45f455a81c61ce348f0a14c2e'
          '95b0ee26f03132a948fea9f2136b2e2e6a4b40fe'
          'b668ba50d55030c68431a95756bc1f291d74b2b2'
          '8d66d21fa4cbfe2a80478301af94ba54f65e4ea0'
          '9cec592787e32451f58fa608ea057870e07aa704'
          'd10af7780d1634778d898c709e2d950aa1561856'
          '15c1684f3e671f4d0ede639a7c9c08e1a841511c'
          '4a4f5ebc8e30c573f9c3220b8135e3101f8da18c'
          '878a1e0a306f274b285a26d3d4a3f2072caa31e3')
validpgpkeys=('37D964ACC04981C75500FB9BD55D978A8A1420E4') # Netfilter Core Team

prepare() {
  mkdir build
  cd $_pkgbase-$pkgver

  cp ../libip{,6}t_FULLCONENAT.c extensions/
  # use system one
  rm include/linux/types.h
}

build() {
  cd build
  ../$_pkgbase-$pkgver/configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --sbindir=/usr/bin \
    --libexecdir=/usr/lib \
    --enable-bpf-compiler \
    --enable-devel \
    --enable-libipq \
    --enable-shared
  sed -e 's/ -shared / -Wl,-O1,--as-needed\0/g' -i libtool
  make
}

package_iptables-fullconenat() {
  pkgdesc+=' (using legacy interface)'
  _package legacy
}

package_iptables-fullconenat-nft() {
  pkgdesc+=' (using nft interface)'
  depends+=(nftables)
  provides=(iptables iptables-fullconenat arptables ebtables)
  conflicts=(iptables iptables-fullconenat arptables ebtables)
  backup+=(etc/{arp,eb}tables.conf)

  _package nft

  install -Dt "$pkgdir/usr/lib/systemd/system" -m644 {arp,eb}tables.service
  touch "$pkgdir"/etc/{arp,eb}tables.conf
}

_package() {
  DESTDIR="$pkgdir" make -C build install

  for _x in {arp,eb,ip,ip6}tables{,-restore,-save} iptables-apply iptables-xml; do
    if [[ $1 = nft || $_x = ip* ]]; then
      ln -sf xtables-$1-multi "$pkgdir/usr/bin/$_x"
    else
      rm "$pkgdir/usr/bin/$_x"
    fi
  done

  install -Dt "$pkgdir/usr/lib/systemd/system" -m644 {ip,ip6}tables.service
  install -D iptables-$1-flush "$pkgdir/usr/lib/systemd/scripts/iptables-flush"

  install -Dm644 empty.rules "$pkgdir/etc/iptables/iptables.rules"
  install -Dm644 empty.rules "$pkgdir/etc/iptables/ip6tables.rules"
  install -Dt "$pkgdir/usr/share/iptables" -m644 *.rules
  ln -srt "$pkgdir/etc/iptables" "$pkgdir"/usr/share/iptables/{empty,simple_firewall}.rules
}

# vim:set sw=2 et: