syscalls: Add 'arp-network-interface?'.
* guix/build/syscalls.scm (IFF_NOARP): New variable. (arp-network-interface?): New public procedure.
This commit is contained in:
parent
a0dc97a517
commit
5f5499d684
1 changed files with 9 additions and 0 deletions
|
@ -104,6 +104,7 @@ (define-module (guix build syscalls)
|
||||||
network-interface-netmask
|
network-interface-netmask
|
||||||
network-interface-running?
|
network-interface-running?
|
||||||
loopback-network-interface?
|
loopback-network-interface?
|
||||||
|
arp-network-interface?
|
||||||
network-interface-address
|
network-interface-address
|
||||||
set-network-interface-netmask
|
set-network-interface-netmask
|
||||||
set-network-interface-up
|
set-network-interface-up
|
||||||
|
@ -1160,6 +1161,7 @@ (define-as-needed IFF_UP #x1) ;Interface is up
|
||||||
(define-as-needed IFF_BROADCAST #x2) ;Broadcast address valid.
|
(define-as-needed IFF_BROADCAST #x2) ;Broadcast address valid.
|
||||||
(define-as-needed IFF_LOOPBACK #x8) ;Is a loopback net.
|
(define-as-needed IFF_LOOPBACK #x8) ;Is a loopback net.
|
||||||
(define-as-needed IFF_RUNNING #x40) ;interface RFC2863 OPER_UP
|
(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
|
(define IF_NAMESIZE 16) ;maximum interface name size
|
||||||
|
|
||||||
|
@ -1341,6 +1343,13 @@ (define (network-interface-running? name)
|
||||||
(close-port sock)
|
(close-port sock)
|
||||||
(not (zero? (logand flags IFF_RUNNING)))))
|
(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)
|
(define-as-needed (set-network-interface-flags socket name flags)
|
||||||
"Set the flag of network interface NAME to FLAGS."
|
"Set the flag of network interface NAME to FLAGS."
|
||||||
(let ((req (make-bytevector ifreq-struct-size)))
|
(let ((req (make-bytevector ifreq-struct-size)))
|
||||||
|
|
Loading…
Reference in a new issue