diff options
author | Ludovic Courtès <ludo@gnu.org> | 2024-12-25 21:54:16 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-01-08 22:54:37 +0100 |
commit | 431ab103444d92a98bdc2d1540500973234ded0a (patch) | |
tree | 665394c987c71264185cb2ff555f6505b8ef3216 /gnu/services | |
parent | 8d649a8d17120b3dbf0ec3e838e5dccb13841ed0 (diff) |
services: static-networking: Fail when devices don’t show up.
Fixes <https://issues.guix.gnu.org/71173>.
* gnu/services/base.scm (network-set-up/linux): Define
‘max-set-up-duration’ and use it.
* gnu/tests/networking.scm (%static-networking-with-nonexistent-device):
New variable.
(run-static-networking-failure-test): New procedure.
(%test-static-networking-failure): New variable.
Change-Id: Idba9b36750aa8c6368c8f6d1bc1358066f7432e4
Diffstat (limited to 'gnu/services')
-rw-r--r-- | gnu/services/base.scm | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 524e32f264..d67c16a720 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -3092,6 +3092,10 @@ to CONFIG." #f)))) (define (network-set-up/linux config) + (define max-set-up-duration + ;; Maximum waiting time in seconds for devices to be up. + 60) + (match-record config <static-networking> (addresses links routes) (program-file "set-up-network" @@ -3169,12 +3173,19 @@ to CONFIG." (format #t (G_ "Interface with mac-address '~a' not found~%") #$mac-address))))))) links) + ;; 'wait-for-link' below could wait forever when + ;; passed a non-existent device. To ensure timely + ;; completion, install an alarm. + (alarm #$max-set-up-duration) + #$@(map (lambda (address) - #~(begin + #~(let ((device + #$(network-address-device address))) ;; Before going any further, wait for the ;; device to show up. - (wait-for-link - #$(network-address-device address)) + (format #t "Waiting for network device '~a'...~%" + device) + (wait-for-link device) (addr-add #$(network-address-device address) #$(network-address-value address) |