From 4b521f14ac14cb0767ba3bb512478396f8c90beb Mon Sep 17 00:00:00 2001 From: Las Date: Mon, 10 Mar 2025 22:03:22 +0000 Subject: [PATCH] Remove `privateNetwork` variable from local drv goal Can just inline its definition, it was immutable. --- src/libstore/unix/build/local-derivation-goal.cc | 7 ++----- src/libstore/unix/build/local-derivation-goal.hh | 5 ----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/libstore/unix/build/local-derivation-goal.cc b/src/libstore/unix/build/local-derivation-goal.cc index b2e4c1186..bfc5e4c34 100644 --- a/src/libstore/unix/build/local-derivation-goal.cc +++ b/src/libstore/unix/build/local-derivation-goal.cc @@ -1032,9 +1032,6 @@ void LocalDerivationGoal::startBuilder() us. */ - if (derivationType->isSandboxed()) - privateNetwork = true; - userNamespaceSync.create(); usingUserNamespace = userNamespacesSupported(); @@ -1062,7 +1059,7 @@ void LocalDerivationGoal::startBuilder() ProcessOptions options; options.cloneFlags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | CLONE_NEWUTS | CLONE_PARENT | SIGCHLD; - if (privateNetwork) + if (derivationType->isSandboxed()) options.cloneFlags |= CLONE_NEWNET; if (usingUserNamespace) options.cloneFlags |= CLONE_NEWUSER; @@ -1879,7 +1876,7 @@ void LocalDerivationGoal::runChild() userNamespaceSync.readSide = -1; - if (privateNetwork) { + if (derivationType->isSandboxed()) { /* Initialise the loopback interface. */ AutoCloseFD fd(socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)); diff --git a/src/libstore/unix/build/local-derivation-goal.hh b/src/libstore/unix/build/local-derivation-goal.hh index 59b33d72a..d52008eef 100644 --- a/src/libstore/unix/build/local-derivation-goal.hh +++ b/src/libstore/unix/build/local-derivation-goal.hh @@ -88,11 +88,6 @@ struct LocalDerivationGoal : public DerivationGoal */ std::shared_ptr autoDelChroot; - /** - * Whether to run the build in a private network namespace. - */ - bool privateNetwork = false; - /** * Stuff we need to pass to initChild(). */