If the configuration for a DHCP interface specifies to not use the
peer's DNS resolvers, this should be honoured by the udhcpc script.
This patch fixes this.

Signed-off-by: Brian J. Murrell <brian <at> interlinx.bc.ca>

Cheers,
b.

From 23ff12b2ef562c544c2d320cdb7cb93ce71c6c97 Mon Sep 17 00:00:00 2001
From: Brian J. Murrell <br...@interlinx.bc.ca>
Date: Mon, 3 Jan 2011 15:50:37 -0500
Subject: [PATCH] udhcpc should honour the peerdns setting

---
 .../files/usr/share/udhcpc/default.script          |   30 ++++++++++---------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/package/base-files/files/usr/share/udhcpc/default.script 
b/package/base-files/files/usr/share/udhcpc/default.script
index b614c45..e7e635f 100755
--- a/package/base-files/files/usr/share/udhcpc/default.script
+++ b/package/base-files/files/usr/share/udhcpc/default.script
@@ -82,20 +82,22 @@ setup_interface () {
        [ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes
 
        # DNS
-       old_dns=$(uci_get_state network "$ifc" dns)
-       old_domain=$(uci_get_state network "$ifc" dnsdomain)
-       user_dns=$(uci_get "network.$ifc.dns")
-       [ -n "$user_dns" ] && dns="$user_dns"
-
-       [ -n "$dns" ] && [ "$dns" != "$old_dns" -o -n "$user_dns" ] && {
-               echo "udhcpc: setting dns servers: $dns"
-               add_dns "$ifc" $dns
-
-               [ -n "$domain" ] && [ "$domain" != "$old_domain" ] && {
-                       echo "udhcpc: setting dns domain: $domain"
-                       sed -i -e "${old_domain:+/^search $old_domain$/d; 
}/^search $domain$/d" "${RESOLV_CONF}"
-                       echo "search $domain" >> "${RESOLV_CONF}"
-                       change_state network "$ifc" dnsdomain "$domain"
+       [ "$peerdns" -eq 1 ] && {
+               old_dns=$(uci_get_state network "$ifc" dns)
+               old_domain=$(uci_get_state network "$ifc" dnsdomain)
+               user_dns=$(uci_get "network.$ifc.dns")
+               [ -n "$user_dns" ] && dns="$user_dns"
+
+               [ -n "$dns" ] && [ "$dns" != "$old_dns" -o -n "$user_dns" ] && {
+                       echo "udhcpc: setting dns servers: $dns"
+                       add_dns "$ifc" $dns
+
+                       [ -n "$domain" ] && [ "$domain" != "$old_domain" ] && {
+                               echo "udhcpc: setting dns domain: $domain"
+                               sed -i -e "${old_domain:+/^search 
$old_domain$/d; }/^search $domain$/d" "${RESOLV_CONF}"
+                               echo "search $domain" >> "${RESOLV_CONF}"
+                               change_state network "$ifc" dnsdomain "$domain"
+                       }
                }
        }
 
-- 
1.7.1


Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to