summaryrefslogtreecommitdiff
path: root/src/script.c
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2013-05-15 13:06:29 +0200
committerSteven Barth <steven@midlink.org>2013-05-15 13:06:29 +0200
commitdbf89816bd12d727dc7b006406f619ff3d2da382 (patch)
tree3da2d0ccfde92051e4cd90747eceb5a742ac3d1e /src/script.c
parentaeb7c37224051811553c898b2a784944f26276b0 (diff)
downloadodhcp6c-dbf89816bd12d727dc7b006406f619ff3d2da382.tar.gz
script: fix delay call handling
Diffstat (limited to 'src/script.c')
-rw-r--r--src/script.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/script.c b/src/script.c
index 9d88daf..bda9749 100644
--- a/src/script.c
+++ b/src/script.c
@@ -41,6 +41,7 @@ static const int8_t hexvals[] = {
static char *argv[4] = {NULL, NULL, NULL, NULL};
static volatile char *delayed_call = NULL;
+static bool dont_delay = false;
int script_init(const char *path, const char *ifname)
@@ -212,7 +213,9 @@ static void script_call_delayed(int signal __attribute__((unused)))
void script_delay_call(const char *status, int timeout)
{
- if (!delayed_call) {
+ if (dont_delay) {
+ script_call(status);
+ } else if (!delayed_call) {
delayed_call = strdup(status);
signal(SIGALRM, script_call_delayed);
alarm(timeout);
@@ -226,8 +229,10 @@ void script_call(const char *status)
size_t sip_ip_len, sip_fqdn_len, aftr_name_len;
odhcp6c_expire();
- if (delayed_call)
+ if (delayed_call) {
alarm(0);
+ dont_delay = true;
+ }
struct in6_addr *dns = odhcp6c_get_state(STATE_DNS, &dns_len);
uint8_t *search = odhcp6c_get_state(STATE_SEARCH, &search_len);