From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:470:142:3::10]:45541) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hbX7C-00047A-3W for guix-patches@gnu.org; Thu, 13 Jun 2019 17:18:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hbWsA-0004k9-G6 for guix-patches@gnu.org; Thu, 13 Jun 2019 17:03:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50907) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hbWsA-0004js-BX for guix-patches@gnu.org; Thu, 13 Jun 2019 17:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hbWsA-0007iQ-6W for guix-patches@gnu.org; Thu, 13 Jun 2019 17:03:02 -0400 Subject: [bug#35895] [PATCH] linux-container: Remove networking service when network is shared with host. Resent-Message-ID: From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20190525070113.5576-1-arunisaac@systemreboot.net> <20190525072030.7739-1-arunisaac@systemreboot.net> <8736l2iuao.fsf@cbaines.net> <20190603191031.7e751c2a@scratchpost.org> Date: Thu, 13 Jun 2019 23:02:26 +0200 In-Reply-To: (Arun Isaac's message of "Mon, 10 Jun 2019 02:05:08 +0530") Message-ID: <87a7el19nh.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Arun Isaac Cc: 35895@debbugs.gnu.org Hello, Arun Isaac skribis: > From a7b795d9af3347330b48470d3988d43b8038c2c1 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. [...] > +(define dummy-networking-shepherd-service > + (shepherd-service > + (documentation "Provide loopback and networking without actually doing > +anything.") > + (provision '(loopback networking)) > + (start #~(const #t)))) > + > +(define dummy-networking-service-type > + (service-type > + (name 'dummy-networking) > + (extensions > + (list (service-extension > + shepherd-root-service-type > + (const (list dummy-networking-shepherd-service))))) > + (default-value #f))) You can use =E2=80=98shepherd-service-type=E2=80=99 as a shorthand for thes= e two definitions. > + (services (append > + (remove (lambda (service) > + (memq (service-kind service) > + useless-services)) > + (operating-system-user-services os)) > + ;; Many Guix services depend on a 'networking' shepherd > + ;; service, so make sure to provide a dummy 'networking' > + ;; service when we are sure that networking is already se= t up > + ;; in the host and can be used. That prevents double set= up. > + (if shared-network? > + (list (service dummy-networking-service-type)) > + (list)))) I=E2=80=99m really nitpicking here, but I like to have the first argument to =E2=80=98append=E2=80=99 on the same line, and I also visually recognize '(= ) more easily than (list). Anyway, LGTM! Thanks, Ludo=E2=80=99.