mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-03 18:09:18 -05:00
syscalls: 'configure-network-interface' has a #:netmask parameter.
* guix/build/syscalls.scm (configure-network-interface): Add #:netmask keyword parameter and honor it.
This commit is contained in:
parent
175c910380
commit
e9ff8d9ff1
1 changed files with 7 additions and 3 deletions
|
@ -1028,15 +1028,19 @@ (define (network-interface-netmask socket name)
|
||||||
(list name (strerror err))
|
(list name (strerror err))
|
||||||
(list err))))))
|
(list err))))))
|
||||||
|
|
||||||
(define (configure-network-interface name sockaddr flags)
|
(define* (configure-network-interface name sockaddr flags
|
||||||
|
#:key netmask)
|
||||||
"Configure network interface NAME to use SOCKADDR, an address as returned by
|
"Configure network interface NAME to use SOCKADDR, an address as returned by
|
||||||
'make-socket-address', and FLAGS, a bitwise-or of IFF_* constants."
|
'make-socket-address', and FLAGS, a bitwise-or of IFF_* constants. If NETMASK
|
||||||
|
is true, it must be a socket address to use as the network mask."
|
||||||
(let ((sock (socket (sockaddr:fam sockaddr) SOCK_STREAM 0)))
|
(let ((sock (socket (sockaddr:fam sockaddr) SOCK_STREAM 0)))
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
(const #t)
|
(const #t)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(set-network-interface-address sock name sockaddr)
|
(set-network-interface-address sock name sockaddr)
|
||||||
(set-network-interface-flags sock name flags))
|
(set-network-interface-flags sock name flags)
|
||||||
|
(when netmask
|
||||||
|
(set-network-interface-netmask sock name netmask)))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(close-port sock)))))
|
(close-port sock)))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue