Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Mar 2021 12:07:45 +0000 (UTC)
From:      Bernhard Froehlich <decke@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r568953 - in head/net: . wireguard wireguard-tools wireguard-tools/files
Message-ID:  <202103221207.12MC7jF2096809@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: decke
Date: Mon Mar 22 12:07:45 2021
New Revision: 568953
URL: https://svnweb.freebsd.org/changeset/ports/568953

Log:
  net/wireguard-tools: Repocopy from net/wireguard, flavorize and add rc.d script for lite flavor

Added:
  head/net/wireguard-tools/
     - copied from r568952, head/net/wireguard/
  head/net/wireguard-tools/files/wireguard_lite.in   (contents, props changed)
  head/net/wireguard-tools/files/wireguard_wgquick.in   (contents, props changed)
Deleted:
  head/net/wireguard/
  head/net/wireguard-tools/files/wireguard.in
Modified:
  head/net/Makefile
  head/net/wireguard-tools/Makefile
  head/net/wireguard-tools/distinfo
  head/net/wireguard-tools/pkg-descr
  head/net/wireguard-tools/pkg-plist

Modified: head/net/Makefile
==============================================================================
--- head/net/Makefile	Mon Mar 22 12:03:11 2021	(r568952)
+++ head/net/Makefile	Mon Mar 22 12:07:45 2021	(r568953)
@@ -1527,9 +1527,9 @@
     SUBDIR += webalizer-geodb
     SUBDIR += whois
     SUBDIR += widentd
-    SUBDIR += wireguard
     SUBDIR += wireguard-go
     SUBDIR += wireguard-kmod
+    SUBDIR += wireguard-tools
     SUBDIR += wireshark
     SUBDIR += wireshark-lite
     SUBDIR += wlan2eth

Modified: head/net/wireguard-tools/Makefile
==============================================================================
--- head/net/wireguard/Makefile	Mon Mar 22 12:03:11 2021	(r568952)
+++ head/net/wireguard-tools/Makefile	Mon Mar 22 12:07:45 2021	(r568953)
@@ -1,10 +1,9 @@
 # $FreeBSD$
 
-PORTNAME=	wireguard
+PORTNAME=	wireguard-tools
 PORTVERSION=	1.0.20210315
 CATEGORIES=	net net-vpn
 MASTER_SITES=	https://git.zx2c4.com/wireguard-tools/snapshot/
-DISTNAME=	wireguard-tools-${PORTVERSION}
 
 MAINTAINER=	decke@FreeBSD.org
 COMMENT=	Fast, modern and secure VPN Tunnel
@@ -12,8 +11,10 @@ COMMENT=	Fast, modern and secure VPN Tunnel
 LICENSE=	GPLv2
 LICENSE_FILE=	${WRKDIR}/${DISTNAME}/COPYING
 
+FLAVORS=	default lite
+lite_PKGNAMESUFFIX=	-lite
+
 USES=		gmake tar:xz
-USE_RC_SUBR=	${PORTNAME}
 
 WRKSRC=		${WRKDIR}/${DISTNAME}/src
 
@@ -26,10 +27,21 @@ OPTIONS_DEFAULT=WGQUICK
 OPTIONS_SUB=	yes
 
 WGQUICK_DESC=		wg-quick(8) userland utility
-WGQUICK_RUN_DEPENDS=	bash:shells/bash \
-			wireguard-go:net/wireguard-go
+WGQUICK_RUN_DEPENDS=	bash:shells/bash
 WGQUICK_MAKE_ARGS=	WITH_WGQUICK=yes
 WGQUICK_MAKE_ARGS_OFF=	WITH_WGQUICK=no
+
+.if ${FLAVOR:U} == lite
+USE_RC_SUBR=	wireguard_lite
+OPTIONS_EXCLUDE=WGQUICK
+COMMENT+=	(lite flavor)
+.endif
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MWGQUICK}
+USE_RC_SUBR=	wireguard_wgquick
+.endif
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \

Modified: head/net/wireguard-tools/distinfo
==============================================================================
--- head/net/wireguard/distinfo	Mon Mar 22 12:03:11 2021	(r568952)
+++ head/net/wireguard-tools/distinfo	Mon Mar 22 12:07:45 2021	(r568953)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1615823936
+TIMESTAMP = 1615824165
 SHA256 (wireguard-tools-1.0.20210315.tar.xz) = af001d5492be6bf58ef0bebe04b446b6f50eb53e1226fab679cc34af40733a22
 SIZE (wireguard-tools-1.0.20210315.tar.xz) = 96988

