mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 14:48:51 +01:00
Don't emit 'enable' code for required providers
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
fe9df4dfd1
commit
be1765f44d
@ -615,46 +615,44 @@ sub add_a_provider( $$ ) {
|
|||||||
emit $_ for @{$providers{$table}->{routes}};
|
emit $_ for @{$providers{$table}->{routes}};
|
||||||
}
|
}
|
||||||
|
|
||||||
emit( '',
|
emit( '' );
|
||||||
'if [ $COMMAND = enable ]; then'
|
|
||||||
);
|
|
||||||
|
|
||||||
push_indent;
|
my ( $tbl, $weight );
|
||||||
|
|
||||||
my ( $tbl, $weight );
|
|
||||||
|
|
||||||
if ( $balance || $default ) {
|
|
||||||
$tbl = $default || $config{USE_DEFAULT_RT} ? DEFAULT_TABLE : MAIN_TABLE;
|
|
||||||
$weight = $balance ? $balance : $default;
|
|
||||||
|
|
||||||
if ( $gateway ) {
|
|
||||||
emit qq(add_gateway "nexthop via $gateway dev $physical weight $weight $realm" ) . $tbl;
|
|
||||||
} else {
|
|
||||||
emit qq(add_gateway "nexthop dev $physical weight $weight $realm" ) . $tbl;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$weight = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
|
|
||||||
|
|
||||||
emit ( qq(progress_message2 " Provider $table ($number) Started") );
|
|
||||||
|
|
||||||
pop_indent;
|
|
||||||
|
|
||||||
emit( 'else' );
|
|
||||||
|
|
||||||
if ( $optional ) {
|
if ( $optional ) {
|
||||||
emit " echo $weight > \${VARDIR}/${physical}_weight";
|
emit( 'if [ $COMMAND = enable ]; then' );
|
||||||
|
|
||||||
|
push_indent;
|
||||||
|
|
||||||
|
if ( $balance || $default ) {
|
||||||
|
$tbl = $default || $config{USE_DEFAULT_RT} ? DEFAULT_TABLE : MAIN_TABLE;
|
||||||
|
$weight = $balance ? $balance : $default;
|
||||||
|
|
||||||
|
if ( $gateway ) {
|
||||||
|
emit qq(add_gateway "nexthop via $gateway dev $physical weight $weight $realm" ) . $tbl;
|
||||||
|
} else {
|
||||||
|
emit qq(add_gateway "nexthop dev $physical weight $weight $realm" ) . $tbl;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$weight = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit( "setup_${dev}_tc" ) if $tcdevices->{$interface};
|
||||||
|
|
||||||
|
emit ( qq(progress_message2 " Provider $table ($number) Started") );
|
||||||
|
|
||||||
|
pop_indent;
|
||||||
|
|
||||||
|
emit( 'else' ,
|
||||||
|
qq( echo $weight > \${VARDIR}/${physical}_weight) ,
|
||||||
|
qq( progress_message " Provider $table ($number) Started"),
|
||||||
|
qq(fi\n)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
emit " rm -f \${VARDIR}/${physical}_weight";
|
emit( qq(progress_message "Provider $table ($number) Started") );
|
||||||
}
|
}
|
||||||
|
|
||||||
emit( " progress_message " Provider $table ($number) Started"",
|
|
||||||
"fi\n"
|
|
||||||
);
|
|
||||||
|
|
||||||
pop_indent;
|
pop_indent;
|
||||||
|
|
||||||
emit 'else';
|
emit 'else';
|
||||||
|
Loading…
Reference in New Issue
Block a user