Make BALANCE_PROVIDERS default the setting of USE_DEFAULT_RT

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2017-01-17 15:02:16 -08:00
parent ac5fd195ec
commit cc3b8793e0
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
6 changed files with 60 additions and 34 deletions

View File

@ -5280,7 +5280,13 @@ sub update_config_file( $ ) {
}
update_default( 'USE_DEFAULT_RT', 'No' );
if ( $config{USE_DEFAULT_RT} eq '' || $config{USE_DEFAULT_RT} =~ /^no$/i ) {
update_default( 'BALANCE_PROVIDERS', 'No' );
} else {
update_default( 'BALANCE_PROVIDERS', 'Yes' );
}
update_default( 'EXPORTMODULES', 'No' );
update_default( 'RESTART', 'reload' );
update_default( 'PAGER', $shorewallrc1{DEFAULT_PAGER} );
@ -6288,9 +6294,7 @@ sub get_configuration( $$$$ ) {
default_yes_no 'RESTORE_DEFAULT_ROUTE' , 'Yes';
default_yes_no 'AUTOMAKE' , '';
default_yes_no 'TRACK_PROVIDERS' , '';
default_yes_no 'BALANCE_PROVIDERS' , 'Yes';
$config{BALANCE_PROVIDERS} = '' unless $config{USE_DEFAULT_RT};
default_yes_no 'BALANCE_PROVIDERS' , $config{USE_DEFAULT_RT} ? 'Yes' : '';
unless ( ( $config{NULL_ROUTE_RFC1918} || '' ) =~ /^(?:blackhole|unreachable|prohibit)$/ ) {
default_yes_no( 'NULL_ROUTE_RFC1918', '' );

View File

@ -603,6 +603,7 @@ sub process_a_provider( $ ) {
fatal_error "A provider interface must have at least one associated zone" unless $tproxy || %{interface_zones($interface)};
unless ( $pseudo ) {
if ( $local ) {
fatal_error "GATEWAY not valid with 'local' provider" unless $gatewaycase eq 'omitted';
fatal_error "'track' not valid with 'local'" if $track;
@ -616,7 +617,7 @@ sub process_a_provider( $ ) {
fatal_error "MARK not allowed with 'tproxy'" if $mark ne '-';
fatal_error "'persistent' is not valid with 'tproxy" if $persistent;
$mark = $globals{TPROXY_MARK};
} elsif ( ! $pseudo && ( ( my $rf = ( $config{ROUTE_FILTER} eq 'on' ) ) || $interfaceref->{options}{routefilter} ) ) {
} elsif ( ( my $rf = ( $config{ROUTE_FILTER} eq 'on' ) ) || $interfaceref->{options}{routefilter} ) {
if ( $config{USE_DEFAULT_RT} ) {
if ( $rf ) {
fatal_error "There may be no providers when ROUTE_FILTER=Yes and USE_DEFAULT_RT=Yes";
@ -633,8 +634,7 @@ sub process_a_provider( $ ) {
}
}
}
}
my $val = 0;
my $pref;

View File

@ -208,6 +208,16 @@
<option>balance=</option><replaceable>weight</replaceable>
where <replaceable>weight</replaceable> is the weight of the
route out of this interface.</para>
<para>Prior to Shorewall 5.1.1, when USE_DEFAULT_RT=Yes,
<option>balance=1</option> is assumed unless the
<option>fallback</option>, <option>loose</option>,
<option>load</option> or <option>tproxy</option> option is
specified. Beginning with Shorewall 5.1.1, when
BALANCE_PROVIDERS=Yes, <option>balance=1</option> is assumed
unless the <option>fallback</option>, <option>loose</option>,
<option>load</option> or <option>tproxy</option> option is
specified.</para>
</listitem>
</varlistentry>

View File

@ -452,11 +452,12 @@
determines whether the <option>balance</option> provider option (see
<ulink
url="shorewall-providers.html">shorewall-providers(5)</ulink>) is
the default. When BALANCE_PROVIDERS=Yes (the default), then the
the default. When BALANCE_PROVIDERS=Yes, then the
<option>balance</option> option is assumed unless the
<option>fallback</option>, <option>loose</option>,
<option>load</option> or <option>tproxy</option> option is
specified.</para>
specified. If this option is not set or is set to the empty value,
then the default value is the value of USE_DEFAULT_RT.</para>
</listitem>
</varlistentry>

View File

@ -173,6 +173,16 @@
where <replaceable>weight</replaceable> is the weight of the
route out of this interface. Prior to Shorewall 5.0.13, only
one provider can specify this option.</para>
<para>Prior to Shorewall 5.1.1, when USE_DEFAULT_RT=Yes,
<option>balance=1</option> is assumed unless the
<option>fallback</option>, <option>loose</option>,
<option>load</option> or <option>tproxy</option> option is
specified. Beginning with Shorewall 5.1.1, when
BALANCE_PROVIDERS=Yes, <option>balance=1</option> is assumed
unless the <option>fallback</option>, <option>loose</option>,
<option>load</option> or <option>tproxy</option> option is
specified.</para>
</listitem>
</varlistentry>

View File

@ -383,11 +383,12 @@
determines whether the <option>balance</option> provider option (see
<ulink
url="shorewall6-providers.html">shorewall6-providers(5)</ulink>) is
the default. When BALANCE_PROVIDERS=Yes (the default), then the
the default. When BALANCE_PROVIDERS=Yes, then the
<option>balance</option> option is assumed unless the
<option>fallback</option>, <option>loose</option>,
<option>load</option> or <option>tproxy</option> option is
specified.</para>
specified. If this option is not set or is set to the empty value,
then the default value is the value of USE_DEFAULT_RT.</para>
</listitem>
</varlistentry>