Added: head/net/wireguard-tools/files/wireguard_lite.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/wireguard-tools/files/wireguard_lite.in	Mon Mar 22 12:07:45 2021	(r568953)
@@ -0,0 +1,98 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# 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: "")
+# wireguard_<iface>_ips (str):    List of IP Addresses for iface
+# wireguard_<iface>_routes (str): List of Routes for this iface
+# wireguard_<iface>_mtu (str):    MTU for iface (default: "1500")
+
+. /etc/rc.subr
+
+load_rc_config $name
+
+: ${wireguard_enable="NO"}
+: ${wireguard_interfaces=""}
+
+name=wireguard
+rcvar=wireguard_enable
+extra_commands="reload"
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+reload_cmd="${name}_reload"
+
+wireguard_start()
+{
+	for interface in ${wireguard_interfaces}; do
+		load_rc_config wireguard_${interface}
+
+		eval wireguard_ips="\${wireguard_${interface}_ips}"
+		eval wireguard_routes="\${wireguard_${interface}_routes}"
+		eval wireguard_mtu="\${wireguard_${interface}_mtu}"
+
+		ifconfig ${interface} create
+		%%PREFIX%%/bin/wg setconf ${interface} %%PREFIX%%/etc/wireguard/${interface}.conf
+
+		for ip in ${wireguard_ips}; do
+			if [ "${ip#*:}" != "${ip}" ]; then
+				ifconfig ${interface} inet6 ${ip} alias
+			else
+				ifconfig ${interface} inet ${ip} alias
+			fi
+		done
+
+		if [ ! -z "${wireguard_mtu}" ]; then
+			ifconfig ${interface} mtu ${wireguard_mtu}
+		fi
+
+		ifconfig ${interface} up
+
+		for route in ${wireguard_routes}; do
+			if [ "${route#*:}" != "${route}" ]; then
+				route -q -n add -inet6 ${route} -interface ${interface}
+			else
+				route -q -n add -inet ${route} -interface ${interface}
+			fi
+		done
+	done
+}
+
+wireguard_stop()
+{
+	for interface in ${wireguard_interfaces}; do
+		load_rc_config wireguard_${interface}
+
+		eval wireguard_routes="\${wireguard_${interface}_routes}"
+
+		for route in ${wireguard_routes}; do
+			if [ "${route#*:}" != "${route}" ]; then
+				route -q -n delete -inet6 ${route} -interface ${interface}
+			else
+				route -q -n delete -inet ${route} -interface ${interface}
+			fi
+		done
+
+		ifconfig ${interface} down
+
+		ifconfig ${interface} destroy
+	done
+}
+
+wireguard_reload()
+{
+	for interface in ${wireguard_interfaces}; do
+		%%PREFIX%%/bin/wg syncconf ${interface} %%PREFIX%%/etc/wireguard/${interface}.conf
+	done
+}
+
+run_rc_command "$1"

Added: head/net/wireguard-tools/files/wireguard_wgquick.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/wireguard-tools/files/wireguard_wgquick.in	Mon Mar 22 12:07:45 2021	(r568953)
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# 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: "")
+# wireguard_env (str):        Environment variables for the userspace
+#                             implementation. (eg: "LOG_LEVEL=debug")
+
+. /etc/rc.subr
+
+name=wireguard
+rcvar=wireguard_enable
+extra_commands="reload"
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+reload_cmd="${name}_reload"
+
+wireguard_start()
+{
+	${wireguard_env:+eval export $wireguard_env}
+
+	for interface in ${wireguard_interfaces}; do
+		%%PREFIX%%/bin/wg-quick up ${interface}
+	done
+}
+
+wireguard_stop()
+{
+	for interface in ${wireguard_interfaces}; do
+		%%PREFIX%%/bin/wg-quick down ${interface}
+	done
+}
+
+wireguard_reload()
+{
+	${wireguard_env:+eval export $wireguard_env}
+
+	for interface in ${wireguard_interfaces}; do
+		tmpfile="`mktemp`"
+		%%PREFIX%%/bin/wg-quick strip ${interface} > ${tmpfile}
+		%%PREFIX%%/bin/wg syncconf ${interface} ${tmpfile}
+		rm -f ${tmpfile}
+	done
+}
+
+load_rc_config $name
+
+: ${wireguard_enable="NO"}
+: ${wireguard_interfaces=""}
+: ${wireguard_env=""}
+
+run_rc_command "$1"

Modified: head/net/wireguard-tools/pkg-descr
==============================================================================
--- head/net/wireguard/pkg-descr	Mon Mar 22 12:03:11 2021	(r568952)
+++ head/net/wireguard-tools/pkg-descr	Mon Mar 22 12:07:45 2021	(r568953)
@@ -1,8 +1,4 @@
-WireGuard is an extremely simple yet fast and modern VPN that utilizes
-state-of-the-art cryptography. It aims to be faster, simpler, leaner,
-and more useful than IPSec, while avoiding the massive headache. It
-intends to be considerably more performant than OpenVPN. WireGuard is
-designed as a general purpose VPN for running on embedded interfaces and
-super computers alike, fit for many different circumstances.
+This supplies the main userspace tooling for using and configuring
+WireGuard tunnels, including the wg(8) and wg-quick(8) utilities.
 
-WWW: https://www.wireguard.com
+WWW: https://git.zx2c4.com/wireguard-tools/about/

Modified: head/net/wireguard-tools/pkg-plist
==============================================================================
--- head/net/wireguard/pkg-plist	Mon Mar 22 12:03:11 2021	(r568952)
+++ head/net/wireguard-tools/pkg-plist	Mon Mar 22 12:07:45 2021	(r568953)
@@ -3,5 +3,5 @@ bin/wg
 %%WGQUICK%%man/man8/wg-quick.8.gz
 man/man8/wg.8.gz
 share/bash-completion/completions/wg
-share/bash-completion/completions/wg-quick
+%%WGQUICK%%share/bash-completion/completions/wg-quick
 %%WGQUICK%%@dir etc/wireguard



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103221207.12MC7jF2096809>