From 8693f4ab06b6e0a3fb7f256a013ab83836d586d3 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Fri, 18 Oct 2024 10:20:11 -0400 Subject: [PATCH] tests/network-bridge-firewall: unload br_netfilter if loaded by the test script Signed-off-by: Simon Deziel --- tests/network-bridge-firewall | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/network-bridge-firewall b/tests/network-bridge-firewall index ca6de773..51bb1068 100755 --- a/tests/network-bridge-firewall +++ b/tests/network-bridge-firewall @@ -43,6 +43,10 @@ iptables --version 2>&1 | grep legacy ip6tables --version 2>&1 | grep legacy ebtables --version 2>&1 | grep legacy +# Check if br_netfilter module is already loaded. +BR_NETFILTER_LOADED=false +lsmod | grep -qw ^br_netfilter && BR_NETFILTER_LOADED=true + # Setup bridge filter and unmanaged bridges modprobe br_netfilter ip link add lxdbr0unmanaged type bridge @@ -301,5 +305,10 @@ lxc storage delete default lxd shutdown iptables -D INPUT +# Unload br_netfilter only if it was loaded by the test script +if [ "${BR_NETFILTER_LOADED}" = "false" ]; then + modprobe -r br_netfilter +fi + # shellcheck disable=SC2034 FAIL=0