From: Roy Marples Date: Tue, 4 Feb 2014 15:46:38 +0000 (+0000) Subject: Fork correctly from RA and DAD. X-Git-Tag: v6.3.0~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b5b066a566d6f1882c1a08dfe041c71a8c93be02;p=thirdparty%2Fdhcpcd.git Fork correctly from RA and DAD. --- diff --git a/dhcpcd.c b/dhcpcd.c index 64040f5a..e0640aa1 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -252,7 +252,7 @@ daemonise(void) } /* Done with the fd now */ if (pid != 0) { - syslog(LOG_INFO, "forked to background, child pid %d",pid); + syslog(LOG_INFO, "forked to background, child pid %d", pid); writepid(pidfd, pid); close(pidfd); pidfd = -1; @@ -1435,7 +1435,6 @@ exit_failure: i = EXIT_FAILURE; exit1: - if (ifaces) { while ((ifp = TAILQ_FIRST(ifaces))) { TAILQ_REMOVE(ifaces, ifp, next); diff --git a/ipv6nd.c b/ipv6nd.c index 1517379f..d801357d 100644 --- a/ipv6nd.c +++ b/ipv6nd.c @@ -523,7 +523,7 @@ add_router(struct ra *router) TAILQ_INSERT_TAIL(&ipv6_routers, router, next); } -static void +static int ipv6nd_scriptrun(struct ra *rap) { int hasdns; @@ -543,7 +543,7 @@ ipv6nd_scriptrun(struct ra *rap) "%s: waiting for Router Advertisement" " DAD to complete", rap->iface->name); - return; + return 0; } } } @@ -566,7 +566,7 @@ ipv6nd_scriptrun(struct ra *rap) script_runreason(rap->iface, "ROUTERADVERT"); if (hasdns) - daemonise(); + hasdns = daemonise(); #if 0 else if (options & DHCPCD_DAEMONISE && !(options & DHCPCD_DAEMONISED) && new_data) @@ -576,6 +576,7 @@ ipv6nd_scriptrun(struct ra *rap) ifp->name); } #endif + return hasdns; } static void @@ -621,7 +622,8 @@ ipv6nd_dadcallback(void *arg) syslog(LOG_DEBUG, "%s: Router Advertisement DAD completed", rap->iface->name); - ipv6nd_scriptrun(rap); + if (ipv6nd_scriptrun(rap)) + return; } } } @@ -1009,8 +1011,10 @@ ipv6nd_handlera(struct interface *ifp, struct icmp6_hdr *icp, ssize_t len) ipv6_buildroutes(); /* We will get run by the expire function */ - if (rap->lifetime) - ipv6nd_scriptrun(rap); + if (rap->lifetime) { + if (ipv6nd_scriptrun(rap)) + return; + } eloop_timeout_delete(NULL, ifp); eloop_timeout_delete(NULL, rap); /* reachable timer */