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
This commit is contained in:
Mark Johnston 2024-04-01 13:20:55 -04:00
parent 125c4560bc
commit 63613e3ba1

View file

@ -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;
}