aboutsummaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2019-05-09 17:03:03 +0200
committerMarius Bakke <mbakke@fastmail.com>2019-05-09 20:00:21 +0200
commit5f5499d684058b2a359e9a3e8e6738bbd0c77834 (patch)
tree53b7a96f54b4e7ea0dc862727c9e415ae3720a7b /guix/build
parenta0dc97a517cbc4c82640e30cacb2a564d128bbe9 (diff)
downloadgnu-guix-5f5499d684058b2a359e9a3e8e6738bbd0c77834.tar
gnu-guix-5f5499d684058b2a359e9a3e8e6738bbd0c77834.tar.gz
syscalls: Add 'arp-network-interface?'.
* guix/build/syscalls.scm (IFF_NOARP): New variable. (arp-network-interface?): New public procedure.
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 749616ceb1..3abe65bc4f 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -104,6 +104,7 @@
network-interface-netmask
network-interface-running?
loopback-network-interface?
+ arp-network-interface?
network-interface-address
set-network-interface-netmask
set-network-interface-up
@@ -1160,6 +1161,7 @@ bytes."
(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-as-needed IFF_NOARP #x80) ;ARP disabled or unsupported
(define IF_NAMESIZE 16) ;maximum interface name size
@@ -1341,6 +1343,13 @@ interface NAME."
(close-port sock)
(not (zero? (logand flags IFF_RUNNING)))))
+(define (arp-network-interface? name)
+ "Return true if NAME supports the Address Resolution Protocol."
+ (let* ((sock (socket SOCK_STREAM AF_INET 0))
+ (flags (network-interface-flags sock name)))
+ (close-port sock)
+ (zero? (logand flags IFF_NOARP))))
+
(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)))