Allow family on routes, #152

This commit is contained in:
Roy Marples 2009-04-19 20:05:40 +00:00
parent 73f6d1c39e
commit 4febf00c06
2 changed files with 16 additions and 8 deletions

View File

@ -182,7 +182,12 @@ _add_address()
_add_route()
{
local inet6=
local inet6= family=
if [ "$1" = "-A" -o "$1" = "-f" -o "$1" = "-family" ]; then
family="-A $2"
shift; shift
fi
if [ -n "${metric}" ]; then
set -- "$@" metric ${metric}
@ -197,13 +202,10 @@ _add_route()
fi
case "$@" in
*:*)
inet6="-A inet6"
[ "$1" = "-net" ] && shift
;;
*:*) [ "$1" = "-net" ] && shift;;
esac
route ${inet6} add "$@" dev "${IFACE}"
route ${family} add "$@" dev "${IFACE}"
}
_delete_addresses()

View File

@ -131,6 +131,13 @@ _add_address()
_add_route()
{
local family=
if [ "$1" = "-A" -o "$1" = "-f" -o "$1" = "-family" ]; then
family="-f $2"
shift; shift
fi
if [ $# -eq 3 ]; then
set -- "$1" "$2" via "$3"
elif [ "$3" = "gw" ]; then
@ -145,7 +152,6 @@ _add_route()
metric) cmd="${cmd} $1"; have_metric=true;;
netmask) cmd="${cmd}/$(_netmask2cidr "$2")"; shift;;
-host|-net);;
-A) [ "$2" = "inet6" ] && shift;;
*) cmd="${cmd} $1";;
esac
shift
@ -155,7 +161,7 @@ _add_route()
cmd="${cmd} metric ${metric}"
fi
ip route append ${cmd} dev "${IFACE}"
ip ${family} route append ${cmd} dev "${IFACE}"
eend $?
}