[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: syscalls: 'configure-network-interface' has a #:netmask parameter

From: Ludovic Courtès
Subject: 01/03: syscalls: 'configure-network-interface' has a #:netmask parameter.
Date: Thu, 17 Nov 2016 22:22:36 +0000 (UTC)

civodul pushed a commit to branch master
in repository guix.

commit e9ff8d9ff15db2917d7200cda2bb68a52a9b19b0
Author: Ludovic Courtès <address@hidden>
Date:   Thu Nov 17 23:09:22 2016 +0100

    syscalls: 'configure-network-interface' has a #:netmask parameter.
    * guix/build/syscalls.scm (configure-network-interface): Add #:netmask
    keyword parameter and honor it.
 guix/build/syscalls.scm |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index f4d4d15..c3832f6 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1028,15 +1028,19 @@ the same type as that returned by 
                  (list name (strerror err))
                  (list err))))))
-(define (configure-network-interface name sockaddr flags)
+(define* (configure-network-interface name sockaddr flags
+                                      #:key netmask)
   "Configure network interface NAME to use SOCKADDR, an address as returned by
-'make-socket-address', and FLAGS, a bitwise-or of IFF_* constants."
+'make-socket-address', and FLAGS, a bitwise-or of IFF_* constants.  If NETMASK
+is true, it must be a socket address to use as the network mask."
   (let ((sock (socket (sockaddr:fam sockaddr) SOCK_STREAM 0)))
       (const #t)
       (lambda ()
         (set-network-interface-address sock name sockaddr)
-        (set-network-interface-flags sock name flags))
+        (set-network-interface-flags sock name flags)
+        (when netmask
+          (set-network-interface-netmask sock name netmask)))
       (lambda ()
         (close-port sock)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]