mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-10-15 00:56:15 -08:00
fix: avoid shared IPv4 miscompilation on Rust 1.95 (#2703)
Keep ipv4_inet out of line to prevent LLVM load combining from zeroing the address and prefix when inlined into async add_ip. This works around Windows named-NIC IPv4 setup failures on the current release toolchain. Link the upstream LLVM fix so the workaround can be removed once all build toolchains include it. Fixes #2696
This commit is contained in:
1 parent
0ca2fde0fb
commit
8839b4b2f1
1 file changed
+4
@@ -896,6 +896,10 @@ impl SharedVirtualNicRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
// Rust 1.95's LLVM can zero this result when inlined into the async add_ip path.
|
||||
// Remove this workaround once all build toolchains include LLVM's fix:
|
||||
// https://github.com/llvm/llvm-project/pull/207229
|
||||
#[inline(never)]
|
||||
fn ipv4_inet(address: Ipv4Addr, prefix: i32) -> Result<Ipv4Inet, Error> {
|
||||
let prefix = u8::try_from(prefix)
|
||||
.map_err(|_| anyhow::anyhow!("invalid IPv4 prefix length {}", prefix))?;
|
||||
|
||||
Reference in new issue
Block a user