Loading DnsProxyListener.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1144,7 +1144,7 @@ void DnsProxyListener::GetHostByAddrHandler::doDns64ReverseLookup(struct hostent queryLimiter.finish(uid); if (*hpp) { // Replace IPv4 address with original queried IPv6 address in place. The space has // reserved by _dns_gethtbyaddr() and netbsd_gethostent_r() in // reserved by dns_gethtbyaddr() and netbsd_gethostent_r() in // system/netd/resolv/gethnamaddr.cpp. // Note that android_gethostbyaddrfornetcontext returns only one entry in result. memcpy((*hpp)->h_addr_list[0], &v6addr, sizeof(v6addr)); Loading gethnamaddr.cpp +12 −19 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ static void map_v4v6_hostent(struct hostent*, char**, char*); static void pad_v4v6_hostent(struct hostent* hp, char** bpp, char* ep); static void addrsort(char**, int, res_state); static int _dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, static int dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, const android_net_context* netcontext, getnamaddr* info); static int dns_gethtbyname(const char* name, int af, getnamaddr* info); Loading Loading @@ -545,7 +545,7 @@ static int android_gethostbyaddrfornetcontext_real(const void* addr, socklen_t l info.buf = buf; info.buflen = buflen; if (_hf_gethtbyaddr(uaddr, len, af, &info)) { int error = _dns_gethtbyaddr(uaddr, len, af, netcontext, &info); int error = dns_gethtbyaddr(uaddr, len, af, netcontext, &info); if (error != 0) { return error; } Loading Loading @@ -796,13 +796,11 @@ static int dns_gethtbyname(const char* name, int addr_type, getnamaddr* info) { return 0; } static int _dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, static int dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, const android_net_context* netcontext, getnamaddr* info) { char qbuf[MAXDNAME + 1], *qp, *ep; int n; struct hostent* hp; int advance; res_state res; info->hp->h_length = len; info->hp->h_addrtype = af; Loading Loading @@ -835,25 +833,20 @@ static int _dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, return EAI_FAMILY; } querybuf* buf = (querybuf*) malloc(sizeof(querybuf)); if (buf == NULL) { return EAI_MEMORY; } res = res_get_state(); if (res == NULL) { free(buf); return EAI_MEMORY; } auto buf = std::make_unique<querybuf>(); res_state res = res_get_state(); if (!res) return EAI_MEMORY; res_setnetcontext(res, netcontext); int herrno = NETDB_INTERNAL; n = res_nquery(res, qbuf, C_IN, T_PTR, buf->buf, (int) sizeof(buf->buf), &herrno); if (n < 0) { free(buf); LOG(DEBUG) << "res_nquery failed (" << n << ")"; return herrnoToAiErrno(herrno); } hp = getanswer(buf, n, qbuf, T_PTR, res, info->hp, info->buf, info->buflen, &herrno); free(buf); hostent* hp = getanswer(buf.get(), n, qbuf, T_PTR, res, info->hp, info->buf, info->buflen, &herrno); if (hp == NULL) { return herrnoToAiErrno(herrno); } Loading Loading
DnsProxyListener.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1144,7 +1144,7 @@ void DnsProxyListener::GetHostByAddrHandler::doDns64ReverseLookup(struct hostent queryLimiter.finish(uid); if (*hpp) { // Replace IPv4 address with original queried IPv6 address in place. The space has // reserved by _dns_gethtbyaddr() and netbsd_gethostent_r() in // reserved by dns_gethtbyaddr() and netbsd_gethostent_r() in // system/netd/resolv/gethnamaddr.cpp. // Note that android_gethostbyaddrfornetcontext returns only one entry in result. memcpy((*hpp)->h_addr_list[0], &v6addr, sizeof(v6addr)); Loading
gethnamaddr.cpp +12 −19 Original line number Diff line number Diff line Loading @@ -113,7 +113,7 @@ static void map_v4v6_hostent(struct hostent*, char**, char*); static void pad_v4v6_hostent(struct hostent* hp, char** bpp, char* ep); static void addrsort(char**, int, res_state); static int _dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, static int dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, const android_net_context* netcontext, getnamaddr* info); static int dns_gethtbyname(const char* name, int af, getnamaddr* info); Loading Loading @@ -545,7 +545,7 @@ static int android_gethostbyaddrfornetcontext_real(const void* addr, socklen_t l info.buf = buf; info.buflen = buflen; if (_hf_gethtbyaddr(uaddr, len, af, &info)) { int error = _dns_gethtbyaddr(uaddr, len, af, netcontext, &info); int error = dns_gethtbyaddr(uaddr, len, af, netcontext, &info); if (error != 0) { return error; } Loading Loading @@ -796,13 +796,11 @@ static int dns_gethtbyname(const char* name, int addr_type, getnamaddr* info) { return 0; } static int _dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, static int dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, const android_net_context* netcontext, getnamaddr* info) { char qbuf[MAXDNAME + 1], *qp, *ep; int n; struct hostent* hp; int advance; res_state res; info->hp->h_length = len; info->hp->h_addrtype = af; Loading Loading @@ -835,25 +833,20 @@ static int _dns_gethtbyaddr(const unsigned char* uaddr, int len, int af, return EAI_FAMILY; } querybuf* buf = (querybuf*) malloc(sizeof(querybuf)); if (buf == NULL) { return EAI_MEMORY; } res = res_get_state(); if (res == NULL) { free(buf); return EAI_MEMORY; } auto buf = std::make_unique<querybuf>(); res_state res = res_get_state(); if (!res) return EAI_MEMORY; res_setnetcontext(res, netcontext); int herrno = NETDB_INTERNAL; n = res_nquery(res, qbuf, C_IN, T_PTR, buf->buf, (int) sizeof(buf->buf), &herrno); if (n < 0) { free(buf); LOG(DEBUG) << "res_nquery failed (" << n << ")"; return herrnoToAiErrno(herrno); } hp = getanswer(buf, n, qbuf, T_PTR, res, info->hp, info->buf, info->buflen, &herrno); free(buf); hostent* hp = getanswer(buf.get(), n, qbuf, T_PTR, res, info->hp, info->buf, info->buflen, &herrno); if (hp == NULL) { return herrnoToAiErrno(herrno); } Loading