From nobody Tue Apr 02 00:59:33 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 4V7qKV2t7Vz5FZpb; Tue, 2 Apr 2024 00:59:42 +0000 (UTC) (envelope-from zlei@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V7qKV22Tzz4XyB; Tue, 2 Apr 2024 00:59:42 +0000 (UTC) (envelope-from zlei@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712019582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IYCF4wcBNwb65UtuNY0VXd+BRxyNJdie0uyBzTWVSiY=; b=U9Kon8lsJqBTn0SztJmx7RcjqOPDV2d6i+CrVVwo43tDvqOQ5vtsMSuk5Bh+EATMkyva1z 3S8uQ24zUXBwGevk/CIgQNGCNw4lU+nVe170YKdC01mPzumRNrjyLxHckAyk25X8lbgJdU yUvFoUuguQzBlgOPoOwpXfTquOH/b0sCUxt+axGlOHH+HHBwhAhRUZD0YWvJIkAGFtAWZP DLXVhG4El7+R6Zpc+DDpFPaK38xeQ2LPJBnVPAxWtYdAQmCzAHGDGzgxBDS8YqwZdLxqKS mK/ZW8hags6lFa9l5xKfOyT9rOQBU5RoXIJ0zXK26u72gU8WUPzV0WqSKJGBrA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712019582; a=rsa-sha256; cv=none; b=QBsB199rUtItkefRkVlmPtgBx+5mgZ8VoSJ2uKyujd89FXbZeUiZMm4IvUtnZU/O5++169 k6qjx3i/Kc2O2hNxs7CyK4ohGKuEFPghhQpAbcRNNwl+mEX8muMj0JA5VvAadfCmY4NJ7p vsm/qqQPdEJPxar9dVQn3KYTYWZdEeSim5+TMoNzQKFpHoTN5vWLWntWkcyIx8mCvlpXfA 9Gx/uJmkZPmRh2yTxkalPMDY3D7rPRo3Ro+8bYortWjlsrv+OH8D4Z59qbdz+gUXt5kcF2 71oFMH0kbuzA1CPIqRHbnA6Thld4hvHhVwKV6o1XKM8COUK/tiYxt5ci5zhAMg== 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=1712019582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=IYCF4wcBNwb65UtuNY0VXd+BRxyNJdie0uyBzTWVSiY=; b=oqukn/ZxZFeq/AkBWprs9u5wxkiGykk+WKLM8wHvvCr1fSN6oyo2L+VzNnhsNYOKSOXPO0 5MHmMrQ5Mw2nzrCTBQ8pbZx/D8QJlTYzRx7mwm/2vEIuwaW5PaZAZsnorVzDTTeZJPLU0u GEYIFZCOW7ERUeoGjdwrCdRxEfBrC3OtnaZhH7XFgv6IN/nSLlnDpOmcJvRrmFn+OfvIfM GuPU0VKkgmH2d/6Ey8pALxALgc+amTGyWkWC+tlA0AHMpbItpbFQEyD4x0LK12jJ04ue8Q T+PV8Rqr3FFlZv+3sSK0Iw+fTYsJUBTjznO9aQPalrpY6X0WBYjGbd2+6dChzQ== Received: from smtpclient.apple (unknown [IPv6:2001:19f0:6001:9db:98f0:9fe0:3545:10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: zlei/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4V7qKS759wz1PCd; Tue, 2 Apr 2024 00:59:40 +0000 (UTC) (envelope-from zlei@FreeBSD.org) From: Zhenlei Huang Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_FD3BFEC7-1909-421F-B544-1A90D3B1EA1B" 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: git: 63613e3ba1e1 - main - wg: Use ENETUNREACH when transmitting to a non-existent peer Date: Tue, 2 Apr 2024 08:59:33 +0800 In-Reply-To: <202404011723.431HNlNf040122@gitrepo.freebsd.org> Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: Mark Johnston References: <202404011723.431HNlNf040122@gitrepo.freebsd.org> X-Mailer: Apple Mail (2.3696.120.41.1.8) --Apple-Mail=_FD3BFEC7-1909-421F-B544-1A90D3B1EA1B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii I can confirm this fixes = https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266712 = . > On Apr 2, 2024, at 1:23 AM, Mark Johnston wrote: >=20 > The branch main has been updated by markj: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D63613e3ba1e188e9fece43e1613bd697= f04b345e >=20 > commit 63613e3ba1e188e9fece43e1613bd697f04b345e > Author: Mark Johnston > AuthorDate: 2024-04-01 17:20:55 +0000 > Commit: Mark Johnston > CommitDate: 2024-04-01 17:23:32 +0000 >=20 > wg: Use ENETUNREACH when transmitting to a non-existent peer >=20 > The old errno value used is specifically for Capsicum and shouldn't = be > co-opted in this way. It has special handling in the generic = syscall > layer (see syscallret()). OpenBSD returns ENETUNREACH in this = case; > let's do the same thing. >=20 > Reviewed by: kevans, imp > MFC after: 2 weeks > Sponsored by: Klara, Inc. > Differential Revision: https://reviews.freebsd.org/D44582 > --- > sys/dev/wg/if_wg.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) >=20 > diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c > index 42c426ac1819..bb61917ee4fc 100644 > --- a/sys/dev/wg/if_wg.c > +++ b/sys/dev/wg/if_wg.c > @@ -251,9 +251,6 @@ struct wg_softc { >=20 > #define MAX_LOOPS 8 > #define MTAG_WGLOOP 0x77676c70 /* wglp */ > -#ifndef ENOKEY > -#define ENOKEY ENOTCAPABLE > -#endif >=20 > #define GROUPTASK_DRAIN(gtask) \ > gtaskqueue_drain((gtask)->gt_taskqueue, &(gtask)->gt_task) > @@ -2115,7 +2112,7 @@ wg_xmit(if_t ifp, struct mbuf *m, sa_family_t = af, uint32_t mtu) > BPF_MTAP2_AF(ifp, m, pkt->p_af); >=20 > if (__predict_false(peer =3D=3D NULL)) { > - rc =3D ENOKEY; > + rc =3D ENETUNREACH; > goto err_xmit; > } >=20 --Apple-Mail=_FD3BFEC7-1909-421F-B544-1A90D3B1EA1B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii I = can confirm this fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D266712&= nbsp;.

On Apr 2, 2024, at 1:23 AM, Mark Johnston = <markj@freebsd.org> wrote:

The = branch main has been updated by markj:

URL: = https://cgit.FreeBSD.org/src/commit/?id=3D63613e3ba1e188e9fece4= 3e1613bd697f04b345e

commit = 63613e3ba1e188e9fece43e1613bd697f04b345e
Author: =     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-04-01 17:20:55 +0000
Commit: =     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-04-01 17:23:32 +0000

   wg: Use ENETUNREACH when transmitting to a = non-existent peer

   The = old errno value used is specifically for Capsicum and shouldn't be
   co-opted in this way.  It has special = handling in the generic syscall
   layer = (see syscallret()).  OpenBSD returns ENETUNREACH in this case;
   let's do the same thing.

   Reviewed by:    kevans, = imp
   MFC after: =      2 weeks
=    Sponsored by:   Klara, Inc.
=    Differential Revision:  https://reviews.freebsd.org/D44582
---
sys/dev/wg/if_wg.c | 5 +----
1 file changed, = 1 insertion(+), 4 deletions(-)

diff --git = a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c
index = 42c426ac1819..bb61917ee4fc 100644
--- = a/sys/dev/wg/if_wg.c
+++ b/sys/dev/wg/if_wg.c
@@ -251,9 +251,6 @@ struct wg_softc {

#define MAX_LOOPS 8
#define = MTAG_WGLOOP = 0x77676c70 /* wglp */
-#ifndef ENOKEY
-#define ENOKEY = ENOTCAPABLE
-#endif

= #define = GROUPTASK_DRAIN(gtask) \
= gtaskqueue_drain((gtask)->gt_taskqueue, = &(gtask)->gt_task)
@@ -2115,7 +2112,7 @@ = wg_xmit(if_t ifp, struct mbuf *m, sa_family_t af, uint32_t mtu)
= BPF_MTAP2_AF(ifp, m, pkt->p_af);

= = if (__predict_false(peer =3D=3D NULL)) {
- rc =3D = ENOKEY;
+ rc =3D ENETUNREACH;
= = = goto err_xmit;
}




= --Apple-Mail=_FD3BFEC7-1909-421F-B544-1A90D3B1EA1B--