Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | SUMMARY = "Tools for managing kernel packet filtering capabilities" |
| 2 | DESCRIPTION = "iptables is the userspace command line program used to configure and control network packet \ |
| 3 | filtering code in Linux." |
| 4 | HOMEPAGE = "http://www.netfilter.org/" |
| 5 | BUGTRACKER = "http://bugzilla.netfilter.org/" |
| 6 | LICENSE = "GPLv2+" |
| 7 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ |
| 8 | file://iptables/iptables.c;beginline=13;endline=25;md5=c5cffd09974558cf27d0f763df2a12dc \ |
| 9 | " |
| 10 | |
| 11 | SRC_URI = "http://netfilter.org/projects/iptables/files/iptables-${PV}.tar.bz2 \ |
| 12 | file://0001-configure-Add-option-to-enable-disable-libnfnetlink.patch \ |
| 13 | file://0002-configure.ac-only-check-conntrack-when-libnfnetlink-enabled.patch \ |
| 14 | file://iptables.service \ |
| 15 | file://iptables.rules \ |
| 16 | file://ip6tables.service \ |
| 17 | file://ip6tables.rules \ |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 18 | " |
Andrew Geissler | d1e8949 | 2021-02-12 15:35:20 -0600 | [diff] [blame] | 19 | SRC_URI[sha256sum] = "c109c96bb04998cd44156622d36f8e04b140701ec60531a10668cfdff5e8d8f0" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 20 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 21 | SYSTEMD_SERVICE:${PN} = "\ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 22 | iptables.service \ |
| 23 | ${@bb.utils.contains('PACKAGECONFIG', 'ipv6', 'ip6tables.service', '', d)} \ |
| 24 | " |
| 25 | |
| 26 | inherit autotools pkgconfig systemd |
| 27 | |
| 28 | EXTRA_OECONF = "--with-kernel=${STAGING_INCDIR}" |
| 29 | |
| 30 | PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" |
| 31 | PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," |
| 32 | |
| 33 | # libnfnetlink recipe is in meta-networking layer |
| 34 | PACKAGECONFIG[libnfnetlink] = "--enable-libnfnetlink,--disable-libnfnetlink,libnfnetlink libnetfilter-conntrack" |
| 35 | |
| 36 | # libnftnl recipe is in meta-networking layer(previously known as libnftables) |
| 37 | PACKAGECONFIG[libnftnl] = "--enable-nftables,--disable-nftables,libnftnl" |
| 38 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 39 | do_configure:prepend() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 40 | # Remove some libtool m4 files |
| 41 | # Keep ax_check_linker_flags.m4 which belongs to autoconf-archive. |
| 42 | rm -f libtool.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 |
| 43 | } |
| 44 | |
| 45 | IPTABLES_RULES_DIR ?= "${sysconfdir}/${BPN}" |
| 46 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 47 | do_install:append() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 48 | install -d ${D}${IPTABLES_RULES_DIR} |
| 49 | install -m 0644 ${WORKDIR}/iptables.rules ${D}${IPTABLES_RULES_DIR} |
| 50 | |
| 51 | install -d ${D}${systemd_system_unitdir} |
| 52 | install -m 0644 ${WORKDIR}/iptables.service ${D}${systemd_system_unitdir} |
| 53 | |
| 54 | sed -i \ |
| 55 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 56 | -e 's,@RULESDIR@,${IPTABLES_RULES_DIR},g' \ |
| 57 | ${D}${systemd_system_unitdir}/iptables.service |
| 58 | |
| 59 | if ${@bb.utils.contains('PACKAGECONFIG', 'ipv6', 'true', 'false', d)} ; then |
| 60 | install -m 0644 ${WORKDIR}/ip6tables.rules ${D}${IPTABLES_RULES_DIR} |
| 61 | install -m 0644 ${WORKDIR}/ip6tables.service ${D}${systemd_system_unitdir} |
| 62 | |
| 63 | sed -i \ |
| 64 | -e 's,@SBINDIR@,${sbindir},g' \ |
| 65 | -e 's,@RULESDIR@,${IPTABLES_RULES_DIR},g' \ |
| 66 | ${D}${systemd_system_unitdir}/ip6tables.service |
| 67 | fi |
| 68 | } |
| 69 | |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 70 | PACKAGES =+ "${PN}-modules ${PN}-apply" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 71 | PACKAGES_DYNAMIC += "^${PN}-module-.*" |
| 72 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 73 | python populate_packages:prepend() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 74 | modules = do_split_packages(d, '${libdir}/xtables', r'lib(.*)\.so$', '${PN}-module-%s', '${PN} module %s', extra_depends='') |
| 75 | if modules: |
| 76 | metapkg = d.getVar('PN') + '-modules' |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 77 | d.appendVar('RDEPENDS:' + metapkg, ' ' + ' '.join(modules)) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 78 | } |
| 79 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 80 | RDEPENDS:${PN} = "${PN}-module-xt-standard" |
| 81 | RRECOMMENDS:${PN} = " \ |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 82 | ${PN}-modules \ |
| 83 | kernel-module-x-tables \ |
| 84 | kernel-module-ip-tables \ |
| 85 | kernel-module-iptable-filter \ |
| 86 | kernel-module-iptable-nat \ |
| 87 | kernel-module-nf-defrag-ipv4 \ |
| 88 | kernel-module-nf-conntrack \ |
| 89 | kernel-module-nf-conntrack-ipv4 \ |
| 90 | kernel-module-nf-nat \ |
| 91 | kernel-module-ipt-masquerade \ |
| 92 | ${@bb.utils.contains('PACKAGECONFIG', 'ipv6', '\ |
| 93 | kernel-module-ip6table-filter \ |
| 94 | kernel-module-ip6-tables \ |
| 95 | ', '', d)} \ |
| 96 | " |
| 97 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 98 | FILES:${PN} += "${datadir}/xtables" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 99 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 100 | FILES:${PN}-apply = "${sbindir}/ip*-apply" |
| 101 | RDEPENDS:${PN}-apply = "${PN} bash" |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 102 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 103 | # Include the symlinks as well in respective packages |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 104 | FILES:${PN}-module-xt-conntrack += "${libdir}/xtables/libxt_state.so" |
| 105 | FILES:${PN}-module-xt-ct += "${libdir}/xtables/libxt_NOTRACK.so" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 106 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 107 | ALLOW_EMPTY:${PN}-modules = "1" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 108 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 109 | INSANE_SKIP:${PN}-module-xt-conntrack = "dev-so" |
| 110 | INSANE_SKIP:${PN}-module-xt-ct = "dev-so" |