Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watchping does not start on wan interface on TP-Link WDR3600 #1157

Closed
ilario opened this issue Dec 18, 2024 · 2 comments · Fixed by #1158
Closed

Watchping does not start on wan interface on TP-Link WDR3600 #1157

ilario opened this issue Dec 18, 2024 · 2 comments · Fixed by #1158

Comments

@ilario
Copy link
Member

ilario commented Dec 18, 2024

Observed this over various reboots, using a TP-Link WDR3600 and testing most of the pull requests currently open. No idea is some of the pull requests increased the time required for the interface to get up.

root@LiMe-f9c239:~# logread |grep watchping
Wed Dec 18 21:08:28 2024 user.info watchping: starting all tasks
Wed Dec 18 21:08:28 2024 user.info watchping: interface wan does not exist (yet?) waiting 10 seconds to try again
Wed Dec 18 21:08:38 2024 user.info watchping: interface wan does not exist in openwrt but continuing...
Wed Dec 18 21:08:38 2024 user.info watchping: started task (interface=wan;timeout=120;pinghosts=8.8.8.8;pinginterval=20;hookname=wan)
Wed Dec 18 21:08:38 2024 user.info watchping: started task (interface=eth0.2;timeout=120;pinghosts=2001:470:20::2;pinginterval=20;hookname=wan6)
Wed Dec 18 21:08:38 2024 user.info watchping: all tasks started
Wed Dec 18 21:08:38 2024 user.info watchping: adding ifup trigger for wan6
Wed Dec 18 21:08:38 2024 user.info watchping: adding ifup trigger for wan
root@LiMe-f9c239:~# ps | grep ping
 3437 root      1392 S    {watchping} /bin/sh /usr/bin/watchping eth0.2 120 2001:470:20::2 20 wan6
 4351 root      1372 S    grep ping
root@LiMe-f9c239:~# service watchping restart
root@LiMe-f9c239:~# ps | grep ping
 4859 root      1388 S    {watchping} /bin/sh /usr/bin/watchping eth0.2 120 8.8.8.8 20 wan
 4861 root      1388 S    {watchping} /bin/sh /usr/bin/watchping eth0.2 120 2001:470:20::2 20 wan6
@ilario ilario changed the title Watchping does not start when wan interface takes too long to be up Watchping does not start on wan interface on TP-Link WDR3600 Jan 4, 2025
@ilario
Copy link
Member Author

ilario commented Jan 4, 2025

Tested a bit.
It happened not because of a short timeout, but because some bug somewhere.
Watchping tries to get the WAN interface name (eth0.2) from the "wan" name here:

ifname="$(uci_get_state network "$interface" ifname)"

That works for wan6 but fails for wan.

Internally, OpenWrt checks for the content of /var/state/network that, for some reason, has the entry for wan6 but does not have it for wan:

root@LiMe-f9c239:/# cat /var/state/network 
network.lan.up='1'
network.lan.ifname='br-lan'
network.lm_net_br_lan_anygw_if.up='1'
network.lm_net_br_lan_anygw_if.ifname='anygw'
network.lm_net_eth0_1_babeld_if.up='1'
network.lm_net_eth0_1_babeld_if.ifname='eth0-1_17'
network.lm_net_eth0_2_babeld_if.up='1'
network.lm_net_eth0_2_babeld_if.ifname='eth0-2_17'
network.wan6.up='1'
network.wan6.ifname='eth0.2'
network.loopback.up='1'
network.loopback.ifname='lo'
network.lm_net_eth0_1_batadv_if.up='1'
network.lm_net_eth0_1_batadv_if.ifname='eth0-1_29'
network.lm_net_eth0_2_batadv_if.up='1'
network.lm_net_eth0_2_batadv_if.ifname='eth0-2_29'
network.bat0.up='1'
network.bat0.ifname='bat0'
network.lm_net_wlan0_mesh.up='1'
network.lm_net_wlan0_mesh.ifname='wlan0-mesh'
network.lm_net_wlan0_mesh_babeld_if.up='1'
network.lm_net_wlan0_mesh_babeld_if.ifname='wlan0-mesh_17'
network.lm_net_wlan1_mesh.up='1'
network.lm_net_wlan1_mesh.ifname='wlan1-mesh'
network.lm_net_wlan1_mesh_babeld_if.up='1'
network.lm_net_wlan1_mesh_babeld_if.ifname='wlan1-mesh_17'
network.lm_net_wlan0_mesh_batadv_if.up='1'
network.lm_net_wlan0_mesh_batadv_if.ifname='wlan0-mesh_29'
network.lm_net_wlan1_mesh_batadv_if.up='1'
network.lm_net_wlan1_mesh_batadv_if.ifname='wlan1-mesh_29'

Regenerating the file with /etc/init.d/network restart results in the same content.

While uci shows everything is as expected:

root@LiMe-f9c239:/# uci show network.wan6
network.wan6=interface
network.wan6.device='eth0.2'
network.wan6.proto='none'
root@LiMe-f9c239:/# uci show network.wan
network.wan=interface
network.wan.device='eth0.2'
network.wan.proto='dhcp'

@ilario
Copy link
Member Author

ilario commented Jan 6, 2025

More tests:

If the router is connected to the WAN before it gets switched on, the watchping for IPv4 never starts, neither disconnecting and reconnecting the WAN cable. Even if the /var/state/network has the entry for wan.

If the router WAN port is disconnected when the router gets switched on, and thec cable gets connected later, the watchping for IPv4 works.

Basically, the WAN interface takes long time to get up and the sleep of 10 seconds here

ifname="$(uci_get_state network "$interface" ifname)"
[ -z "$ifname" ] && {
logger -p user.info -t "watchping" "interface $interface does not exist (yet?) waiting 10 seconds to try again"
sleep 10

is not enough. From my observation using the 2024.1 branch on a TP-Link WDR3600 and selecting many LibreMesh packages, it seems that 15 seconds are required. So, the solution proposed in #1158 would work.

No idea when this time increased, I suppose it is because of some of the changes in the last years...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant