Skip to content

Commit

Permalink
tests/network-bridge-firewall: unload br_netfilter if loaded by the t…
Browse files Browse the repository at this point in the history
…est script (#323)
  • Loading branch information
simondeziel authored Oct 18, 2024
2 parents ff4477a + 8693f4a commit 5c4b4fc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/network-bridge-firewall
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 5c4b4fc

Please sign in to comment.