summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJoakim Hulthe <joakim.hulthe@mullvad.net>2025-02-11 15:38:49 +0100
committerJoakim Hulthe <joakim.hulthe@mullvad.net>2025-02-25 13:37:36 +0100
commita0a2e1f935a16540332f431d9bd98d55fc181609 (patch)
treefad098944f153476e27663de505a66744b308e62
parentf4a54e55c72d10fe02e14ccb72216f2522f34641 (diff)
downloadmullvadvpn-a0a2e1f935a16540332f431d9bd98d55fc181609.tar.xz
mullvadvpn-a0a2e1f935a16540332f431d9bd98d55fc181609.zip
Add safety comments in talpid_routing::windows::route_manager
-rw-r--r--talpid-routing/src/windows/route_manager.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/talpid-routing/src/windows/route_manager.rs b/talpid-routing/src/windows/route_manager.rs
index 86ccff21fa..e8806dce3d 100644
--- a/talpid-routing/src/windows/route_manager.rs
+++ b/talpid-routing/src/windows/route_manager.rs
@@ -611,6 +611,7 @@ fn adapter_interface_enabled(
// SAFETY: All fields in the Anonymous2 union are at represented by a u32 so dereferencing
// them is safe
AF_INET => Ok(0 != unsafe { adapter.Anonymous2.Flags } & IP_ADAPTER_IPV4_ENABLED),
+ // SAFETY: Same as above.
AF_INET6 => Ok(0 != unsafe { adapter.Anonymous2.Flags } & IP_ADAPTER_IPV6_ENABLED),
_ => Err(Error::InvalidSiFamily),
}
@@ -662,6 +663,7 @@ fn equal_address(lhs: &SOCKADDR_INET, rhs: &SOCKET_ADDRESS) -> Result<bool> {
return Ok(false);
}
+ // SAFETY: The si_family field is always valid
match unsafe { lhs.si_family } {
AF_INET => {
let typed_rhs = rhs.lpSockaddr as *mut SOCKADDR_IN;