diff --git a/Shorewall/clib.providers b/Shorewall/clib.providers index 71fb7c273..97a5ddd93 100644 --- a/Shorewall/clib.providers +++ b/Shorewall/clib.providers @@ -109,7 +109,7 @@ __EOF__ # Add Provider $table ($number) # __EOF__ - save_command "if [ \"\$(find_first_interface_address_if_any $interface)\" != 0.0.0.0 ]; then" + save_command "if interface_is_up $interface && [ \"\$(find_first_interface_address_if_any $interface)\" != 0.0.0.0 ]; then" save_indent1="$INDENT" INDENT="$INDENT " diff --git a/Shorewall/compiler b/Shorewall/compiler index afd690289..695d45a92 100755 --- a/Shorewall/compiler +++ b/Shorewall/compiler @@ -78,7 +78,6 @@ strip_file_and_clib_load() # $1 = logical file, $2 = library to load if logical strip_file $1 $f if [ -s $TMP_DIR/$1 ]; then - shift clib_load $2 $3 "Entries in the $f file require the Shorewall compiler module ${SHAREDIR}/clib.$2 which is not installed" fi } @@ -90,7 +89,6 @@ strip_file_and_lib_load() # $1 = logical file, $2 = library to load if logical f strip_file $1 $f if [ -s $TMP_DIR/$1 ]; then - shift lib_load $2 $3 "Entries in the $f file require the Shorewall library ${SHAREDIR}/lib.$2 which is not installed" fi } @@ -6162,6 +6160,10 @@ combine_list() echo \$o } +interface_is_up() { + test -n "\$(ip link ls dev \$1 | grep -e '[<,]UP[,>]')" +} + # # Initialize environment # diff --git a/Shorewall/lib.base b/Shorewall/lib.base index f72b956f0..2dcae3d95 100644 --- a/Shorewall/lib.base +++ b/Shorewall/lib.base @@ -1085,6 +1085,13 @@ find_interface_by_mac() { done } +# +# Determine if an interface is in the UP state +# +interface_is_up() { + test -n "$(ip link ls dev $1 | grep -e '[<,]UP[,>]')" +} + # # Find interface address--returns the first IP address assigned to the passed # device diff --git a/Shorewall/shorewall b/Shorewall/shorewall index 3d67506f4..da582c4f9 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -1567,8 +1567,7 @@ make_verbose() { # debugging= -if [ $# -gt 0 ] ; then - if [ "$1" = "debug" ] || [ "$1" = "trace" ]; then +if [ $# -gt 0 ] && [ "x$1" = "xdebug" ] || [ "x$1" = "xtrace" ]; then debugging=debug shift fi