From nobody Thu Sep 12 13:11:51 2024 X-Original-To: dev-commits-src-main@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 4X4Hs417Pyz5WVjL; Thu, 12 Sep 2024 13:11:52 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X4Hs40KhKz40MQ; Thu, 12 Sep 2024 13:11:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726146712; 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=ztUQqN41PaJOg6oXBOrT8Hbq/9t/Jf7d8nILVEh0U+s=; b=d2/iKLcugMu6rz02ZsONzwTYr8cP+i4Br3xMaBh2lG2Uz/deOpBrVRZb7p0myOfDEo1tOf vDntuUzHRcyRXIOoJRu7VYTvCp7EC6/MsQiBh/iziyeYGA+hD6LoLQn14Lp9inZGbfTfQi Kpo6itFjLFkdbZ6YlyVXxw5Unpmq2Zg0vHMKC0XFkGL1lUCSVWVRTeuWHfo3W6IwpF6vCZ d7rDwZL2gH0QI1pAZQrArOUe8su0ifgoKjAX4j4s5ov94tdjFzrrwD443BKvusU6tui9nW GdaxxoxgZkAT9LQJLHffB4g159PElbow/1GP/ew4zh8/qILxPjTv5nkpZRq+Bw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726146712; a=rsa-sha256; cv=none; b=SgS2OEgXWeMqz0m5W4h4zU4o/WlP9pGuDUB7bJ0DVfC0f0vS+mcHFdMOS/QkGqp3rgWRDW vFKq3+Tor9JNFUtzFX2QnPCqZZrPpT1JFCeUzimbGaxjVcRtp7FktvEuVkrPxKfZSterYa H4ie2cRKtyqw6BNuZy/oSZDcJFCTnX+wwxdu6dbJlL/Qy9VP9WI98Y2TkEE3b33uBfbPE5 72ykc4gOtxOx/VVu7ke1435SIwsBkdenWRji4PfeR49XYutZQLctLvoyhsulelz+I1i9Is RSFZsugmbZP3yusjxAYT3x71+7IOfQzL1DSIrfx/Nkp+Estx332/CrANPVuV5Q== 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=1726146712; 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=ztUQqN41PaJOg6oXBOrT8Hbq/9t/Jf7d8nILVEh0U+s=; b=GrVmRGQV+LCpKbdzJj0TF1+jQss6+QyzZL1QLlTtiXsV3nQ0jRsoPgINMvm98JFjsA04KH NGaGTLHQlQ7NEKdeMeXOauorWepKmGbT0QdvoAbQsMnndyZNn/FAjzCAlO1L7QLiL+RLaK RZHRjC7kw6AZJSZwgWZcaiASaLhnVq3zfKFgwhVNjsjQTKecDkN4GHtSxznAySsBYPqfRT THtoa13pQZCgM7X/kjWSsGQKiIoaKolOXKnp6P8Z39qo7YAfX3exPZasPrEk9RoNKQkAHZ 1YjNvsFL6w+M8//NsZeXmvq7MvKVy5lcRN01BufCegkm6Bk9TZAu56Y8rnS7Jw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4X4Hs372spz1FxM; Thu, 12 Sep 2024 13:11:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48CDBpvq015096; Thu, 12 Sep 2024 13:11:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48CDBpH1015093; Thu, 12 Sep 2024 13:11:51 GMT (envelope-from git) Date: Thu, 12 Sep 2024 13:11:51 GMT Message-Id: <202409121311.48CDBpH1015093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 3c95262007ef - main - if_ovpn: only install tunnel callback once List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c95262007ef934c9e98b87460a48889bf42c1b9 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c95262007ef934c9e98b87460a48889bf42c1b9 commit 3c95262007ef934c9e98b87460a48889bf42c1b9 Author: Kristof Provost AuthorDate: 2024-09-12 08:37:41 +0000 Commit: Kristof Provost CommitDate: 2024-09-12 13:11:36 +0000 if_ovpn: only install tunnel callback once Rather than attempt to install the tunnel callback every time we add a peer only do so the first time. Reviewed by: zlei Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D46651 --- sys/net/if_ovpn.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/net/if_ovpn.c b/sys/net/if_ovpn.c index e2c1dc7f7fc5..f1c2e1403d4b 100644 --- a/sys/net/if_ovpn.c +++ b/sys/net/if_ovpn.c @@ -511,6 +511,7 @@ ovpn_new_peer(struct ifnet *ifp, const nvlist_t *nvl) int fd; uint32_t peerid; int ret = 0; + bool setcb = false; if (nvl == NULL) return (EINVAL); @@ -631,6 +632,7 @@ ovpn_new_peer(struct ifnet *ifp, const nvlist_t *nvl) * we're destroying the ifp. */ soref(sc->so); + setcb = true; } /* Insert the peer into the list. */ @@ -638,9 +640,11 @@ ovpn_new_peer(struct ifnet *ifp, const nvlist_t *nvl) sc->peercount++; OVPN_WUNLOCK(sc); - ret = udp_set_kernel_tunneling(sc->so, ovpn_udp_input, NULL, sc); - MPASS(ret == 0 || ret == EBUSY); - ret = 0; + + if (setcb) { + ret = udp_set_kernel_tunneling(sc->so, ovpn_udp_input, NULL, sc); + MPASS(ret == 0); + } goto done;