mirror of
https://gitlab.com/shorewall/code.git
synced 2025-01-03 12:09:14 +01:00
Optimize detect_configuration() for enable/disable
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
bebb41674a
commit
75d18139f7
@ -1729,12 +1729,12 @@ sub compile_updown() {
|
|||||||
q( if [ "$COMMAND" = up ]; then) ,
|
q( if [ "$COMMAND" = up ]; then) ,
|
||||||
q( progress_message3 "Attempting enable on interface $1") ,
|
q( progress_message3 "Attempting enable on interface $1") ,
|
||||||
q( COMMAND=enable) ,
|
q( COMMAND=enable) ,
|
||||||
q( detect_configuration),
|
q( detect_configuration $1),
|
||||||
q( enable_provider $1),
|
q( enable_provider $1),
|
||||||
q( elif [ "$PHASE" != post-down ]; then # pre-down or not Debian) ,
|
q( elif [ "$PHASE" != post-down ]; then # pre-down or not Debian) ,
|
||||||
q( progress_message3 "Attempting disable on interface $1") ,
|
q( progress_message3 "Attempting disable on interface $1") ,
|
||||||
q( COMMAND=disable) ,
|
q( COMMAND=disable) ,
|
||||||
q( detect_configuration),
|
q( detect_configuration $1),
|
||||||
q( disable_provider $1) ,
|
q( disable_provider $1) ,
|
||||||
q( fi) ,
|
q( fi) ,
|
||||||
q(elif [ "$COMMAND" = up ]; then) ,
|
q(elif [ "$COMMAND" = up ]; then) ,
|
||||||
@ -1941,6 +1941,19 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
|
|
||||||
emit( "$physical)" ), push_indent if $wildcards;
|
emit( "$physical)" ), push_indent if $wildcards;
|
||||||
|
|
||||||
|
if ( $provider eq $physical ) {
|
||||||
|
#
|
||||||
|
# Just an optional interface, or provider and interface are the same
|
||||||
|
#
|
||||||
|
emit qq(if [ -z "\$1" -o "\$1" = "$physical" ]; then);
|
||||||
|
} else {
|
||||||
|
#
|
||||||
|
# Provider
|
||||||
|
#
|
||||||
|
emit qq(if [ -z "\$1" -o "\$1" = "$physical" -o "\$1" = "$provider" ]; then);
|
||||||
|
}
|
||||||
|
|
||||||
|
push_indent;
|
||||||
if ( $providerref->{gatewaycase} eq 'detect' ) {
|
if ( $providerref->{gatewaycase} eq 'detect' ) {
|
||||||
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
|
emit qq(if interface_is_usable $physical && [ -n "$providerref->{gateway}" ]; then);
|
||||||
} else {
|
} else {
|
||||||
@ -1952,6 +1965,10 @@ sub handle_optional_interfaces( $ ) {
|
|||||||
emit( " SW_${base}_IS_USABLE=Yes" ,
|
emit( " SW_${base}_IS_USABLE=Yes" ,
|
||||||
'fi' );
|
'fi' );
|
||||||
|
|
||||||
|
pop_indent;
|
||||||
|
|
||||||
|
emit( 'fi' );
|
||||||
|
|
||||||
emit( ';;' ), pop_indent if $wildcards;
|
emit( ';;' ), pop_indent if $wildcards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ case "$COMMAND" in
|
|||||||
[ $# -ne 1 ] && usage 2
|
[ $# -ne 1 ] && usage 2
|
||||||
mutex_on
|
mutex_on
|
||||||
if product_is_started; then
|
if product_is_started; then
|
||||||
detect_configuration
|
detect_configuration $1
|
||||||
enable_provider $1
|
enable_provider $1
|
||||||
fi
|
fi
|
||||||
mutex_off
|
mutex_off
|
||||||
@ -387,7 +387,7 @@ case "$COMMAND" in
|
|||||||
[ $# -ne 1 ] && usage 2
|
[ $# -ne 1 ] && usage 2
|
||||||
mutex_on
|
mutex_on
|
||||||
if product_is_started; then
|
if product_is_started; then
|
||||||
detect_configuration
|
detect_configuration $1
|
||||||
disable_provider $1
|
disable_provider $1
|
||||||
fi
|
fi
|
||||||
mutex_off
|
mutex_off
|
||||||
|
Loading…
Reference in New Issue
Block a user