aboutsummaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2017-07-23 03:42:12 -0400
committerLeo Famulari <leo@famulari.name>2017-07-23 03:42:12 -0400
commit6c1a317e29c45e85e3a0e050612cdefe470b100c (patch)
treee65dedf933090b1a9f8398655b3b20eba49fae96 /guix/build
parentb7158b767b7fd9f0379dfe08083c48a0cf0f3d50 (diff)
parent9478c05955643f8ff95dabccc1e42b20abb88049 (diff)
downloadgnu-guix-6c1a317e29c45e85e3a0e050612cdefe470b100c.tar
gnu-guix-6c1a317e29c45e85e3a0e050612cdefe470b100c.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/syscalls.scm9
1 files changed, 9 insertions, 0 deletions
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 41208e32a8..55b0df3911 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -92,6 +92,7 @@
all-network-interface-names
network-interface-names
network-interface-netmask
+ network-interface-running?
loopback-network-interface?
network-interface-address
set-network-interface-netmask
@@ -1160,6 +1161,7 @@ bytes."
(define-as-needed IFF_UP #x1) ;Interface is up
(define-as-needed IFF_BROADCAST #x2) ;Broadcast address valid.
(define-as-needed IFF_LOOPBACK #x8) ;Is a loopback net.
+(define-as-needed IFF_RUNNING #x40) ;interface RFC2863 OPER_UP
(define IF_NAMESIZE 16) ;maximum interface name size
@@ -1334,6 +1336,13 @@ interface NAME."
(close-port sock)
(not (zero? (logand flags IFF_LOOPBACK)))))
+(define (network-interface-running? name)
+ "Return true if NAME designates a running network interface."
+ (let* ((sock (socket SOCK_STREAM AF_INET 0))
+ (flags (network-interface-flags sock name)))
+ (close-port sock)
+ (not (zero? (logand flags IFF_RUNNING)))))
+
(define-as-needed (set-network-interface-flags socket name flags)
"Set the flag of network interface NAME to FLAGS."
(let ((req (make-bytevector ifreq-struct-size)))