From 6944fdbdbd2339ee66f30e416806da9c7e8b6e01 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 17 May 2015 23:20:59 +0200 Subject: syscalls: Add 'set-network-interface-up'. * guix/build/syscalls.scm (set-network-interface-up): New procedure. --- guix/build/syscalls.scm | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'guix/build') diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index b62a8cce64..5bc4595d08 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014 Ludovic Courtès +;;; Copyright © 2014, 2015 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -46,6 +46,7 @@ network-interface-address set-network-interface-flags set-network-interface-address + set-network-interface-up configure-network-interface)) ;;; Commentary: @@ -552,4 +553,17 @@ the same type as that returned by 'make-socket-address'." (lambda () (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 -- cgit v1.2.3