When udhcpc (and maybe other tools) configures the wan interface, it updates 
update /tmp/resolv.conf.auto and dnsmasq has to read the new nameservers from 
there.  Unfortunately dnsmasq uses polling so it can take up to a second 
until it refreshes; if any iface hotplug scripts (like ntpclient) need a 
working resolver on localhost, they will fail if hotplug is quicker than the 
dnsmasq poll interval.

This patch simply introduces a one second delay before any 20+ hotplug scripts 
are started.

Signed-off-by: Malte S. Stretz <[email protected]>

---

This patch (with less description) is also attached to ticket #5301, as 
recommended by Hamish Guthrie last week I hereby send it to the list as well.

 package/dnsmasq/Makefile              |    2 ++
 package/dnsmasq/files/dnsmasq.hotplug |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)
 create mode 100644 package/dnsmasq/files/dnsmasq.hotplug

diff --git a/package/dnsmasq/Makefile b/package/dnsmasq/Makefile
index 1b030d1..77dd1df 100644
--- a/package/dnsmasq/Makefile
+++ b/package/dnsmasq/Makefile
@@ -48,6 +48,8 @@ define Package/dnsmasq/install
        $(INSTALL_DATA) ./files/dhcp.conf $(1)/etc/config/dhcp
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/dnsmasq.init $(1)/etc/init.d/dnsmasq
+       $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
+       $(INSTALL_DATA) ./files/dnsmasq.hotplug 
$(1)/etc/hotplug.d/iface/15-dnsmasq
 endef
 
 $(eval $(call BuildPackage,dnsmasq))
diff --git a/package/dnsmasq/files/dnsmasq.hotplug 
b/package/dnsmasq/files/dnsmasq.hotplug
new file mode 100644
index 0000000..96ed7a5
--- /dev/null
+++ b/package/dnsmasq/files/dnsmasq.hotplug
@@ -0,0 +1,3 @@
+#!/bin/sh
+# Make sure dnsmasq had enough time to poll resolv.conf.
+sleep 1
-- 
1.5.4.3


-- 
   
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to