Skip to content

watchcat: restart_iface can repeatedly restart an interface during a outage #29318

@dhrm1k

Description

@dhrm1k

Package Name

watchcat

Maintainer

Roger D rogerdammit@gmail.com (@roger- )

OpenWrt Version

24.10.4

OpenWrt Target/Subtarget

x86/64

Steps to Reproduce

  1. Install and enable watchcat.
  2. Configure a rule with:
    • mode='restart_iface'
    • period='5'
    • pingperiod='1s'
    • pinghosts='203.0.113.1'
    • interface='br-lan'
  3. Restart the service:
    /etc/init.d/watchcat restart
  4. Observe the logs:
    logread | grep watchcat

Actual Behaviour

When the host remains unreachable, watchcat keeps restarting the
interface repeatedly during the same outage.

Example log output:

Wed May  6 14:46:55 2026 daemon.info watchcat[22624]: Could not reach 203.0.113.1 via "br-lan" for "10" seconds. Restarting "br-lan" after reaching "5" seconds
Wed May  6 14:46:55 2026 daemon.info watchcat[22624]: Restarting network interface: "br-lan".
Wed May  6 14:47:05 2026 daemon.info watchcat[22624]: Could not reach 203.0.113.1 via "br-lan" for "10" seconds. Restarting "br-lan" after reaching "5" seconds
Wed May  6 14:47:05 2026 daemon.info watchcat[22624]: Restarting network interface: "br-lan".
Wed May  6 14:47:15 2026 daemon.info watchcat[22624]: Could not reach 203.0.113.1 via "br-lan" for "10" seconds. Restarting "br-lan" after reaching "5" seconds
Wed May  6 14:47:15 2026 daemon.info watchcat[22624]: Restarting network interface: "br-lan".

This continues roughly once per check cycle while the outage persists.

The issue appears to be that restart_iface resets the failure timer
using a timestamp taken before the recovery action runs. If the restart
itself takes longer than the configured period (the time taken for interface
down and up in simple words), the next failed check can
immediately exceed the threshold again and trigger another restart.

Confirmation Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions