tests/TRACE-target-of-iptables-can-t-work-in: Unload modules only if loaded

Apply the same kernel version check to cleanup phase and omit module
unloading.
This commit is contained in:
Phil Sutter 2023-11-08 00:07:03 +01:00
parent 452b549ac6
commit d10a06dda4

View File

@ -119,10 +119,14 @@ rlJournalStart
rlRun "ip -6 route restore < ip-route.save6" 0 "restore routing info ipv6"
rlRun "iptables -t raw -F"
rlRun "ip6tables -t raw -F"
rlRun "rmmod nf_log_ipv4"
rlRun "rmmod nf_log_ipv6"
rlRun "rmmod nf_log_common"
rlRun "rmmod nfnetlink_log" 0,1
if rlTestVersion "$(uname -r)" "<" "4.6"; then
rlRun "rmmod nf_log_ipv4"
rlRun "rmmod nf_log_ipv6"
rlRun "rmmod nf_log_common"
rlRun "rmmod nfnetlink_log" 0,1
else
rlLogInfo "new kernel detected: skipping unloading modules"
fi
rlLogInfo "restoring services"
for svc in $SERVICES; do
rlServiceRestore $svc