dnsmasq: make the check for existing DHCP servers more reliable
authorFelix Fietkau <nbd@nbd.name>
Fri, 29 Jul 2016 12:26:55 +0000 (14:26 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 29 Jul 2016 14:41:09 +0000 (16:41 +0200)
If there is no carrier yet, wait for 2 seconds (STP forwarding delay)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/dnsmasq/files/dnsmasq.init

index 3809e6c119ffc714517996ac916323162bb74194..0941f87fa8d028e8fc5aa6153bd402d80b31fde4 100644 (file)
@@ -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 ] && \