diff options
-rw-r--r-- | changelog | 3 | ||||
-rwxr-xr-x | src.usr/share/udhcpc/default.script | 20 |
2 files changed, 18 insertions, 5 deletions
@@ -1,6 +1,7 @@ busybox (1.32.0-3) trunk - * A default gateway is no longer missing. + * </usr/share/udhcpc/default.script> now supports the "ip route" + command in case "route" is disabled. -- Patrick McDermott <patrick.mcdermott@libiquity.com> Sat, 12 Dec 2020 10:09:01 -0500 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' |