unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 53045@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludovic.courtes@inria.fr>,
	"Yann Dupont" <Yann.Dupont@univ-nantes.fr>
Subject: [bug#53045] [PATCH] services: networking: Add netmask to loopback address.
Date: Thu,  6 Jan 2022 10:46:03 +0100	[thread overview]
Message-ID: <20220106094603.11283-1-ludo@gnu.org> (raw)

From: Ludovic Courtès <ludovic.courtes@inria.fr>

Previously, we would get a fishy 127.0.0.1/0 interface:

  $ ip a show dev lo
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope host lo
	 valid_lft forever preferred_lft forever
      inet 127.0.0.1/0 scope global lo
	 valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
	 valid_lft forever preferred_lft forever

With this change, we get nothing but the "/8" version:

  $ ip a show dev lo
  1: lo: <LOOPBACK,MULTICAST,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 scope global lo
	 valid_lft forever preferred_lft forever
      inet6 ::1/128 scope host
	 valid_lft forever preferred_lft forever

Reported by Yann Dupont <Yann.Dupont@univ-nantes.fr>.

* gnu/services/base.scm (assert-valid-address): Remove special cases for
127.0.0.1 and ::1.
(%loopback-static-networking): Add "/8".
---
 gnu/services/base.scm | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 88869e40d2..e46bb591a9 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
 ;;; Copyright © 2015, 2016, 2020 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
@@ -2393,11 +2393,7 @@ (define (ipv6-address? str)
 
 (define-compile-time-procedure (assert-valid-address (address string?))
   "Ensure ADDRESS has a valid netmask."
-  (unless (or (cidr->netmask address)
-              (and=> (false-if-exception (inet-pton AF_INET address))
-                     (cut = INADDR_LOOPBACK <>))
-              (and=> (false-if-exception (inet-pton AF_INET6 address))
-                     (cut = 1 <>)))
+  (unless (cidr->netmask address)
     (raise
      (make-compound-condition
       (formatted-message (G_ "address '~a' lacks a network mask")
@@ -2741,7 +2737,7 @@ (define %loopback-static-networking
   (static-networking
    (addresses (list (network-address
                      (device "lo")
-                     (value "127.0.0.1"))))
+                     (value "127.0.0.1/8"))))
    (requirement '())
    (provision '(loopback))))
 

base-commit: 97657689507a0681aa9699407d292383ff22c330
-- 
2.33.0





             reply	other threads:[~2022-01-06 10:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06  9:46 Ludovic Courtès [this message]
2022-01-07 11:09 ` [bug#53045] [PATCH] services: networking: Add netmask to loopback address Yann Dupont
2022-01-08 22:28   ` bug#53045: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220106094603.11283-1-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=53045@debbugs.gnu.org \
    --cc=Yann.Dupont@univ-nantes.fr \
    --cc=ludovic.courtes@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).