From patchwork Fri Jul 14 15:29:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Abramov X-Patchwork-Id: 1055 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 7B13927BBEA; Fri, 14 Jul 2023 16:31:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 79F8327BBE2 for ; Fri, 14 Jul 2023 16:31:24 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qKKl9-0000HH-9C; Fri, 14 Jul 2023 11:31:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKl4-0000FJ-L9 for guix-patches@gnu.org; Fri, 14 Jul 2023 11:31:04 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qKKl4-0008H8-Df for guix-patches@gnu.org; Fri, 14 Jul 2023 11:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qKKl4-0004pA-8i for guix-patches@gnu.org; Fri, 14 Jul 2023 11:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64616] [PATCH 0/1] services: static-networking: Add support for bonds and vlans Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 14 Jul 2023 15:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64616@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168934863618508 (code B ref -1); Fri, 14 Jul 2023 15:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Jul 2023 15:30:36 +0000 Received: from localhost ([127.0.0.1]:43237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKKkd-0004oR-PK for submit@debbugs.gnu.org; Fri, 14 Jul 2023 11:30:36 -0400 Received: from lists.gnu.org ([2001:470:142::17]:38484) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKKkc-0004oG-Oo for submit@debbugs.gnu.org; Fri, 14 Jul 2023 11:30:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKkW-0000Br-WB for guix-patches@gnu.org; Fri, 14 Jul 2023 11:30:29 -0400 Received: from mail.mmer.org ([178.22.65.174]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qKKkU-0007t8-6R for guix-patches@gnu.org; Fri, 14 Jul 2023 11:30:28 -0400 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id 9fd62da2 for ; Fri, 14 Jul 2023 15:30:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to :subject:date:message-id:mime-version:content-transfer-encoding; s=dkim; bh=PDASo1cmA3HGGMUt9WTenveurpZ55dlsZfzM/PxzdeM=; b=9NEP ijcHjCsV3CCn/QoFHZcgUg+O8R7z0vp7i9aDKbLllYVxb41xmxNoj9Da6TCUgzF+ /02AXLLf6iTULXkrKoupVT66R9yHO5pTYPYheuxTQiMAlDEeIIoSmMd+A5g15avK B3h9EVE+LqkG8JMrlLmRaT4F3myUr0Fu7G4BbE0= Received: from delta (j74210.upc-j.chello.nl [24.132.74.210]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id 5fbd04b8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Fri, 14 Jul 2023 15:30:18 +0000 (UTC) Date: Fri, 14 Jul 2023 17:29:58 +0200 Message-Id: <20230714152958.22645-1-levenson@mmer.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Received-SPF: pass client-ip=178.22.65.174; envelope-from=levenson@mmer.org; helo=mail.mmer.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Reply-to: Alexey Abramov X-ACL-Warn: , Alexey Abramov via Guix-patches X-Patchwork-Original-From: Alexey Abramov via Guix-patches via From: Alexey Abramov Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Hi Guix! After new release of guile-netlink, I made some changes on a guix side to be able to configure bonds and vlans using static-networking declaration. In short, I introduced two more structures for *matching* existing interfaces: and . The reason for that is that struct creates new interfaces in network-set-up/linux. And if we want to construct a bond we need a way to apply settings for existing interfaces. With these changes applied, it is passable to do something like this: (static-networking (links (list (network-link (name "bond0") (type "bond") (arguments '((mode . "802.3ad") (miimon . 100) (lacp-active . "on") (lacp-rate . "fast")))) (network-link-by-macaddress (macaddress "98:11:22:33:44:55") (arguments '((master . "bond0")))) (network-link-by-macaddress (macaddress "98:11:22:33:44:56") (arguments '((master . "bond0")))) (network-link (name "bond0.1055") (type "vlan") (arguments '((id . 1055) (link . "bond0")))))) (addresses (list (network-address (value "192.168.1.4/24") (device "bond0.1055"))))) This example is taken from the test, where I removed interface renaming step. You should also know that network stack in Qemu won't with this configuration. The purpose of the test was to check if the stack has proper settings. If it is not enough, Please let me know. I can try to use openvswitch for that There is one thing that bothers me. Here is a comment I put in the code: It is interesting that "modprobe bonding" creates an interface bond0 straigt away. If we won't have bonding module, and execute `ip link add name bond0 type bond' we will get RTNETLINK answers: File exists This breaks our configuration if we want to use `bond0' name. Create (force modprobe bonding) and delete the interface to free up. As you can see I create an interface bond0 (in case some bonds are in configuration). It is forces netlink to load the bonding module and then delete it to free up the 'name'. Please let me know what you think. Alexey Abramov (1): services: static-networking: Add support for bonding. doc/guix.texi | 61 ++++++++++++++++- gnu/services/base.scm | 109 +++++++++++++++++++++++++++--- gnu/tests/networking.scm | 141 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 299 insertions(+), 12 deletions(-)