summary refs log tree commit diff
path: root/guix/build/syscalls.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/build/syscalls.scm')
-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)))