Don't configure persistence if the interface has no address

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2015-10-26 07:42:47 -07:00
parent 69dd7ce0b9
commit 56bf8b1572

View File

@ -794,6 +794,8 @@ sub add_a_provider( $$ ) {
if ( $gateway ) {
$address = get_interface_address $interface unless $address;
emit( qq([ -z "$address" ] && return\n) );
if ( $hostroute ) {
if ( $family == F_IPV4 ) {
emit qq(run_ip route replace $gateway src $address dev $physical ${mtu});
@ -1068,7 +1070,9 @@ CEOF
emit( qq(echo 1 > \${VARDIR}/${physical}.status) );
if ( $optional ) {
emit( "persistent_${what}_${table}\n" ) if $persistent;
if ( $persistent ) {
emit( "persistent_${what}_${table}\n" );
}
if ( $shared ) {
emit ( "error_message \"WARNING: Gateway $gateway is not reachable -- Provider $table ($number) not Started\"" );
@ -1142,7 +1146,7 @@ CEOF
'if [ $COMMAND = disable ]; then',
" do_persistent_${what}_${table}",
"else",
" rm -f \${VARDIR}/${physical}_enabled\n"
" rm -f \${VARDIR}/${physical}_enabled\n",
"fi\n",
);
}