summaryrefslogtreecommitdiffstats
path: root/src/ipv6nd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2019-11-29 22:11:46 +0000
committerRoy Marples <roy@marples.name>2019-11-29 22:11:46 +0000
commit3063ebb6c8ac7c96196fa923cdd5f7c0384de23b (patch)
tree2d7280e8b0b12bf39073ec42e3bda342affe0474 /src/ipv6nd.c
parentbb0b9d36b97324630874be5175d9faa42d1df3b9 (diff)
downloaddhcpcd-3063ebb6c8ac7c96196fa923cdd5f7c0384de23b.tar.xz
dhcpcd: Rework daemonisation
Now that we spawn helper processes for priviledge separation, we need to fork() and setssid() much earlier. Infact, pretty much from the get go of starting up. dhcpcd_daemonise now writes to the launcher signal pipe about the result of "daemonisation", even though it's already deamonised at this point. This allows dhcpcd to keep the helper processes running when started by the system init at boot.
Diffstat (limited to 'src/ipv6nd.c')
-rw-r--r--src/ipv6nd.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/ipv6nd.c b/src/ipv6nd.c
index f6a4913b..e7eec427 100644
--- a/src/ipv6nd.c
+++ b/src/ipv6nd.c
@@ -809,10 +809,10 @@ ipv6nd_free(struct interface *ifp)
return n;
}
-static int
+static void
ipv6nd_scriptrun(struct ra *rap)
{
- int hasdns, hasaddress, pid;
+ int hasdns, hasaddress;
struct ipv6_addr *ap;
hasaddress = 0;
@@ -830,7 +830,7 @@ ipv6nd_scriptrun(struct ra *rap)
logdebugx("%s: waiting for Router Advertisement"
" DAD to complete",
rap->iface->name);
- return 0;
+ return;
}
}
}
@@ -843,19 +843,16 @@ ipv6nd_scriptrun(struct ra *rap)
}
script_runreason(rap->iface, "ROUTERADVERT");
- pid = 0;
if (hasdns && (hasaddress ||
!(rap->flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER))))
- pid = dhcpcd_daemonise(rap->iface->ctx);
+ dhcpcd_daemonise(rap->iface->ctx);
#if 0
else if (options & DHCPCD_DAEMONISE &&
!(options & DHCPCD_DAEMONISED) && new_data)
logwarnx("%s: did not fork due to an absent"
" RDNSS option in the RA",
ifp->name);
-}
#endif
- return pid;
}
static void
@@ -972,8 +969,7 @@ try_script:
logdebugx("%s: Router Advertisement DAD "
"completed",
rap->iface->name);
- if (ipv6nd_scriptrun(rap))
- return;
+ ipv6nd_scriptrun(rap);
}
}
#ifdef ND6_ADVERTISE
@@ -1375,8 +1371,7 @@ ipv6nd_handlera(struct dhcpcd_ctx *ctx,
#endif
rt_build(ifp->ctx, AF_INET6);
- if (ipv6nd_scriptrun(rap))
- return;
+ ipv6nd_scriptrun(rap);
eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp);
eloop_timeout_delete(ifp->ctx->eloop, NULL, rap); /* reachable timer */