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
diff --git a/server/main.cpp b/server/main.cpp
index c697c3d..cbdc899 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -82,11 +82,16 @@
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);
}