Strengthen detect_gateway()

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9106 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2008-12-17 23:46:15 +00:00
parent c9e28cd64d
commit 828796a678

View File

@ -396,7 +396,7 @@ find_nexthop() # $1 = interface
# #
find_default_interface() { find_default_interface() {
ip -6 route list | while read first rest; do ip -6 route list | while read first rest; do
[ "$first" = '2000::/3' ] && echo $(find_device $rest) && return [ "$first" = 2000::/3 -o "$first" = default ] && echo $(find_device $rest) && return
done done
} }
@ -504,7 +504,7 @@ get_routed_networks() # $1 = interface name, $2-n = Fatal error message
ip -6 route show dev $1 2> /dev/null | ip -6 route show dev $1 2> /dev/null |
while read address rest; do while read address rest; do
case "$address" in case "$address" in
2000::/3) default|2000::/3)
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then
shift shift
fatal_error "$@" fatal_error "$@"
@ -750,11 +750,11 @@ detect_gateway() # $1 = interface
# #
# First assume that this is some sort of point-to-point interface # First assume that this is some sort of point-to-point interface
# #
gateway=$( find_peer $(ip addr list $interface ) ) gateway=$( find_peer $(ip -6 addr list $interface ) )
# #
# Maybe there's a default route through this gateway already # Maybe there's a default route through this gateway already
# #
[ -n "$gateway" ] || gateway=$(find_gateway $(ip -6 route list dev $interface)) [ -n "$gateway" ] || gateway=$(find_gateway $(ip -6 route list dev $interface | grep -E '^(default |2000::/3)'))
# #
# Last hope -- is there a load-balancing route through the interface? # Last hope -- is there a load-balancing route through the interface?
# #