From f24a18b1da57c60922b2c17e660737f98cd5421b Mon Sep 17 00:00:00 2001 From: monojenkins Date: Fri, 23 Oct 2020 12:59:36 -0400 Subject: [PATCH] [w32socket] Turn WireGuard ENOKEY errno to WASANETUNREACH (#43734) When the destination IP on the packet doesn't match any WireGuard peer (such as if the peer is disconnected while the app is running), the sender may get an ENOKEY errno. This is mentioned in Section 3 "Send/Receive" of https://www.wireguard.com/papers/wireguard.pdf Fixes https://github.com/mono/mono/issues/20503 Co-authored-by: lambdageek --- src/mono/mono/metadata/w32socket-unix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mono/mono/metadata/w32socket-unix.c b/src/mono/mono/metadata/w32socket-unix.c index 276aabe..3c0e13a 100644 --- a/src/mono/mono/metadata/w32socket-unix.c +++ b/src/mono/mono/metadata/w32socket-unix.c @@ -1549,6 +1549,9 @@ mono_w32socket_convert_error (gint error) #ifdef ENONET case ENONET: return WSAENETUNREACH; #endif +#ifdef ENOKEY + case ENOKEY: return WSAENETUNREACH; +#endif default: g_error ("%s: no translation into winsock error for (%d) \"%s\"", __func__, error, g_strerror (error)); } -- 2.7.4