connect to host … : Unknown error for WSAEHOSTUNREACH / WSAENETUNREACH (no errno mapping)
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 76/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c
- 领域
- networking
调研方向
从 contrib/win32/win32compat/socketio.c 中的 errno_from_WSAError() 开始。issue 指出缺少 WSAEHOSTUNREACH 和 WSAENETUNREACH 的映射;请检查 misc.c 中对应的错误字符串。如果有相关的 Windows 连接测试,请运行并确认无法访问的主机会产生有意义的错误,而不是“Unknown error”。
由索引模型根据 Issue 内容生成。
描述
Summary
When the TCP connect fails because the host or network is unreachable (for example, Wi-Fi drops), ssh prints
ssh: connect to host 192.168.0.63 port 22: Unknown error
instead of a meaningful message. Tools that parse ssh's output to decide whether a failure is transient can't classify it. VS Code Remote-SSH, for example, treats it as a permanent error and stops reconnecting.
Steps to reproduce
ssh -F NUL -o BatchMode=yes [email protected](no route) →ssh: connect to host 240.0.0.1 port 22: Unknown error, instantly.- Or, with Wi-Fi disconnected (
netsh wlan disconnect),ssh <LAN host>→ sameUnknown error. .NET reports the same connect asSocketError.HostUnreachable(10065).
Expected
No route to host / Network is unreachable (or at least a message naming the Winsock error).
Actual
Unknown error.
Cause
contrib/win32/win32compat/socketio.c, errno_from_WSAError() maps only a handful of WSA codes. Everything else falls to
default:
return wsaerrno - 10000;
So WSAEHOSTUNREACH (10065) becomes errno 65 and WSAENETUNREACH (10051) becomes 51. w32_strerror() in misc.c only has strings for EADDRINUSE..EWOULDBLOCK (100–140), so strerror_s returns "Unknown error" for those values.
Suggested fix: add explicit cases:
WSAENETDOWN→ENETDOWNWSAENETUNREACH→ENETUNREACHWSAEHOSTUNREACH→EHOSTUNREACHWSAEADDRNOTAVAIL→EADDRNOTAVAIL
Optionally, use the POSIX/glibc wording in _sys_errlist_ext ("No route to host", "Network is unreachable"); the current "Host is unreachable" and "Network unreachable" differ from what other platforms print and from what scripts match.
Version
OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2(Windows 10 Pro 22H2 19045, built-in)- Same code in
v10.4.0.0(socketio.cunchanged).
- 主要语言
- 没有语言数据
- 星标
- 8.3k
- 派生
- 822
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PowerShell/Win32-OpenSSH 的其他 Issue
-
Area-ssh-agent Issue-Upstream Parity
难度 2/5 1-3 小时 新手友好度 74/100
PowerShell/Win32-OpenSSH#2458 · 1 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 10/100
PowerShell/Win32-OpenSSH#2480 · 2 条评论 · 1 个 reaction ·
-
ssh -t exec path concatenates the command unquoted — GNU-style -c shells lose all but the first word可能已有人在做 @caomengxuan666 于 5 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 62/100
PowerShell/Win32-OpenSSH#2478 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 42/100
PowerShell/Win32-OpenSSH#2476 · 1 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 48/100
PowerShell/Win32-OpenSSH#2472 · 1 条评论 · 1 个 reaction ·
查看 PowerShell/Win32-OpenSSH 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
-
bug
难度 2/5 1-3 小时 新手友好度 80/100
rossoctl/cortex#1546 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
apache/openserverless#282 · 2 条评论 ·
-
Type: Bug
难度 2/5 1-3 小时 新手友好度 78/100
inverse-inc/packetfence#9605 ·
维护者通常 10 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
SoftEtherVPN/SoftEtherVPN#2322 ·
维护者通常 1 天内回复