From unknown Tue Jun 24 22:40:08 2025 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) From: Alexey Abramov 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 Content-Transfer-Encoding: 8bit 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-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) 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(-) -- 2.40.1 From unknown Tue Jun 24 22:40:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64616] [PATCH 1/1] services: static-networking: Add support for bonding. References: <20230714152958.22645-1-levenson@mmer.org> In-Reply-To: <20230714152958.22645-1-levenson@mmer.org> Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 14 Jul 2023 15:37:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64616@debbugs.gnu.org Received: via spool by 64616-submit@debbugs.gnu.org id=B64616.168934901819104 (code B ref 64616); Fri, 14 Jul 2023 15:37:04 +0000 Received: (at 64616) by debbugs.gnu.org; 14 Jul 2023 15:36:58 +0000 Received: from localhost ([127.0.0.1]:43249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKKqo-0004y3-1l for submit@debbugs.gnu.org; Fri, 14 Jul 2023 11:36:58 -0400 Received: from mail.mmer.org ([178.22.65.174]:60660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qKKql-0004xf-8N for 64616@debbugs.gnu.org; Fri, 14 Jul 2023 11:36:56 -0400 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id c8958e80 for <64616@debbugs.gnu.org>; Fri, 14 Jul 2023 15:36:45 +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=m5E/modeeWo/MQJOpy75E6mEddK/nd072XlE3HKNYZk=; b=zL95 lxZbixvB+2/32uUxdDZk9725BmqOUvsyYERrWgkCUk6FW9Tc5D54Bo8BU7cGnqUz agTgGmTaIC7NTdiRsRTY0vo9R0L5XoV+Er+nvDXSmRpdSFHA4H09l4eutDdh8D5s 31Vh5eyPCbmU+VT5pXDWskwRM7sCb9QtV6MELHE= Received: from delta (j74210.upc-j.chello.nl [24.132.74.210]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id eafd2c03 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <64616@debbugs.gnu.org>; Fri, 14 Jul 2023 15:36:45 +0000 (UTC) From: Alexey Abramov Date: Fri, 14 Jul 2023 17:36:38 +0200 Message-Id: <20230714153638.23768-1-levenson@mmer.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/services/base.scm (, ): Provide records to match *existing* interfaces and amend them. * gnu/services/base.scm (network-set-up/linux, network-tear-down/linux): Add support to change settings of existing interfaces. Move address cleanup above links cleanup. * doc/guix.texi (Networking Setup): Document it. * gnu/tests/networking.scm (run-static-networking-advanced-test): Add tests --- doc/guix.texi | 61 ++++++++++++++++- gnu/services/base.scm | 109 +++++++++++++++++++++++++++--- gnu/tests/networking.scm | 141 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 299 insertions(+), 12 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 0cdc528c1c..69712a64fb 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20278,7 +20278,8 @@ IP address (a string) through which traffic is routed. @deftp {Data Type} network-link Data type for a network link (@pxref{Link,,, guile-netlink, -Guile-Netlink Manual}). +Guile-Netlink Manual}). A new interface with settings, specified in +arguments will be created. @table @code @item name @@ -20292,6 +20293,64 @@ List of arguments for this type of link. @end table @end deftp +@deftp {Data Type} network-link-by-macaddress +Data type for a network link with a specific MAC address. Arguments will +be applied to existing link matching the MAC. + +@table @code +@item macaddress +The MAC address to match a link. + +@item arguments +List of arguments for the link to be applied. +@end table +@end deftp + +@deftp {Data Type} network-link-by-name +Data type for a network link with a specific name. Arguments will be +applied to existing link mathing the name. + +@table @code +@item name +The name of the link. + +@item arguments +List of arguments for the link to be applied. +@end table +@end deftp + +Here is another example for more advance configuration with bonds and +vlans. The following snippet will create a bond out of two interfaces, +rename the slaves and create a vlan 1055 on top of it. + +@lisp +(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"))))) +@end lisp + @cindex loopback device @defvar %loopback-static-networking This is the @code{static-networking} record representing the ``loopback diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 636d827ff9..ae3b1b5dc3 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -133,6 +133,16 @@ (define-module (gnu services base) network-link-type network-link-arguments + network-link-by-macaddress + network-link-by-macaddress? + network-link-by-macaddress-maccaddress + network-link-by-macaddress-arguments + + network-link-by-name + network-link-by-name? + network-link-by-name-name + network-link-by-name-arguments + network-route network-route? network-route-destination @@ -2676,6 +2686,19 @@ (define-record-type* (type network-link-type) ;symbol--e.g.,'veth (arguments network-link-arguments)) ;list +(define-record-type* + network-link-by-macaddress make-network-link-by-macaddress + network-link-by-macaddress? + (macaddress network-link-by-macaddress-maccaddress) + (arguments network-link-by-macaddress-arguments)) + +(define-record-type* + network-link-by-name make-network-link-by-name + network-link-by-name? + (name network-link-by-name-name) + (arguments network-link-by-name-arguments)) + + (define-record-type* network-route make-network-route network-route? @@ -2795,7 +2818,64 @@ (define (network-set-up/linux config) (scheme-file "set-up-network" (with-extensions (list guile-netlink) #~(begin - (use-modules (ip addr) (ip link) (ip route)) + (use-modules (ip addr) (ip link) (ip route) + (srfi srfi-1) + (ice-9 format) + (ice-9 match)) + + (define (match-link-by field-accessor value) + (fold (lambda (link result) + (if (equal? (field-accessor link) value) + link + result)) + #f + (get-links))) + + (define (alist->keyword+value alist) + (fold (match-lambda* + (((k . v) r) + (cons* (symbol->keyword k) v r))) '() alist)) + + ;; FIXME: 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 + ;; bond0 name. + #$(let lp ((links links)) + (cond + ((null? links) #f) + ((and (network-link? (car links)) + (string=? (network-link-type (car links)) "bond")) + #~(begin + (false-if-exception (link-add "bond0" "bond")) + (link-del "bond0"))) + (else (lp (cdr links))))) + + #$@(map (match-lambda + (($ name type arguments) + #~(begin + (link-add #$name #$type #:type-args '#$arguments) + ;; XXX: If we add routes, addresses must be already + ;; assigned, and interfaces must be up. It doesn't + ;; matter if they won't have carrier or anything + (link-set #$name #:up #t))) + (($ macaddress arguments) + #~(let ((link (match-link-by link-addr #$macaddress))) + (if link + (apply link-set (link-id link) (alist->keyword+value '#$arguments)) + (format #t (G_ "Interface with macaddress '~a' not found~%") #$macaddress)))) + (($ name arguments) + #~(let ((link (match-link-by link-name #$name))) + (if link + (apply link-set (link-id link) (alist->keyword+value '#$arguments)) + (format #t (G_ "Interface with name '~a' not found~%") #$name))))) + links) #$@(map (lambda (address) #~(begin @@ -2814,11 +2894,7 @@ (define (network-set-up/linux config) #:multicast-on #t #:up #t))) addresses) - #$@(map (match-lambda - (($ name type arguments) - #~(link-add #$name #$type - #:type-args '#$arguments))) - links) + #$@(map (lambda (route) #~(route-add #$(network-route-destination route) #:device @@ -2862,11 +2938,9 @@ (define-syntax-rule (false-if-netlink-error exp) #:src #$(network-route-source route)))) routes) - #$@(map (match-lambda - (($ name type arguments) - #~(false-if-netlink-error - (link-del #$name)))) - links) + + ;; Cleanup addresses first, they might be assigned to + ;; created bonds, vlans or bridges. #$@(map (lambda (address) #~(false-if-netlink-error (addr-del #$(network-address-device @@ -2875,6 +2949,19 @@ (define-syntax-rule (false-if-netlink-error exp) #:ipv6? #$(network-address-ipv6? address)))) addresses) + + ;; It is now safe to delete some links + #$@(map (match-lambda + (($ name type arguments) + #~(false-if-netlink-error + (link-del #$name))) + ;; XXX: Here we can probably reset existing + ;; interfaces. + (($ macaddress arguments) + #f) + (($ name arguments) + #f)) + links) #f))))) (define (static-networking-shepherd-service config) diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm index a192c7e655..b2d6ec597a 100644 --- a/gnu/tests/networking.scm +++ b/gnu/tests/networking.scm @@ -39,6 +39,7 @@ (define-module (gnu tests networking) #:use-module (gnu services shepherd) #:use-module (ice-9 match) #:export (%test-static-networking + %test-static-networking-advanced %test-inetd %test-openvswitch %test-dhcpd @@ -124,6 +125,146 @@ (define %test-static-networking (guix combinators))))) (run-static-networking-test (virtual-machine os)))))) +(define (run-static-networking-advanced-test vm) + (define test + (with-imported-modules '((gnu build marionette) + (guix build syscalls)) + #~(begin + (use-modules (gnu build marionette) + (guix build syscalls) + (srfi srfi-64)) + + (define marionette + (make-marionette + '(#$vm "-net" "nic,model=e1000,macaddr=98:11:22:33:44:55" + "-net" "nic,model=e1000,macaddr=98:11:22:33:44:56"))) + + (test-runner-current (system-test-runner #$output)) + (test-begin "static-networking-advanced") + + (test-assert "service is up" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'networking)) + marionette)) + + (test-assert "network interfaces" + (marionette-eval + '(begin + (use-modules (guix build syscalls)) + (network-interface-names)) + marionette)) + + (test-equal "bond0 bonding mode" + "802.3ad 4" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/bonding/mode" read-line)) + marionette)) + + (test-equal "bond0 bonding lacp_rate" + "fast 1" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/bonding/lacp_rate" read-line)) + marionette)) + + (test-equal "bond0 bonding miimon" + "100" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/bonding/miimon" read-line)) + marionette)) + + (test-equal "bond0 bonding slaves" + "a b" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/bonding/slaves" read-line)) + marionette)) + + ;; The hw mac address will come from the first slave bonded to the + ;; channel. + (test-equal "bond0 mac address" + "98:11:22:33:44:55" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/address" read-line)) + marionette)) + + (test-equal "bond0.1055 is up" + IFF_UP + (marionette-eval + '(let* ((sock (socket AF_INET SOCK_STREAM 0)) + (flags (network-interface-flags sock "bond0.1055"))) + (logand flags IFF_UP)) + marionette)) + + (test-equal "bond0.1055 address is correct" + "192.168.1.4" + (marionette-eval + '(let* ((sock (socket AF_INET SOCK_STREAM 0)) + (addr (network-interface-address sock "bond0.1055"))) + (close-port sock) + (inet-ntop (sockaddr:fam addr) (sockaddr:addr addr))) + marionette)) + + (test-equal "bond0.1055 netmask is correct" + "255.255.255.0" + (marionette-eval + '(let* ((sock (socket AF_INET SOCK_STREAM 0)) + (mask (network-interface-netmask sock "bond0.1055"))) + (close-port sock) + (inet-ntop (sockaddr:fam mask) (sockaddr:addr mask))) + marionette)) + (test-end)))) + + (gexp->derivation "static-networking-advanced" test)) + +(define %test-static-networking-advanced + (system-test + (name "static-networking-advanced") + (description "Test the 'static-networking' service with advanced features like bonds, vlans etc...") + (value + (let ((os (marionette-operating-system + (simple-operating-system + (service static-networking-service-type + (list (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 '((name . "a") + (master . "bond0")))) + (network-link-by-macaddress + (macaddress "98:11:22:33:44:56") + (arguments '((name . "b") + (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")))))))) + #:imported-modules '((gnu services herd) + (guix combinators))))) + (run-static-networking-advanced-test (virtual-machine os)))))) + ;;; ;;; Inetd. -- 2.40.1 From unknown Tue Jun 24 22:40:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64616] [PATCH 0/1] services: static-networking: Add support for bonds and vlans Resent-From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Jul 2023 03:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Alexey Abramov Cc: 64616@debbugs.gnu.org Received: via spool by 64616-submit@debbugs.gnu.org id=B64616.16899955444369 (code B ref 64616); Sat, 22 Jul 2023 03:13:01 +0000 Received: (at 64616) by debbugs.gnu.org; 22 Jul 2023 03:12:24 +0000 Received: from localhost ([127.0.0.1]:35152 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN32d-00018O-SF for submit@debbugs.gnu.org; Fri, 21 Jul 2023 23:12:24 -0400 Received: from mail.envs.net ([5.199.136.28]:38434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN32b-00018B-2Y for 64616@debbugs.gnu.org; Fri, 21 Jul 2023 23:12:23 -0400 Received: from localhost (mail.envs.net [127.0.0.1]) by mail.envs.net (Postfix) with ESMTP id 94D5238A18D8; Sat, 22 Jul 2023 03:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa; t=1689995538; bh=sfIC5QEmSvZobf5FrjjzmNGX606DIBn8uYersGPYMDA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=SOE0SjnOk/Qf1bBq+Ogj4HV5C28dRoBcC2t3ewdFQU3VAHYDgataXWQZmrS+GfHDL wdHVwUq67UyEg57kY5Aa2VkP7oxxkcELozxjWKZoP4pVDFs8caNw5EK9mMWR+Derd/ kRS3yohej0/2c88OcAsVw9CHEKIDGDh+6FrUu+i0CXHNLNC4Kbm8D3AW8X1T2fywh6 N2YhKZ7xUM4hTQf1qUmaedArrRdObxwdtbDypOvnFJxOKyvRVrQ0TCeN99XWVOlPA9 YJ+bTX945wIkdJbHTsisgPILueHMczG3nrqsmWVkPTByP/SHHepuRjKE2bRB4MlX97 EaPddE93I1KrcZIVbJqVzC6jqpmjuMo9PrWbbYb6DUCStnjuNa8w7dPcax+Ip5vh8U 1ufeiAYWMMD6qqdHz/jjgmNEcEEi03xALE61bFJfXlYcnX+1fdqXq6ZbwXdai8E2k2 pksNtOaIPvGTD6hyVPUvbuZX2+bdfruAmlsb2i+KMcQ/P0aSV7apsqEspZ6edMm1c9 L80UW4BHkN2wzCKZ/pyS2cqoZD6OOg8X3kT+Olb4sN7UGbvLWIg62/MjoKUA1PWLX7 Thr+hVl65IQOiMBmrIvYEaHyVCozdM1zbKZUGcX7zWW77BeLYlFfV8j0/fS1Rq+IpX 52kCDIk1OJ3sUUJp3r7Y5KPc= X-Virus-Scanned: Debian amavisd-new at mail.envs.net Received: from mail.envs.net ([127.0.0.1]) by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id bv-J1e_rfVYd; Sat, 22 Jul 2023 03:12:15 +0000 (UTC) Received: from localhost (unknown [117.174.235.109]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.envs.net (Postfix) with ESMTPSA; Sat, 22 Jul 2023 03:12:15 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 617570f7; Sat, 22 Jul 2023 03:12:03 +0000 (UTC) From: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= References: <20230714152958.22645-1-levenson@mmer.org> Date: Sat, 22 Jul 2023 11:12:03 +0800 In-Reply-To: <20230714152958.22645-1-levenson@mmer.org> (Alexey Abramov's message of "Fri, 14 Jul 2023 17:29:58 +0200") Message-ID: <874jlwmygs.fsf@envs.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alexey Abramov writes: > 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. Hello I think this is a useful feature! > > 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. If I understand correctly, this will allow we create bond interfaces in static-networking-service-type and configure those interfaces with static IP. Maybe there are needs for create bond interfaces, but configure them with dhcp dynamic IP, will we able to that with this patch? From unknown Tue Jun 24 22:40:08 2025 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: Tue, 25 Jul 2023 11:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Cc: 64616@debbugs.gnu.org Received: via spool by 64616-submit@debbugs.gnu.org id=B64616.169028329227534 (code B ref 64616); Tue, 25 Jul 2023 11:09:02 +0000 Received: (at 64616) by debbugs.gnu.org; 25 Jul 2023 11:08:12 +0000 Received: from localhost ([127.0.0.1]:44729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qOFtk-0007A2-0q for submit@debbugs.gnu.org; Tue, 25 Jul 2023 07:08:12 -0400 Received: from mail.mmer.org ([178.22.65.174]:33480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qOFtg-00079l-2J for 64616@debbugs.gnu.org; Tue, 25 Jul 2023 07:08:10 -0400 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id f90bcb4c; Tue, 25 Jul 2023 11:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; s=dkim; bh=/m3J/SNxo8AO TCujTjSUBRKWgUkUGSdSsbAzASRfzT4=; b=BlRe21AqhxOfMXIFhYmVSwih4Ilz 92ihItUQGjMjbygdUW4c8jL7FBkjJSSJ2upJxCBG75BqtW0zX7Dgt+uRe/t3djEb fckHC3hohrNYNF0pk3rRCTzQRsUuY34GRCEi8WICP+VHDH2aZieSuIpbR2nkkahR sGUyfl+oipQQU4w= Received: from delta.lan (j74210.upc-j.chello.nl [24.132.74.210]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id a648e71a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 25 Jul 2023 11:08:00 +0000 (UTC) From: Alexey Abramov In-Reply-To: <874jlwmygs.fsf@envs.net> ("=?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?="'s message of "Sat, 22 Jul 2023 11:12:03 +0800") References: <20230714152958.22645-1-levenson@mmer.org> <874jlwmygs.fsf@envs.net> Date: Tue, 25 Jul 2023 13:07:59 +0200 Message-ID: <87sf9c9rlc.fsf@delta.lan> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi! =E5=AE=8B=E6=96=87=E6=AD=A6 writes: > Alexey Abramov writes: > >> Hi Guix! >> >> After new release of guile-netlink, I made some changes on a guix side t= o be >> able to configure bonds and vlans using static-networking declaration. > > Hello I think this is a useful feature! >> >> In short, I introduced two more structures for *matching* existing inter= faces: >> and . The reason for = that >> is that struct creates new interfaces in network-set-up/l= inux. >> And if we want to construct a bond we need a way to apply settings for >> existing interfaces. > > If I understand correctly, this will allow we create bond interfaces in > static-networking-service-type and configure those interfaces with > static IP. Maybe there are needs for create bond interfaces, but > configure them with dhcp dynamic IP, will we able to that with this > patch? Thanks for taking the time to check it. You absolutely right. Running dhcp-client and static-networking on routers, for example, is must. This p= atch won't allow this, but another one related to dhcp-client-configuration bug#64850 = will.=20 --=20 Alexey From unknown Tue Jun 24 22:40:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64616] [PATCH 0/1] services: static-networking: Add support for bonds and vlans Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 12 Aug 2023 20:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Alexey Abramov Cc: Julien Lepiller , 64616@debbugs.gnu.org Received: via spool by 64616-submit@debbugs.gnu.org id=B64616.16918721558775 (code B ref 64616); Sat, 12 Aug 2023 20:30:02 +0000 Received: (at 64616) by debbugs.gnu.org; 12 Aug 2023 20:29:15 +0000 Received: from localhost ([127.0.0.1]:57530 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUvEY-0002HS-Ow for submit@debbugs.gnu.org; Sat, 12 Aug 2023 16:29:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37808) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUvET-0002H9-F9 for 64616@debbugs.gnu.org; Sat, 12 Aug 2023 16:29:13 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qUvEM-0007Yi-6D; Sat, 12 Aug 2023 16:29:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=B7pG6piZx0W7fxirBqzMq8zWY0SsnhOM+bBM5eo4EDw=; b=jGcHoNyb8p8lg/6l0iVi Nsu81QFdhnwpUMjJ3sVGAhVilwLtYsZ6MSbnRP7hQ7jWqZeU36uurY94KxFPzpPrs9Fos1XhR9nJl 35rXNsNdXJ5FcEwLe9/TJ85YxrwYploSicKE0OhhjmGaEHrH2FQCt/Sg/PxL2z9q5mbjuBFS0HIhI /eZKdQUlOUv8xCeuDijv+xz1Ca4yOaSleZ7VSH+cAlavaFb0Fflf92DJ5kBFcoJcYOE/FKdEoHbU6 W4nHMIerEHbgzJzmuWIBVaruMCIGZ0mSkRlIz6Y5muTcJ+pXn/fqxoo0gtX5VQDeGiYyN5gQg0Jb7 ribs9WXhYfhftg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20230714152958.22645-1-levenson@mmer.org> <20230714153638.23768-1-levenson@mmer.org> Date: Sat, 12 Aug 2023 22:28:59 +0200 In-Reply-To: <20230714153638.23768-1-levenson@mmer.org> (Alexey Abramov's message of "Fri, 14 Jul 2023 17:36:38 +0200") Message-ID: <87350of1is.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Alexey, Alexey Abramov skribis: > * gnu/services/base.scm (, > ): Provide records to match *existing* > interfaces and amend them. > * gnu/services/base.scm (network-set-up/linux, > network-tear-down/linux): Add support to change settings of existing > interfaces. Move address cleanup above links cleanup. > * doc/guix.texi (Networking Setup): Document it. > * gnu/tests/networking.scm (run-static-networking-advanced-test): Add tes= ts Sounds like a great addition! Not being a networking expert, I=E2=80=99d like to have someone else commen= t on it (Cc=E2=80=99ing Julien in case they=E2=80=99re around), but I can make s= ome preliminary comments: > @deftp {Data Type} network-link > Data type for a network link (@pxref{Link,,, guile-netlink, > -Guile-Netlink Manual}). > +Guile-Netlink Manual}). A new interface with settings, specified in > +arguments will be created. I don=E2=80=99t understand this sentence, especially since creating a record will not create a new interface. > +@deftp {Data Type} network-link-by-macaddress > +Data type for a network link with a specific MAC address. Arguments will > +be applied to existing link matching the MAC. > + > +@table @code > +@item macaddress > +The MAC address to match a link. [...] > +@deftp {Data Type} network-link-by-name > +Data type for a network link with a specific name. Arguments will be > +applied to existing link mathing the name. > + > +@table @code > +@item name > +The name of the link. [...] > +(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")))) My first reaction is that a =E2=80=9Cnetwork link matched by MAC address=E2= =80=9D is still =E2=80=9Ca network link=E2=80=9D. IOW, I would find it more natural = to have a single data type; it would also mirror the data types used by the RTnetlink layer. To do that, what would you think of keeping just the record, but adding two new fields: =E2=80=98for-mac-address=E2=80=99 and =E2=80=98for-device=E2=80=99? (As an aside, please don=E2=80=99t abbreviate; so =E2=80=98mac-address=E2= =80=99 rather than =E2=80=98macaddress=E2=80=99.) > +Here is another example for more advance configuration with bonds and > +vlans. The following snippet will create a bond out of two interfaces, > +rename the slaves and create a vlan 1055 on top of it. Could you (1) explain in one or two sentences what bonds and VLANs are, ideally with a cross-reference to learn more about it, and (2) explain the example in a bit more detail? I would also encourage you to use the =E2=80=9Cupstream=E2=80=9D and =E2=80=9Cdownstream=E2=80=9D rather than =E2= =80=9Cmaster=E2=80=9D and =E2=80=9Cslave=E2=80=9D, due to their obvious connotation, though I realize that Guile-Netlink and presumably Linux/RTnetlink itself use that terminology. > +(define (run-static-networking-advanced-test vm) This is awesome! Thank you! Ludo=E2=80=99. From unknown Tue Jun 24 22:40:08 2025 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: Mon, 28 Aug 2023 16:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Julien Lepiller , 64616@debbugs.gnu.org Received: via spool by 64616-submit@debbugs.gnu.org id=B64616.169324187112384 (code B ref 64616); Mon, 28 Aug 2023 16:58:02 +0000 Received: (at 64616) by debbugs.gnu.org; 28 Aug 2023 16:57:51 +0000 Received: from localhost ([127.0.0.1]:48932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qafYl-0003Dg-4J for submit@debbugs.gnu.org; Mon, 28 Aug 2023 12:57:51 -0400 Received: from mail.mmer.org ([178.22.65.174]:42462) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qafYi-0003DR-B6 for 64616@debbugs.gnu.org; Mon, 28 Aug 2023 12:57:49 -0400 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id 517c1f96; Mon, 28 Aug 2023 16:57:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=mmer.org; h=from:to:cc :subject:in-reply-to:references:date:message-id:mime-version :content-type:content-transfer-encoding; s=dkim; bh=ZGm71SLSUtHj 0fDMwcBcm9m9V9NVxDkE4AmoJH08hhk=; b=nQ7eJ08FSGBp8JbjK3RS8jeYYS2T GWVUXUE7hSI910uVkNZ235UezC0ORD7Zhatyx4jSd6zBv0KuSy/HocKbcDBX3han 17dHYoK3irrE9PQQE3SLvpDxWmhWQoVF3BuN9U0GvJn6umkOo5bAFckHUpRg+03M l2LrF1xiuBEUF20= Received: from delta.lan (i60212.upc-i.chello.nl [62.195.60.212]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id ca71e0ec (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 28 Aug 2023 16:57:34 +0000 (UTC) From: Alexey Abramov In-Reply-To: <87350of1is.fsf_-_@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sat, 12 Aug 2023 22:28:59 +0200") References: <20230714152958.22645-1-levenson@mmer.org> <20230714153638.23768-1-levenson@mmer.org> <87350of1is.fsf_-_@gnu.org> Date: Mon, 28 Aug 2023 18:57:32 +0200 Message-ID: <87r0nnt88z.fsf@delta.lan> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludo, Julien Ludovic Court=C3=A8s writes: > Hi Alexey, > > Alexey Abramov skribis: > >> * gnu/services/base.scm (, >> ): Provide records to match *existing* >> interfaces and amend them. >> * gnu/services/base.scm (network-set-up/linux, >> network-tear-down/linux): Add support to change settings of existing >> interfaces. Move address cleanup above links cleanup. >> * doc/guix.texi (Networking Setup): Document it. >> * gnu/tests/networking.scm (run-static-networking-advanced-test): Add te= sts > > Sounds like a great addition! > > Not being a networking expert, I=E2=80=99d like to have someone else comm= ent on > it (Cc=E2=80=99ing Julien in case they=E2=80=99re around), but I can make= some > preliminary comments: Many thanks!=20 >> @deftp {Data Type} network-link >> Data type for a network link (@pxref{Link,,, guile-netlink, >> -Guile-Netlink Manual}). >> +Guile-Netlink Manual}). A new interface with settings, specified in >> +arguments will be created. > > I don=E2=80=99t understand this sentence, especially since creating a > record will not create a new interface. Yeah. You right. I somehow got an impression that network-link is for link-add. No comments. ) [...] > My first reaction is that a =E2=80=9Cnetwork link matched by MAC address= =E2=80=9D is > still =E2=80=9Ca network link=E2=80=9D. IOW, I would find it more natura= l to have a > single data type; it would also mirror the data types used by the > RTnetlink layer. > > To do that, what would you think of keeping just the > record, but adding two new fields: =E2=80=98for-mac-address=E2=80=99 and > =E2=80=98for-device=E2=80=99? > > (As an aside, please don=E2=80=99t abbreviate; so =E2=80=98mac-address=E2= =80=99 rather than > =E2=80=98macaddress=E2=80=99.) I like that, thanks. I have a patch series where you can define the configuration like this: --8<---------------cut here---------------start------------->8--- (list (network-link (name "bond0") (type "bond") (arguments '((mode . "802.3ad") (miimon . 100) (lacp-active . "on") (lacp-rate . "fast")))) (network-link (for-mac-address "98:11:22:33:44:55") (arguments '((name . "a") (master . "bond0")))) (network-link (for-mac-address "98:11:22:33:44:56") (arguments '((name . "b") (master . "bond0")))) (network-link (name "bond0.1055") (type "vlan") (arguments '((id . 1055) (link . "bond0"))))) --8<---------------cut here---------------end--------------->8--- Is that what you meant? However, after your suggestions... What do you think if we could use the name field without type to amend existing ones, and for example netlink with mac-address field only, to match interfaces by mac. Something like this: --8<---------------cut here---------------start------------->8--- (list (network-link (mac-address "98:11:22:33:44:55") (arguments '((name . "a")))) (network-link (mac-address "98:11:22:33:44:56") (arguments '((name . "b")))) (network-link (name "bond0") (type "bond") (arguments '((mode . "802.3ad") (miimon . 100) (lacp-active . "on") (lacp-rate . "fast")))) =20=20=20=20=20=20 (network-link (name "a") (arguments '((master . "bond0")))) (network-link (name "b") (arguments '((master . "bond0")))) (network-link (name "bond0.1055") (type "vlan") (arguments '((id . 1055) (link . "bond0"))))) --8<---------------cut here---------------end--------------->8--- IMHO this does look better. What do you think?=20 >> +Here is another example for more advance configuration with bonds and >> +vlans. The following snippet will create a bond out of two interfaces, >> +rename the slaves and create a vlan 1055 on top of it. > > Could you (1) explain in one or two sentences what bonds and VLANs are, > ideally with a cross-reference to learn more about it, and (2) explain > the example in a bit more detail? Got it, will do. > I would also encourage you to use the =E2=80=9Cupstream=E2=80=9D and =E2= =80=9Cdownstream=E2=80=9D > rather than =E2=80=9Cmaster=E2=80=9D and =E2=80=9Cslave=E2=80=9D, due to = their obvious connotation, > though I realize that Guile-Netlink and presumably Linux/RTnetlink > itself use that terminology. I see. The technology is indeed uses this exact connotation. Documentation [1] itself also uses these terms. I personally, don't see how this change will help people with configuration or searching for documentation. With all respect, truly, I would like to keep master/slave terminology, at least here. > This is awesome! ) I am trying.=20 --=20 Alexey Footnotes: [1] https://www.kernel.org/doc/Documentation/networking/bonding.txt From unknown Tue Jun 24 22:40:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64616] [PATCH 0/1] services: static-networking: Add support for bonds and vlans Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 09 Sep 2023 10:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Alexey Abramov Cc: Julien Lepiller , 64616@debbugs.gnu.org Received: via spool by 64616-submit@debbugs.gnu.org id=B64616.169425670014391 (code B ref 64616); Sat, 09 Sep 2023 10:52:01 +0000 Received: (at 64616) by debbugs.gnu.org; 9 Sep 2023 10:51:40 +0000 Received: from localhost ([127.0.0.1]:46247 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qevYy-0003k2-47 for submit@debbugs.gnu.org; Sat, 09 Sep 2023 06:51:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qevYw-0003jo-Ow for 64616@debbugs.gnu.org; Sat, 09 Sep 2023 06:51:39 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qevYo-000155-8Q; Sat, 09 Sep 2023 06:51:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=wfo2eSxs9H38w5NPRYq35RXzHtwqOUKHLe7itPj2t5A=; b=HrRO7ymTgyZ3O18qVV+8 /he+TG8XR+HYqRN33hYMhLHTX3bR7w2A9sSFjBl97XQkcdROf2YZ6hieFiA5GYNvTI+AGu6qoEuI4 XEFjAOPpAjbIo4/RjYhRjdVcbgaLcgbbLnpGWN2++8kTvdyIv4jEipN7VG989cy1/0lPs+kwQVthc dvFUlGcKUCugtCW7lwR+GTIjKw+xS0EWgPVaDg23A2GsnR0rEacze5HbzKVxxVa0+/RsANxCT5xfe O5OCKK2+k6e08U5NnJox3GAlC2Y5cpY0+UJdwBLG+pYrhXiBcG90CS+eEt5pZXAdRNkrOuF70WvKB IF5CoI4d64Bz9g==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20230714152958.22645-1-levenson@mmer.org> <20230714153638.23768-1-levenson@mmer.org> <87350of1is.fsf_-_@gnu.org> <87r0nnt88z.fsf@delta.lan> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Tridi 23 Fructidor an 231 de la =?UTF-8?Q?R=C3=A9volution,?= jour du Houblon X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 09 Sep 2023 12:51:28 +0200 In-Reply-To: <87r0nnt88z.fsf@delta.lan> (Alexey Abramov's message of "Mon, 28 Aug 2023 18:57:32 +0200") Message-ID: <87a5tvzkjz.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Alexey, Alexey Abramov skribis: > Is that what you meant? However, after your suggestions... What do you > think if we could use the name field without type to amend existing > ones, and for example netlink with mac-address field only, to match > interfaces by mac. Something like this: > > (list (network-link > (mac-address "98:11:22:33:44:55") > (arguments '((name . "a")))) > > (network-link > (mac-address "98:11:22:33:44:56") > (arguments '((name . "b")))) > > (network-link > (name "bond0") > (type "bond") > (arguments '((mode . "802.3ad") > (miimon . 100) > (lacp-active . "on") > (lacp-rate . "fast")))) >=20=20=20=20=20=20=20 > (network-link > (name "a") > (arguments '((master . "bond0")))) > > (network-link > (name "b") > (arguments '((master . "bond0")))) > > (network-link > (name "bond0.1055") > (type "vlan") > (arguments '((id . 1055) > (link . "bond0"))))) > > IMHO this does look better. What do you think?=20 Yes, I like it better too. Go for it! Thanks, Ludo=E2=80=99. From unknown Tue Jun 24 22:40:08 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#64616] [PATCH v2] services: static-networking: Add support for bonding. References: <20230714152958.22645-1-levenson@mmer.org> In-Reply-To: <20230714152958.22645-1-levenson@mmer.org> Resent-From: Alexey Abramov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 29 Sep 2023 19:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64616 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64616@debbugs.gnu.org Received: via spool by 64616-submit@debbugs.gnu.org id=B64616.169601609625171 (code B ref 64616); Fri, 29 Sep 2023 19:35:01 +0000 Received: (at 64616) by debbugs.gnu.org; 29 Sep 2023 19:34:56 +0000 Received: from localhost ([127.0.0.1]:57242 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qmJGJ-0006Xu-0N for submit@debbugs.gnu.org; Fri, 29 Sep 2023 15:34:55 -0400 Received: from mail.mmer.org ([178.22.65.174]:33516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qmJGF-0006XV-5L for 64616@debbugs.gnu.org; Fri, 29 Sep 2023 15:34:53 -0400 Received: from mail.mmer.org (localhost [127.0.0.1]) by mail.mmer.org (OpenSMTPD) with ESMTP id 85444033 for <64616@debbugs.gnu.org>; Fri, 29 Sep 2023 19:34:27 +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=bQfoxEMlMuxblbRY4sCaguSGs3DQKhUZOonPaos/i8o=; b=6/9/ ji/uCkWVHJ0WQXRDXXYcSGkkoscZvh7PCbUqRJdkg17+SzsirE9o3cr+vTjh5y4z QNnqlJKw+K/ZUyrLELhS8FI66CCGLX9Z47M09e1z9rYLzfFDfhMuSnnfxEqHYkZ7 tIgOvrpLdXzMDUbBnvpxn7ECJVeORzQbVgb6gJY= Received: from delta (i60212.upc-i.chello.nl [62.195.60.212]) by mail.mmer.org (OpenSMTPD) with ESMTPSA id c4f517c2 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for <64616@debbugs.gnu.org>; Fri, 29 Sep 2023 19:34:27 +0000 (UTC) From: Alexey Abramov Date: Fri, 29 Sep 2023 21:34:06 +0200 Message-Id: <20230929193406.19755-1-levenson@mmer.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * gnu/services/base.scm (): Add mac-address field. Set type field to #f by default, so it won't be mandatory. network-link without a type will be used for existing interfaces. (assert-network-link-mac-address, mac-address?): Add sanitizer. Allow valid mac-address or #f. (assert-network-link-type): Add sanitizer. Allow symbol or #f. * gnu/services/base.scm (network-set-up/linux, network-tear-down/linux): Adapt to new structure. * doc/guix.texi (Networking Setup): Document it. * gnu/tests/networking.scm (run-static-networking-advanced-test): New variable. --- doc/guix.texi | 61 +++++++++++++++- gnu/services/base.scm | 134 ++++++++++++++++++++++++++++++---- gnu/tests/networking.scm | 151 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 330 insertions(+), 16 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index f49ed894a7..ba8a4a704e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -20414,20 +20414,75 @@ IP address (a string) through which traffic is routed. @deftp {Data Type} network-link Data type for a network link (@pxref{Link,,, guile-netlink, -Guile-Netlink Manual}). +Guile-Netlink Manual}). During startup, network links are employed to +construct or modify existing or virtual ethernet links. These ethernet +links can be identified by their @var{name} or @var{mac-address}. If +there is a need to create virtual interface, @var{name} and @var{type} +fields are required. @table @code @item name -The name of the link---e.g., @code{"v0p0"}. +The name of the link---e.g., @code{"v0p0"} (default: @code{#f}). @item type -A symbol denoting the type of the link---e.g., @code{'veth}. +A symbol denoting the type of the link---e.g., @code{'veth} (default: @code{#f}). + +@item mac-address +The mac-address of the link---e.g., @code{"98:11:22:33:44:55"} (default: @code{#f}). @item arguments List of arguments for this type of link. @end table @end deftp +Consider a scenario where a server equipped with a network interface +which has multiple ports. These ports are connected to a switch, which +supports @uref{https://en.wikipedia.org/wiki/Link_aggregation, link +aggregation} (also known as bonding or NIC teaming). The switch uses +port channels to consolidate multiple physical interfaces into one +logical interface to provide higher bandwidth, load balancing, and link +redundancy. When a port is added to a LAG (or link aggregation group), +it inherits the properties of the port-channel. Some of these +properties are VLAN membership, trunk status, and so on. + +@uref{https://en.wikipedia.org/wiki/Virtual_LAN, VLAN} (or virtual local +area network) is a logical network that is isolated from other VLANs on +the same physical network. This can be used to segregate traffic, +improve security, and simplify network management. + +With all that in mind let's configure our static network for the server. +We will bond two existing interfaces together using 802.3ad schema and on +top of it, build a VLAN interface with id 1055. We assign a static ip +to our new VLAN interface. + +@lisp +(static-networking + (links (list (network-link + (name "bond0") + (type 'bond) + (arguments '((mode . "802.3ad") + (miimon . 100) + (lacp-active . "on") + (lacp-rate . "fast")))) + + (network-link + (mac-address "98:11:22:33:44:55") + (arguments '((master . "bond0")))) + + (network-link + (mac-address "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"))))) +@end lisp + @cindex loopback device @defvar %loopback-static-networking This is the @code{static-networking} record representing the ``loopback diff --git a/gnu/services/base.scm b/gnu/services/base.scm index b3f2d2e8b8..aaf9ae5359 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2642,6 +2642,33 @@ (define-compile-time-procedure (assert-valid-address (address string?)) address))))))) address) +(define (mac-address? str) + "Return true if STR is a valid MAC address." + (let ((pattern (make-regexp "^([0-9A-Fa-f]{2}:?){6}$"))) + (false-if-exception (vector? (regexp-exec pattern str))))) + +(define-compile-time-procedure (assert-network-link-mac-address (value identity)) + (cond + ((eq? value #f) value) + ((and (string? value) (mac-address? value)) value) + (else (raise + (make-compound-condition + (formatted-message (G_ "Value (~S) is not a valid mac address.~%") + value) + (condition (&error-location + (location (source-properties->location procedure-call-location))))))))) + +(define-compile-time-procedure (assert-network-link-type (value identity)) + (match value + (#f value) + (('quote _) (datum->syntax #'value value)) + (else + (raise + (make-compound-condition + (formatted-message (G_ "Value (~S) is not a symbol.~%") value) + (condition (&error-location + (location (source-properties->location procedure-call-location))))))))) + (define-record-type* static-networking make-static-networking static-networking? @@ -2669,8 +2696,14 @@ (define-record-type* (define-record-type* network-link make-network-link network-link? - (name network-link-name) ;string--e.g, "v0p0" - (type network-link-type) ;symbol--e.g.,'veth + (name network-link-name + (default #f)) ;string or #f --e.g, "v0p0" + (type network-link-type + (sanitize assert-network-link-type) + (default #f)) ;symbol or #f--e.g.,'veth, 'bond + (mac-address network-link-mac-address + (sanitize assert-network-link-mac-address) + (default #f)) (arguments network-link-arguments)) ;list (define-record-type* @@ -2795,7 +2828,77 @@ (define (network-set-up/linux config) (scheme-file "set-up-network" (with-extensions (list guile-netlink) #~(begin - (use-modules (ip addr) (ip link) (ip route)) + (use-modules (ip addr) (ip link) (ip route) + (srfi srfi-1) + (ice-9 format) + (ice-9 match)) + + (define (match-link-by field-accessor value) + (fold (lambda (link result) + (if (equal? (field-accessor link) value) + link + result)) + #f + (get-links))) + + (define (alist->keyword+value alist) + (fold (match-lambda* + (((k . v) r) + (cons* (symbol->keyword k) v r))) '() alist)) + + ;; FIXME: 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 + ;; bond0 name. + #$(let lp ((links links)) + (cond + ((null? links) #f) + ((and (network-link? (car links)) + ;; Type is not mandatory + (false-if-exception + (eq? (network-link-type (car links)) 'bond))) + #~(begin + (false-if-exception (link-add "bond0" "bond")) + (link-del "bond0"))) + (else (lp (cdr links))))) + + #$@(map (match-lambda + (($ name type mac-address arguments) + (cond + ;; Create a new interface + ((and (string? name) (symbol? type)) + #~(begin + (link-add #$name (symbol->string '#$type) #:type-args '#$arguments) + ;; XXX: If we add routes, addresses must be + ;; already assigned, and interfaces must be + ;; up. It doesn't matter if they won't have + ;; carrier or anything. + (link-set #$name #:up #t))) + + ;; Amend an existing interface + ((and (string? name) + (eq? type #f)) + #~(let ((link (match-link-by link-name #$name))) + (if link + (apply link-set + (link-id link) + (alist->keyword+value '#$arguments)) + (format #t (G_ "Interface with name '~a' not found~%") #$name)))) + ((string? mac-address) + #~(let ((link (match-link-by link-addr #$mac-address))) + (if link + (apply link-set + (link-id link) + (alist->keyword+value '#$arguments)) + (format #t (G_ "Interface with mac-address '~a' not found~%") #$mac-address))))))) + links) #$@(map (lambda (address) #~(begin @@ -2814,11 +2917,7 @@ (define (network-set-up/linux config) #:multicast-on #t #:up #t))) addresses) - #$@(map (match-lambda - (($ name type arguments) - #~(link-add #$name #$type - #:type-args '#$arguments))) - links) + #$@(map (lambda (route) #~(route-add #$(network-route-destination route) #:device @@ -2862,11 +2961,9 @@ (define-syntax-rule (false-if-netlink-error exp) #:src #$(network-route-source route)))) routes) - #$@(map (match-lambda - (($ name type arguments) - #~(false-if-netlink-error - (link-del #$name)))) - links) + + ;; Cleanup addresses first, they might be assigned to + ;; created bonds, vlans or bridges. #$@(map (lambda (address) #~(false-if-netlink-error (addr-del #$(network-address-device @@ -2875,6 +2972,17 @@ (define-syntax-rule (false-if-netlink-error exp) #:ipv6? #$(network-address-ipv6? address)))) addresses) + + ;; It is now safe to delete some links + #$@(map (match-lambda + (($ name type mac-address arguments) + (cond + ;; We delete interfaces that were created + ((and (string? name) (symbol? type)) + #~(false-if-netlink-error + (link-del #$name))) + (else #t)))) + links) #f))))) (define (static-networking-shepherd-service config) diff --git a/gnu/tests/networking.scm b/gnu/tests/networking.scm index a192c7e655..52f818af48 100644 --- a/gnu/tests/networking.scm +++ b/gnu/tests/networking.scm @@ -39,6 +39,7 @@ (define-module (gnu tests networking) #:use-module (gnu services shepherd) #:use-module (ice-9 match) #:export (%test-static-networking + %test-static-networking-advanced %test-inetd %test-openvswitch %test-dhcpd @@ -124,6 +125,156 @@ (define %test-static-networking (guix combinators))))) (run-static-networking-test (virtual-machine os)))))) +(define (run-static-networking-advanced-test vm) + (define test + (with-imported-modules '((gnu build marionette) + (guix build syscalls)) + #~(begin + (use-modules (gnu build marionette) + (guix build syscalls) + (srfi srfi-64)) + + (define marionette + (make-marionette + '(#$vm "-net" "nic,model=e1000,macaddr=98:11:22:33:44:55" + "-net" "nic,model=e1000,macaddr=98:11:22:33:44:56"))) + + (test-runner-current (system-test-runner #$output)) + (test-begin "static-networking-advanced") + + (test-assert "service is up" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'networking)) + marionette)) + + (test-assert "network interfaces" + (marionette-eval + '(begin + (use-modules (guix build syscalls)) + (network-interface-names)) + marionette)) + + (test-equal "bond0 bonding mode" + "802.3ad 4" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/bonding/mode" read-line)) + marionette)) + + (test-equal "bond0 bonding lacp_rate" + "fast 1" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/bonding/lacp_rate" read-line)) + marionette)) + + (test-equal "bond0 bonding miimon" + "100" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/bonding/miimon" read-line)) + marionette)) + + (test-equal "bond0 bonding slaves" + "a b" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/bonding/slaves" read-line)) + marionette)) + + ;; The hw mac address will come from the first slave bonded to the + ;; channel. + (test-equal "bond0 mac address" + "98:11:22:33:44:55" + (marionette-eval + '(begin + (use-modules (ice-9 rdelim)) + (call-with-input-file "/sys/class/net/bond0/address" read-line)) + marionette)) + + (test-equal "bond0.1055 is up" + IFF_UP + (marionette-eval + '(let* ((sock (socket AF_INET SOCK_STREAM 0)) + (flags (network-interface-flags sock "bond0.1055"))) + (logand flags IFF_UP)) + marionette)) + + (test-equal "bond0.1055 address is correct" + "192.168.1.4" + (marionette-eval + '(let* ((sock (socket AF_INET SOCK_STREAM 0)) + (addr (network-interface-address sock "bond0.1055"))) + (close-port sock) + (inet-ntop (sockaddr:fam addr) (sockaddr:addr addr))) + marionette)) + + (test-equal "bond0.1055 netmask is correct" + "255.255.255.0" + (marionette-eval + '(let* ((sock (socket AF_INET SOCK_STREAM 0)) + (mask (network-interface-netmask sock "bond0.1055"))) + (close-port sock) + (inet-ntop (sockaddr:fam mask) (sockaddr:addr mask))) + marionette)) + (test-end)))) + + (gexp->derivation "static-networking-advanced" test)) + +(define %test-static-networking-advanced + (system-test + (name "static-networking-advanced") + (description "Test the 'static-networking' service with advanced features like bonds, vlans etc...") + (value + (let ((os (marionette-operating-system + (simple-operating-system + (service static-networking-service-type + (list (static-networking + (links (list + + (network-link + (mac-address "98:11:22:33:44:55") + (arguments '((name . "a")))) + + (network-link + (mac-address "98:11:22:33:44:56") + (arguments '((name . "b")))) + + (network-link + (name "bond0") + (type 'bond) + (arguments '((mode . "802.3ad") + (miimon . 100) + (lacp-active . "on") + (lacp-rate . "fast")))) + + (network-link + (name "a") + (arguments '((master . "bond0")))) + + (network-link + (name "b") + (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")))))))) + #:imported-modules '((gnu services herd) + (guix combinators))))) + (run-static-networking-advanced-test (virtual-machine os)))))) + ;;; ;;; Inetd. -- 2.41.0 From unknown Tue Jun 24 22:40:08 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Alexey Abramov Subject: bug#64616: closed (Re: [bug#64616] [PATCH v2] services: static-networking: Add support for bonding.) Message-ID: References: <87h6mxt7po.fsf@gnu.org> <20230714152958.22645-1-levenson@mmer.org> X-Gnu-PR-Message: they-closed 64616 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 64616@debbugs.gnu.org Date: Wed, 11 Oct 2023 17:02:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1697043721-785-1" This is a multi-part message in MIME format... ------------=_1697043721-785-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #64616: [PATCH 0/1] services: static-networking: Add support for bonds and = vlans which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 64616@debbugs.gnu.org. --=20 64616: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D64616 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1697043721-785-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 64616-done) by debbugs.gnu.org; 11 Oct 2023 17:01:09 +0000 Received: from localhost ([127.0.0.1]:39929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqca4-0000Ay-Oh for submit@debbugs.gnu.org; Wed, 11 Oct 2023 13:01:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40320) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qqca2-0000AW-Dy for 64616-done@debbugs.gnu.org; Wed, 11 Oct 2023 13:01:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qqcZa-0002y4-1A; Wed, 11 Oct 2023 13:00:38 -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:References:In-Reply-To:Subject:To: From; bh=di9+CBFVkj2LIa3/Ryx46lgIpYYE7dOgHGjR6GqjDBU=; b=F5v6GOoUUQK3lBP0Q0Os +yPniNTesSw7c1/0CYDM3zEBQkywU3O4PzATjzPa/jE99EsVfhZosY/tz21ialKsOXIRS8giawKTh G0/Bu7I49c3cPnnnutq6Uv+C2lH9q15RP6g0KswbuajNIfy2rl9pZntxRVs1uHOiOyxwgfl1LR2ad bdnitWO6uhby6TWvY692w0p7GPqCW+yqCPRVAkp9H2PSJFODKnS5axqA90zfCVN7MFHm360h7/EWy unAsWpY6IsYS2oUzJ2slSOl7kbL/Zb7G5h9fJHxBGTkctFXJiiiXR7NQ20TAYXNaTvDJgh/X4A6Bw cbdbpndGLYvtvA==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Alexey Abramov Subject: Re: [bug#64616] [PATCH v2] services: static-networking: Add support for bonding. In-Reply-To: <20230929193406.19755-1-levenson@mmer.org> (Alexey Abramov's message of "Fri, 29 Sep 2023 21:34:06 +0200") References: <20230714152958.22645-1-levenson@mmer.org> <20230929193406.19755-1-levenson@mmer.org> Date: Wed, 11 Oct 2023 19:00:35 +0200 Message-ID: <87h6mxt7po.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64616-done Cc: 64616-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Alexey, Alexey Abramov skribis: > * gnu/services/base.scm (): Add mac-address field. Set > type field to #f by default, so it won't be mandatory. network-link > without a type will be used for existing interfaces. > (assert-network-link-mac-address, mac-address?): Add sanitizer. Allow > valid mac-address or #f. > (assert-network-link-type): Add sanitizer. Allow symbol or #f. > * gnu/services/base.scm (network-set-up/linux, > network-tear-down/linux): Adapt to new structure. > * doc/guix.texi (Networking Setup): Document it. > * gnu/tests/networking.scm (run-static-networking-advanced-test): New > variable. Finally applied, thank you! Ludo=E2=80=99. ------------=_1697043721-785-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit 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) From: Alexey Abramov To: guix-patches@gnu.org Subject: [PATCH 0/1] services: static-networking: Add support for bonds and vlans 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 Content-Transfer-Encoding: 8bit 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-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) 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(-) -- 2.40.1 ------------=_1697043721-785-1--