summaryrefslogtreecommitdiffstats
path: root/src/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2020-10-07 14:37:35 +0100
committerRoy Marples <roy@marples.name>2020-10-07 14:37:35 +0100
commitd047f2dd0d9cee881d1d3e56da8ba67664f7726d (patch)
tree5cf0e8409af49ce16e10f0661a76b2e9e016740d /src/dhcpcd.c
parente2caea689681e9e2f9291290939390ea7d12b2f9 (diff)
downloaddhcpcd-d047f2dd0d9cee881d1d3e56da8ba67664f7726d.tar.xz
privsep: Only log chrooting from the launcher process
And the sandbox tech as well. Rework stop_interface so we can reuse an option for marking a process as the launcher.
Diffstat (limited to 'src/dhcpcd.c')
-rw-r--r--src/dhcpcd.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/dhcpcd.c b/src/dhcpcd.c
index 8f429bc5..a9ced339 100644
--- a/src/dhcpcd.c
+++ b/src/dhcpcd.c
@@ -409,7 +409,7 @@ dhcpcd_drop(struct interface *ifp, int stop)
}
static void
-stop_interface(struct interface *ifp)
+stop_interface(struct interface *ifp, const char *reason)
{
struct dhcpcd_ctx *ctx;
@@ -418,10 +418,7 @@ stop_interface(struct interface *ifp)
ifp->options->options |= DHCPCD_STOPPING;
dhcpcd_drop(ifp, 1);
- if (ifp->options->options & DHCPCD_DEPARTED)
- script_runreason(ifp, "DEPARTED");
- else
- script_runreason(ifp, "STOPPED");
+ script_runreason(ifp, reason == NULL ? "STOPPED" : reason);
/* Delete all timeouts for the interfaces */
eloop_q_timeout_delete(ctx->eloop, ELOOP_QUEUE_ALL, NULL, ifp);
@@ -1025,8 +1022,7 @@ dhcpcd_handleinterface(void *arg, int action, const char *ifname)
}
if (ifp->active) {
logdebugx("%s: interface departed", ifp->name);
- ifp->options->options |= DHCPCD_DEPARTED;
- stop_interface(ifp);
+ stop_interface(ifp, "DEPARTED");
}
TAILQ_REMOVE(ctx->ifaces, ifp, next);
if_free(ifp);
@@ -1339,7 +1335,7 @@ stop_all_interfaces(struct dhcpcd_ctx *ctx, unsigned long long opts)
if (ifp->options->options & DHCPCD_RELEASE)
ifp->options->options &= ~DHCPCD_PERSISTENT;
ifp->options->options |= DHCPCD_EXITING;
- stop_interface(ifp);
+ stop_interface(ifp, NULL);
}
}
@@ -1591,7 +1587,7 @@ dumperr:
ifp->options->options |= opts;
if (opts & DHCPCD_RELEASE)
ifp->options->options &= ~DHCPCD_PERSISTENT;
- stop_interface(ifp);
+ stop_interface(ifp, NULL);
}
return 0;
}
@@ -2293,7 +2289,7 @@ printpidfile:
break;
default:
setproctitle("[launcher]");
- ctx.options |= DHCPCD_FORKED;
+ ctx.options |= DHCPCD_FORKED | DHCPCD_LAUNCHER;
ctx.fork_fd = fork_fd[0];
close(fork_fd[1]);
#ifdef PRIVSEP_RIGHTS