From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E83EE15817D for ; Tue, 11 Jun 2024 00:39:13 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F32062BC017; Tue, 11 Jun 2024 00:39:12 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D46472BC017 for ; Tue, 11 Jun 2024 00:39:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8533333BEE8 for ; Tue, 11 Jun 2024 00:39:11 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E8B9C1C56 for ; Tue, 11 Jun 2024 00:39:09 +0000 (UTC) From: "Patrick McLean" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Patrick McLean" Message-ID: <1716529919.9ef4fb84a7c1848c067f89f5510f448fb04c5c7a.chutzpah@OpenRC> Subject: [gentoo-commits] proj/netifrc:master commit in: net/ X-VCS-Repository: proj/netifrc X-VCS-Files: net/wireguard.sh X-VCS-Directories: net/ X-VCS-Committer: chutzpah X-VCS-Committer-Name: Patrick McLean X-VCS-Revision: 9ef4fb84a7c1848c067f89f5510f448fb04c5c7a X-VCS-Branch: master Date: Tue, 11 Jun 2024 00:39:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 19e510f3-2f9d-497e-99b1-84eeda37d77b X-Archives-Hash: 391c5d0fed2b0fb52885fa4a5b9c2a2c commit: 9ef4fb84a7c1848c067f89f5510f448fb04c5c7a Author: Andrey Volkov ekb-info ru> AuthorDate: Tue Sep 28 13:43:52 2021 +0000 Commit: Patrick McLean gentoo org> CommitDate: Fri May 24 05:51:59 2024 +0000 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=9ef4fb84 Add type_${IFVAR}=wireguard for arbitrary wireguard interface names Signed-off-by: Andrey Volkov ekb-info.ru> net/wireguard.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/net/wireguard.sh b/net/wireguard.sh index 301836d..269c8f0 100644 --- a/net/wireguard.sh +++ b/net/wireguard.sh @@ -9,9 +9,15 @@ wireguard_depend() before interface } +_is_wireguard() { + is_interface_type wireguard +} + wireguard_pre_start() { - [ "${IFACE#wg}" != "$IFACE" ] || return 0 + local wireguard= + eval wireguard=\$type_${IFVAR} + [ "${wireguard}" = "wireguard" -o "${IFACE#wg}" != "$IFACE" ] || return 0 ip link delete dev "$IFACE" type wireguard 2>/dev/null ebegin "Creating WireGuard interface $IFACE" @@ -35,6 +41,7 @@ wireguard_pre_start() e=$? if [ $e -eq 0 ]; then eend $e + set_interface_type wireguard return $e fi fi @@ -45,7 +52,7 @@ wireguard_pre_start() wireguard_post_stop() { - [ "${IFACE#wg}" != "$IFACE" ] || return 0 + _is_wireguard || [ "${IFACE#wg}" != "$IFACE" ] || return 0 ebegin "Removing WireGuard interface $IFACE" ip link delete dev "$IFACE" type wireguard