Add a netcontext variant of gethostbyaddr
Bug: 34953048
Test: Integration tests pass
Change-Id: Id04830345be56cd7a077981c6e2acfb5568e7a88
diff --git a/libc/dns/net/getnameinfo.c b/libc/dns/net/getnameinfo.c
index 236e7f2..5fa4e37 100644
--- a/libc/dns/net/getnameinfo.c
+++ b/libc/dns/net/getnameinfo.c
@@ -300,7 +300,10 @@
break;
}
} else {
- hp = android_gethostbyaddrfornet_proxy(addr, afd->a_addrlen, afd->a_af, netid, mark);
+ // This code should only run in the app context, not inside netd, so netid is
+ // the app's netid. netd doesn't use getnameinfo for network requests.
+ const struct android_net_context netcontext = { .app_netid = netid, .app_mark = mark };
+ hp = android_gethostbyaddrfornetcontext_proxy(addr, afd->a_addrlen, afd->a_af, &netcontext);
if (hp) {
#if 0
/*