Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions package/iptables/iptables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,33 @@ else
IPTABLES_CONF_OPTS += --disable-bpf-compiler --disable-nfsynproxy
endif

# Enable kernel support for iptables-nft even if nftables compat is not
# enabled by default.
ifeq ($(BR2_PACKAGE_IPTABLES_NFTABLES),y)
define IPTABLES_LINUX_CONFIG_FIXUPS_IPTABLES_NFT
$(call KCONFIG_ENABLE_OPT,CONFIG_NF_TABLES)
$(call KCONFIG_ENABLE_OPT,CONFIG_NF_TABLES_INET)
$(call KCONFIG_ENABLE_OPT,CONFIG_NFT_SOCKET)
endef
endif

# Enable kernel support for iptables-legacy only if nftables compat is not
# enabled by default.
ifeq ($(BR2_PACKAGE_IPTABLES_NFTABLES_DEFAULT),)
define IPTABLES_LINUX_CONFIG_FIXUPS_IPTABLES_LEGACY
# [for Linux kernel versions 6.17 and later]
$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_IPTABLES_LEGACY)
$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XTABLES_LEGACY)
endef
endif

define IPTABLES_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_IPTABLES)
$(call KCONFIG_ENABLE_OPT,CONFIG_IP_NF_FILTER)
$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER)
$(call KCONFIG_ENABLE_OPT,CONFIG_NETFILTER_XTABLES)
$(IPTABLES_LINUX_CONFIG_FIXUPS_IPTABLES_LEGACY)
$(IPTABLES_LINUX_CONFIG_FIXUPS_IPTABLES_NFT)
endef

define IPTABLES_INSTALL_INIT_SYSV
Expand Down
7 changes: 5 additions & 2 deletions support/testing/tests/package/test_iptables.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TestIptables(infra.basetest.BRTest):
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.82"
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.18.36"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
Expand All @@ -38,7 +38,10 @@ def test_run(self):
self.emulator.login()

# We check the program can execute.
self.assertRunOk("iptables --version")
cmd = "iptables --version"
output, exit_code = self.emulator.run(cmd)
self.assertEqual(exit_code, 0)
self.assertTrue(output[0].endswith("(legacy)"))

# We delete all rules in all chains. We also set default
# policies to ACCEPT for INPUT and OUTPUT chains. This should
Expand Down