X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/c4f3575368c5aeef4134d82125df2814d688cc2a..356535ffd7bc1343ce6bc2fc367f788cc2c1bd24:/package/base-files/default/usr/share/udhcpc/default.script?ds=sidebyside diff --git a/package/base-files/default/usr/share/udhcpc/default.script b/package/base-files/default/usr/share/udhcpc/default.script index a244e05a1..53c8faf31 100755 --- a/package/base-files/default/usr/share/udhcpc/default.script +++ b/package/base-files/default/usr/share/udhcpc/default.script @@ -1,7 +1,7 @@ #!/bin/sh [ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1 . /etc/functions.sh -include network +include /lib/network RESOLV_CONF="/tmp/resolv.conf" @@ -14,7 +14,7 @@ hotplug_event() { config_get proto $ifc proto [ "$proto" = "dhcp" ] || continue - env -i ACTION="$1" INTERFACE="$ifname" PROTO=dhcp /sbin/hotplug iface + env -i ACTION="$1" INTERFACE="$ifc" DEVICE="$ifname" PROTO=dhcp /sbin/hotplug iface done } @@ -37,13 +37,15 @@ case "$1" in route add default gw $i dev $interface done fi - - echo -n > $RESOLV_CONF - ${domain:+echo search $domain} >> $RESOLV_CONF - for i in $dns ; do - echo "adding dns $i" - echo "nameserver $i" >> $RESOLV_CONF - done + + [ -n "$dns" ] && { + echo -n > $RESOLV_CONF + ${domain:+echo search $domain} >> $RESOLV_CONF + for i in $dns ; do + echo "adding dns $i" + echo "nameserver $i" >> $RESOLV_CONF + done + } hotplug_event ifup