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: I581862f8884a0a9f6d3aa89c981d9b8066dc3ed8
diff --git a/res_send.cpp b/res_send.cpp
index f86e5f6..35c9c5f 100644
--- a/res_send.cpp
+++ b/res_send.cpp
@@ -772,9 +772,7 @@
return -1;
}
}
- if (fchown(statp->_vcsock, statp->uid, -1) == -1) {
- PLOG(WARNING) << __func__ << ": Failed to chown socket";
- }
+ resolv_tag_socket(statp->_vcsock, statp->uid);
if (statp->_mark != MARK_UNSET) {
if (setsockopt(statp->_vcsock, SOL_SOCKET, SO_MARK, &statp->_mark,
sizeof(statp->_mark)) < 0) {
@@ -1017,9 +1015,7 @@
}
}
- if (fchown(statp->_u._ext.nssocks[ns], statp->uid, -1) == -1) {
- PLOG(WARNING) << __func__ << ": Failed to chown socket";
- }
+ resolv_tag_socket(statp->_u._ext.nssocks[ns], statp->uid);
if (statp->_mark != MARK_UNSET) {
if (setsockopt(statp->_u._ext.nssocks[ns], SOL_SOCKET, SO_MARK, &(statp->_mark),
sizeof(statp->_mark)) < 0) {