From e23f12f59182bec966c79c65dec034b8084ff8db Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Tue, 26 Jan 2016 09:20:33 +0100 Subject: [PATCH] script: Launch script with correct action if last script call is terminated Actions launched as resume will be used in a next script_call if the new action is not marked as resume even when the previous script run was already terminated. This behavior is particular visible when a RA is received as the script will run with action bound and not ra-updated resulting into a wan6 interface down/up transition --- src/script.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/script.c b/src/script.c index 3d313cf..f272c19 100644 --- a/src/script.c +++ b/src/script.c @@ -353,13 +353,15 @@ static void s46_to_env(enum odhcp6c_state state, const uint8_t *data, size_t len void script_call(const char *status, int delay, bool resume) { time_t now = odhcp6c_get_milli_time() / 1000; + bool running_script = false; if (running) { kill(running, SIGTERM); delay -= now - started; + running_script = true; } - if (resume || !action[0]) + if (resume || !running_script || !action[0]) strncpy(action, status, sizeof(action) - 1); pid_t pid = fork(); -- 2.39.5