From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:47299) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdCS7-00031E-QS for guix-patches@gnu.org; Tue, 18 Jun 2019 07:39:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdCS6-00042F-Kf for guix-patches@gnu.org; Tue, 18 Jun 2019 07:39:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58543) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hdCS6-00041Z-E6 for guix-patches@gnu.org; Tue, 18 Jun 2019 07:39:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hdCS6-00039R-8p for guix-patches@gnu.org; Tue, 18 Jun 2019 07:39:02 -0400 Subject: [bug#35895] [PATCH] linux-container: Remove networking service when network is shared with host. Resent-Message-ID: From: Arun Isaac In-Reply-To: <87a7el19nh.fsf@gnu.org> References: <20190525070113.5576-1-arunisaac@systemreboot.net> <20190525072030.7739-1-arunisaac@systemreboot.net> <8736l2iuao.fsf@cbaines.net> <20190603191031.7e751c2a@scratchpost.org> <87a7el19nh.fsf@gnu.org> Date: Tue, 18 Jun 2019 17:07:54 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35895@debbugs.gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain I've made the suggested changes. Please find attached an updated patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-linux-container-Remove-networking-service-when-netwo.patch Content-Transfer-Encoding: quoted-printable From=204b50e35e3d2b8adea1e496e0336d23f35d0c9def Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 25 May 2019 11:49:42 +0530 Subject: [PATCH] linux-container: Remove networking service when network is shared with host. * gnu/system/linux-container.scm (dummy-networking-shepherd-service): New procedure. (dummy-networking-service-type): New variable. (containerized-operating-system): If network is shared with host, replace static-networking-service-type with dummy-networking-service-type. =2D-- gnu/system/linux-container.scm | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index c1e963d047..61248c62b9 100644 =2D-- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm @@ -30,6 +30,7 @@ #:use-module (gnu build linux-container) #:use-module (gnu services) #:use-module (gnu services base) + #:use-module (gnu services shepherd) #:use-module (gnu system) #:use-module (gnu system file-systems) #:export (system-container @@ -65,6 +66,16 @@ from OS that are needed on the bare metal and not in a c= ontainer." files))) base))) =20 +(define dummy-networking-service-type + (shepherd-service-type + 'dummy-networking + (const (shepherd-service + (documentation "Provide loopback and networking without actually +doing anything.") + (provision '(loopback networking)) + (start #~(const #t)))) + #f)) + (define* (containerized-operating-system os mappings #:key shared-network? @@ -96,7 +107,8 @@ containerized OS. EXTRA-FILE-SYSTEMS is a list of file = systems to add to OS." agetty-service-type) ;; Remove nscd service if network is shared with the host. (if shared-network? =2D (list nscd-service-type) + (list nscd-service-type + static-networking-service-type) (list)))) =20 (operating-system @@ -105,10 +117,17 @@ containerized OS. EXTRA-FILE-SYSTEMS is a list of fi= le systems to add to OS." (essential-services (container-essential-services this-operating-system #:shared-network? shared-network?)) =2D (services (remove (lambda (service) =2D (memq (service-kind service) =2D useless-services)) =2D (operating-system-user-services os))) + (services (append (remove (lambda (service) + (memq (service-kind service) + useless-services)) + (operating-system-user-services os)) + ;; Many Guix services depend on a 'networking' sheph= erd + ;; service, so make sure to provide a dummy 'network= ing' + ;; service when we are sure that networking is alrea= dy set up + ;; in the host and can be used. That prevents doubl= e setup. + (if shared-network? + (list (service dummy-networking-service-type)) + '()))) (file-systems (append (map mapping->fs (if shared-network? (append %network-file-mappings mappings) =2D-=20 2.22.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAl0IzRIACgkQLiXui2GA K7NoGggAwOmtAXeO7o98E20XIc6/0+DqMAaXm7t0/RNWhdnXKp/+wEEWJyRQSSbC lZqdAN3LkJzWZvUvjKqCmZUFFLC9AaYh3Z6MXtFrwL4yImohyIAKjI9fvsVqc2EK sChHxCvTGwP3lh3UqxtEf4jp2LE5UzH2py8E6iSbceinGGa1uNsoYPZMt7/Ic2Lv PBBrZPoiUnDVivVCt0wJW8vNPnO6UssGvVKkg8apuM1lHIdcymmO4tnPoDlIAgp+ im9GZpEey9APEfzvB8YYC8Fesv2GccsNHDc29uTi04zd76IDzZtIBsIvt/4FLrrm mJPOc22fdp1aZDuPThxNfMb6eU+KfA== =Kgnr -----END PGP SIGNATURE----- --==-=-=--