blob: ff9fcb1b53b65ca0fe20ec4ebe4e3b68f4424537 [file] [log] [blame]
Brad Bishopc342db32019-05-15 21:57:59 -04001SUMMARY = "Tools for managing kernel packet filtering capabilities"
2DESCRIPTION = "iptables is the userspace command line program used to configure and control network packet \
3filtering code in Linux."
4HOMEPAGE = "http://www.netfilter.org/"
5BUGTRACKER = "http://bugzilla.netfilter.org/"
6LICENSE = "GPLv2+"
7LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263\
8 file://iptables/iptables.c;beginline=13;endline=25;md5=c5cffd09974558cf27d0f763df2a12dc"
9
10SRC_URI = "http://netfilter.org/projects/iptables/files/iptables-${PV}.tar.bz2 \
11 file://0001-configure-Add-option-to-enable-disable-libnfnetlink.patch \
12 file://0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch \
Brad Bishopa34c0302019-09-23 22:34:48 -040013 file://iptables.service \
14 file://iptables.rules \
Brad Bishopc342db32019-05-15 21:57:59 -040015"
16
Brad Bishop96ff1982019-08-19 13:50:42 -040017SRC_URI[md5sum] = "29de711d15c040c402cf3038c69ff513"
18SRC_URI[sha256sum] = "a23cac034181206b4545f4e7e730e76e08b5f3dd78771ba9645a6756de9cdd80"
Brad Bishopc342db32019-05-15 21:57:59 -040019
Brad Bishopa34c0302019-09-23 22:34:48 -040020inherit autotools pkgconfig systemd
Brad Bishopc342db32019-05-15 21:57:59 -040021
22EXTRA_OECONF = "--with-kernel=${STAGING_INCDIR}"
23
24PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}"
25
26PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
27
28# libnfnetlink recipe is in meta-networking layer
29PACKAGECONFIG[libnfnetlink] = "--enable-libnfnetlink,--disable-libnfnetlink,libnfnetlink libnetfilter-conntrack"
30
31# libnftnl recipe is in meta-networking layer(previously known as libnftables)
32PACKAGECONFIG[libnftnl] = "--enable-nftables,--disable-nftables,libnftnl"
33
34do_configure_prepend() {
35 # Remove some libtool m4 files
36 # Keep ax_check_linker_flags.m4 which belongs to autoconf-archive.
37 rm -f libtool.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4
38}
39
40PACKAGES += "${PN}-modules"
41PACKAGES_DYNAMIC += "^${PN}-module-.*"
42
43python populate_packages_prepend() {
44 modules = do_split_packages(d, '${libdir}/xtables', r'lib(.*)\.so$', '${PN}-module-%s', '${PN} module %s', extra_depends='')
45 if modules:
46 metapkg = d.getVar('PN') + '-modules'
47 d.appendVar('RDEPENDS_' + metapkg, ' ' + ' '.join(modules))
48}
49
50FILES_${PN} += "${datadir}/xtables"
51
Brad Bishop96ff1982019-08-19 13:50:42 -040052# Include the symlinks as well in respective packages
53FILES_${PN}-module-xt-conntrack += "${libdir}/xtables/libxt_state.so"
54FILES_${PN}-module-xt-ct += "${libdir}/xtables/libxt_NOTRACK.so"
55
56INSANE_SKIP_${PN}-module-xt-conntrack = "dev-so"
57INSANE_SKIP_${PN}-module-xt-ct = "dev-so"
58
Brad Bishopc342db32019-05-15 21:57:59 -040059ALLOW_EMPTY_${PN}-modules = "1"
60
Brad Bishopa34c0302019-09-23 22:34:48 -040061do_install_append() {
62
63 install -d ${D}${sysconfdir}/iptables
64 install -m 0644 ${WORKDIR}/iptables.rules ${D}${sysconfdir}/iptables
65
66 install -d ${D}${systemd_system_unitdir}
67 install -m 0644 ${WORKDIR}/iptables.service ${D}${systemd_system_unitdir}
68
69 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_system_unitdir}/iptables.service
70}
71
72SYSTEMD_SERVICE_${PN} = "iptables.service"
73
Brad Bishopc342db32019-05-15 21:57:59 -040074RDEPENDS_${PN} = "${PN}-module-xt-standard"
75RRECOMMENDS_${PN} = " \
76 ${PN}-modules \
77 kernel-module-x-tables \
78 kernel-module-ip-tables \
79 kernel-module-iptable-filter \
80 kernel-module-iptable-nat \
81 kernel-module-nf-defrag-ipv4 \
82 kernel-module-nf-conntrack \
83 kernel-module-nf-conntrack-ipv4 \
84 kernel-module-nf-nat \
85 kernel-module-ipt-masquerade \
86"