Make 'gateway' optional in providers file

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4174 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-06-27 23:14:45 +00:00
parent 122fc77f4e
commit e6d9444402
2 changed files with 13 additions and 7 deletions

View File

@ -1145,18 +1145,18 @@ __EOF__
balance=yes
if [ -n "$first" ]; then
if [ "x$gateway" = xdetect ] ; then
save_command "DEFAULT_ROUTE=\"nexthop via \$gateway dev $interface weight $1\""
else
if [ -n "$gateway" ] ; then
save_command "DEFAULT_ROUTE=\"nexthop via $gateway dev $interface weight $1\""
else
save_command "DEFAULT_ROUTE=\"nexthop dev $interface weight $1\""
fi
first=
else
if [ "x$gateway" = xdetect ] ; then
save_command "DEFAULT_ROUTE=\"\$DEFAULT_ROUTE nexthop via \$gateway dev $interface weight $1\""
else
if [ -n "$gateway" ] ; then
save_command "DEFAULT_ROUTE=\"\$DEFAULT_ROUTE nexthop via $gateway dev $interface weight $1\""
else
save_command "DEFAULT_ROUTE=\"\$DEFAULT_ROUTE nexthop dev $interface weight $1\""
fi
fi
}
@ -1203,6 +1203,7 @@ __EOF__
fi
if [ "x$gateway" = xdetect ] ; then
gateway='$gateway'
indent >&3 << __EOF__
gateway=\$(detect_gateway $interface)
@ -1214,11 +1215,14 @@ else
fi
__EOF__
else
elif [ "x$gateway" != "x-" -a -n "$gateway" ]; then
indent >&3 << __EOF__
run_ip route replace $gateway src \$(find_first_interface_address $interface) dev $interface table $number
run_ip route add default via $gateway dev $interface table $number
__EOF__
else
gateway=
save_command "run_ip route add default dev $interface table $number"
fi
if [ x${mark} != x- ]; then

View File

@ -42,6 +42,8 @@
# You can enter "detect" here and Shorewall will
# attempt to detect the gateway automatically.
#
# For PPP devices, you can leave this column empty.
#
# OPTIONS A comma-separated list selected from the following:
#
# track If specified, inbound connections on this interface