aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2016-07-29 14:26:55 +0200
committerFelix Fietkau <nbd@nbd.name>2016-07-29 16:41:09 +0200
commit6916ca8d33db0ab11434a8fb45f72abd70065c5e (patch)
tree5951a5306d20724bf8180484f868de501e5e843f
parent712b6fdc5c1d56287e1f4eae5724590b241b5674 (diff)
downloadupstream-6916ca8d33db0ab11434a8fb45f72abd70065c5e.tar.gz
upstream-6916ca8d33db0ab11434a8fb45f72abd70065c5e.tar.bz2
upstream-6916ca8d33db0ab11434a8fb45f72abd70065c5e.zip
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@nbd.name>
-rw-r--r--package/network/services/dnsmasq/files/dnsmasq.init6
1 files changed, 6 insertions, 0 deletions
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 3809e6c119..0941f87fa8 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 ] && \