me
/
guix
Archived
1
0
Fork 0

syscalls: Add 'arp-network-interface?'.

* guix/build/syscalls.scm (IFF_NOARP): New variable.
(arp-network-interface?): New public procedure.
master
Marius Bakke 2019-05-09 17:03:03 +02:00
parent a0dc97a517
commit 5f5499d684
No known key found for this signature in database
GPG Key ID: A2A06DF2A33A54FA
1 changed files with 9 additions and 0 deletions

View File

@ -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)))