More code structure cleanup -- Providers.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2009-05-22 13:55:39 -07:00
parent 08b5abbdb2
commit 110b6a613d

View File

@ -495,6 +495,8 @@ sub add_a_provider( ) {
emit "fi\n";
push @providers, $table;
progress_message " Provider \"$currentline\" $done";
}
sub add_an_rtrule( ) {
@ -586,15 +588,7 @@ sub setup_null_routing() {
}
}
sub setup_providers() {
my $providers = 0;
my $fn = open_file 'providers';
while ( read_a_line ) {
unless ( $providers ) {
progress_message2 "$doing $fn ...";
sub start_providers() {
require_capability( 'MANGLE_ENABLED' , 'a non-empty providers file' , 's' );
fatal_error "A non-empty providers file is not permitted with MANGLE_ENABLED=No" unless $config{MANGLE_ENABLED};
@ -631,17 +625,9 @@ sub setup_providers() {
emit 'DEFAULT_ROUTE=';
emit 'FALLBACK_ROUTE=';
emit '';
}
}
add_a_provider;
$providers++;
progress_message " Provider \"$currentline\" $done";
}
if ( $providers ) {
sub finish_providers() {
if ( $balancing ) {
my $table = MAIN_TABLE;
@ -714,6 +700,19 @@ sub setup_providers() {
emit "fi\n";
}
}
sub setup_providers() {
my $providers = 0;
my $fn = open_file 'providers';
first_entry sub() { progress_message2 "$doing $fn..."; start_providers; };
add_a_provider, $providers++ while read_a_line;
if ( $providers ) {
finish_providers;
my $fn = open_file 'route_rules';
@ -752,6 +751,7 @@ sub setup_providers() {
emit "fi\n";
}
}
}
sub lookup_provider( $ ) {