mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-27 13:09:23 -05:00
syscalls: Add 'set-network-interface-up'.
* guix/build/syscalls.scm (set-network-interface-up): New procedure.
This commit is contained in:
parent
152dd61ca4
commit
6944fdbdbd
1 changed files with 15 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -46,6 +46,7 @@ (define-module (guix build syscalls)
|
||||||
network-interface-address
|
network-interface-address
|
||||||
set-network-interface-flags
|
set-network-interface-flags
|
||||||
set-network-interface-address
|
set-network-interface-address
|
||||||
|
set-network-interface-up
|
||||||
configure-network-interface))
|
configure-network-interface))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
@ -552,4 +553,17 @@ (define (configure-network-interface name sockaddr flags)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(close-port sock)))))
|
(close-port sock)))))
|
||||||
|
|
||||||
|
(define* (set-network-interface-up name
|
||||||
|
#:key (family AF_INET))
|
||||||
|
"Turn up the interface NAME."
|
||||||
|
(let ((sock (socket family SOCK_STREAM 0)))
|
||||||
|
(dynamic-wind
|
||||||
|
(const #t)
|
||||||
|
(lambda ()
|
||||||
|
(let ((flags (network-interface-flags sock name)))
|
||||||
|
(set-network-interface-flags sock name
|
||||||
|
(logior flags IFF_UP))))
|
||||||
|
(lambda ()
|
||||||
|
(close-port sock)))))
|
||||||
|
|
||||||
;;; syscalls.scm ends here
|
;;; syscalls.scm ends here
|
||||||
|
|
Loading…
Reference in a new issue