Watchcat does not restart the interface

Watchcat

OpenWrt 23.05.0-rc2 (r23228-cd17d8df2a)

Does not restart the interface.
In the log, all events occur, in the log it says that the interface is being overloaded, but in fact this does not happen.

Tue Jul 4 06:37:55 2023 daemon.info watchcat[2597]: Could not reach 8.8.8.8 via "cloudfire" for "10" seconds. Restarting "cloudfire" after reaching "30" seconds
Tue Jul 4 06:38:05 2023 daemon.info watchcat[2597]: Could not reach 8.8.8.8 via "cloudfire" for "20" seconds. Restarting "cloudfire" after reaching "30" seconds
Tue Jul 4 06:38:15 2023 daemon.info watchcat[2597]: Could not reach 8.8.8.8 via "cloudfire" for "30" seconds. Restarting "cloudfire" after reaching "30" seconds
Tue Jul 4 06:38:15 2023 daemon.info watchcat[2597]: Restarting network interface: "cloudfire".
Tue Jul 4 06:38:15 2023 daemon.notice netifd: Network device 'cloudfire' link is down
Tue Jul 4 06:38:15 2023 daemon.notice netifd: Network device 'cloudfire' link is up

If you click on the reset button of the same interface in the LUCI, then the reboot occurs.

I can confirm even in 22.x branch the interface is not restarted

1 Like

Model BT Home Hub 5A
Architecture xRX200 rev 1.2
Target Platform lantiq/xrx200
Firmware Version OpenWrt 23.05.2 r23630-842932a63d / LuCI openwrt-23.05 branch git-23.306.39416-c86c256
Kernel Version 5.15.137

Same here! I note that this topic has been ignored for 9 months, so maybe I should start a new topic?

As the other two contributors above say, watchcat claims to be restarting the interface. However, it gets stuck in a loop repeatedly trying to restart the interface. Here is my config:

config watchcat
option period '10s'
option mode 'restart_iface'
option pinghosts 'dns.google'
option addressfamily 'any'
option pingperiod '1m'
option pingsize 'standard'
option interface 'wwan0'

I've tried increasing 'period' and I've tried inserting a sleep here:

watchcat_restart_network_iface() {                                               
        logger -p daemon.info -t "watchcat[$$]" "Restarting network interface: \"$1\"."                                    
        ip link set "$1" down                                                          
        sleep 5                                                                                                                 
        ip link set "$1" up                                                                                                     
}

between the down and the up, thinking that it is some kind of timing issue, but neither made a difference. The interface does get restarted, thus:

Mon May 13 09:13:42 2024 daemon.notice netifd: Network device 'wwan0' link is down
Mon May 13 09:13:42 2024 daemon.notice netifd: Network alias 'wwan0' link is down
Mon May 13 09:13:42 2024 daemon.notice netifd: Interface 'lte_4' has link connectivity loss
Mon May 13 09:13:42 2024 daemon.notice netifd: Network device 'wwan0' link is up
Mon May 13 09:13:42 2024 daemon.notice netifd: Network alias 'wwan0' link is up
Mon May 13 09:13:42 2024 daemon.notice netifd: Interface 'lte_4' has link connectivity

but it fails to create a default route. Hence it fails the ping test again, and gets restarted again, but without the default route, and so on... OTOH pressing the Restart button on the lte interface in Network/Interfaces reliably succeeds in restarting the interface with the default route defined.

It appears that what is needed to fix this issue is to insert a line to create the default route, thus:

watchcat_restart_network_iface() {                                               
        logger -p daemon.info -t "watchcat[$$]" "Restarting network interface: \"$1\"."                                    
        ip link set "$1" down                                                                                                                        
        ip link set "$1" up
        ip route add default via GW_ADDRESS                                                                                             
}                                                                                                                               

but where can I get the gateway address from?

Any help gratefully received!

Thanks
John

Solution is to use the watchcat Mode "Run Script" rather than the (broken) "Restart Interface" and then in the script put:

ifup lte
sleep 10  # give it time to come back up before the next watchcat cycle starts

where lte is the name of the interface in /etc/config/interface:

config interface 'lte'
	option proto 'mbim'
	option apn 'data.lycamobile.co.uk'
	option auth 'none'
	option pdptype 'ipv4'
	option device '/dev/cdc-wdm0'
	option ipv6 '0'

which note is not the same as the real interface:

# ifconfig wwan0
wwan0     Link encap:Ethernet  HWaddr 12:35:F4:98:97:51  
          inet addr:10.34.238.230  Bcast:10.34.238.231  Mask:255.255.255.252
          inet6 addr: fe80::1035:f4ff:fe98:9751/64 Scope:Link
          UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:1287633 errors:0 dropped:0 overruns:0 frame:0
          TX packets:712567 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1527363624 (1.4 GiB)  TX bytes:110765894 (105.6 MiB)