From nobody Sun Apr 12 13:44:08 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ftsG11WXSz6ZM3D for ; Sun, 12 Apr 2026 13:44:09 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ftsG05cR6z3kJD for ; Sun, 12 Apr 2026 13:44:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776001448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ibdpAaRpizj50JHwWLB/rwmgJ87CSVTzLqQ7Mb8J8YM=; b=t97XDNfnoJOban2CtySaqgwIOgZeGX1C+TcWOBVQXgjQI+A2f/puHR+ZWaza8RfV1EuMNi ozCTA/h6uJTtUxdZcQLuoes22MRvTOrbbktJAX7yWPeyfNI+Z8CjNmf8SxEqRHZcDt+xpI TkRqsTqMksgK1Xcr6HthkZv6JKyOVE1AKcfHxn30lyQgQ/b3R84qFT1X/rEcasIR1cDZ4L OHm/92iAVlOx1Lbn1ZlZhjwJ2BMgPXCkOV2PhoMN5MMU64yaEuxbZimGW1V6+ItGetG+9B PXzxzU02nbetOQ/smhlzv+Yk+WKi1cYfloQ6GzSPQSvLj24Hpg+UP6FmlyIncg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776001448; a=rsa-sha256; cv=none; b=A+xO3VU9qhOhH/CZuo4YP7VSIAoXc6Voo40oO8rv50NSeN3o21JyDtk2yba84ZbxGlxi6O 1gah9cg+rBduJ5K2IyYbWx7IOk5EXBgw1opA2iS+k65QkB0MQrZFkgTdL5GVXTHGqRyRAI qeQS2pS6qvCPTDApYN+qRur1obzMdT2glMBoRrbWLQYy0EF+aRrVxGidh3qTWbY3EyNmmv XgC1gV7HHMsssCVfiDNfo2TLLv6vBRfOpwC9sBD5PizQyTP0wTU78cLMXXiDj50eFJlxm/ 3mw9xgSUfF8GWIb68OJGTnF2gkdH+n2pJV1/aiLq+N1EejGGKyfQkyfDGGKrKQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776001448; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ibdpAaRpizj50JHwWLB/rwmgJ87CSVTzLqQ7Mb8J8YM=; b=q3yA32I+N/vK1BkIfP30Xx/uLVTE072q1HoQ/hlILWl+17FQ/zc9Vw6F1ZdBD8q12bBpVM 7WK5chxpMBzU1DBnwPqYUDMYi3aosm5HhSMZwhEpMCtyexQpzxvxQJR4KlPQsC8pGNct/4 0c1ygK+R0B//wCp3E+ewNhu2m0EvCmhJtYClRJ9IoL8VAMO33Jon5Xvjk14HYYIiiONKYF 5aqvf6YDp1JwdV9YqtzSHj1VDIkY9GhXicv7ws0MS1p8pCHi1IMubPR/HXJi3Rz3e31d7y nCHKYNvI4HUJLCahfPYjZWeSxIXk2jWrHXnO6+CG7JNL8daTUhzcaiseC6nJqA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4ftsG04PXYz41G for ; Sun, 12 Apr 2026 13:44:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4348e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 12 Apr 2026 13:44:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: fd67a7587c1a - stable/14 - if_tuntap: make SIOCIFDESTROY interruptible List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fd67a7587c1a187cc162cf02ece94f4142874f35 Auto-Submitted: auto-generated Date: Sun, 12 Apr 2026 13:44:08 +0000 Message-Id: <69dba1a8.4348e.746f944d@gitrepo.freebsd.org> The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=fd67a7587c1a187cc162cf02ece94f4142874f35 commit fd67a7587c1a187cc162cf02ece94f4142874f35 Author: Kyle Evans AuthorDate: 2025-08-21 14:21:41 +0000 Commit: Kyle Evans CommitDate: 2026-04-12 13:43:37 +0000 if_tuntap: make SIOCIFDESTROY interruptible There's no good justification to permanently hang a thread until the tunnel can be destroyed. Make it interruptible so that the admin can ^C it and remedy the situation if something erroneously has the tunnel open, rather than forcing them to open another shell to resolve it. Reviewed by: markj (cherry picked from commit 274bf7c8ae7e7b51853cd541481985f0e687f10e) --- sys/net/if_tuntap.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/sys/net/if_tuntap.c b/sys/net/if_tuntap.c index 45d981de9fdb..f42daed4a68d 100644 --- a/sys/net/if_tuntap.c +++ b/sys/net/if_tuntap.c @@ -623,19 +623,34 @@ out: CURVNET_RESTORE(); } -static void -tun_destroy(struct tuntap_softc *tp) +static int +tun_destroy(struct tuntap_softc *tp, bool may_intr) { + int error; TUN_LOCK(tp); + MPASS((tp->tun_flags & TUN_DYING) == 0); tp->tun_flags |= TUN_DYING; - if (tp->tun_busy != 0) - cv_wait_unlock(&tp->tun_cv, &tp->tun_mtx); - else - TUN_UNLOCK(tp); + error = 0; + while (tp->tun_busy != 0) { + if (may_intr) + error = cv_wait_sig(&tp->tun_cv, &tp->tun_mtx); + else + cv_wait(&tp->tun_cv, &tp->tun_mtx); + if (error != 0) { + tp->tun_flags &= ~TUN_DYING; + TUN_UNLOCK(tp); + return (error); + } + } + TUN_UNLOCK(tp); CURVNET_SET(TUN2IFP(tp)->if_vnet); + mtx_lock(&tunmtx); + TAILQ_REMOVE(&tunhead, tp, tun_list); + mtx_unlock(&tunmtx); + /* destroy_dev will take care of any alias. */ destroy_dev(tp->tun_dev); seldrain(&tp->tun_rsel); @@ -656,6 +671,8 @@ tun_destroy(struct tuntap_softc *tp) cv_destroy(&tp->tun_cv); free(tp, M_TUN); CURVNET_RESTORE(); + + return (0); } static int @@ -663,12 +680,7 @@ tun_clone_destroy(struct if_clone *ifc __unused, struct ifnet *ifp, uint32_t fla { struct tuntap_softc *tp = ifp->if_softc; - mtx_lock(&tunmtx); - TAILQ_REMOVE(&tunhead, tp, tun_list); - mtx_unlock(&tunmtx); - tun_destroy(tp); - - return (0); + return (tun_destroy(tp, true)); } static void @@ -723,9 +735,9 @@ tun_uninit(const void *unused __unused) mtx_lock(&tunmtx); while ((tp = TAILQ_FIRST(&tunhead)) != NULL) { - TAILQ_REMOVE(&tunhead, tp, tun_list); mtx_unlock(&tunmtx); - tun_destroy(tp); + /* tun_destroy() will remove it from the tailq. */ + tun_destroy(tp, false); mtx_lock(&tunmtx); } mtx_unlock(&tunmtx);