summaryrefslogtreecommitdiff
path: root/server/main.cpp
diff options
context:
space:
mode:
authorSehee Park <sehee32.park@samsung.com>2019-07-04 13:53:45 +0900
committerSehee Park <sehee32.park@samsung.com>2019-08-26 08:27:41 +0000
commitb953a915f72fe9674e0186c086520c48bb6dacbb (patch)
treea558f623e8ec823df5662305761ed386b68d3acf /server/main.cpp
parent84f8e595d24fd4f4d97b0d5d136c528f59652b01 (diff)
downloadnetd-b953a915f72fe9674e0186c086520c48bb6dacbb.tar.gz
Tag with TAG_SYSTEM_DNS for dns packets.
Tag with TAG_SYSTEM_DNS for dns packets so that apps know that the traffic is not sent by them but is sent by the system on their behalf. Test: atest resolv_integration_test Bug: 132125333 Change-Id: I2e3502d75bd1a6a55f5e62a7fa23141e4cf2e375
Diffstat (limited to 'server/main.cpp')
-rw-r--r--server/main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/server/main.cpp b/server/main.cpp
index c697c3de..cbdc8993 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -82,11 +82,16 @@ void logCallback(const char* msg) {
gLog.info(std::string(msg));
}
+int tagSocketCallback(int sockFd, uint32_t tag, uid_t uid) {
+ return gCtls->trafficCtrl.tagSocket(sockFd, tag, uid, geteuid());
+}
+
bool initDnsResolver() {
ResolverNetdCallbacks callbacks = {
.get_network_context = &getNetworkContextCallback,
.log = &logCallback,
.check_calling_permission = &checkCallingPermissionCallback,
+ .tagSocket = &tagSocketCallback,
};
return RESOLV_STUB.resolv_init(callbacks);
}