summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-04-21 14:09:48 +0200
committerFelix Fietkau <nbd@openwrt.org>2015-04-21 14:09:48 +0200
commitd0dcf744ba054c9b572be63519b1415685353c8d (patch)
treeee22eef8ea886d2b4dbc9d871d17249c9f598151
parent2d581d30932fb8130e459945c362e59e75beab51 (diff)
proto-shell: retry setup if the proto handler script quits without changing the state or starting a process
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--proto-shell.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/proto-shell.c b/proto-shell.c
index 7a1896b..bc4c658 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -284,9 +284,16 @@ proto_shell_task_finish(struct proto_shell_state *state,
if (task == &state->proto_task)
proto_shell_handler(&state->proto, PROTO_CMD_TEARDOWN,
false);
- if (task == &state->script_task && state->renew_pending)
- proto_shell_handler(&state->proto, PROTO_CMD_RENEW,
- false);
+ if (task == &state->script_task) {
+ if (state->renew_pending)
+ proto_shell_handler(&state->proto,
+ PROTO_CMD_RENEW, false);
+ else if (!state->proto_task.uloop.pending &&
+ state->sm == S_SETUP)
+ proto_shell_handler(&state->proto,
+ PROTO_CMD_TEARDOWN,
+ false);
+ }
break;
case S_SETUP_ABORT: