diff options
author | Roy Marples <roy@marples.name> | 2009-04-19 20:05:40 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2009-04-19 20:05:40 +0000 |
commit | 4febf00c06a027a96b00ae12e1bc077792738985 (patch) | |
tree | ad72a191a1cbae725361382c3588ec7cd76bd709 | |
parent | 73f6d1c39e88b16de87b76836ecf8ba72d75131e (diff) |
Allow family on routes, #152
-rw-r--r-- | net/ifconfig.sh.Linux.in | 14 | ||||
-rw-r--r-- | net/iproute2.sh | 10 |
2 files changed, 16 insertions, 8 deletions
diff --git a/net/ifconfig.sh.Linux.in b/net/ifconfig.sh.Linux.in index 8c887fbc..1708724f 100644 --- a/net/ifconfig.sh.Linux.in +++ b/net/ifconfig.sh.Linux.in @@ -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() diff --git a/net/iproute2.sh b/net/iproute2.sh index 9901aae5..953bae25 100644 --- a/net/iproute2.sh +++ b/net/iproute2.sh @@ -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 $? } |