aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-09-17 09:27:07 +0200
committerLudovic Courtès <ludo@gnu.org>2014-09-17 09:27:07 +0200
commitf02f65efb4328a3018b6302af9e12f67e4a5e342 (patch)
treec529e5b35bce7c6d3a7e43df3915b889a8ab12fe
parent6a3f4c74fd07a8c28fda3cc7389765f30da7895a (diff)
downloadpatches-f02f65efb4328a3018b6302af9e12f67e4a5e342.tar
patches-f02f65efb4328a3018b6302af9e12f67e4a5e342.tar.gz
services: dhcp-client: Start 'dhclient' in "no wait" mode.
* gnu/services/networking.scm (dhcp-client-service): Pass '-nw' to 'dhclient'.
-rw-r--r--gnu/services/networking.scm13
1 files changed, 10 insertions, 3 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index ff7bd7fde9..d532fc8d99 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -107,10 +107,16 @@ Protocol (DHCP) client, on all the non-loopback network interfaces."
(with-monad %store-monad
(return (service
- (documentation
- "Set up networking via DHCP.")
+ (documentation "Set up networking via DHCP.")
(requirement '(user-processes udev))
+
+ ;; XXX: Running with '-nw' ("no wait") avoids blocking for a
+ ;; minute when networking is unavailable, but also means that the
+ ;; interface is not up yet when 'start' completes. To wait for
+ ;; the interface to be ready, one should instead monitor udev
+ ;; events.
(provision '(networking))
+
(start #~(lambda _
;; When invoked without any arguments, 'dhclient'
;; discovers all non-loopback interfaces *that are
@@ -121,7 +127,8 @@ Protocol (DHCP) client, on all the non-loopback network interfaces."
(ifaces (filter valid?
(all-network-interfaces)))
(pid (fork+exec-command
- (cons* #$dhclient "-pf" #$pid-file
+ (cons* #$dhclient "-nw"
+ "-pf" #$pid-file
ifaces))))
(and (zero? (cdr (waitpid pid)))
(call-with-input-file #$pid-file read)))))