diff options
Diffstat (limited to 'src.usr/share/udhcpc')
-rwxr-xr-x | src.usr/share/udhcpc/default.script | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src.usr/share/udhcpc/default.script b/src.usr/share/udhcpc/default.script index bb27ec0..e88ccef 100755 --- a/src.usr/share/udhcpc/default.script +++ b/src.usr/share/udhcpc/default.script @@ -1,5 +1,18 @@ #!/bin/sh +route() +{ + local cmd="${1}" + local tgt="${2}" + shift 2 + + if [ -x /sbin/ip ]; then + /sbin/ip route "${cmd}" "${tgt}" via "${@}" + elif [ -x /sbin/route ]; then + /sbin/route "${cmd}" "${tgt}" gw "${@}" + fi +} + case "${1}" in 'deconfig') /sbin/ifconfig "${interface}" 0.0.0.0 @@ -9,13 +22,12 @@ case "${1}" in ${broadcast+broadcast ${broadcast}} \ ${netmask+netmask ${netmask}} if [ "x${router+set}" = 'xset' ]; then - while /sbin/ip route del default via 0.0.0.0 \ - dev "${interface}" 2>/dev/null; do + while route del default 0.0.0.0 dev "${interface}" \ + 2>/dev/null; do : done for router in ${router}; do - /sbin/ip route add default via "${router}" \ - dev "${interface}" + route add default "${router}" dev "${interface}" done fi exec 3>'/etc/resolv.conf' |