From b88051becfcd563c2c4a4436d3db2840e52adefc Mon Sep 17 00:00:00 2001 From: kirill Date: Tue, 19 May 2026 01:12:49 +0000 Subject: [PATCH] usr.sbin/ifstated: timestamp sync external tests When external_exec() runs a test synchronously, it refreshes prevstatus but left lastexec unchanged. A later status change could therefore be ignored by eval_state(), because that code gates body evaluation on the first external test timestamp for the current state. Set lastexec together with prevstatus for synchronous runs; this keeps the cached test status and execution time consistent across state re-entry. OK: deraadt@ --- usr.sbin/ifstated/ifstated.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/ifstated/ifstated.c b/usr.sbin/ifstated/ifstated.c index 66297283e9a..f011701fc4d 100644 --- a/usr.sbin/ifstated/ifstated.c +++ b/usr.sbin/ifstated/ifstated.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifstated.c,v 1.68 2024/04/23 13:34:51 jsg Exp $ */ +/* $OpenBSD: ifstated.c,v 1.69 2026/05/19 01:12:49 kirill Exp $ */ /* * Copyright (c) 2004 Marco Pfatschbacher @@ -340,8 +340,10 @@ external_exec(struct ifsd_external *external, int async) if (!async) { waitpid(external->pid, &s, 0); external->pid = 0; - if (WIFEXITED(s)) + if (WIFEXITED(s)) { external->prevstatus = WEXITSTATUS(s); + external->lastexec = time(NULL); + } } }