How to configure netifd to autoconnect/reconnect after 'link is down'?

At present I have in /etc/config/network:

config interface 'wan'
        option proto 'modemmanager'
        option device '/sys/devices/platform/1e1c0000.xhci/usb2/2-1'
        option auth 'pap'
        option iptype 'ipv4v6'
        option apn 'xx
        option username 'yy'
        option password 'zz'

And thanks in part to this patch, upon a modem disconnection event I see:

Wed Nov  2 20:38:54 2022 daemon.info [2716]: <info>  [modem0] state changed (connected -> disconnecting)
Wed Nov  2 20:38:54 2022 daemon.info [2716]: <info>  [modem0] state changed (disconnecting -> registered)
Wed Nov  2 20:38:54 2022 daemon.info [2716]: <info>  [modem0/bearer3] connection #1 finished: duration 121s, tx: 258333 bytes, rx: 371928 bytes
Wed Nov  2 20:38:54 2022 user.notice modemmanager: interface wan (network device wwan0) disconnected
Wed Nov  2 20:38:54 2022 daemon.notice netifd: Interface 'wan' has lost the connection
Wed Nov  2 20:38:54 2022 daemon.notice netifd: Network device 'wwan0' link is down
Wed Nov  2 20:38:54 2022 daemon.warn dnsmasq[1]: no servers found in /tmp/resolv.conf.d/resolv.conf.auto, will retry

At this point I need to manually type 'ifup wan' to restore internet connectivity.

What do I need to add to /etc/config/network to ensure that netifd will reconnect upon:

Wed Nov  2 20:38:54 2022 daemon.notice netifd: Interface 'wan' has lost the connection
Wed Nov  2 20:38:54 2022 daemon.notice netifd: Network device 'wwan0' link is down

Hi
Can a hotplug script be triggered by the link down?

1 Like

Almost certainly, and if this is the 'OpenWrt way' then I will just do that. But I had imagined that netifd would either automatically bring such an interface back up or there would be an option to do so.