GNU bug report logs - #35895
[PATCH 0/1] linux-container: Remove networking service when network is shared with host.

Previous Next

Package: guix-patches;

Reported by: Arun Isaac <arunisaac <at> systemreboot.net>

Date: Sat, 25 May 2019 07:16:01 UTC

Severity: normal

Tags: patch

Done: Arun Isaac <arunisaac <at> systemreboot.net>

Bug is archived. No further changes may be made.

Full log


Message #26 received at 35895 <at> debbugs.gnu.org (full text, mbox):

From: Arun Isaac <arunisaac <at> systemreboot.net>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>,
 Christopher Baines <mail <at> cbaines.net>, 35895 <at> debbugs.gnu.org
Subject: Re: [bug#35895] [PATCH] linux-container: Remove networking service
 when network is shared with host.
Date: Tue, 18 Jun 2019 17:07:54 +0530
[Message part 1 (text/plain, inline)]
I've made the suggested changes. Please find attached an updated patch.

[0001-linux-container-Remove-networking-service-when-netwo.patch (text/x-patch, inline)]
From 4b50e35e3d2b8adea1e496e0336d23f35d0c9def Mon Sep 17 00:00:00 2001
From: Arun Isaac <arunisaac <at> systemreboot.net>
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.
---
 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
--- 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 container."
                          files)))
             base)))
 
+(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?
-                (list nscd-service-type)
+                (list nscd-service-type
+                      static-networking-service-type)
                 (list))))
 
   (operating-system
@@ -105,10 +117,17 @@ containerized OS.  EXTRA-FILE-SYSTEMS is a list of file systems to add to OS."
     (essential-services (container-essential-services
                          this-operating-system
                          #:shared-network? shared-network?))
-    (services (remove (lambda (service)
-                        (memq (service-kind service)
-                              useless-services))
-                      (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' shepherd
+                      ;; service, so make sure to provide a dummy 'networking'
+                      ;; service when we are sure that networking is already set up
+                      ;; in the host and can be used.  That prevents double setup.
+                      (if shared-network?
+                          (list (service dummy-networking-service-type))
+                          '())))
     (file-systems (append (map mapping->fs
                                (if shared-network?
                                    (append %network-file-mappings mappings)
-- 
2.22.0

[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 6 years and 53 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.