From 828796a6782e72daf9abb09a03dbd839beaa1631 Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 17 Dec 2008 23:46:15 +0000 Subject: [PATCH] Strengthen detect_gateway() git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@9106 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall-perl/prog.header6 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Shorewall-perl/prog.header6 b/Shorewall-perl/prog.header6 index ba1020e05..7860dbf31 100644 --- a/Shorewall-perl/prog.header6 +++ b/Shorewall-perl/prog.header6 @@ -396,7 +396,7 @@ find_nexthop() # $1 = interface # find_default_interface() { 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 } @@ -504,7 +504,7 @@ get_routed_networks() # $1 = interface name, $2-n = Fatal error message ip -6 route show dev $1 2> /dev/null | while read address rest; do case "$address" in - 2000::/3) + default|2000::/3) if [ $# -gt 1 ]; then shift fatal_error "$@" @@ -750,11 +750,11 @@ detect_gateway() # $1 = 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 # - [ -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? #