[OpenWrt-Devel] dnsmasq: Ignore carrier status for bridge interfaces
diff mbox series

Message ID c53d5e45cc17448085c606d7d3245b34@4rf-nz-exchange.local.4rf.com
State New
Headers show
Series
  • [OpenWrt-Devel] dnsmasq: Ignore carrier status for bridge interfaces
Related show

Commit Message

Reuben Dowle Jan. 20, 2020, 8:41 p.m. UTC
dnsmasq sometimes does not listen for DHCP at bootup on lan (see bug FS#1765).

This occurs because netifd can incorrectly indicate carrier down on an
interface through devstatus after issuing a carrier up hotplug event.

This patch ignores carrier status for bridge interfaces, as this does not
reflect media state so is not a useful check.

Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
---
 package/network/services/dnsmasq/files/dnsmasq.init | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--
2.7.4


The information in this email communication (inclusive of attachments) is confidential to 4RF Limited and the intended recipient(s). If you are not the intended recipient(s), please note that any use, disclosure, distribution or copying of this information or any part thereof is strictly prohibited and that the author accepts no liability for the consequences of any action taken on the basis of the information provided. If you have received this email in error, please notify the sender immediately by return email and then delete all instances of this email from your system. 4RF Limited will not accept responsibility for any consequences associated with the use of this email (including, but not limited to, damages sustained as a result of any viruses and/or any action or lack of action taken in reliance on it).

Patch
diff mbox series

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index ae02f32..dd9874b
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -104,9 +104,12 @@  dhcp_check() {

 # 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
+local carrier
+local type
+eval $(devstatus "$ifname" | jsonfilter -e "carrier=@.carrier" -e "type=@.type")
+if [ "$carrier" = "false" -a "$type" != "bridge" ]; then
+return 1
+fi

 udhcpc -n -q -s /bin/true -t 1 -i "$ifname" >&- && rv=1 || rv=0