diff options
| author | David Lönnhager <david.l@mullvad.net> | 2023-03-14 11:17:18 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2023-03-14 11:17:18 +0100 |
| commit | 884f8d8c52bc9ed063abeb09295d8bd7483ea8dc (patch) | |
| tree | 2c1f31025731dc54100e3b2b4a51c78d837f5403 | |
| parent | 45aec8a4d48180333cc082fbd63341ae58868d40 (diff) | |
| parent | 9f20723ac9df757263fb9c6f7749d20395b76ceb (diff) | |
| download | mullvadvpn-884f8d8c52bc9ed063abeb09295d8bd7483ea8dc.tar.xz mullvadvpn-884f8d8c52bc9ed063abeb09295d8bd7483ea8dc.zip | |
Merge branch 'update-windows-deps'
| -rw-r--r-- | Cargo.lock | 189 | ||||
| -rw-r--r-- | mullvad-cli/Cargo.toml | 2 | ||||
| -rw-r--r-- | mullvad-daemon/Cargo.toml | 8 | ||||
| -rw-r--r-- | mullvad-paths/Cargo.toml | 2 | ||||
| -rw-r--r-- | mullvad-problem-report/Cargo.toml | 2 | ||||
| -rw-r--r-- | mullvad-relay-selector/Cargo.toml | 2 | ||||
| -rw-r--r-- | mullvad-types/src/relay_constraints.rs | 2 | ||||
| -rw-r--r-- | talpid-core/Cargo.toml | 6 | ||||
| -rw-r--r-- | talpid-openvpn-plugin/Cargo.toml | 2 | ||||
| -rw-r--r-- | talpid-openvpn/Cargo.toml | 4 | ||||
| -rw-r--r-- | talpid-platform-metadata/Cargo.toml | 2 | ||||
| -rw-r--r-- | talpid-routing/Cargo.toml | 2 | ||||
| -rw-r--r-- | talpid-routing/src/windows/route_manager.rs | 13 | ||||
| -rw-r--r-- | talpid-tunnel/Cargo.toml | 2 | ||||
| -rw-r--r-- | talpid-windows-net/Cargo.toml | 2 | ||||
| -rw-r--r-- | talpid-windows-net/src/net.rs | 8 | ||||
| -rw-r--r-- | talpid-wireguard/Cargo.toml | 4 | ||||
| -rw-r--r-- | talpid-wireguard/src/wireguard_nt.rs | 19 |
18 files changed, 114 insertions, 157 deletions
diff --git a/Cargo.lock b/Cargo.lock index 1927043462..87bef3c513 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1401,7 +1401,7 @@ dependencies = [ "jni", "jnix-macros", "once_cell", - "parking_lot 0.12.1", + "parking_lot", ] [[package]] @@ -1602,14 +1602,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.36.1", + "windows-sys 0.45.0", ] [[package]] @@ -1678,7 +1678,7 @@ dependencies = [ "serde", "talpid-types", "tokio", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "winres", ] @@ -1709,7 +1709,7 @@ dependencies = [ "mullvad-version", "nix 0.23.1", "objc", - "parking_lot 0.11.2", + "parking_lot", "rand 0.8.5", "regex", "serde", @@ -1725,7 +1725,7 @@ dependencies = [ "uuid", "winapi", "windows-service", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "winres", ] @@ -1800,7 +1800,7 @@ dependencies = [ "log", "once_cell", "widestring 1.0.2", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -1822,7 +1822,7 @@ dependencies = [ "talpid-types", "tokio", "uuid", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "winres", ] @@ -1838,7 +1838,7 @@ dependencies = [ "log", "mullvad-api", "mullvad-types", - "parking_lot 0.11.2", + "parking_lot", "rand 0.8.5", "serde", "serde_json", @@ -2154,50 +2154,25 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.5", -] - -[[package]] -name = "parking_lot" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.3", + "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", - "instant", "libc", "redox_syscall", "smallvec", - "winapi", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys 0.36.1", + "windows-sys 0.45.0", ] [[package]] @@ -3202,7 +3177,7 @@ dependencies = [ "once_cell", "os_pipe", "parity-tokio-ipc", - "parking_lot 0.11.2", + "parking_lot", "pfctl", "prost", "quickcheck", @@ -3236,7 +3211,7 @@ dependencies = [ "which", "widestring 1.0.2", "windows-service", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "winreg", "zeroize", ] @@ -3269,7 +3244,7 @@ dependencies = [ "log", "os_pipe", "parity-tokio-ipc", - "parking_lot 0.11.2", + "parking_lot", "prost", "shadowsocks-service", "shell-escape", @@ -3285,7 +3260,7 @@ dependencies = [ "uuid", "which", "widestring 1.0.2", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "winreg", ] @@ -3305,7 +3280,7 @@ dependencies = [ "tonic", "tonic-build", "tower", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "winres", ] @@ -3315,7 +3290,7 @@ version = "0.0.0" dependencies = [ "rs-release", "talpid-dbus", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -3337,7 +3312,7 @@ dependencies = [ "tokio", "tokio-stream", "widestring 1.0.2", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -3365,7 +3340,7 @@ dependencies = [ "talpid-windows-net", "tokio", "tun", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -3408,7 +3383,7 @@ dependencies = [ "libc", "socket2", "winapi", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -3432,7 +3407,7 @@ dependencies = [ "netlink-packet-utils", "netlink-proto", "nix 0.23.1", - "parking_lot 0.11.2", + "parking_lot", "rand 0.8.5", "rtnetlink", "socket2", @@ -3446,7 +3421,7 @@ dependencies = [ "tokio-stream", "tunnel-obfuscation", "widestring 1.0.2", - "windows-sys 0.42.0", + "windows-sys 0.45.0", "zeroize", ] @@ -3534,9 +3509,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.25.0" +version = "1.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" dependencies = [ "autocfg", "bytes", @@ -3544,12 +3519,12 @@ dependencies = [ "memchr", "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -3849,7 +3824,7 @@ dependencies = [ "ipconfig", "lazy_static", "lru-cache", - "parking_lot 0.12.1", + "parking_lot", "resolv-conf", "serde", "smallvec", @@ -4175,27 +4150,13 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-service" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "917fdb865e7ff03af9dd86609f8767bc88fefba89e8efd569de8e208af8724b3" +checksum = "cd9db37ecb5b13762d95468a2fc6009d4b2c62801243223aabd44fca13ad13c8" dependencies = [ "bitflags", - "err-derive", "widestring 1.0.2", - "windows-sys 0.36.1", -] - -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "windows-sys 0.45.0", ] [[package]] @@ -4205,85 +4166,79 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_x86_64_msvc", ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.0" +name = "windows-sys" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] [[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" +name = "windows-targets" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] [[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" +name = "windows_aarch64_gnullvm" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] -name = "windows_i686_gnu" -version = "0.36.1" +name = "windows_aarch64_msvc" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "winreg" diff --git a/mullvad-cli/Cargo.toml b/mullvad-cli/Cargo.toml index fa671fd3c0..2ba23a65ca 100644 --- a/mullvad-cli/Cargo.toml +++ b/mullvad-cli/Cargo.toml @@ -38,7 +38,7 @@ winres = "0.1" mullvad-version = { path = "../mullvad-version" } [target.'cfg(windows)'.build-dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_System_SystemServices", ] diff --git a/mullvad-daemon/Cargo.toml b/mullvad-daemon/Cargo.toml index 28d00cc9b3..d427ac84f3 100644 --- a/mullvad-daemon/Cargo.toml +++ b/mullvad-daemon/Cargo.toml @@ -17,7 +17,7 @@ ipnetwork = "0.16" lazy_static = "1.0" libc = "0.2" log = "0.4" -parking_lot = "0.11" +parking_lot = "0.12.0" rand = "0.8.5" regex = "1.0" serde = { version = "1.0", features = ["derive"] } @@ -57,12 +57,12 @@ objc = "0.2.3" [target.'cfg(windows)'.dependencies] ctrlc = "3.0" duct = "0.13" -windows-service = "0.5.0" +windows-service = "0.6.0" winapi = { version = "0.3", features = ["winnt", "excpt"] } dirs-next = "2.0" [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_Foundation", "Win32_Security", @@ -79,7 +79,7 @@ winres = "0.1" mullvad-version = { path = "../mullvad-version" } [target.'cfg(windows)'.build-dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_System_SystemServices", ] diff --git a/mullvad-paths/Cargo.toml b/mullvad-paths/Cargo.toml index 1d56987aaf..e1e8fae8e0 100644 --- a/mullvad-paths/Cargo.toml +++ b/mullvad-paths/Cargo.toml @@ -18,7 +18,7 @@ widestring = "1.0" once_cell = "1.13" [target.'cfg(target_os = "windows")'.dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_Foundation", "Win32_Security", diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml index 1787e2ed21..d516186203 100644 --- a/mullvad-problem-report/Cargo.toml +++ b/mullvad-problem-report/Cargo.toml @@ -34,7 +34,7 @@ winres = "0.1" mullvad-version = { path = "../mullvad-version" } [target.'cfg(windows)'.build-dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_System_SystemServices", ] diff --git a/mullvad-relay-selector/Cargo.toml b/mullvad-relay-selector/Cargo.toml index 9a18fa1618..18718d16dc 100644 --- a/mullvad-relay-selector/Cargo.toml +++ b/mullvad-relay-selector/Cargo.toml @@ -13,7 +13,7 @@ err-derive = "0.3.1" futures = "0.3" ipnetwork = "0.16" log = "0.4" -parking_lot = "0.11" +parking_lot = "0.12.0" rand = "0.8.5" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/mullvad-types/src/relay_constraints.rs b/mullvad-types/src/relay_constraints.rs index 3e8163d80e..ed3239c8c0 100644 --- a/mullvad-types/src/relay_constraints.rs +++ b/mullvad-types/src/relay_constraints.rs @@ -96,6 +96,8 @@ impl<T: fmt::Debug + Clone + Eq + PartialEq> Constraint<T> { } } +// Using the default attribute fails on Android +#[allow(clippy::derivable_impls)] impl<T: fmt::Debug + Clone + Eq + PartialEq> Default for Constraint<T> { fn default() -> Self { Constraint::Any diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml index 285d0c0d1b..d1bcf36db7 100644 --- a/talpid-core/Cargo.toml +++ b/talpid-core/Cargo.toml @@ -21,7 +21,7 @@ once_cell = "1.13" libc = "0.2" log = "0.4" os_pipe = "0.9" -parking_lot = "0.11" +parking_lot = "0.12.0" regex = "1.1.0" talpid-routing = { path = "../talpid-routing" } talpid-types = { path = "../talpid-types" } @@ -78,11 +78,11 @@ subslice = "0.2" widestring = "1.0" winreg = { version = "0.7", features = ["transactions"] } memoffset = "0.6" -windows-service = "0.5.0" +windows-service = "0.6.0" talpid-windows-net = { path = "../talpid-windows-net" } [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_Foundation", "Win32_Globalization", diff --git a/talpid-openvpn-plugin/Cargo.toml b/talpid-openvpn-plugin/Cargo.toml index 191c0effe4..283d5a826f 100644 --- a/talpid-openvpn-plugin/Cargo.toml +++ b/talpid-openvpn-plugin/Cargo.toml @@ -33,7 +33,7 @@ winres = "0.1" mullvad-version = { path = "../mullvad-version" } [target.'cfg(windows)'.build-dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_System_SystemServices", ] diff --git a/talpid-openvpn/Cargo.toml b/talpid-openvpn/Cargo.toml index ed20600243..36c6581e07 100644 --- a/talpid-openvpn/Cargo.toml +++ b/talpid-openvpn/Cargo.toml @@ -19,7 +19,7 @@ is-terminal = "0.4.2" lazy_static = "1.0" log = "0.4" os_pipe = "0.9" -parking_lot = "0.11" +parking_lot = "0.12.0" shell-escape = "0.1" talpid-routing = { path = "../talpid-routing" } talpid-tunnel = { path = "../talpid-tunnel" } @@ -45,7 +45,7 @@ winreg = { version = "0.7", features = ["transactions"] } talpid-windows-net = { path = "../talpid-windows-net" } [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_Foundation", "Win32_System_LibraryLoader", diff --git a/talpid-platform-metadata/Cargo.toml b/talpid-platform-metadata/Cargo.toml index c6ed0ded87..6ae3aa9852 100644 --- a/talpid-platform-metadata/Cargo.toml +++ b/talpid-platform-metadata/Cargo.toml @@ -13,7 +13,7 @@ rs-release = "0.1.7" talpid-dbus = { path = "../talpid-dbus" } [target.'cfg(target_os = "windows")'.dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_Foundation", "Win32_System_LibraryLoader", diff --git a/talpid-routing/Cargo.toml b/talpid-routing/Cargo.toml index 7c23b92a1a..a2f7e780be 100644 --- a/talpid-routing/Cargo.toml +++ b/talpid-routing/Cargo.toml @@ -34,7 +34,7 @@ libc = "0.2" socket2 = { version = "0.4.2", features = ["all"] } talpid-windows-net = { path = "../talpid-windows-net" } widestring = "1.0" -windows-sys = { version = "0.42.0", features = [ +windows-sys = { version = "0.45.0", features = [ "Win32_NetworkManagement_Ndis", "Win32_Globalization" ]} diff --git a/talpid-routing/src/windows/route_manager.rs b/talpid-routing/src/windows/route_manager.rs index 2e9f032180..ff7ffe23b4 100644 --- a/talpid-routing/src/windows/route_manager.rs +++ b/talpid-routing/src/windows/route_manager.rs @@ -437,7 +437,7 @@ impl RouteManagerInternal { })?, }; - return Ok(Some(luid)); + Ok(Some(luid)) } pub fn delete_applied_routes(&mut self) -> Result<()> { @@ -504,8 +504,7 @@ impl RouteManagerInternal { for record in (*records).iter_mut() { if matches!(record.route.node, NetNode::DefaultNode) - && family - == u32::from(ipnetwork_to_address_family(record.route.network).to_af_family()) + && family == ipnetwork_to_address_family(record.route.network).to_af_family() { affected_routes.push(record); } @@ -569,7 +568,7 @@ fn interface_luid_from_gateway(gateway: &SOCKADDR_INET) -> Result<NET_LUID_LH> { | GAA_FLAG_INCLUDE_GATEWAYS; // SAFETY: The si_family field is always valid to access. - let family: u32 = u32::from(unsafe { gateway.si_family }); + let family = unsafe { gateway.si_family }; let adapters = Adapters::new(family, ADAPTER_FLAGS)?; // Process adapters to find matching ones. @@ -651,7 +650,7 @@ unsafe fn isolate_gateway_address<'a>( loop { // SAFETY: The contract states that Address.lpSockaddr is dereferencable if the element is // non-null - if family == u32::from((*gateway.Address.lpSockaddr).sa_family) { + if family == (*gateway.Address.lpSockaddr).sa_family { // SAFETY: The contract states that this field must have lifetime 'a matches.push(&gateway.Address); } @@ -686,7 +685,7 @@ fn equal_address(lhs: &'_ SOCKADDR_INET, rhs: &'_ SOCKET_ADDRESS) -> Result<bool return Ok(false); } - match unsafe { lhs.si_family } as u32 { + match unsafe { lhs.si_family } { AF_INET => { let typed_rhs = rhs.lpSockaddr as *mut SOCKADDR_IN; // SAFETY: If rhs.lpSockaddr.sa_family is IPv4 then lpSockaddr is a SOCKADDR_IN @@ -733,7 +732,7 @@ impl Adapters { // called again. let status = unsafe { GetAdaptersAddresses( - family, + u32::from(family), flags, std::ptr::null_mut(), buffer_pointer as *mut IP_ADAPTER_ADDRESSES_LH, diff --git a/talpid-tunnel/Cargo.toml b/talpid-tunnel/Cargo.toml index de1001347b..7a8fcf04cd 100644 --- a/talpid-tunnel/Cargo.toml +++ b/talpid-tunnel/Cargo.toml @@ -34,7 +34,7 @@ tun = "0.5.1" talpid-windows-net = { path = "../talpid-windows-net" } [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_Foundation", "Win32_Networking_WinSock", diff --git a/talpid-windows-net/Cargo.toml b/talpid-windows-net/Cargo.toml index 044d5efdd9..ebf233741e 100644 --- a/talpid-windows-net/Cargo.toml +++ b/talpid-windows-net/Cargo.toml @@ -13,7 +13,7 @@ libc = "0.2" socket2 = { version = "0.4.2", features = ["all"] } futures = "0.3.15" winapi = { version = "0.3.6", features = ["ws2def"] } -windows-sys = { version = "0.42", features = [ +windows-sys = { version = "0.45.0", features = [ "Win32_Foundation", "Win32_Globalization", "Win32_System_Com", diff --git a/talpid-windows-net/src/net.rs b/talpid-windows-net/src/net.rs index 18a3f7748c..ceb9b250fd 100644 --- a/talpid-windows-net/src/net.rs +++ b/talpid-windows-net/src/net.rs @@ -81,7 +81,7 @@ pub enum Error { /// Unknown address family #[error(display = "Unknown address family: {}", _0)] - UnknownAddressFamily(u32), + UnknownAddressFamily(u16), } /// Handles cases where there DAD state is neither tentative nor preferred. @@ -119,7 +119,7 @@ impl From<NL_DAD_STATE> for DadStateError { impl AddressFamily { /// Convert one of the `AF_*` constants to an [`AddressFamily`]. pub fn try_from_af_family(family: u16) -> Result<AddressFamily> { - match u32::from(family) { + match family { AF_INET => Ok(AddressFamily::Ipv4), AF_INET6 => Ok(AddressFamily::Ipv6), family => Err(Error::UnknownAddressFamily(family)), @@ -246,7 +246,7 @@ pub async fn wait_for_interfaces(luid: NET_LUID_LH, ipv4: bool, ipv6: bool) -> i if unsafe { row.InterfaceLuid.Value != luid.Value } { return; } - match row.Family as u32 { + match row.Family { AF_INET => found_ipv4 = true, AF_INET6 => found_ipv6 = true, _ => (), @@ -473,7 +473,7 @@ pub fn inet_sockaddr_from_socketaddr(addr: SocketAddr) -> SOCKADDR_INET { /// Converts a `SOCKADDR_INET` to `SocketAddr`. Returns an error if the address family is invalid. pub fn try_socketaddr_from_inet_sockaddr(addr: SOCKADDR_INET) -> Result<SocketAddr> { - let family = unsafe { addr.si_family } as u32; + let family = unsafe { addr.si_family }; unsafe { let mut storage: sockaddr_storage = mem::zeroed(); *(&mut storage as *mut _ as *mut SOCKADDR_INET) = addr; diff --git a/talpid-wireguard/Cargo.toml b/talpid-wireguard/Cargo.toml index 233141db96..0d13792190 100644 --- a/talpid-wireguard/Cargo.toml +++ b/talpid-wireguard/Cargo.toml @@ -16,7 +16,7 @@ ipnetwork = "0.16" lazy_static = "1.0" libc = "0.2" log = "0.4" -parking_lot = "0.11" +parking_lot = "0.12.0" talpid-routing = { path = "../talpid-routing" } talpid-types = { path = "../talpid-types" } talpid-tunnel-config-client = { path = "../talpid-tunnel-config-client" } @@ -54,7 +54,7 @@ widestring = "1.0" # Figure out which features are needed and which are not [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.42.0" +version = "0.45.0" features = [ "Win32_Foundation", "Win32_Globalization", diff --git a/talpid-wireguard/src/wireguard_nt.rs b/talpid-wireguard/src/wireguard_nt.rs index 3180e56064..538bda7f68 100644 --- a/talpid-wireguard/src/wireguard_nt.rs +++ b/talpid-wireguard/src/wireguard_nt.rs @@ -145,7 +145,7 @@ pub enum Error { /// Unknown address family #[error(display = "Unknown address family: {}", _0)] - UnknownAddressFamily(u32), + UnknownAddressFamily(u16), /// Failure to set up logging #[error(display = "Failed to set up logging")] @@ -220,7 +220,7 @@ impl WgAllowedIp { Self::validate(&address, address_family, cidr)?; Ok(Self { address, - address_family: address_family as u16, + address_family, cidr, }) } @@ -260,7 +260,7 @@ impl PartialEq for WgAllowedIp { if self.cidr != other.cidr { return false; } - match self.address_family as u32 { + match self.address_family { AF_INET => { net::ipaddr_from_inaddr(unsafe { self.address.v4 }) == net::ipaddr_from_inaddr(unsafe { other.address.v4 }) @@ -281,7 +281,7 @@ impl Eq for WgAllowedIp {} impl fmt::Debug for WgAllowedIp { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let mut s = f.debug_struct("WgAllowedIp"); - match self.address_family as u32 { + match self.address_family { AF_INET => s.field( "address", &net::ipaddr_from_inaddr(unsafe { self.address.v4 }), @@ -762,7 +762,8 @@ impl WgNtDll { config: *const MaybeUninit<u8>, config_size: usize, ) -> io::Result<()> { - let result = (self.func_set_configuration)(adapter, config, config_size as u32); + let result = + (self.func_set_configuration)(adapter, config, u32::try_from(config_size).unwrap()); if result == 0 { return Err(io::Error::last_os_error()); } @@ -841,7 +842,7 @@ fn serialize_config(config: &Config) -> Result<Vec<MaybeUninit<u8>>> { listen_port: 0, private_key: config.tunnel.private_key.to_bytes(), public_key: [0u8; WIREGUARD_KEY_LENGTH], - peers_count: config.peers.len() as u32, + peers_count: u32::try_from(config.peers.len()).unwrap(), }; buffer.extend(as_uninit_byte_slice(&header)); @@ -866,7 +867,7 @@ fn serialize_config(config: &Config) -> Result<Vec<MaybeUninit<u8>>> { tx_bytes: 0, rx_bytes: 0, last_handshake: 0, - allowed_ips_count: peer.allowed_ips.len() as u32, + allowed_ips_count: u32::try_from(peer.allowed_ips.len()).unwrap(), }; buffer.extend(as_uninit_byte_slice(&wg_peer)); @@ -927,7 +928,7 @@ unsafe fn deserialize_config( let allowed_ip: WgAllowedIp = *(allowed_ip_data.as_ptr() as *const WgAllowedIp); if let Err(error) = WgAllowedIp::validate( &allowed_ip.address, - u32::from(allowed_ip.address_family), + allowed_ip.address_family, allowed_ip.cidr, ) { log::error!( @@ -1072,7 +1073,7 @@ mod tests { }, p0_allowed_ip_0: WgAllowedIp { address: WgIpAddr::from("1.3.3.0".parse::<Ipv4Addr>().unwrap()), - address_family: AF_INET as u16, + address_family: AF_INET, cidr: 24, }, }; |
