From patchwork Wed Oct 27 13:59:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 414 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4C4DB27BBE3; Wed, 27 Oct 2021 16:07:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D0C4727BBE1 for ; Wed, 27 Oct 2021 16:07:23 +0100 (BST) Received: from localhost ([::1]:60094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfkWQ-0007nn-Tw for patchwork@mira.cbaines.net; Wed, 27 Oct 2021 11:07:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfjTJ-0005pn-HR for guix-patches@gnu.org; Wed, 27 Oct 2021 10:00:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38492) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfjTI-0004eT-5n for guix-patches@gnu.org; Wed, 27 Oct 2021 10:00:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mfjTG-0000FM-B1; Wed, 27 Oct 2021 10:00:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51440] [PATCH 00/10] Declarative static networking interface Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: julien@lepiller.eu, guix-patches@gnu.org Resent-Date: Wed, 27 Oct 2021 14:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51440 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51440@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Julien Lepiller X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Julien Lepiller Received: via spool by submit@debbugs.gnu.org id=B.1635343174860 (code B ref -1); Wed, 27 Oct 2021 14:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Oct 2021 13:59:34 +0000 Received: from localhost ([127.0.0.1]:50037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfjSo-0000Do-AF for submit@debbugs.gnu.org; Wed, 27 Oct 2021 09:59:34 -0400 Received: from lists.gnu.org ([209.51.188.17]:34660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfjSm-0000De-C3 for submit@debbugs.gnu.org; Wed, 27 Oct 2021 09:59:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfjSl-0004ZL-Va for guix-patches@gnu.org; Wed, 27 Oct 2021 09:59:31 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfjSk-0004ag-Vv; Wed, 27 Oct 2021 09:59:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=eO6PxoXTDnqRtHxcrmmY/QY73k1nb+Y98hVvC6ZiSk0=; b=CusXH/ocOkS6ii RjhMU/trn4fjVoDVNqWQt4w/8ylPLPBcaGfazfodCOJYxaC7a69dA1BZzb03Dr7XI/1Cge/sG7vw9 /4FQSPl5s1UFztA6GyEO5W+jmdBT4fO+B40BdK/9of3DSmjzX22yZSTt03ugTWCrVO+D0E6x7sRSg J/jwoFUqx9awC3QnjO1IN4lBLfl1wS1j83kt3G0ZaaUOaFMRajji07yFg5E0/DWISOHk/aydrbUw7 g6ymmcdBATunoNAtALzXkAAu1DLTC9jcbV4t4Q1i2f58JJcM08xC6m5T+CabKtg/Po9wlUVWeygN+ XRfxWwpOasLZJG/kCbkA==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:54230 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfjSk-0007wg-IK; Wed, 27 Oct 2021 09:59:30 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 27 Oct 2021 15:59:18 +0200 Message-Id: <20211027135918.18833-1-ludo@gnu.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi! This patch set builds on Julien’s neat Guile-Netlink to finally provide a proper static networking configuration interface. One can now write things like: (service static-networking-service-type ;; Network configuration for one NIC, IPv4 + IPv6. (static-networking (addresses (list (network-address (device "eno1") (value "10.0.2.15/24")) (network-address (device "eno1") (value "2001:123:4567:101::1")))) (routes (list (network-route (destination "default") (gateway "10.0.2.2")) (network-route (destination "default") (gateway "2020:321:4567:42::1")))) (name-servers '("10.0.2.3")))) For the record, the ‘static-networking-service’ procedure currently in ‘master’ is IPv4-only and would not allow you to assign more than one address to an interface anyway, among other limitations. These long-overdue patches close an embarrassing gap. The interface provided here is a direct mapping of that of Guile-Netlink, which is the same as that of the ‘ip’ command, itself closely modeled after Linux’s internal interfaces AIUI. Thus, it should be roughly as expressive as ‘ip’, but declarative. I’m not a network person though, so I’d appreciate if more knowledgeable people would take a look at the interface. In particular, I’d like to have examples of ‘links’ to include in the manual—I’m not quite sure how to use that. Ideas? This patches preserve backward-compatibility: the ‘static-networking-service’ procedure still works the same. There’s one observable difference though: there’s only one ‘networking’ Shepherd service now; you no longer get ‘networking-eno1’ and similar. The ‘static-networking’ constructor was public since commit c9436025a90b86047ba2203d58bbf238f8f9b2f9 but undocumented; thus I changed the fields of without worrying about compatibility. I tested this with: make check-system \ TESTS="static-networking openvswitch ganeti-kvm dhcpd childhurd" I would appreciate more testing, including tests on the bare metal for IPv6 support. Ensuring portability to GNU/Hurd took me more time than I’d have thought, but it works. “Links” are not supported there, and only “default” routes are supported. I took a detour in commit “Use Guile-Netlink on GNU/Linux”: that patch shows that I was blissfully hoping to use good’ol ioctls on GNU/Hurd, but that turned out to be a dead end because they don’t support IPv6 (which really isn’t a surprise but I don’t know, I must have been lacking focus at that point of my journey!). With all this I think we should be able to do “cool things with containers”, but again, that’s not my area of expertise so please do chime in if you container networking is your thing. Feedback welcome! Ludo’. Ludovic Courtès (10): tests: Add 'static-networking' test. tests: openvswitch: Check whether ovs0 is up. doc: Add new "Networking Setup" node for the main setup options. gnu: guile-netlink: Allow cross-compilation. services: static-networking: Use Guile-Netlink on GNU/Linux. services: secret-service: Turn into a Shepherd service. services: static-networking: Change interface to mimic netlink. services: Define '%qemu-static-networking'. services: Define '%loopback-static-networking'. tests: Replace uses of deprecated 'static-networking-service'. doc/guix.texi | 505 ++++++++++++++++++++++---------- gnu/build/hurd-boot.scm | 10 +- gnu/build/secret-service.scm | 17 +- gnu/packages/guile-xyz.scm | 11 +- gnu/services/base.scm | 391 +++++++++++++++++++------ gnu/services/virtualization.scm | 45 ++- gnu/system/hurd.scm | 12 +- gnu/system/install.scm | 5 +- gnu/tests/ganeti.scm | 7 +- gnu/tests/networking.scm | 141 ++++++++- 10 files changed, 851 insertions(+), 293 deletions(-) base-commit: 0a42998a50e8bbe9e49142b21a570db00efe7491