[source] dnsmasq: make the check for existing DHCP servers more reliable

LEDE Commits lede-commits at lists.infradead.org
Fri Jul 29 07:41:27 PDT 2016


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/?p=source.git;a=commitdiff;h=6916ca8d33db0ab11434a8fb45f72abd70065c5e

commit 6916ca8d33db0ab11434a8fb45f72abd70065c5e
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Fri Jul 29 14:26:55 2016 +0200

    dnsmasq: make the check for existing DHCP servers more reliable
    
    If there is no carrier yet, wait for 2 seconds (STP forwarding delay)
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/network/services/dnsmasq/files/dnsmasq.init | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 3809e6c..0941f87 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -64,6 +64,12 @@ dhcp_check() {
 
 	[ -s "$stamp" ] && return $(cat "$stamp")
 
+	# If there's no carrier yet, skip this interface.
+	# The init script will be called again once the link is up
+	case "$(devstatus "$ifname" | jsonfilter -e @.carrier)" in
+		false) return 1;;
+	esac
+
 	udhcpc -n -q -s /bin/true -t 1 -i "$ifname" >&- && rv=1 || rv=0
 
 	[ $rv -eq 1 ] && \



More information about the lede-commits mailing list