mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-20 09:47:51 +02:00
Remove 'slowstart' stuff and restore proper termination status
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5748 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
cd97ccfd4e
commit
62285033c9
@ -227,10 +227,6 @@ my $exclseq = 0;
|
|||||||
#
|
#
|
||||||
my $iprangematch = 0;
|
my $iprangematch = 0;
|
||||||
#
|
#
|
||||||
# Keep track of whether there are run-time commands in the chain rules
|
|
||||||
#
|
|
||||||
my $slowstart = 0;
|
|
||||||
#
|
|
||||||
# Sequence for naming temporary chains
|
# Sequence for naming temporary chains
|
||||||
#
|
#
|
||||||
my $chainseq;
|
my $chainseq;
|
||||||
@ -254,8 +250,6 @@ sub add_command($$)
|
|||||||
push @{$chainref->{rules}}, join ('', '~', ' ' x $loopcount, $command );
|
push @{$chainref->{rules}}, join ('', '~', ' ' x $loopcount, $command );
|
||||||
|
|
||||||
$chainref->{referenced} = 1;
|
$chainref->{referenced} = 1;
|
||||||
|
|
||||||
$slowstart = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1433,16 +1427,10 @@ use constant { NULL_STATE => 0 ,
|
|||||||
|
|
||||||
my $state = NULL_STATE;
|
my $state = NULL_STATE;
|
||||||
|
|
||||||
my $rulenumber = 0;
|
|
||||||
|
|
||||||
sub emitr( $ ) {
|
sub emitr( $ ) {
|
||||||
my $rule = $_[0];
|
my $rule = $_[0];
|
||||||
|
|
||||||
unless ( $slowstart ) {
|
if ( substr( $rule, 0, 1 ) eq '~' ) {
|
||||||
$rulenumber++;
|
|
||||||
substr($rule, 80) = "#$rulenumber" unless length $rule >= 80;
|
|
||||||
emit_unindented $rule;
|
|
||||||
} elsif ( substr( $rule, 0, 1 ) eq '~' ) {
|
|
||||||
#
|
#
|
||||||
# A command
|
# A command
|
||||||
#
|
#
|
||||||
@ -1487,12 +1475,7 @@ sub create_netfilter_load() {
|
|||||||
|
|
||||||
emit '';
|
emit '';
|
||||||
|
|
||||||
if ( $slowstart ) {
|
emit 'exec 3>${VARDIR}/.iptables-restore-input';
|
||||||
emit 'exec 3>${VARDIR}/.iptables-input';
|
|
||||||
} else {
|
|
||||||
emit 'iptables-restore << __EOF__';
|
|
||||||
$state = CAT_STATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for my $table qw/raw nat mangle filter/ {
|
for my $table qw/raw nat mangle filter/ {
|
||||||
emitr "*$table";
|
emitr "*$table";
|
||||||
@ -1529,15 +1512,13 @@ sub create_netfilter_load() {
|
|||||||
emit_unindented '__EOF__' unless $state == CMD_STATE;
|
emit_unindented '__EOF__' unless $state == CMD_STATE;
|
||||||
emit '';
|
emit '';
|
||||||
|
|
||||||
if ( $slowstart ) {
|
emitj( ' exec 3>&-',
|
||||||
emitj( ' exec 3>&-',
|
'',
|
||||||
'',
|
'iptables-restore < ${VARDIR}/.iptables-restore-input'
|
||||||
'iptables-restore < ${VARDIR}/.iptables_input'
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
emitj( 'if [ $? != 0 ]; then',
|
emitj( 'if [ $? != 0 ]; then',
|
||||||
' fatal_error "iptables-restore Failed"',
|
' fatal_error "iptables-restore Failed. Input is in ${VARDIR}/.iptables-restore-input"',
|
||||||
"fi\n"
|
"fi\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -86,7 +86,15 @@ my $tempfile; # Temporary File Name
|
|||||||
sub fatal_error
|
sub fatal_error
|
||||||
{
|
{
|
||||||
print STDERR " ERROR: @_\n";
|
print STDERR " ERROR: @_\n";
|
||||||
die;
|
|
||||||
|
if ( $object ) {
|
||||||
|
close $object;
|
||||||
|
unlink $tempfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
system "rm -rf $ENV{TMP_DIR}" if $ENV{TMP_DIR};
|
||||||
|
|
||||||
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -332,13 +340,4 @@ sub finalize_aux_config() {
|
|||||||
progress_message3 "Shorewall configuration compiled to $file";
|
progress_message3 "Shorewall configuration compiled to $file";
|
||||||
}
|
}
|
||||||
|
|
||||||
END {
|
|
||||||
if ( $object ) {
|
|
||||||
close $object;
|
|
||||||
unlink $tempfile;
|
|
||||||
}
|
|
||||||
|
|
||||||
system "rm -rf $ENV{TMP_DIR}" if $ENV{TMP_DIR};
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -237,12 +237,12 @@ sub warning_message
|
|||||||
|
|
||||||
sub fatal_error {
|
sub fatal_error {
|
||||||
if ( $currentfile ) {
|
if ( $currentfile ) {
|
||||||
print STDERR " ERROR: @_ : $currentfilename#$currentlinenumber\n";
|
Shorewall::Common::fatal_error "@_ : $currentfilename#$currentlinenumber";
|
||||||
} else {
|
} else {
|
||||||
print STDERR " ERROR: @_\n";
|
Shorewall::Common::fatal_error @_;
|
||||||
}
|
}
|
||||||
|
|
||||||
die "Terminated\n";
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user