From owner-svn-ports-head@freebsd.org Wed May 22 20:51:42 2019 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 BC6AA15B6EFC; Wed, 22 May 2019 20:51:42 +0000 (UTC) (envelope-from dch@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5FFD968494; Wed, 22 May 2019 20:51:42 +0000 (UTC) (envelope-from dch@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 3971F22D15; Wed, 22 May 2019 20:51:42 +0000 (UTC) (envelope-from dch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MKpgtu078368; Wed, 22 May 2019 20:51:42 GMT (envelope-from dch@FreeBSD.org) Received: (from dch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MKpfGS078365; Wed, 22 May 2019 20:51:41 GMT (envelope-from dch@FreeBSD.org) Message-Id: <201905222051.x4MKpfGS078365@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dch set sender to dch@FreeBSD.org using -f From: Dave Cottlehuber Date: Wed, 22 May 2019 20:51:41 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r502286 - in head/net/zerotier: . files X-SVN-Group: ports-head X-SVN-Commit-Author: dch X-SVN-Commit-Paths: in head/net/zerotier: . files X-SVN-Commit-Revision: 502286 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5FFD968494 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] 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: Wed, 22 May 2019 20:51:43 -0000 Author: dch Date: Wed May 22 20:51:41 2019 New Revision: 502286 URL: https://svnweb.freebsd.org/changeset/ports/502286 Log: net/zerotier: wait for ONLINE status before booting - add new flag to wnable waiting for zt interface to become available - handle newer name for tap(4) in CURRENT Approved by: jrm (mentor) Differential Revision: https://reviews.freebsd.org/D18533 Modified: head/net/zerotier/Makefile head/net/zerotier/files/zerotier.in head/net/zerotier/pkg-message Modified: head/net/zerotier/Makefile ============================================================================== --- head/net/zerotier/Makefile Wed May 22 20:49:02 2019 (r502285) +++ head/net/zerotier/Makefile Wed May 22 20:51:41 2019 (r502286) @@ -3,7 +3,7 @@ PORTNAME= zerotier DISTVERSION= 1.2.12 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= net MAINTAINER= dch@FreeBSD.org @@ -36,6 +36,12 @@ PLIST_FILES= bin/zerotier-cli bin/zerotier-idtool sbin SUB_LIST+= ZEROTIER_SYSLOG="-s debug -T zerotier" .else SUB_LIST+= ZEROTIER_SYSLOG="" +.endif +# after r347241 tun(4) and tap(4) have been merged to tuntap(4) +.if (${OSVERSION} >= 1300028) +SUB_LIST+= ZEROTIER_IF_TAP="if_tuntap" +.else +SUB_LIST+= ZEROTIER_IF_TAP="if_tap" .endif .endif Modified: head/net/zerotier/files/zerotier.in ============================================================================== --- head/net/zerotier/files/zerotier.in Wed May 22 20:49:02 2019 (r502285) +++ head/net/zerotier/files/zerotier.in Wed May 22 20:51:41 2019 (r502286) @@ -12,29 +12,51 @@ # # zerotier_enable (bool): Set to NO by default. # Set it to YES to enable zerotier. +# zerotier_wait_for_net (bool): Set to NO by default. Use for DHCP interfaces only +# Set it to YES to require zerotier to wait until online . /etc/rc.subr name=zerotier rcvar=zerotier_enable +desc="peer-to-peer software-defined networking" load_rc_config $name -: ${zerotier_enable:="NO"} +: ${zerotier_enable:=NO} +: ${zerotier_wait_for_net:=NO} -required_modules="if_tap" +required_modules=%%ZEROTIER_IF_TAP%% pidfile="/var/run/${name}.pid" start_precmd="install -o root /dev/null ${pidfile}" -command="/usr/sbin/daemon" +command=/usr/sbin/daemon command_args=" \ -c \ -t ${name} \ -r \ -P ${pidfile} \ %%ZEROTIER_SYSLOG%% \ - /usr/local/sbin/${name}-one" + %%PREFIX%%/sbin/${name}-one /var/db/${name}-one/" -run_rc_command "$1" +start_postcmd=start_postcmd +start_postcmd() +{ if checkyesno zerotier_wait_for_net; then + zerotier_count=5 + until %%PREFIX%%/bin/zerotier-cli status |egrep -o ONLINE\$; do + warn ${name} is waiting for ONLINE status + sleep 2 + zerotier_count=$((zerotier_count-1)) + test $zerotier_count -le 0 && break + done + if test $zerotier_count -le 0; then + warn ${name} still not ONLINE, stopped blocking + else + warn ${name} is ONLINE + fi + fi +} + +run_rc_command "$1" Modified: head/net/zerotier/pkg-message ============================================================================== --- head/net/zerotier/pkg-message Wed May 22 20:49:02 2019 (r502285) +++ head/net/zerotier/pkg-message Wed May 22 20:51:41 2019 (r502286) @@ -17,4 +17,14 @@ net.link.tap.up_on_open=1 This avoids a race condition where zerotier interfaces are created, but not up, prior to firewalls and services trying to use them. +You can place optional configuration in /var/db/zerotier-one/local.conf +as required, see documentation at https://www.zerotier.com/manual.shtml + +If your system boots from DHCP (such as a laptop), there is a new rc.conf +flag that will require that system startup will wait until the zerotier +network is established before proceeding. Note that this flag *does not* +work for systems confgured with statically assigned IP addresses, and +these will hang indefinitely due to an irreducible loop in rc(8) startup +files. This flag is disabled by default. + #################################