1SUMMARY = "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 = "GPL-2.0-or-later" 7LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 8 file://iptables/iptables.c;beginline=13;endline=25;md5=c5cffd09974558cf27d0f763df2a12dc \ 9" 10 11SRC_URI = "http://netfilter.org/projects/iptables/files/iptables-${PV}.tar.xz \ 12 file://iptables.service \ 13 file://iptables.rules \ 14 file://ip6tables.service \ 15 file://ip6tables.rules \ 16 file://0001-configure-Add-option-to-enable-disable-libnfnetlink.patch \ 17 " 18SRC_URI[sha256sum] = "5cc255c189356e317d070755ce9371eb63a1b783c34498fb8c30264f3cc59c9c" 19 20SYSTEMD_SERVICE:${PN} = "\ 21 iptables.service \ 22 ${@bb.utils.contains('PACKAGECONFIG', 'ipv6', 'ip6tables.service', '', d)} \ 23" 24 25inherit autotools pkgconfig systemd 26 27EXTRA_OECONF = "--with-kernel=${STAGING_INCDIR}" 28 29CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0" 30 31PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)}" 32PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6," 33 34# libnfnetlink recipe is in meta-networking layer 35PACKAGECONFIG[libnfnetlink] = "--enable-libnfnetlink --enable-connlabel,--disable-libnfnetlink --disable-connlabel,libnfnetlink libnetfilter-conntrack" 36 37# libnftnl recipe is in meta-networking layer(previously known as libnftables) 38PACKAGECONFIG[libnftnl] = "--enable-nftables,--disable-nftables,libnftnl" 39 40do_configure:prepend() { 41 # Remove some libtool m4 files 42 # Keep ax_check_linker_flags.m4 which belongs to autoconf-archive. 43 rm -f libtool.m4 lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 44 45 # Copy a header to fix out of tree builds 46 cp -f ${S}/libiptc/linux_list.h ${S}/include/libiptc/ 47} 48 49IPTABLES_RULES_DIR ?= "${sysconfdir}/${BPN}" 50 51do_install:append() { 52 install -d ${D}${IPTABLES_RULES_DIR} 53 install -m 0644 ${UNPACKDIR}/iptables.rules ${D}${IPTABLES_RULES_DIR} 54 55 install -d ${D}${systemd_system_unitdir} 56 install -m 0644 ${UNPACKDIR}/iptables.service ${D}${systemd_system_unitdir} 57 58 sed -i \ 59 -e 's,@SBINDIR@,${sbindir},g' \ 60 -e 's,@RULESDIR@,${IPTABLES_RULES_DIR},g' \ 61 ${D}${systemd_system_unitdir}/iptables.service 62 63 if ${@bb.utils.contains('PACKAGECONFIG', 'ipv6', 'true', 'false', d)} ; then 64 install -m 0644 ${UNPACKDIR}/ip6tables.rules ${D}${IPTABLES_RULES_DIR} 65 install -m 0644 ${UNPACKDIR}/ip6tables.service ${D}${systemd_system_unitdir} 66 67 sed -i \ 68 -e 's,@SBINDIR@,${sbindir},g' \ 69 -e 's,@RULESDIR@,${IPTABLES_RULES_DIR},g' \ 70 ${D}${systemd_system_unitdir}/ip6tables.service 71 fi 72 73 # if libnftnl is included, make the iptables symlink point to the nft-based binary by default 74 if ${@bb.utils.contains('PACKAGECONFIG', 'libnftnl', 'true', 'false', d)} ; then 75 ln -sf ${sbindir}/xtables-nft-multi ${D}${sbindir}/iptables 76 ln -sf ${sbindir}/xtables-nft-multi ${D}${sbindir}/iptables-save 77 ln -sf ${sbindir}/xtables-nft-multi ${D}${sbindir}/iptables-restore 78 fi 79} 80 81PACKAGES =+ "${PN}-modules ${PN}-apply" 82PACKAGES_DYNAMIC += "^${PN}-module-.*" 83 84python populate_packages:prepend() { 85 modules = do_split_packages(d, '${libdir}/xtables', r'lib(.*)\.so$', '${PN}-module-%s', '${PN} module %s', extra_depends='') 86 if modules: 87 metapkg = d.getVar('PN') + '-modules' 88 d.appendVar('RDEPENDS:' + metapkg, ' ' + ' '.join(modules)) 89} 90 91RDEPENDS:${PN} = "${PN}-module-xt-standard" 92RRECOMMENDS:${PN} = " \ 93 ${PN}-modules \ 94 kernel-module-x-tables \ 95 kernel-module-ip-tables \ 96 kernel-module-iptable-filter \ 97 kernel-module-iptable-nat \ 98 kernel-module-nf-defrag-ipv4 \ 99 kernel-module-nf-conntrack \ 100 kernel-module-nf-conntrack-ipv4 \ 101 kernel-module-nf-nat \ 102 kernel-module-ipt-masquerade \ 103 ${@bb.utils.contains('PACKAGECONFIG', 'ipv6', '\ 104 kernel-module-ip6table-filter \ 105 kernel-module-ip6-tables \ 106 ', '', d)} \ 107" 108 109FILES:${PN} += "${datadir}/xtables" 110 111FILES:${PN}-apply = "${sbindir}/ip*-apply" 112RDEPENDS:${PN}-apply = "${PN} bash" 113 114# Include the symlinks as well in respective packages 115FILES:${PN}-module-xt-conntrack += "${libdir}/xtables/libxt_state.so" 116FILES:${PN}-module-xt-ct += "${libdir}/xtables/libxt_NOTRACK.so ${libdir}/xtables/libxt_REDIRECT.so" 117FILES:${PN}-module-xt-nat += "${libdir}/xtables/libxt_SNAT.so ${libdir}/xtables/libxt_DNAT.so ${libdir}/xtables/libxt_MASQUERADE.so" 118 119ALLOW_EMPTY:${PN}-modules = "1" 120 121INSANE_SKIP:${PN}-module-xt-conntrack = "dev-so" 122INSANE_SKIP:${PN}-module-xt-ct = "dev-so" 123INSANE_SKIP:${PN}-module-xt-nat = "dev-so" 124