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.

1 Like

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.

1 Like

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

1 Like

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: