]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fork correctly from RA and DAD.
authorRoy Marples <roy@marples.name>
Tue, 4 Feb 2014 15:46:38 +0000 (15:46 +0000)
committerRoy Marples <roy@marples.name>
Tue, 4 Feb 2014 15:46:38 +0000 (15:46 +0000)
dhcpcd.c
ipv6nd.c

index 64040f5abd44ed514087a6b5bcd6472f3fe6dd71..e0640aa1e19b7ce8e594a2f91eccaeedd69eed19 100644 (file)
--- 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);
index 1517379f41faca344decb576e188b7bc8d351e13..d801357d4c48c6e8fed349793f511a2be8e19711 100644 (file)
--- 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 */