Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Apr 2024 08:59:33 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Subject:   Re: git: 63613e3ba1e1 - main - wg: Use ENETUNREACH when transmitting to a non-existent peer
Message-ID:  <CEEE738E-FAD0-47D1-9F81-CB53EC8A959F@FreeBSD.org>
In-Reply-To: <202404011723.431HNlNf040122@gitrepo.freebsd.org>
References:  <202404011723.431HNlNf040122@gitrepo.freebsd.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
I can confirm this fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266712 <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266712>; .

> 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=63613e3ba1e188e9fece43e1613bd697f04b345e
> 
> 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 == NULL)) {
> -		rc = ENOKEY;
> +		rc = ENETUNREACH;
> 		goto err_xmit;
> 	}
> 




[-- Attachment #2 --]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I can confirm this fixes&nbsp;<a href="https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266712" class="">https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=266712</a>&nbsp;.<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 2, 2024, at 1:23 AM, Mark Johnston &lt;<a href="mailto:markj@freebsd.org" class="">markj@freebsd.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">The branch main has been updated by markj:<br class=""><br class="">URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=63613e3ba1e188e9fece43e1613bd697f04b345e" class="">https://cgit.FreeBSD.org/src/commit/?id=63613e3ba1e188e9fece43e1613bd697f04b345e</a><br class=""><br class="">commit 63613e3ba1e188e9fece43e1613bd697f04b345e<br class="">Author: &nbsp;&nbsp;&nbsp;&nbsp;Mark Johnston &lt;<a href="mailto:markj@FreeBSD.org" class="">markj@FreeBSD.org</a>&gt;<br class="">AuthorDate: 2024-04-01 17:20:55 +0000<br class="">Commit: &nbsp;&nbsp;&nbsp;&nbsp;Mark Johnston &lt;<a href="mailto:markj@FreeBSD.org" class="">markj@FreeBSD.org</a>&gt;<br class="">CommitDate: 2024-04-01 17:23:32 +0000<br class=""><br class=""> &nbsp;&nbsp;&nbsp;wg: Use ENETUNREACH when transmitting to a non-existent peer<br class=""><br class=""> &nbsp;&nbsp;&nbsp;The old errno value used is specifically for Capsicum and shouldn't be<br class=""> &nbsp;&nbsp;&nbsp;co-opted in this way. &nbsp;It has special handling in the generic syscall<br class=""> &nbsp;&nbsp;&nbsp;layer (see syscallret()). &nbsp;OpenBSD returns ENETUNREACH in this case;<br class=""> &nbsp;&nbsp;&nbsp;let's do the same thing.<br class=""><br class=""> &nbsp;&nbsp;&nbsp;Reviewed by: &nbsp;&nbsp;&nbsp;kevans, imp<br class=""> &nbsp;&nbsp;&nbsp;MFC after: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 weeks<br class=""> &nbsp;&nbsp;&nbsp;Sponsored by: &nbsp;&nbsp;Klara, Inc.<br class=""> &nbsp;&nbsp;&nbsp;Differential Revision: &nbsp;<a href="https://reviews.freebsd.org/D44582" class="">https://reviews.freebsd.org/D44582</a><br class="">---<br class=""> sys/dev/wg/if_wg.c | 5 +----<br class=""> 1 file changed, 1 insertion(+), 4 deletions(-)<br class=""><br class="">diff --git a/sys/dev/wg/if_wg.c b/sys/dev/wg/if_wg.c<br class="">index 42c426ac1819..bb61917ee4fc 100644<br class="">--- a/sys/dev/wg/if_wg.c<br class="">+++ b/sys/dev/wg/if_wg.c<br class="">@@ -251,9 +251,6 @@ struct wg_softc {<br class=""><br class=""> #define MAX_LOOPS<span class="Apple-tab-span" style="white-space:pre">	</span>8<br class=""> #define MTAG_WGLOOP<span class="Apple-tab-span" style="white-space:pre">	</span>0x77676c70 /* wglp */<br class="">-#ifndef ENOKEY<br class="">-#define<span class="Apple-tab-span" style="white-space:pre">	</span>ENOKEY<span class="Apple-tab-span" style="white-space:pre">	</span>ENOTCAPABLE<br class="">-#endif<br class=""><br class=""> #define<span class="Apple-tab-span" style="white-space:pre">	</span>GROUPTASK_DRAIN(gtask)<span class="Apple-tab-span" style="white-space:pre">	</span><span class="Apple-tab-span" style="white-space:pre">	</span><span class="Apple-tab-span" style="white-space:pre">	</span>\<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span>gtaskqueue_drain((gtask)-&gt;gt_taskqueue, &amp;(gtask)-&gt;gt_task)<br class="">@@ -2115,7 +2112,7 @@ wg_xmit(if_t ifp, struct mbuf *m, sa_family_t af, uint32_t mtu)<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span>BPF_MTAP2_AF(ifp, m, pkt-&gt;p_af);<br class=""><br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span>if (__predict_false(peer == NULL)) {<br class="">-<span class="Apple-tab-span" style="white-space:pre">	</span><span class="Apple-tab-span" style="white-space:pre">	</span>rc = ENOKEY;<br class="">+<span class="Apple-tab-span" style="white-space:pre">	</span><span class="Apple-tab-span" style="white-space:pre">	</span>rc = ENETUNREACH;<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span><span class="Apple-tab-span" style="white-space:pre">	</span>goto err_xmit;<br class=""> <span class="Apple-tab-span" style="white-space:pre">	</span>}<br class=""><br class=""></div></div></blockquote></div><br class=""><div class="">
<div><br class=""></div>

</div>
<br class=""></body></html>
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CEEE738E-FAD0-47D1-9F81-CB53EC8A959F>