On Mon, 2008-06-16 at 23:24 -0400, Brian J. Murrell wrote: > Here's a patch to enable not using the DHCP server assigned DNS servers > via a UCI option.
As it was pointed out that the ppp.sh uci config item for using peer dns
servers is now "peerdns", here is a reworking of my patch to use the
same configuration syntax for DHCP interfaces as well.
Signed-off-by: Brian J. Murrell <[EMAIL PROTECTED]>
Index: package/base-files/files/usr/share/udhcpc/default.script
===================================================================
--- package/base-files/files/usr/share/udhcpc/default.script (revision 11523)
+++ package/base-files/files/usr/share/udhcpc/default.script (working copy)
@@ -14,6 +14,18 @@
config_get proto $ifc proto
[ "$proto" = "dhcp" ] || continue
[ ifup = "$1" ] && {
+ config_get_bool peerdns "$ifc" peerdns 1
+ [ "$peerdns" -eq 1 ] && {
+ [ -n "$dns" ] && {
+ echo -n > "${RESOLV_CONF}.tmp"
+ ${domain:+echo search $domain} >>
"${RESOLV_CONF}.tmp"
+ for i in $dns ; do
+ echo "adding dns $i"
+ echo "nameserver $i" >>
"${RESOLV_CONF}.tmp"
+ done
+ mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
+ }
+ }
uci_set_state network "$ifc" ipaddr "$ip"
uci_set_state network "$ifc" netmask
"${subnet:-255.255.255.0}"
uci_set_state network "$ifc" dnsdomain "$domain"
@@ -46,16 +58,6 @@
$(route -n | awk '/^0.0.0.0\W{9}('$valid')\W/ {next}
/^0.0.0.0/ {print "route del -net "$1" gw "$2";"}')
}
- [ -n "$dns" ] && {
- echo -n > "${RESOLV_CONF}.tmp"
- ${domain:+echo search $domain} >> "${RESOLV_CONF}.tmp"
- for i in $dns ; do
- echo "adding dns $i"
- echo "nameserver $i" >> "${RESOLV_CONF}.tmp"
- done
- mv "${RESOLV_CONF}.tmp" "$RESOLV_CONF"
- }
-
hotplug_event ifup
# user rules
signature.asc
Description: This is a digitally signed message part
_______________________________________________ openwrt-devel mailing list [email protected] http://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
