From: Etienne Champetier Date: Sun, 3 Aug 2025 01:50:07 +0000 (-0400) Subject: mwan3: handle missing interface gracefully X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=8ae00f92b3e5b5f9270f071f25687bedea18cfaa;p=openwrt-packages.git mwan3: handle missing interface gracefully `ubus.call(sprintf('network.interface.%s', ifname), 'status', {})` returns null if the interface `ifname` doesn't exists (yet). For pppoe interfaces using `option ipv6 auto`, a virtual interface suffixed `_6` is automatically created once the connection is established, but until then it doesn't exists. Fixes: 6423781254b9f3e52c6102fb2cbcd9f99f2445a3 ("mwan3: reimplement rpcd plugin using ucode") Signed-off-by: Etienne Champetier --- diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile index 545106330..139a33e64 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 PKG_VERSION:=2.12.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=Florian Eckert , \ Aaron Goodman PKG_LICENSE:=GPL-2.0 diff --git a/net/mwan3/files/usr/share/rpcd/ucode/mwan3 b/net/mwan3/files/usr/share/rpcd/ucode/mwan3 index b5c2f4a4c..2e145c72e 100644 --- a/net/mwan3/files/usr/share/rpcd/ucode/mwan3 +++ b/net/mwan3/files/usr/share/rpcd/ucode/mwan3 @@ -141,7 +141,7 @@ function interfaces_status(request) { 'age': get_x_time(uptime, ifname, 'TIME'), 'online': get_x_time(uptime, ifname, 'ONLINE'), 'offline': get_x_time(uptime, ifname, 'OFFLINE'), - 'uptime': netstatus.uptime || 0, + 'uptime': netstatus?.uptime || 0, 'score': get_int(ifname, 'SCORE'), 'lost': get_int(ifname, 'LOST'), 'turn': get_int(ifname, 'TURN'), @@ -149,7 +149,7 @@ function interfaces_status(request) { 'enabled': ucibool(intf['enabled']), 'running': track_status == 'active', 'tracking': track_status, - 'up': netstatus.up, + 'up': netstatus?.up || false, 'track_ip': track_ips, }; });