Fix Network: Listeners bound to the unspecified IPv6 address ([::]) fall back to IPv4 when socket creation fails with EPROTONOSUPPORT

This commit is contained in:
Maurus Decimus committed 2026-09-04 10:55:41 +02:00
1 parent 7ed4bce203
commit 9d071fc361
2 files changed
+7 -4

No files matched your search

+1
View File
@@ -13,6 +13,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If
## Fixed
- LDAP: Active Directory servers that answer an unauthenticated bind (a non-empty DN with a zero-length password) with success no longer authenticate accounts without a password.
- IMAP: Every command in a pipelined `STATUS` or `FETCH` batch receives its tagged completion, instead of the first failing command dropping the responses for all commands queued behind it.
- Network: Listeners bound to the unspecified IPv6 address (`[::]`) fall back to IPv4 when socket creation fails with `EPROTONOSUPPORT`.
## [0.16.20] - 2026-08-30
+6 -4
View File
@@ -121,7 +121,9 @@ impl Listeners {
} {
Ok(socket) => socket,
Err(err)
if is_eafnosupport(&err) && addr.is_ipv6() && addr.ip().is_unspecified() =>
if is_ipv6_unsupported(&err)
&& addr.is_ipv6()
&& addr.ip().is_unspecified() =>
{
let v4_addr =
StdSocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), addr.port());
@@ -327,15 +329,15 @@ impl Listeners {
}
}
fn is_eafnosupport(err: &std::io::Error) -> bool {
fn is_ipv6_unsupported(err: &std::io::Error) -> bool {
let code = err.raw_os_error();
#[cfg(unix)]
{
code == Some(libc::EAFNOSUPPORT)
matches!(code, Some(libc::EAFNOSUPPORT) | Some(libc::EPROTONOSUPPORT))
}
#[cfg(windows)]
{
code == Some(10047)
matches!(code, Some(10047) | Some(10043))
}
#[cfg(not(any(unix, windows)))]
{