Handle Down or missing interfaces in 'delete_gateway()'

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-09-27 11:43:26 -07:00
parent 792b3b696c
commit 35bd1db7fb
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10

View File

@ -996,9 +996,16 @@ delete_gateway() # $! = Description of the Gateway $2 = table number $3 = device
if [ -n "$route" ]; then
if echo $route | grep -qF ' nexthop '; then
if interface_is_up $3; then
gateway="nexthop $gateway"
else
gateway="nexthop $gateway dead"
fi
if eval echo $route \| fgrep -q \'$gateway\'; then
eval route=\`echo $route \| sed \'s/$gateway/ /\'\`
run_ip route replace table $2 $route
fi
else
dev=$(find_device $route)
[ "$dev" = "$3" ] && run_ip route delete default table $2