diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-05-17 23:24:30 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-05-17 23:24:30 +0200 |
commit | 9bb34f9c9232757f275f458bb2621fe976f8d8fd (patch) | |
tree | f7378db2f70d927e8d95b7465884fceafbe9b52d /gnu | |
parent | 6944fdbdbd2339ee66f30e416806da9c7e8b6e01 (diff) | |
download | guix-9bb34f9c9232757f275f458bb2621fe976f8d8fd.tar guix-9bb34f9c9232757f275f458bb2621fe976f8d8fd.tar.gz |
services: dhcp-client: Turn up the interfaces before calling 'dhclient'.
Somehow, as of Linux 4.0.2, the interfaces are down by default, which
prevents 'dhclient' from actually using them.
* gnu/services/networking.scm (dhcp-client-service): Call
'set-network-interface-up' on each item of IFACES.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/services/networking.scm | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 33ecf9ccd3..102202c853 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -165,20 +165,24 @@ Protocol (DHCP) client, on all the non-loopback network interfaces." (provision '(networking)) (start #~(lambda _ - (false-if-exception (delete-file #$pid-file)) - ;; When invoked without any arguments, 'dhclient' ;; discovers all non-loopback interfaces *that are ;; up*. However, the relevant interfaces are ;; typically down at this point. Thus we perform our ;; own interface discovery here. - (let* ((valid? (negate loopback-network-interface?)) - (ifaces (filter valid? - (all-network-interfaces))) - (pid (fork+exec-command - (cons* #$dhclient "-nw" - "-pf" #$pid-file - ifaces)))) + (define valid? + (negate loopback-network-interface?)) + (define ifaces + (filter valid? (all-network-interfaces))) + + ;; XXX: Make sure the interfaces are up so that + ;; 'dhclient' can actually send/receive over them. + (for-each set-network-interface-up ifaces) + + (false-if-exception (delete-file #$pid-file)) + (let ((pid (fork+exec-command + (cons* #$dhclient "-nw" + "-pf" #$pid-file ifaces)))) (and (zero? (cdr (waitpid pid))) (let loop () (catch 'system-error |