  DnsProxyListener::DnsProxyListener(const NetworkController* netCtrl) :
          FrameworkListener("dnsproxyd"), mNetCtrl(netCtrl) {
      registerCmd(new GetAddrInfoCmd(this));
-@@ -162,6 +180,10 @@ void DnsProxyListener::GetAddrInfoHandler::run() {
+@@ -162,6 +179,10 @@ void DnsProxyListener::GetAddrInfoHandler::run() {
                  mNetContext.uid);
      }
  

     struct hostent* hp;
 
     hp = android_gethostbynamefornet(mName, mAf, mNetId, mMark);
@@ -461,6 +487,11 @@ void DnsProxyListener::GetHostByAddrHandler::run() {
     if (DBG) {
         ALOGD("DnsProxyListener::GetHostByAddrHandler::run\n");
     }

From 15b9620483f09837a24be5468e0d47feaa0c8141 Mon Sep 17 00:00:00 2001
From: Rusty Bird <rustybird@openmailbox.org>
Date: Mon, 29 Feb 2016 12:08:00 +0000
Subject: [system/netd] Copy client's uid and gid into thread's fsuid and fsgid

Inspired by
https://github.com/cernekee/dnsproxy2/commit/0708140aa747764a125b5189cace005773e30a24

Change-Id: I206fc0684dcecd3e94f63b8c5fda3a93db3c7b00
---
 server/DnsProxyListener.cpp | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/server/DnsProxyListener.cpp b/server/DnsProxyListener.cpp
index 6c71c5b..f1f1a90 100644
--- a/server/DnsProxyListener.cpp
+++ b/server/DnsProxyListener.cpp
@@ -21,6 +21,7 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #include <stdlib.h>
+#include <sys/fsuid.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <string.h>
@@ -41,6 +42,22 @@
 #include "NetworkController.h"
 #include "ResponseCode.h"
 
