diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-01-17 09:51:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-17 09:51:28 +0100 |
| commit | 240123722abf90e0d6bbe46efc81895fbc75825b (patch) | |
| tree | 49f7270913bd616645b2717b576f94619097fee6 /src | |
| parent | 97e66dfd6dc96076914362e1f42996a371dfa865 (diff) | |
| parent | 94d27bc0331d2595f9fd98c9477507806f4dd0d0 (diff) | |
| download | vyos-1x-240123722abf90e0d6bbe46efc81895fbc75825b.tar.gz vyos-1x-240123722abf90e0d6bbe46efc81895fbc75825b.zip | |
Merge pull request #4946 from Firefishy/T8187-fix-watchdog-timeout-validation
T8187: fix watchdog timeout validation if kernel min/max timeout are zero
Diffstat (limited to 'src')
| -rwxr-xr-x | src/conf_mode/system_watchdog.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/conf_mode/system_watchdog.py b/src/conf_mode/system_watchdog.py index 059e74dd9..8c050f333 100755 --- a/src/conf_mode/system_watchdog.py +++ b/src/conf_mode/system_watchdog.py @@ -63,7 +63,7 @@ def _read_sysfs_int(path: Path) -> Optional[int]: def _get_watchdog_timeout_limits() -> tuple[int, int]: """Return (min_timeout, max_timeout) from sysfs if available. - If sysfs is unavailable (device not present/loaded yet), fall back to a + If sysfs is unavailable (device not present/loaded yet) or zero, fall back to a conservative common kernel max of 65535 seconds. """ @@ -74,10 +74,8 @@ def _get_watchdog_timeout_limits() -> tuple[int, int]: max_timeout = _read_sysfs_int(WATCHDOG_SYSFS / 'max_timeout') # Some drivers may not expose min/max. Fall back to sane defaults. - if min_timeout is None: - min_timeout = 1 - if max_timeout is None: - max_timeout = 65535 + min_timeout = min_timeout if min_timeout and min_timeout > 0 else 1 + max_timeout = max_timeout if max_timeout and max_timeout > 0 else 65535 return min_timeout, max_timeout |
