Date: Thu, 12 Sep 2024 13:11:51 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 3c95262007ef - main - if_ovpn: only install tunnel callback once Message-ID: <202409121311.48CDBpH1015093@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c95262007ef934c9e98b87460a48889bf42c1b9 commit 3c95262007ef934c9e98b87460a48889bf42c1b9 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2024-09-12 08:37:41 +0000 Commit: Kristof Provost <kp@FreeBSD.org> 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409121311.48CDBpH1015093>