iptables_1.8.11.bb 4.7 KB

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