MCPcopy Create free account
hub / github.com/Windscribe/Desktop-App / enable

Method enable

src/helper/linux/split_tunneling/cgroups.cpp:16–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16bool CGroups::enable(const ConnectStatus &connectStatus, bool isAllowLanTraffic, bool isExclude)
17{
18 spdlog::debug("cgroups enable");
19
20 std::string out;
21
22 // IpAddress fields are converted to strings at the script-argument boundary; mark_ /
23 // netClassId_ / "allow"|"disallow" / "exclusive"|"inclusive" are family-agnostic.
24 // The two trailing args carry the v6 default-gateway and v6 VPN-gateway when the
25 // server pushed dual-stack addresses; both are empty strings when no v6 is
26 // configured (the cgroups-up shell script treats those as a sentinel and skips the
27 // ip6tables block).
28 int ret = Utils::executeCommand(WS_LINUX_INSTALL_DIR "/scripts/cgroups-up",
29 { mark_,
30 connectStatus.defaultAdapter.gatewayIp.toString(),
31 connectStatus.defaultAdapter.adapterName,
32 connectStatus.vpnAdapter.gatewayIp.toString(),
33 connectStatus.vpnAdapter.adapterName,
34 connectStatus.remoteIp.toString(),
35 netClassId_,
36 isAllowLanTraffic ? "allow" : "disallow",
37 isExclude ? "exclusive" : "inclusive",
38 // v6 args (empty when no v6 is configured).
39 connectStatus.defaultAdapter.gatewayIpV6.toString(),
40 connectStatus.vpnAdapter.gatewayIpV6.toString() },
41 &out);
42 if (ret != 0) {
43 spdlog::error("cgroups-up script failed: {}", out);
44 return false;
45 }
46
47 return true;
48}
49
50void CGroups::disable()
51{

Callers 1

updateStateMethod · 0.45

Calls 2

toStringMethod · 0.80
executeCommandFunction · 0.50

Tested by

no test coverage detected