services: static-networking: 'eval-when' for code used at expansion-time.
Reported by bjc on #guix. * gnu/services/base.scm (valid-name, cidr->netmask): Wrap in 'eval-when' since they are used by "compile-time procedures" (macros).
This commit is contained in:
parent
4f63b4b86d
commit
0143e3f291
|
@ -1,5 +1,5 @@
|
|||
;;; GNU Guix --- Functional package management for GNU
|
||||
;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2013-2023 Ludovic Courtès <ludo@gnu.org>
|
||||
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
|
||||
;;; Copyright © 2015, 2016, 2020 Mark H Weaver <mhw@netris.org>
|
||||
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
|
||||
|
@ -703,9 +703,10 @@ (define-deprecated (rngd-service #:key (rng-tools rng-tools)
|
|||
;;; /etc/hosts
|
||||
;;;
|
||||
|
||||
(define (valid-name? name)
|
||||
(eval-when (expand load eval)
|
||||
(define (valid-name? name)
|
||||
"Return true if @var{name} is likely to be a valid host name."
|
||||
(false-if-exception (not (string-any char-set:whitespace name))))
|
||||
(false-if-exception (not (string-any char-set:whitespace name)))))
|
||||
|
||||
(define-compile-time-procedure (assert-valid-name (name valid-name?))
|
||||
"Ensure @var{name} is likely to be a valid host name."
|
||||
|
@ -2664,7 +2665,8 @@ (define-record-type* <network-route>
|
|||
ipv6-address?))))
|
||||
(gateway network-route-gateway (default #f)))
|
||||
|
||||
(define* (cidr->netmask str #:optional (family AF_INET))
|
||||
(eval-when (expand load eval)
|
||||
(define* (cidr->netmask str #:optional (family AF_INET))
|
||||
"Given @var{str}, a string in CIDR notation (e.g., \"1.2.3.4/24\"), return
|
||||
the netmask as a string like \"255.255.255.0\"."
|
||||
(match (string-split str #\/)
|
||||
|
@ -2673,7 +2675,7 @@ (define* (cidr->netmask str #:optional (family AF_INET))
|
|||
(- (if (= family AF_INET6) 128 32)
|
||||
bits))))
|
||||
(inet-ntop family mask)))
|
||||
(_ #f)))
|
||||
(_ #f))))
|
||||
|
||||
(define (cidr->ip str)
|
||||
"Strip the netmask bit of @var{str}, a CIDR-notation IP/netmask address."
|
||||
|
|
Loading…
Reference in a new issue