Subject: [PATCH 2/3] link: Allow to bound interfaces to bonds

From: Alexey Abramov <[email-masked]>
Date: Sat, 8 Oct 2022 18:53:13 +0200

* ip/link.scm (link-set): Add new argument `master'. It is suppose to
be a name of the master interface to which our current device has to
be bound.
---
 ip/link.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ip/link.scm b/ip/link.scm
index 521cffa..70ab79f 100644
--- a/ip/link.scm
+++ b/ip/link.scm
@@ -164,7 +164,8 @@ criteria."
                    (trailers-on #f) (trailers-off #f)
                    (carrier-on #f) (carrier-off #f)
                    (txqueuelen #f) (name #f) (address #f)
-                   (broadcast #f) (mtu #f) (netns #f))
+                   (broadcast #f) (mtu #f) (netns #f)
+                   (master #f))
   (define request-num (random 65535))
   (define id (if (number? device) device (link-name->index device)))
   (define netnsfd (cond
@@ -229,6 +230,11 @@ criteria."
                   (make-route-attr IFLA_MTU
                     (make-u32-route-attr mtu)))
                 '())
+          ,@(if master
+                (list
+                  (make-route-attr IFLA_MASTER
+                    (make-u32-route-attr (link-name->index master))))
+                '())
           ,@(if netns
                 (list
                   (make-route-attr IFLA_NET_NS_FD
-- 
2.36.1