Support inet6 routes.
This commit is contained in:
parent
02c12c1cac
commit
a165fbe384
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
# You can assign a default route
|
# You can assign a default route
|
||||||
#defaultroute="192.168.0.1"
|
#defaultroute="192.168.0.1"
|
||||||
|
#defaultroute6="2001:a:b:c"
|
||||||
|
|
||||||
# Lastly, the interfaces variable pulls in virtual interfaces that cannot
|
# Lastly, the interfaces variable pulls in virtual interfaces that cannot
|
||||||
# be automatically detected.
|
# be automatically detected.
|
||||||
#interfaces="br0 bond0 vlan0"
|
#interfaces="br0 bond0 vlan0"
|
||||||
|
@ -137,6 +137,7 @@ routeflush()
|
|||||||
if [ "$RC_UNAME" = Linux ]; then
|
if [ "$RC_UNAME" = Linux ]; then
|
||||||
if [ -x /sbin/ip ]; then
|
if [ -x /sbin/ip ]; then
|
||||||
ip route flush scope global
|
ip route flush scope global
|
||||||
|
ip route delete default 2>/dev/null
|
||||||
else
|
else
|
||||||
# Sadly we also delete some link routes, but
|
# Sadly we also delete some link routes, but
|
||||||
# this cannot be helped
|
# this cannot be helped
|
||||||
@ -156,6 +157,8 @@ routeflush()
|
|||||||
esac
|
esac
|
||||||
route del $flags $dest $netmask $xtra
|
route del $flags $dest $netmask $xtra
|
||||||
done
|
done
|
||||||
|
# Erase any default dev eth0 routes
|
||||||
|
route del default 2>/dev/null
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
route -qn flush
|
route -qn flush
|
||||||
@ -263,6 +266,24 @@ start()
|
|||||||
eend $?
|
eend $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$defaultroute6" ]; then
|
||||||
|
ebegin "Setting default route $defaultroute6"
|
||||||
|
if [ "$RC_UNAME" = Linux ]; then
|
||||||
|
routecmd="route -A inet6 add"
|
||||||
|
if [ "${defaultroute6#dev }" = "$defaultroute6" ]; then
|
||||||
|
routecmd="$routecmd gw"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
routecmd="route -inet6 add"
|
||||||
|
fi
|
||||||
|
$routecmd default $defaultroute6
|
||||||
|
eend $?
|
||||||
|
elif [ -n "$defaultiproute6" ]; then
|
||||||
|
ebegin "Setting default route $defaultiproute6"
|
||||||
|
ip route add default via $defaultiproute6
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ dump_args()
|
|||||||
|
|
||||||
do_routes()
|
do_routes()
|
||||||
{
|
{
|
||||||
local xtra=
|
local xtra= family=
|
||||||
[ "$RC_UNAME" != Linux ] && xtra=-q
|
[ "$RC_UNAME" != Linux ] && xtra=-q
|
||||||
|
|
||||||
ebegin "$1 static routes"
|
ebegin "$1 static routes"
|
||||||
@ -74,7 +74,14 @@ do_routes()
|
|||||||
ip route $2 $args
|
ip route $2 $args
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
route $xtra $2 -$args
|
# Linux route does cannot work it out ...
|
||||||
|
if [ "$RC_UNAME" = Linux ]; then
|
||||||
|
case "$args" in
|
||||||
|
*:*) family="-A inet6";;
|
||||||
|
*) family=;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
route $famly $xtra $2 -$args
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
veend $?
|
veend $?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user