blob: 2801fd0de537bbf60bb66aa7cb6de8b51857d9f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# Update domain name server IPv4 addresses and
# restart udhcpd on reconfiguration of the interface.
RESOLV_CONF="/etc/resolv.conf"
UDHCPD_CONF="/tmp/udhcpd.conf"
UDHCPD_CONF_TEMPLATE="/etc/udhcpd.conf"
if $if_configured; then
[ ! -f "$RESOLV_CONF" ] && return
# Filter resolv.conf to get the IPv4 name servers
# only.
dns=$(grep -F nameserver $RESOLV_CONF | cut -c 12- | grep -E "^[0-9\.]*$")
cat $UDHCPD_CONF_TEMPLATE \
| sed "s!%%DNS%%!$dns!" \
> $UDHCPD_CONF
chmod a+r "$UDHCPD_CONF"
service udhcpd --ifstarted restart
fi
|