summaryrefslogtreecommitdiffstats
path: root/src.usr/share
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2020-12-12 10:36:55 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2020-12-12 10:36:55 (EST)
commit9007efd01278bed6290f74af74b5abb86b3dfd0f (patch)
treec4f6130f8e606cf1d0467b49cf1d098014228bfa /src.usr/share
parent522e0d787a9e6290341c022e9a879b74ec9ecd58 (diff)
/usr/share/udhcpc/default.script: Support both
Diffstat (limited to 'src.usr/share')
-rwxr-xr-xsrc.usr/share/udhcpc/default.script20
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'