Fix /etc/hotplug.d/iface/00-netstate to handle dummy interfaces (skip non-real interfaces)

Obviously I ask for opinions on this issue...

The current script does not take into account any dummy interfaces such as "wan_4" and generates non-blocking errors ...

[ ifup = "$ACTION" ] && {
       uci_toggle_state network "$INTERFACE" up 1
       [ -n "$DEVICE" ] && {
               uci_toggle_state network "$INTERFACE" ifname "$DEVICE"
       }
}

if possible maybe it would be better to change it like this:

[ "$ACTION" = "ifup" ] && {
    if uci show network."$INTERFACE" >/dev/null 2>&1; then
        uci_toggle_state network "$INTERFACE" up 1
        [ -n "$DEVICE" ] && {
            uci_toggle_state network "$INTERFACE" ifname "$DEVICE"
        }
    fi
}

β€œThis change has been tested only on my setup (OpenWrt 24.10.5) and should be reviewed for compatibility with other platforms.”

log before making the change:

Sun Feb  8 16:09:15 2026 daemon.err netifd[15351]: task_complete(109): Complete hotplug handler for interface 'wan'
Sun Feb  8 16:09:15 2026 daemon.err netifd[15351]: call_hotplug(100): Call hotplug handler for interface 'wan_4', event 'ifup' (wwan0)
Sun Feb  8 16:09:15 2026 daemon.err netifd[15351]: /sbin/uci: Invalid argument
Sun Feb  8 16:09:15 2026 daemon.err netifd[15351]: /sbin/uci: Invalid argument
Sun Feb  8 16:09:17 2026 daemon.err netifd[15351]: task_complete(109): Complete hotplug handler for interface 'wan_4'

log after change:

Sun Feb  8 16:20:31 2026 daemon.err netifd[15351]: task_complete(109): Complete hotplug handler for interface 'wan'
Sun Feb  8 16:20:31 2026 daemon.err netifd[15351]: call_hotplug(100): Call hotplug handler for interface 'wan_4', event 'ifup' (wwan0)
Sun Feb  8 16:20:33 2026 daemon.err netifd[15351]: task_complete(109): Complete hotplug handler for interface 'wan_4'

Cool, you can add -q to uci to silence its output.

Good catch, thanks! :grinning_face:
Using uci -q is indeed cleaner than redirecting output

[ "$ACTION" = "ifup" ] && {
    if uci -q show network."$INTERFACE" >/dev/null; then
        uci_toggle_state network "$INTERFACE" up 1
        [ -n "$DEVICE" ] && {
            uci_toggle_state network "$INTERFACE" ifname "$DEVICE"
        }
    fi
}

This seems suitable for an upstream modification (if possible). :grinning_face:

Dont be shy - make a PR out of it.

I hope this goes well:

https://github.com/openwrt/openwrt/issues/21935

I got stuck because it's not a bug:

It is this .... https://openwrt.org/submitting-patches

I hope it will be taken into consideration,

even though I'm not a developer or a great programmer. :sweat_smile:

Thank you for your time. :grinning_face:

If anyone is running similar setups (QMI/MBIM), feedback would be useful.

If you test this and can confirm the behavior, it may be helpful
to leave feedback directly on the pull request.

This makes it easier for maintainers to evaluate real-world impact.

@AndrewZ and other people …

Update:

A proper fix has been submitted upstream:

The patch adds a guard to skip interfaces not present in UCI config,
which avoids the "Invalid argument" errors seen with dynamic interfaces
like wan_4.

Tested on OpenWrt 24.10.5 (LTE/QMI setup) β€” works as expected.

It works for me (24.10.5, MBIM, lte_4 dynamic interface). Nice fix, thank you guys!