Pass block_untunneled_traffic flag throughh to WireGuard service - #39405
Conversation
925d6b1 to
277e9f7
Compare
277e9f7 to
68006f1
Compare
68006f1 to
e3e6222
Compare
|
[puLL-Merge] - brave/brave-core@39405 DescriptionThreads a Possible Issues
Security Hotspots
ChangesChanges
sequenceDiagram
participant UI as Browser (VPN UI)
participant Mgr as BraveVPNConnectionManager
participant Impl as WireguardConnectionAPIImplWin
participant Utils as wireguard_utils_win
participant COM as BraveWireguardManager (SYSTEM service)
participant Cfg as CreateWireguardConfig
UI->>Impl: PlatformConnectImpl(credentials)
Impl->>Mgr: ShouldBlockUntunneledTraffic()
Mgr->>Mgr: local_prefs_ BlockUntunneled && WireguardEnabled
Mgr-->>Impl: bool
Impl->>Utils: EnableBraveVpnWireguardService(keys, host, block, proxy, cb)
Utils->>COM: EnableVpn(pub, priv, addr, endpoint, block, &last_error)
COM->>Cfg: CreateWireguardConfig(..., block)
Note over Cfg: flag currently unused in body
Cfg-->>COM: config
COM-->>Utils: HRESULT
Utils-->>Impl: OnWireguardServiceLaunched(success)
|
e3e6222 to
14a1b36
Compare
14a1b36 to
3407561
Compare
| const std::string& vpn_server_hostname, | ||
| const std::string& mapped_ipv4_address) { | ||
| const std::string& mapped_ipv4_address, | ||
| const bool block_untunneled_traffic) { |
There was a problem hiding this comment.
block_untunneled_traffic is added to the signature but never used in the body — the config template still hardcodes AllowedIPs = 0.0.0.0/0, ::/0, so everything plumbed through EnableVpn is dropped here and the flag has no effect. Either consume it (e.g. adjust AllowedIPs) in this PR or drop the parameter until the config change lands.
| local_prefs_->GetBoolean(prefs::kBraveVPNWireguardEnabled); | ||
| #else | ||
| NOTREACHED(); | ||
| #endif |
There was a problem hiding this comment.
nit: this new guard spans more than 3 lines and has an #else branch, so per BS-045 the #endif should say what it closes: #endif // BUILDFLAG(ENABLE_BRAVE_VPN_WIREGUARD). (The rest of this file uses bare #endifs, so feel free to skip if you'd rather keep the file uniform.) (Refined Rule: #endif Comments Based on Block Length)
| prefs::kBraveVPNWireguardBlockUntunneledTraffic) && | ||
| local_prefs_->GetBoolean(prefs::kBraveVPNWireguardEnabled); | ||
| #else | ||
| NOTREACHED(); |
There was a problem hiding this comment.
nit: NOTREACHED() is defined in base/notreached.h, which this file doesn't include (only base/check.h / base/logging.h are). Please add the include rather than relying on a transitive one. (✅ Always Include What You Use (IWYU))
| void CheckConnection(); | ||
|
|
||
| void SetSelectedRegion(const std::string& name); | ||
| bool ShouldBlockUntunneledTraffic(); |
There was a problem hiding this comment.
nit: worth a one-line comment on this new public method — the implementation NOTREACHED()s when ENABLE_BRAVE_VPN_WIREGUARD is off and it also requires kBraveVPNWireguardEnabled, neither of which is obvious from the name. (✅ Method Documentation Should Describe the Contract)
Pass block_untunneled_traffic flag to wireguard tunnel service.
For now, there is no behavioral change.
In the f/u, tunnel service will create config and install WFP filters based on that flag.