Handle an action byte value of 0 in the set watchdog timer command
There are multiple options for the action field of the command.
This change only addresses one, where the caller wants there to
be no action taken when the timer expires. Because the implementation
of the watchdog doesn't support multiple actions in precisely that
arrangement, it makes sense to simply disable the timer.
The default behaviour on x86 of the ipmi_watchdog driver is to first
set the watchdog to 10s and an action of "none" and then set it to 10s
with an action of "hard reset." This change is necessary to stop the
watchdog from resetting the host when it receives the initial setting
with the action of "none."
Change-Id: I1a541824d2bd0d7a0c33ec5759c7c959cc2ae5ee
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/apphandler.cpp b/apphandler.cpp
index 2251e8c..5145a0a 100644
--- a/apphandler.cpp
+++ b/apphandler.cpp
@@ -417,6 +417,16 @@
goto finish;
}
+ /*
+ * If the action is 0, it means, do nothing. Multiple actions on timer
+ * expiration aren't supported by phosphor-watchdog yet, so when the
+ * action set is "none", we should just leave the timer disabled.
+ */
+ if (0 == reqptr->t_action)
+ {
+ goto finish;
+ }
+
if (reqptr->t_use & 0x40)
{
sd_bus_error_free(&error);