summaryrefslogtreecommitdiffstats
path: root/server/NetworkController.cpp
diff options
context:
space:
mode:
authorErik Kline <ek@google.com>2017-05-25 17:03:31 +0900
committerErik Kline <ek@google.com>2017-05-26 17:16:47 +0900
commit6d4669fa924315139f3636368c6623209fbfc3ea (patch)
treeea135c99cd37d7d7ff7d53363813150d86817a74 /server/NetworkController.cpp
parent98d8c08b8c55748735c2ff8ccbf7ad01a8f6e882 (diff)
downloadplatform_system_netd-6d4669fa924315139f3636368c6623209fbfc3ea.tar.gz
platform_system_netd-6d4669fa924315139f3636368c6623209fbfc3ea.tar.bz2
platform_system_netd-6d4669fa924315139f3636368c6623209fbfc3ea.zip
Only set protectFromVpn if explicitlySelected is also true.
When a secure VPN is up, setting protectFromVpn=1 and explicitlySelected=0 causes the probe routing lookups used by _have_ipv4 and _have_ipv6 to skip the VPN rule, instead selecting the default network. This means that the address families for which we query DNS records are determined by the address families of the the default network, not those of the VPN. If explicitlySelected==true, setting protectFromVpn=true (if the app can protect its sockets) results in querying the address families from the specified network, which is correct. Test: as follows - built - flashed - booted - runtest -x netd_integration_test.cpp passes - testing per bug discussion Bug: 37131664 Bug: 37347238 Change-Id: I7cf322a047494fd70c3c4d8862d53d6a6dac66de
Diffstat (limited to 'server/NetworkController.cpp')
-rw-r--r--server/NetworkController.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp
index 8e4c69dfd..b90976b6b 100644
--- a/server/NetworkController.cpp
+++ b/server/NetworkController.cpp
@@ -47,6 +47,8 @@
#include "RouteController.h"
#include "VirtualNetwork.h"
+#define DBG 0
+
namespace android {
namespace net {
@@ -287,12 +289,17 @@ void NetworkController::getNetworkContext(
Fwmark fwmark;
fwmark.netId = nc.app_netid;
fwmark.explicitlySelected = explicitlySelected;
- fwmark.protectedFromVpn = canProtect(uid);
+ fwmark.protectedFromVpn = explicitlySelected && canProtect(uid);
fwmark.permission = getPermissionForUser(uid);
nc.app_mark = fwmark.intValue;
nc.dns_mark = getNetworkForDns(&(nc.dns_netid), uid);
+ if (DBG) {
+ ALOGD("app_netid:0x%x app_mark:0x%x dns_netid:0x%x dns_mark:0x%x uid:%d",
+ nc.app_netid, nc.app_mark, nc.dns_netid, nc.dns_mark, uid);
+ }
+
if (netcontext) {
*netcontext = nc;
}