* [Buildroot] [PATCH v2 1/6] package/nftables: add init script
2024-07-23 10:28 [Buildroot] [PATCH v2 0/6] Improved nftables firewall support Fiona Klute via buildroot
@ 2024-07-23 10:28 ` Fiona Klute via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 2/6] package/iptables: optionally default to nftables compat Fiona Klute via buildroot
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Fiona Klute via buildroot @ 2024-07-23 10:28 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Fiona Klute, Ricardo Martincoski
From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
The init script handles an nftables ruleset file with support for
atomic reloading. By default the ruleset is expected in
/etc/nftables.conf, the location can be changed in
/etc/default/nftables. If the ruleset file does not exist on start,
the script does nothing and shows a warning about that fact.
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
---
Changes v1 -> v2:
* clarify comments & commit message
* nftables init script: Warning about missing flush in ruleset on reload
* nftables init script: check for rules file only on start
* nftables init script: return nft return code from start/stop functions
package/nftables/S35nftables | 66 ++++++++++++++++++++++++++++++++++++
package/nftables/nftables.mk | 5 +++
2 files changed, 71 insertions(+)
create mode 100644 package/nftables/S35nftables
diff --git a/package/nftables/S35nftables b/package/nftables/S35nftables
new file mode 100644
index 0000000000..8605ff7e76
--- /dev/null
+++ b/package/nftables/S35nftables
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+DAEMON="nftables"
+
+# Main ruleset file, override in /etc/default/nftables if you want a
+# different location. The file should include a "flush ruleset"
+# command to atomically replace any previous rules on reload (instead
+# of adding to them).
+NFTABLES_CONFIG="/etc/nftables.conf"
+
+# shellcheck source=/dev/null
+[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
+
+start() {
+ printf "Loading nftables rules: "
+ # Run only if the ruleset file exists.
+ if [ ! -f "${NFTABLES_CONFIG}" ]; then
+ echo "${NFTABLES_CONFIG} does not exist, nothing to do."
+ return 0
+ fi
+ /usr/sbin/nft --file "${NFTABLES_CONFIG}"
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ return "$status"
+}
+
+stop() {
+ printf "Clearing nftables rules: "
+ /usr/sbin/nft flush ruleset
+ status=$?
+ if [ "$status" -eq 0 ]; then
+ echo "OK"
+ else
+ echo "FAIL"
+ fi
+ return "$status"
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ FLUSH='flush ruleset'
+ if ! grep -q -x "$FLUSH" "${NFTABLES_CONFIG}"; then
+ printf 'WARNING: no "%s" in %s, duplicated rules likely\n' \
+ "$FLUSH" "${NFTABLES_CONFIG}"
+ fi
+ start
+}
+
+case "$1" in
+ start|stop|restart|reload)
+ "$1"
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload}"
+ exit 1
+esac
+
+exit $?
diff --git a/package/nftables/nftables.mk b/package/nftables/nftables.mk
index 9cba243372..d74ca2da64 100644
--- a/package/nftables/nftables.mk
+++ b/package/nftables/nftables.mk
@@ -57,6 +57,11 @@ define NFTABLES_LINUX_CONFIG_FIXUPS
$(call KCONFIG_ENABLE_OPT,CONFIG_NF_TABLES_INET)
endef
+define NFTABLES_INSTALL_INIT_SYSV
+ $(INSTALL) -m 0755 -D package/nftables/S35nftables \
+ $(TARGET_DIR)/etc/init.d/S35nftables
+endef
+
$(eval $(autotools-package))
# Legacy: we used to handle it in this .mk
--
2.45.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 2/6] package/iptables: optionally default to nftables compat
2024-07-23 10:28 [Buildroot] [PATCH v2 0/6] Improved nftables firewall support Fiona Klute via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 1/6] package/nftables: add init script Fiona Klute via buildroot
@ 2024-07-23 10:28 ` Fiona Klute via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 3/6] package/iptables: check for rules in init script Fiona Klute via buildroot
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Fiona Klute via buildroot @ 2024-07-23 10:28 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Fiona Klute, Ricardo Martincoski
From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
For an nftables-based firewall setup it may be desirable to use
iptables-nft as the "iptables" binary, in particular to better
integrate legacy applications that do not support nftables directly
and call iptables. If the BR2_PACKAGE_IPTABLES_NFTABLES_DEFAULT option
introduced by this patch is enabled, iptables, iptables-restore, and
iptables-save are symlinked to the -nft version of iptables. The
-legacy options can still be called directly if desired.
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
---
Changes v1 -> v2:
* clarify commit message
package/iptables/Config.in | 12 ++++++++++++
package/iptables/iptables.mk | 9 +++++++++
2 files changed, 21 insertions(+)
diff --git a/package/iptables/Config.in b/package/iptables/Config.in
index e6b12603e0..ef02c26242 100644
--- a/package/iptables/Config.in
+++ b/package/iptables/Config.in
@@ -24,6 +24,18 @@ config BR2_PACKAGE_IPTABLES_NFTABLES
help
Build nftables compat utilities.
+if BR2_PACKAGE_IPTABLES_NFTABLES
+
+config BR2_PACKAGE_IPTABLES_NFTABLES_DEFAULT
+ bool "use nftables compat by default"
+ help
+ Make the nftables compat variant of iptables, iptables-save,
+ and iptables-restore the default. This only adjusts symlinks
+ in /usr/sbin, the legacy variants can still be called
+ directly.
+
+endif
+
comment "nftables compat needs a toolchain w/ wchar, dynamic library, headers >= 3.12"
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 || \
!BR2_USE_WCHAR || BR2_STATIC_LIBS
diff --git a/package/iptables/iptables.mk b/package/iptables/iptables.mk
index 6712136962..257834b8cd 100644
--- a/package/iptables/iptables.mk
+++ b/package/iptables/iptables.mk
@@ -62,4 +62,13 @@ define IPTABLES_INSTALL_INIT_SYSV
touch $(TARGET_DIR)/etc/iptables.conf
endef
+ifeq ($(BR2_PACKAGE_IPTABLES_NFTABLES_DEFAULT),y)
+define IPTABLES_MAKE_NFTABLES_DEFAULT
+ ln -sf xtables-nft-multi $(TARGET_DIR)/usr/sbin/iptables
+ ln -sf xtables-nft-multi $(TARGET_DIR)/usr/sbin/iptables-restore
+ ln -sf xtables-nft-multi $(TARGET_DIR)/usr/sbin/iptables-save
+endef
+IPTABLES_POST_INSTALL_TARGET_HOOKS += IPTABLES_MAKE_NFTABLES_DEFAULT
+endif
+
$(eval $(autotools-package))
--
2.45.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 3/6] package/iptables: check for rules in init script
2024-07-23 10:28 [Buildroot] [PATCH v2 0/6] Improved nftables firewall support Fiona Klute via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 1/6] package/nftables: add init script Fiona Klute via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 2/6] package/iptables: optionally default to nftables compat Fiona Klute via buildroot
@ 2024-07-23 10:28 ` Fiona Klute via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 4/6] support/testing: test for nftables " Fiona Klute via buildroot
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Fiona Klute via buildroot @ 2024-07-23 10:28 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Fiona Klute, Ricardo Martincoski
From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
Instead of installing an empty rules file, the init script now checks
if the rules file exists and does nothing on start if it doesn't. Stop
remains unchanged so users can still delete the rules file and then
use the stop command to flush rules from the kernel.
Also fix the shellcheck warning about the unused IPTABLES_ARGS
variable, and use long form option for iptables-save.
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
---
.checkpackageignore | 1 -
package/iptables/S35iptables | 12 ++++++++----
package/iptables/iptables.mk | 1 -
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/.checkpackageignore b/.checkpackageignore
index 760ae29cfb..4152a5c74e 100644
--- a/.checkpackageignore
+++ b/.checkpackageignore
@@ -676,7 +676,6 @@ package/ipmitool/0002-Fix-enterprise-numbers-URL.patch lib_patch.Upstream
package/ipmitool/0003-Do-not-require-the-IANA-PEN-registry-file.patch lib_patch.Upstream
package/ipmitool/0004-configure.ac-allow-disabling-registry-downloads.patch lib_patch.Upstream
package/iprutils/0001-configure.ac-add-AC_USE_SYSTEM_EXTENSIONS.patch lib_patch.Upstream
-package/iptables/S35iptables Shellcheck
package/irda-utils/0001-daemon.patch lib_patch.Sob lib_patch.Upstream
package/irda-utils/0002-nommu.patch lib_patch.Sob lib_patch.Upstream
package/irda-utils/0003-subdir.patch lib_patch.Sob lib_patch.Upstream
diff --git a/package/iptables/S35iptables b/package/iptables/S35iptables
index a2de29d222..a67d0886a9 100644
--- a/package/iptables/S35iptables
+++ b/package/iptables/S35iptables
@@ -2,11 +2,16 @@
DAEMON="iptables"
-IPTABLES_ARGS=""
+IPTABLES_CONF="/etc/iptables.conf"
start() {
printf 'Starting %s: ' "$DAEMON"
- iptables-restore /etc/iptables.conf
+ # Run only if IPTABLES_CONF exists.
+ if [ ! -f "${IPTABLES_CONF}" ]; then
+ echo "${IPTABLES_CONF} does not exist, nothing to do."
+ return 0
+ fi
+ iptables-restore "$IPTABLES_CONF"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
@@ -30,13 +35,12 @@ stop() {
restart() {
stop
- sleep 1
start
}
save() {
printf 'Saving %s: ' "$DAEMON"
- iptables-save -f /etc/iptables.conf
+ iptables-save --file "$IPTABLES_CONF"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
diff --git a/package/iptables/iptables.mk b/package/iptables/iptables.mk
index 257834b8cd..13e80a6966 100644
--- a/package/iptables/iptables.mk
+++ b/package/iptables/iptables.mk
@@ -59,7 +59,6 @@ endef
define IPTABLES_INSTALL_INIT_SYSV
$(INSTALL) -m 0755 -D package/iptables/S35iptables \
$(TARGET_DIR)/etc/init.d/S35iptables
- touch $(TARGET_DIR)/etc/iptables.conf
endef
ifeq ($(BR2_PACKAGE_IPTABLES_NFTABLES_DEFAULT),y)
--
2.45.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 4/6] support/testing: test for nftables init script
2024-07-23 10:28 [Buildroot] [PATCH v2 0/6] Improved nftables firewall support Fiona Klute via buildroot
` (2 preceding siblings ...)
2024-07-23 10:28 ` [Buildroot] [PATCH v2 3/6] package/iptables: check for rules in init script Fiona Klute via buildroot
@ 2024-07-23 10:28 ` Fiona Klute via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 5/6] support/testing: include init script in iptables test Fiona Klute via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 6/6] support/testing: fix MyPy warnings about BRConfigTest Fiona Klute via buildroot
5 siblings, 0 replies; 9+ messages in thread
From: Fiona Klute via buildroot @ 2024-07-23 10:28 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Fiona Klute, Ricardo Martincoski
From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
The new test checks that a pre-defined rules file can be loaded and
works as expected, and that after flushing the blocked IP responds to
ping again.
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
---
DEVELOPERS | 1 +
.../testing/tests/package/test_nftables.py | 37 ++++++++++++++++++-
.../rootfs-overlay/etc/nftables.conf | 8 ++++
3 files changed, 45 insertions(+), 1 deletion(-)
create mode 100644 support/testing/tests/package/test_nftables/rootfs-overlay/etc/nftables.conf
diff --git a/DEVELOPERS b/DEVELOPERS
index 3650321d6f..36418f9d6f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1108,6 +1108,7 @@ F: package/python-pymodbus/
N: Fiona Klute <fiona.klute@gmx.de>
F: package/python-pyasynchat/
F: package/python-pyasyncore/
+F: support/testing/tests/package/test_nftables.py
N: Flávio Tapajós <flavio.tapajos@newtesc.com.br>
F: configs/asus_tinker-s_rk3288_defconfig
diff --git a/support/testing/tests/package/test_nftables.py b/support/testing/tests/package/test_nftables.py
index 142e7d0352..2622c7e822 100644
--- a/support/testing/tests/package/test_nftables.py
+++ b/support/testing/tests/package/test_nftables.py
@@ -85,7 +85,7 @@ class TestNftables(infra.basetest.BRTest):
# supposed to fail earlier is now supposed to succeed.
self.assertRunOk(ping_test_cmd)
- def test_run(self):
+ def boot_vm(self):
img = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
kern = os.path.join(self.builddir, "images", "Image")
self.emulator.boot(arch="aarch64",
@@ -97,6 +97,9 @@ class TestNftables(infra.basetest.BRTest):
"-initrd", img])
self.emulator.login()
+ def test_run(self):
+ self.boot_vm()
+
# We check the program can execute.
self.assertRunOk("nft --version")
@@ -107,3 +110,35 @@ class TestNftables(infra.basetest.BRTest):
# We run again the same test sequence using our simple nft
# python implementation, to check the language bindings.
self.nftables_test(prog="/root/nft.py")
+
+
+class TestNftablesInit(TestNftables):
+ config = TestNftables.config + \
+ """
+ BR2_INIT_BUSYBOX=y
+ """
+
+ def test_run(self):
+ self.boot_vm()
+
+ # start with known state (rules from /etc/nftables.conf)
+ self.assertRunOk("/etc/init.d/S35nftables reload")
+
+ # Same concept as in TestNftables.nftables_test: The rules
+ # should allow ping to 127.0.0.1, but not 127.0.0.2.
+ ping_cmd_prefix = "ping -c 3 -i 0.5 -W 2 "
+ self.assertRunOk(ping_cmd_prefix + "127.0.0.1")
+ _, exit_code = self.emulator.run(ping_cmd_prefix + "127.0.0.2")
+ self.assertNotEqual(exit_code, 0)
+
+ # Stop should flush the rules, ping to both addresses should
+ # work now.
+ self.assertRunOk("/etc/init.d/S35nftables stop")
+ self.assertRunOk(ping_cmd_prefix + "127.0.0.1")
+ self.assertRunOk(ping_cmd_prefix + "127.0.0.2")
+
+ # Start is essentially the same as reload, check that
+ # 127.0.0.2 gets blocked again.
+ self.assertRunOk("/etc/init.d/S35nftables start")
+ _, exit_code = self.emulator.run(ping_cmd_prefix + "127.0.0.2")
+ self.assertNotEqual(exit_code, 0)
diff --git a/support/testing/tests/package/test_nftables/rootfs-overlay/etc/nftables.conf b/support/testing/tests/package/test_nftables/rootfs-overlay/etc/nftables.conf
new file mode 100644
index 0000000000..a04af1d634
--- /dev/null
+++ b/support/testing/tests/package/test_nftables/rootfs-overlay/etc/nftables.conf
@@ -0,0 +1,8 @@
+flush ruleset
+
+table inet filter {
+ chain input {
+ type filter hook input priority filter; policy accept;
+ ip daddr 127.0.0.2 icmp type echo-request drop
+ }
+}
--
2.45.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 5/6] support/testing: include init script in iptables test
2024-07-23 10:28 [Buildroot] [PATCH v2 0/6] Improved nftables firewall support Fiona Klute via buildroot
` (3 preceding siblings ...)
2024-07-23 10:28 ` [Buildroot] [PATCH v2 4/6] support/testing: test for nftables " Fiona Klute via buildroot
@ 2024-07-23 10:28 ` Fiona Klute via buildroot
2024-07-23 12:26 ` Thomas Petazzoni via buildroot
2024-07-23 10:28 ` [Buildroot] [PATCH v2 6/6] support/testing: fix MyPy warnings about BRConfigTest Fiona Klute via buildroot
5 siblings, 1 reply; 9+ messages in thread
From: Fiona Klute via buildroot @ 2024-07-23 10:28 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Fiona Klute, Ricardo Martincoski
From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
Check a save/start/stop cycle based on the rules created by direct
commands in the pre-existing test.
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
---
package/iptables/S35iptables | 2 +-
support/testing/tests/package/test_iptables.py | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/package/iptables/S35iptables b/package/iptables/S35iptables
index a67d0886a9..d6ff4a4762 100644
--- a/package/iptables/S35iptables
+++ b/package/iptables/S35iptables
@@ -23,7 +23,7 @@ start() {
stop() {
printf 'Stopping %s: ' "$DAEMON"
- iptables -F
+ iptables --flush
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
diff --git a/support/testing/tests/package/test_iptables.py b/support/testing/tests/package/test_iptables.py
index ee57b31558..e807fc9e83 100644
--- a/support/testing/tests/package/test_iptables.py
+++ b/support/testing/tests/package/test_iptables.py
@@ -11,6 +11,7 @@ class TestIptables(infra.basetest.BRTest):
"""
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_INIT_BUSYBOX=y
BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
@@ -70,9 +71,26 @@ class TestIptables(infra.basetest.BRTest):
_, exit_code = self.emulator.run(ping_test_cmd)
self.assertNotEqual(exit_code, 0)
+ # Save the current rules to test the init script later.
+ self.assertRunOk("/etc/init.d/S35iptables save")
+
# We delete our only rule #1 in the INPUT chain.
self.assertRunOk("iptables --delete INPUT 1")
# Since we deleted the rule, the ping test command which was
# supposed to fail earlier is now supposed to succeed.
self.assertRunOk(ping_test_cmd)
+
+ # Load the rules as saved before.
+ self.assertRunOk("/etc/init.d/S35iptables start")
+
+ # Ping to 127.0.0.2 is expected to fail again.
+ _, exit_code = self.emulator.run(ping_test_cmd)
+ self.assertNotEqual(exit_code, 0)
+
+ # And flush the rules again.
+ self.assertRunOk("/etc/init.d/S35iptables stop")
+
+ # Since we deleted the rule, the ping test command which was
+ # supposed to fail earlier is now supposed to succeed.
+ self.assertRunOk(ping_test_cmd)
--
2.45.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [Buildroot] [PATCH v2 5/6] support/testing: include init script in iptables test
2024-07-23 10:28 ` [Buildroot] [PATCH v2 5/6] support/testing: include init script in iptables test Fiona Klute via buildroot
@ 2024-07-23 12:26 ` Thomas Petazzoni via buildroot
2024-07-23 13:41 ` Fiona Klute via buildroot
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-23 12:26 UTC (permalink / raw)
To: Fiona Klute via buildroot
Cc: Julien Olivain, Fiona Klute, Ricardo Martincoski
Hello Fiona,
Thanks for this patch series!
On Tue, 23 Jul 2024 12:28:30 +0200
Fiona Klute via buildroot <buildroot@buildroot.org> wrote:
> From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
>
> Check a save/start/stop cycle based on the rules created by direct
> commands in the pre-existing test.
>
> Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
> ---
> package/iptables/S35iptables | 2 +-
> support/testing/tests/package/test_iptables.py | 18 ++++++++++++++++++
> 2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/package/iptables/S35iptables b/package/iptables/S35iptables
> index a67d0886a9..d6ff4a4762 100644
> --- a/package/iptables/S35iptables
> +++ b/package/iptables/S35iptables
> @@ -23,7 +23,7 @@ start() {
>
> stop() {
> printf 'Stopping %s: ' "$DAEMON"
> - iptables -F
> + iptables --flush
I suppose this change was not meant to be in this patch, but probably
in an earlier patch of the series?
Thanks,
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [Buildroot] [PATCH v2 5/6] support/testing: include init script in iptables test
2024-07-23 12:26 ` Thomas Petazzoni via buildroot
@ 2024-07-23 13:41 ` Fiona Klute via buildroot
0 siblings, 0 replies; 9+ messages in thread
From: Fiona Klute via buildroot @ 2024-07-23 13:41 UTC (permalink / raw)
To: Thomas Petazzoni, Fiona Klute via buildroot
Cc: Julien Olivain, Ricardo Martincoski
Am 23.07.24 um 14:26 schrieb Thomas Petazzoni:
> Hello Fiona,
>
> Thanks for this patch series!
>
> On Tue, 23 Jul 2024 12:28:30 +0200
> Fiona Klute via buildroot <buildroot@buildroot.org> wrote:
>
>> From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
>>
>> Check a save/start/stop cycle based on the rules created by direct
>> commands in the pre-existing test.
>>
>> Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
>> ---
>> package/iptables/S35iptables | 2 +-
>> support/testing/tests/package/test_iptables.py | 18 ++++++++++++++++++
>> 2 files changed, 19 insertions(+), 1 deletion(-)
>>
>> diff --git a/package/iptables/S35iptables b/package/iptables/S35iptables
>> index a67d0886a9..d6ff4a4762 100644
>> --- a/package/iptables/S35iptables
>> +++ b/package/iptables/S35iptables
>> @@ -23,7 +23,7 @@ start() {
>>
>> stop() {
>> printf 'Stopping %s: ' "$DAEMON"
>> - iptables -F
>> + iptables --flush
>
> I suppose this change was not meant to be in this patch, but probably
> in an earlier patch of the series?
Right, thanks for catching that. I've just sent v3 with that fixed.
Sorry about the noise!
Best regards,
Fiona
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2 6/6] support/testing: fix MyPy warnings about BRConfigTest
2024-07-23 10:28 [Buildroot] [PATCH v2 0/6] Improved nftables firewall support Fiona Klute via buildroot
` (4 preceding siblings ...)
2024-07-23 10:28 ` [Buildroot] [PATCH v2 5/6] support/testing: include init script in iptables test Fiona Klute via buildroot
@ 2024-07-23 10:28 ` Fiona Klute via buildroot
5 siblings, 0 replies; 9+ messages in thread
From: Fiona Klute via buildroot @ 2024-07-23 10:28 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain, Fiona Klute, Ricardo Martincoski
From: "Fiona Klute (WIWA)" <fiona.klute@gmx.de>
This removes warnings in editors/IDEs with MyPy typechecking
integration. Test classes override "config" with strings (different
type than None).
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
---
I haven't seen any other type annotations in the testing code, if
they're not welcome please just drop this patch from the
series. Personally I think they're good to avoid bugs.
support/testing/infra/basetest.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/support/testing/infra/basetest.py b/support/testing/infra/basetest.py
index 12d96415da..9fb9dffc53 100644
--- a/support/testing/infra/basetest.py
+++ b/support/testing/infra/basetest.py
@@ -24,8 +24,8 @@ MINIMAL_CONFIG = \
class BRConfigTest(unittest.TestCase):
"""Test up to the configure stage."""
- config = None
- br2_external = list()
+ config: str
+ br2_external: list[str] = list()
downloaddir = None
outputdir = None
logtofile = True
--
2.45.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 9+ messages in thread