From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id uIznCq9WYmQLbQAASxT56A (envelope-from ) for ; Mon, 15 May 2023 17:58:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IAXfCq9WYmTPGAAA9RJhRA (envelope-from ) for ; Mon, 15 May 2023 17:58:39 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ACB4E383BF for ; Mon, 15 May 2023 17:58:38 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pyaaT-0005rV-TE; Mon, 15 May 2023 11:58:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pyaaI-0005rA-F2 for guix-patches@gnu.org; Mon, 15 May 2023 11:58:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pyaaI-0008Tx-6D for guix-patches@gnu.org; Mon, 15 May 2023 11:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pyaaH-00042d-O2 for guix-patches@gnu.org; Mon, 15 May 2023 11:58:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63403] [PATCH 1/1] services: wireguard: Implement a dynamic IP monitoring feature. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 May 2023 15:58:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63403 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63403@debbugs.gnu.org Received: via spool by 63403-submit@debbugs.gnu.org id=B63403.168416623915479 (code B ref 63403); Mon, 15 May 2023 15:58:01 +0000 Received: (at 63403) by debbugs.gnu.org; 15 May 2023 15:57:19 +0000 Received: from localhost ([127.0.0.1]:44188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyaZa-00041b-Jz for submit@debbugs.gnu.org; Mon, 15 May 2023 11:57:19 -0400 Received: from mail-qv1-f54.google.com ([209.85.219.54]:44437) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pyaZT-00041H-En for 63403@debbugs.gnu.org; Mon, 15 May 2023 11:57:17 -0400 Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-619ca08c166so59897106d6.1 for <63403@debbugs.gnu.org>; Mon, 15 May 2023 08:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684166225; x=1686758225; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:to:from:from:to:cc:subject:date:message-id:reply-to; bh=fIogbxU91ZhdSW0IOVLhBZeNjwez2bdZAJaIwOEnTLw=; b=sjhxpvacoVAwAnVYfwByTl7KtAffCdfo0J7gbFs2JxiLR1Csj4YVUygWgj/IsqGuKu MGqDI0CeqrPyItF7i+IYzbTYKIs3m/mjsaLVX8eIqrKYv5PCklI7raec58aeYkLimg9j xLGR1tP6AsZJotsJyQB0Sw9ZpqsjlA0TEqttz2FdhhZvH0trtbfKQDgOxeTxcSSHMfK+ QoAmHsb+V2e2xvyUAIE0kypqYCqtcQiz4lKLiUqv5gK10+vjRBlCacUZjdiphEVy5pzD 4MdThM06BKoLaLANFYrDVcLgwfBt1nxnm+LMJBLlMXsxYNvGtB04HNp1AH4FRZVqFqCy P0dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684166225; x=1686758225; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fIogbxU91ZhdSW0IOVLhBZeNjwez2bdZAJaIwOEnTLw=; b=HQrJC76maGe7bTtFPeMiMp0IiorsmyWA25b+4zh2FdmP1aM9QDrFe0m83HfbfRa8Z3 A+SzeJzFl41C+j5djiQ5xHUaMJlJKS1ABzPZslujDjDk4re52y8f6v3c1NY4vxX+Fwwg NMLAoIIOKiL9Mgj8D9uGkJzGBqoW7YC8esXTGl8eF7823sfGC9VflKkyenRgHRFlZMNl S5hH3t8H1u5+gVvWsBkjrTeBiXgys8juFtClUxla+8FXCAl5w/B6cKoGkRbTasNv0phf 2BGfopqxyTqLGbkonxedqQAhc00eLaX+iWNz96HQ8BX3rcPD9sxYvLa3g4SuMLvllEFr xoQw== X-Gm-Message-State: AC+VfDyzL7ezmkiiTxQGWWTNpleOemPc647BUVXYZPHxLkyvVyw/TIR+ dwylKZz2X2Bd6SYf01taeLCJhBZaqPNgtA== X-Google-Smtp-Source: ACHHUZ4IFiQNcsvo03pBMbBvpNYhvM5AGx9YIOlMXKXEAlvhyQ4A4ZiDgUOyr+7RleoqC+QN0Q9oSw== X-Received: by 2002:a05:6214:4017:b0:621:1c72:af3 with SMTP id kd23-20020a056214401700b006211c720af3mr40531207qvb.0.1684166224890; Mon, 15 May 2023 08:57:04 -0700 (PDT) Received: from hurd (dsl-205-236-230-106.b2b2c.ca. [205.236.230.106]) by smtp.gmail.com with ESMTPSA id o18-20020a05620a111200b0075932cd3ca0sm29168qkk.69.2023.05.15.08.57.03 for <63403@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 08:57:04 -0700 (PDT) From: Maxim Cournoyer References: <81431f5906cd69b4377e1f5d5b26e7c915c7cc87.1683679924.git.maxim.cournoyer@gmail.com> Date: Mon, 15 May 2023 11:57:02 -0400 In-Reply-To: <81431f5906cd69b4377e1f5d5b26e7c915c7cc87.1683679924.git.maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Tue, 9 May 2023 21:09:00 -0400") Message-ID: <871qjhvb8x.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1684166319; a=rsa-sha256; cv=none; b=CAxNm63BnA59BLosweknC1QMmYDpy3fU+pigvBf06XIyLR/W1tQukXuOa1PNRkVyA0MmDD tViir4/H/xUnDjDN6Qsv2CWKtM8iyKlFBpd4jM+2UgS6P4DhDN5zU1iImNPIShyvuiKs2F +FcC0d6W6bHnDNM3vbdHJxyTvq93mL+kw+9VwC9TPmABm1n/+5sxGXxx+XUhirIIEIauSF Ti64pfKiWVLuJyBeHDiwhvO5c+YBcXWTN2KF7NBUT1uYbe0nMFWXtZuRVdxl11iKMY/XML vIW/WlFPGqIKtUldediw90LVjMs5w/cehuLfgxgU7XBP2QhlNtOzE3ZI1lqK0Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=sjhxpvac; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1684166319; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=fIogbxU91ZhdSW0IOVLhBZeNjwez2bdZAJaIwOEnTLw=; b=HgMl/Xp2k1TSoP4X9fVgq5gwvyCVvmIZEjN91FhPBLwDHqrRAkJD6+ET5yogHhAUMWnOR2 d5uqbOqI7XjswipAcLEtZOv0U0f87P2AXTUQs4Ehno+ZARnQHnJPYTimGyDgmKjLy1QNKa iZScmkblIFKG+ydC7OaXICk8bFAGboJM3mexni44EIqOJ0pct1oCDVpRijHT4xrg5RUi/P pBvL08ioamSTiLdasuHHlsaybRQthLMrY6UZmkbadN/3YxrTrwRytwue7iy2na3gqpXpT/ FWcg1rb/Siod6mgsTkh7G6gosTOdMwhkWkv06lf6/HAhh4phJdy9VwxESOXwcg== X-Migadu-Spam-Score: -1.89 X-Spam-Score: -1.89 X-Migadu-Queue-Id: ACB4E383BF X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b=sjhxpvac; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-TUID: 375zvwP+b9xy Hi, Maxim Cournoyer writes: > * gnu/services/vpn.scm () > [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 @@ -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