guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#63403] [PATCH 1/1] services: wireguard: Implement a dynamic IP moni


From: Maxim Cournoyer
Subject: [bug#63403] [PATCH 1/1] services: wireguard: Implement a dynamic IP monitoring feature.
Date: Mon, 15 May 2023 11:57:02 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> * gnu/services/vpn.scm (<wireguard-configuration>)
> [monitor-ips?, monitor-ips-internal]: New fields.
> * gnu/services/vpn.scm (define-with-source): New syntax.
> (wireguard-service-name, strip-port/maybe)
> (ipv4-address?, ipv6-address?, host-name?)
> (peers->endpoint-host-names)
> (wireguard-monitoring-jobs): New procedures.
> (wireguard-service-type): Register it.
> * tests/services/vpn.scm: New file.
> * Makefile.am (SCM_TESTS): Register it.
> * doc/guix.texi (VPN Services): Update doc.

I've found a bug when no endpoints were used.  The following changes
were needed:

--8<---------------cut here---------------start------------->8---
modified   gnu/services/vpn.scm
@@ -921,7 +921,7 @@ (define (peers->endpoint-host-names peers)
   "Return host names used as the endpoints of PEERS, if any.  Any \":PORT\"
 suffixes are stripped."
   (map strip-port/maybe
-       (filter host-name? (map wireguard-peer-endpoint peers))))
+       (filter host-name? (filter-map wireguard-peer-endpoint peers))))
 
 (define (wireguard-shepherd-service config)
   (match-record config <wireguard-configuration>
@@ -998,7 +998,8 @@ (define (wireguard-monitoring-jobs config)
                                               resolved-ips)
                                  (format #t "restarting ~a service due to \
 stale endpoint IPs~%" service-name)
-                                 (restart-service service-name))))))))))))))
+                                 (restart-service service-name))))))))))
+          '()))))                       ;monitor-ips? is #f
 
 (define wireguard-service-type
   (service-type
--8<---------------cut here---------------end--------------->8---

Will send a v2.

-- 
Thanks,
Maxim





reply via email to

[Prev in Thread] Current Thread [Next in Thread]