summaryrefslogtreecommitdiff
path: root/guix/build/syscalls.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-11-17 23:09:22 +0100
committerLudovic Courtès <ludo@gnu.org>2016-11-17 23:21:47 +0100
commite9ff8d9ff15db2917d7200cda2bb68a52a9b19b0 (patch)
treeb49b164754f7a05a233d69e50b02d573f0065960 /guix/build/syscalls.scm
parent175c9103800640a2ecdc2c33094a03687270b341 (diff)
downloadgnu-guix-e9ff8d9ff15db2917d7200cda2bb68a52a9b19b0.tar
gnu-guix-e9ff8d9ff15db2917d7200cda2bb68a52a9b19b0.tar.gz
syscalls: 'configure-network-interface' has a #:netmask parameter.
* guix/build/syscalls.scm (configure-network-interface): Add #:netmask keyword parameter and honor it.
Diffstat (limited to 'guix/build/syscalls.scm')
-rw-r--r--guix/build/syscalls.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index f4d4d155ec..c3832f6d48 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1028,15 +1028,19 @@ the same type as that returned by 'make-socket-address'."
(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)))
(dynamic-wind
(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)))))