summaryrefslogtreecommitdiff
path: root/aports/busybox/default.script
diff options
context:
space:
mode:
authorPÁLI Gábor János <pali.gabor@gmail.com>2022-10-11 18:20:54 +0200
committerPÁLI Gábor János <pali.gabor@gmail.com>2022-10-11 18:20:54 +0200
commitfd09e88160c1e1bf42e54fa0488bcf34e0be106d (patch)
treebecef946fa6dd0f78156811ac283f0fcd43275b0 /aports/busybox/default.script
parentb1a7cbcafcae8421d002b86bab9d65d3a7c7623c (diff)
downloadfreebsd-wifibox-alpine-fd09e88160c1e1bf42e54fa0488bcf34e0be106d.zip
busybox: Implement daisy chaining for `udhcpc` and `udhcpd`.
Diffstat (limited to 'aports/busybox/default.script')
-rw-r--r--aports/busybox/default.script33
1 files changed, 26 insertions, 7 deletions
diff --git a/aports/busybox/default.script b/aports/busybox/default.script
index e2cd521..a00a303 100644
--- a/aports/busybox/default.script
+++ b/aports/busybox/default.script
@@ -7,6 +7,7 @@ UDHCPC="/etc/udhcpc"
UDHCPC_CONF="$UDHCPC/udhcpc.conf"
RESOLV_CONF="/etc/resolv.conf"
+UDHCPD_CONF="no"
[ -f $UDHCPC_CONF ] && . $UDHCPC_CONF
export broadcast
@@ -102,14 +103,10 @@ routes() {
resolvconf() {
local i
- [ -n "$IF_PEER_DNS" ] && [ "$IF_PEER_DNS" != "yes" ] && return
if [ "$RESOLV_CONF" = "no" ] || [ "$RESOLV_CONF" = "NO" ] \
|| [ -z "$RESOLV_CONF" ] || [ -z "$dns" ]; then
return
fi
- for i in $NO_DNS; do
- [ "$i" = "$interface" ] && return
- done
echo -n > "$RESOLV_CONF.$$"
if [ -n "$search" ]; then
echo "search $search" >> "$RESOLV_CONF.$$"
@@ -123,11 +120,33 @@ resolvconf() {
mv "$RESOLV_CONF.$$" "$RESOLV_CONF"
}
+udhcpd_conf() {
+ if [ "$UDHCPD_CONF" = "no" ] || [ "$UDHCPD_CONF" = "NO" ] \
+ || [ -z "$UDHCPD_CONF" ]; then
+ return
+ fi
+ cat $UDHCPD_CONF_TEMPLATE \
+ | sed "s!%%DNS%%!$dns!" \
+ > $UDHCPD_CONF
+ chmod a+r "$UDHCPD_CONF"
+ service udhcpd --ifstarted restart
+}
+
+propagate_dns() {
+ local i
+ [ -n "$IF_PEER_DNS" ] && [ "$IF_PEER_DNS" != "yes" ] && return
+ for i in $NO_DNS; do
+ [ "$i" = "$interface" ] && return
+ done
+ resolvconf
+ udhcpd_conf
+}
+
bound() {
ip -4 addr add $ip/$mask ${broadcast:+broadcast $broadcast} dev $interface
ip -4 link set dev $interface up
routes
- resolvconf
+ propagate_dns
}
renew() {
@@ -145,12 +164,12 @@ renew() {
done
if ! grep "^search $domain"; then
- resolvconf
+ propagate_dns
return
fi
for i in $dns; do
if ! grep "^nameserver $i"; then
- resolvconf
+ propagate_dns
return
fi
done