From owner-svn-ports-head@freebsd.org Thu Oct 25 12:13:31 2018 Return-Path: Delivered-To: svn-ports-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 968401073774; Thu, 25 Oct 2018 12:13:31 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49BF97F5E1; Thu, 25 Oct 2018 12:13:31 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2AF3611ABD; Thu, 25 Oct 2018 12:13:31 +0000 (UTC) (envelope-from decke@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9PCDV3o075372; Thu, 25 Oct 2018 12:13:31 GMT (envelope-from decke@FreeBSD.org) Received: (from decke@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9PCDUE1075370; Thu, 25 Oct 2018 12:13:30 GMT (envelope-from decke@FreeBSD.org) Message-Id: <201810251213.w9PCDUE1075370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: decke set sender to decke@FreeBSD.org using -f From: Bernhard Froehlich Date: Thu, 25 Oct 2018 12:13:30 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r482968 - in head/net/wireguard: . files X-SVN-Group: ports-head X-SVN-Commit-Author: decke X-SVN-Commit-Paths: in head/net/wireguard: . files X-SVN-Commit-Revision: 482968 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2018 12:13:31 -0000 Author: decke Date: Thu Oct 25 12:13:30 2018 New Revision: 482968 URL: https://svnweb.freebsd.org/changeset/ports/482968 Log: net/wireguard: Update rc.d script to let the user define which wg interfaces to manage Most people will likely want to put wireguard_interfaces="wg0" in /etc/rc.conf Reported by: Jason A. Donenfeld Modified: head/net/wireguard/Makefile head/net/wireguard/files/wireguard.in Modified: head/net/wireguard/Makefile ============================================================================== --- head/net/wireguard/Makefile Thu Oct 25 11:54:50 2018 (r482967) +++ head/net/wireguard/Makefile Thu Oct 25 12:13:30 2018 (r482968) @@ -2,6 +2,7 @@ PORTNAME= wireguard PORTVERSION= 0.0.20181018 +PORTREVISION= 1 CATEGORIES= net MASTER_SITES= https://git.zx2c4.com/WireGuard/snapshot/ DISTNAME= WireGuard-${PORTVERSION} Modified: head/net/wireguard/files/wireguard.in ============================================================================== --- head/net/wireguard/files/wireguard.in Thu Oct 25 11:54:50 2018 (r482967) +++ head/net/wireguard/files/wireguard.in Thu Oct 25 12:13:30 2018 (r482968) @@ -5,6 +5,13 @@ # PROVIDE: wireguard # REQUIRE: DAEMON # KEYWORD: shutdown +# +# wireguard_enable (bool): Set to "YES" to enable wireguard. +# (default: "NO") +# +# wireguard_interfaces (str): List of interfaces to bring up/down +# on start/stop. (eg: "wg0 wg1") +# (default: "") . /etc/rc.subr @@ -16,20 +23,20 @@ stop_cmd="${name}_stop" wireguard_start() { - for f in %%PREFIX%%/etc/wireguard/*.conf; do - %%PREFIX%%/bin/wg-quick up ${f} + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg-quick up ${interface} done } wireguard_stop() { - %%PREFIX%%/bin/wg show interfaces | while IFS= read -r interfaces; - do - for interface in $interfaces; do - %%PREFIX%%/wg-quick down ${interface} - done + for interface in ${wireguard_interfaces}; do + %%PREFIX%%/bin/wg-quick down ${interface} done } load_rc_config $name + +: ${wireguard_interfaces=""} + run_rc_command "$1"