From owner-svn-src-head@FreeBSD.ORG Fri Apr 10 09:50:15 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2E0CED01; Fri, 10 Apr 2015 09:50:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2D7B995; Fri, 10 Apr 2015 09:50:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3A9oE90092998; Fri, 10 Apr 2015 09:50:14 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3A9oEVG092995; Fri, 10 Apr 2015 09:50:14 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201504100950.t3A9oEVG092995@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 10 Apr 2015 09:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281363 - in head: share/man/man4 sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Apr 2015 09:50:15 -0000 Author: glebius Date: Fri Apr 10 09:50:13 2015 New Revision: 281363 URL: https://svnweb.freebsd.org/changeset/base/281363 Log: Redo r274966. Instead of global all-interface all-vnet undocumented sysctl, use per-interface flag, and document it. Sponsored by: Nginx, Inc. Modified: head/share/man/man4/tap.4 head/sys/net/if_tap.c Modified: head/share/man/man4/tap.4 ============================================================================== --- head/share/man/man4/tap.4 Fri Apr 10 09:37:53 2015 (r281362) +++ head/share/man/man4/tap.4 Fri Apr 10 09:50:13 2015 (r281363) @@ -1,7 +1,7 @@ .\" $FreeBSD$ .\" Based on PR#2411 .\" -.Dd November 30, 2014 +.Dd April 10, 2015 .Dt TAP 4 .Os .Sh NAME @@ -275,7 +275,9 @@ brought down .Dq ifconfig tap Ns Sy N No down ) unless the device is a .Em VMnet -device. +device, or has +.Dv IFF_LINK0 +flag set. All queued frames are thrown away. If the interface is up when the data device is not open, output frames are thrown away rather than Modified: head/sys/net/if_tap.c ============================================================================== --- head/sys/net/if_tap.c Fri Apr 10 09:37:53 2015 (r281362) +++ head/sys/net/if_tap.c Fri Apr 10 09:50:13 2015 (r281363) @@ -156,7 +156,6 @@ static int tapdebug = 0; /* deb static int tapuopen = 0; /* allow user open() */ static int tapuponopen = 0; /* IFF_UP on open() */ static int tapdclone = 1; /* enable devfs cloning */ -static int tapclosedeladdrs = 1; /* del addrs on close */ static SLIST_HEAD(, tap_softc) taphead; /* first device */ static struct clonedevs *tapclones; @@ -173,9 +172,6 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, up_o "Bring interface up when /dev/tap is opened"); SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTLFLAG_RWTUN, &tapdclone, 0, "Enably legacy devfs interface creation"); -SYSCTL_INT(_net_link_tap, OID_AUTO, deladdrs_on_close, CTLFLAG_RW, - &tapclosedeladdrs, 0, "Delete addresses and routes when /dev/tap is " - "closed"); SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, &tapdebug, 0, ""); DEV_MODULE(if_tap, tapmodevent, NULL); @@ -536,12 +532,11 @@ tapclose(struct cdev *dev, int foo, int IF_DRAIN(&ifp->if_snd); /* - * do not bring the interface down, and do not anything with - * interface, if we are in VMnet mode. just close the device. + * Do not bring the interface down, and do not anything with + * interface, if we are in VMnet mode. Just close the device. */ - - if (tapclosedeladdrs == 1 && ((tp->tap_flags & TAP_VMNET) == 0) && - (ifp->if_flags & IFF_UP)) { + if (((tp->tap_flags & TAP_VMNET) == 0) && + (ifp->if_flags & (IFF_UP | IFF_LINK0)) == IFF_UP) { mtx_unlock(&tp->tap_mtx); if_down(ifp); mtx_lock(&tp->tap_mtx);