Re: git: 63613e3ba1e1 - main - wg: Use ENETUNREACH when transmitting to a non-existent peer
Date: Tue, 02 Apr 2024 00:59:33 UTC
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; > } >