summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2013-09-24 16:44:22 -0700
committerRobert Greenwalt <rgreenwalt@google.com>2013-09-24 16:44:22 -0700
commit2dae2f8729c3254d5f805ce3df535458db193c12 (patch)
tree9c3ddd8c095d9dfb821e13dde5b46815da8005ab
parenta95f8a3426e6a4f17cf41888673f58302781b7be (diff)
downloadnetd-2dae2f8729c3254d5f805ce3df535458db193c12.tar.gz
A split-tunnel vpn shouldn't snarf all dns queries if it's not going to provide dns servers to service them. bug:10115444 Change-Id: I4f8de66b75a04ca0e274edb92ace7acee762bca2
-rw-r--r--DnsProxyListener.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/DnsProxyListener.cpp b/DnsProxyListener.cpp
index a025828f..eb02f015 100644
--- a/DnsProxyListener.cpp
+++ b/DnsProxyListener.cpp
@@ -129,15 +129,17 @@ void DnsProxyListener::GetAddrInfoHandler::run() {
}
char tmp[IF_NAMESIZE + 1];
+ int mark = mMark;
if (mIface == NULL) {
//fall back to the per uid interface if no per pid interface exists
if(!_resolv_get_pids_associated_interface(mPid, tmp, sizeof(tmp)))
- _resolv_get_uids_associated_interface(mUid, tmp, sizeof(tmp));
+ if(!_resolv_get_uids_associated_interface(mUid, tmp, sizeof(tmp)))
+ mark = -1; // if we don't have a targeted iface don't use a mark
}
struct addrinfo* result = NULL;
uint32_t rv = android_getaddrinfoforiface(mHost, mService, mHints, mIface ? mIface : tmp,
- mMark, &result);
+ mark, &result);
if (rv) {
// getaddrinfo failed
mClient->sendBinaryMsg(ResponseCode::DnsProxyOperationFailed, &rv, sizeof(rv));
@@ -467,16 +469,18 @@ void DnsProxyListener::GetHostByAddrHandler::run() {
}
char tmp[IF_NAMESIZE + 1];
+ int mark = mMark;
if (mIface == NULL) {
//fall back to the per uid interface if no per pid interface exists
if(!_resolv_get_pids_associated_interface(mPid, tmp, sizeof(tmp)))
- _resolv_get_uids_associated_interface(mUid, tmp, sizeof(tmp));
+ if(!_resolv_get_uids_associated_interface(mUid, tmp, sizeof(tmp)))
+ mark = -1;
}
struct hostent* hp;
// NOTE gethostbyaddr should take a void* but bionic thinks it should be char*
hp = android_gethostbyaddrforiface((char*)mAddress, mAddressLen, mAddressFamily,
- mIface ? mIface : tmp, mMark);
+ mIface ? mIface : tmp, mark);
if (DBG) {
ALOGD("GetHostByAddrHandler::run gethostbyaddr errno: %s hp->h_name = %s, name_len = %d\n",