aboutsummaryrefslogtreecommitdiff
path: root/src/lib/net/resolve.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-03 07:50:18 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-04 08:02:56 -0400
commit9c24ceeb3f2082193bf76a77ad6d6d011561e239 (patch)
tree0e79e48dbc666a0a2aedbe566826bc9cfc1962e3 /src/lib/net/resolve.c
parentac8f6d51f4200b27adc0da9fc1eeb44b89c8ebab (diff)
downloadtor-9c24ceeb3f2082193bf76a77ad6d6d011561e239.tar.gz
tor-9c24ceeb3f2082193bf76a77ad6d6d011561e239.zip
Make tor_addr_lookup_host_impl mockable.
Diffstat (limited to 'src/lib/net/resolve.c')
-rw-r--r--src/lib/net/resolve.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/net/resolve.c b/src/lib/net/resolve.c
index c8fe338e52..442bc4a6b3 100644
--- a/src/lib/net/resolve.c
+++ b/src/lib/net/resolve.c
@@ -8,6 +8,7 @@
* \brief Use the libc DNS resolver to convert hostnames into addresses.
**/
+#define RESOLVE_PRIVATE
#include "lib/net/resolve.h"
#include "lib/net/address.h"
@@ -70,10 +71,10 @@ tor_lookup_hostname,(const char *name, uint32_t *addr))
*
* See tor_addr_lookup() for details.
*/
-static int
-tor_addr_lookup_host_impl(const char *name,
+MOCK_IMPL(STATIC int,
+tor_addr_lookup_host_impl,(const char *name,
uint16_t family,
- tor_addr_t *addr)
+ tor_addr_t *addr))
{
int err;
struct addrinfo *res=NULL, *res_p;
@@ -125,10 +126,10 @@ tor_addr_lookup_host_impl(const char *name,
*
* See tor_addr_lookup() for details.
*/
-static int
-tor_addr_lookup_host_impl(const char *name,
+MOCK_IMPL(STATIC int,
+tor_addr_lookup_host_impl,(const char *name,
uint16_t family,
- tor_addr_t *addr)
+ tor_addr_t *addr))
{
(void) family;
struct hostent *ent;
@@ -172,7 +173,6 @@ tor_addr_lookup_host_impl(const char *name,
return (err == TRY_AGAIN) ? 1 : -1;
#endif
}
-
#endif /* defined(HAVE_GETADDRINFO) */
/** Similar behavior to Unix gethostbyname: resolve <b>name</b>, and set