Merge branch 'clean-test-ipset' into 'master'

Destroy the temporary IP set in the cleanup function

See merge request shorewall/code!13
This commit is contained in:
Tom Eastep 2024-04-16 02:46:50 +00:00
commit 3c77d83260

View File

@ -1507,7 +1507,7 @@ sub qt1( $ ) {
} }
# #
# Delete the test chains # Delete the test chains and IP sets
# #
sub cleanup_iptables() { sub cleanup_iptables() {
qt1( "$iptables $iptablesw -F $sillyname" ); qt1( "$iptables $iptablesw -F $sillyname" );
@ -1530,6 +1530,12 @@ sub cleanup_iptables() {
qt1( "$iptables $iptablesw -t raw -X $sillyname" ); qt1( "$iptables $iptablesw -t raw -X $sillyname" );
} }
my $ipset = $config{IPSET} || 'ipset';
$ipset = which( $ipset ) unless $ipset =~ '/';
if ( $ipset && -x $ipset ) {
qt( "$ipset -X $sillyname" );
}
$sillyname = $sillyname1 = ''; $sillyname = $sillyname1 = '';
} }
@ -1574,7 +1580,7 @@ sub cleanup() {
unlink ( $perlscriptname ), $perlscriptname = undef if $perlscriptname; unlink ( $perlscriptname ), $perlscriptname = undef if $perlscriptname;
unlink ( @tempfiles ), @tempfiles = () if @tempfiles; unlink ( @tempfiles ), @tempfiles = () if @tempfiles;
# #
# Delete temporary chains # Delete temporary chains and IP sets
# #
cleanup_iptables if $sillyname; cleanup_iptables if $sillyname;
} }