diff options
| author | Jonathan <jonathan@mullvad.net> | 2023-02-22 14:37:56 +0100 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2023-02-28 10:07:52 +0100 |
| commit | 8a7074a29e4eb53266d0efd84f3df393ec14581e (patch) | |
| tree | a58156babd920ba82f53d76b0f8ed314abf8c85b /talpid-core/src | |
| parent | 893705e56e243a4c6e91ffdfded9bfa9f820549e (diff) | |
| download | mullvadvpn-8a7074a29e4eb53266d0efd84f3df393ec14581e.tar.xz mullvadvpn-8a7074a29e4eb53266d0efd84f3df393ec14581e.zip | |
Update naming in windows firewall
exitEndpoint and entryEndpoint are incorrect names instead endpoint1
and endpoint2 are more descriptive.
Diffstat (limited to 'talpid-core/src')
| -rw-r--r-- | talpid-core/src/firewall/windows.rs | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/talpid-core/src/firewall/windows.rs b/talpid-core/src/firewall/windows.rs index b015db2385..fa40fdcb42 100644 --- a/talpid-core/src/firewall/windows.rs +++ b/talpid-core/src/firewall/windows.rs @@ -168,15 +168,16 @@ impl Firewall { ptr::null() }; - // SAFETY: `allowed_tun_ips`, `entry_endpoint` and `exit_endpoint` must not be dropped until + // SAFETY: `endpoint1_ip`, `endpoint2_ip`, `endpoint1` and `endpoint2` must not be dropped until // `WinFw_ApplyPolicyConnecting` has returned. - let mut allowed_tun_ips = [WideCString::new(), WideCString::new()]; - let (entry_endpoint, exit_endpoint) = match allowed_tunnel_traffic { + let mut endpoint1_ip = WideCString::new(); + let mut endpoint2_ip = WideCString::new(); + let (endpoint1, endpoint2) = match allowed_tunnel_traffic { AllowedTunnelTraffic::One(endpoint) => { - allowed_tun_ips[0] = widestring_ip(endpoint.address.ip()); + endpoint1_ip = widestring_ip(endpoint.address.ip()); ( Some(WinFwEndpoint { - ip: allowed_tun_ips[0].as_ptr(), + ip: endpoint1_ip.as_ptr(), port: endpoint.address.port(), protocol: WinFwProt::from(endpoint.protocol), }), @@ -184,30 +185,30 @@ impl Firewall { ) } AllowedTunnelTraffic::Two(endpoint1, endpoint2) => { - allowed_tun_ips[0] = widestring_ip(endpoint1.address.ip()); - let entry_endpoint = Some(WinFwEndpoint { - ip: allowed_tun_ips[0].as_ptr(), + endpoint1_ip = widestring_ip(endpoint1.address.ip()); + let endpoint1 = Some(WinFwEndpoint { + ip: endpoint1_ip.as_ptr(), port: endpoint1.address.port(), protocol: WinFwProt::from(endpoint1.protocol), }); - allowed_tun_ips[1] = widestring_ip(endpoint2.address.ip()); - let exit_endpoint = Some(WinFwEndpoint { - ip: allowed_tun_ips[1].as_ptr(), + endpoint2_ip = widestring_ip(endpoint2.address.ip()); + let endpoint2 = Some(WinFwEndpoint { + ip: endpoint2_ip.as_ptr(), port: endpoint2.address.port(), protocol: WinFwProt::from(endpoint2.protocol), }); - (entry_endpoint, exit_endpoint) + (endpoint1, endpoint2) } AllowedTunnelTraffic::None | AllowedTunnelTraffic::All => (None, None), }; let allowed_tunnel_traffic = WinFwAllowedTunnelTraffic { type_: WinFwAllowedTunnelTrafficType::from(allowed_tunnel_traffic), - entry_endpoint: entry_endpoint + endpoint1: endpoint1 .as_ref() .map(|ep| ep as *const _) .unwrap_or(ptr::null()), - exit_endpoint: exit_endpoint + endpoint2: endpoint2 .as_ref() .map(|ep| ep as *const _) .unwrap_or(ptr::null()), @@ -228,9 +229,10 @@ impl Firewall { // SAFETY: All of these hold stack allocated memory which is pointed to by // `allowed_tunnel_traffic` and must remain allocated until `WinFw_ApplyPolicyConnecting` // has returned. - drop(allowed_tun_ips); - drop(entry_endpoint); - drop(exit_endpoint); + drop(endpoint1_ip); + drop(endpoint2_ip); + drop(endpoint1); + drop(endpoint2); res } @@ -471,8 +473,8 @@ mod winfw { #[repr(C)] pub struct WinFwAllowedTunnelTraffic { pub type_: WinFwAllowedTunnelTrafficType, - pub entry_endpoint: *const WinFwEndpoint, - pub exit_endpoint: *const WinFwEndpoint, + pub endpoint1: *const WinFwEndpoint, + pub endpoint2: *const WinFwEndpoint, } #[repr(u8)] |
