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

View File

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