aboutsummaryrefslogtreecommitdiffstats
path: root/libglouglou/libggnet_dns.c
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2012-12-15 07:19:06 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2012-12-15 07:19:06 +0100
commitf5cab42c844d281be2c5b55844e26501308f64ce (patch)
tree29af5882c8173ae42f812c4c5a2405da14de402a /libglouglou/libggnet_dns.c
parentrevert previous commit, my brain was deeply flawed (diff)
downloadglouglou-f5cab42c844d281be2c5b55844e26501308f64ce.tar.xz
glouglou-f5cab42c844d281be2c5b55844e26501308f64ce.zip
fix dns resolving: evdns eats network byte order !
Diffstat (limited to 'libglouglou/libggnet_dns.c')
-rw-r--r--libglouglou/libggnet_dns.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libglouglou/libggnet_dns.c b/libglouglou/libggnet_dns.c
index 782c395..25bada3 100644
--- a/libglouglou/libggnet_dns.c
+++ b/libglouglou/libggnet_dns.c
@@ -51,6 +51,7 @@ ggnet_dns_reverse(struct ggnet_dns *ggdns,
struct evutil_addrinfo hints;
struct ggnet_dns_req *req;
struct evdns_request *ereq;
+ struct in_addr nip;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
@@ -68,9 +69,11 @@ ggnet_dns_reverse(struct ggnet_dns *ggdns,
req->cb_usr = cb_usr;
req->data = data;
+ nip.s_addr = htonl(ip->s_addr); /* evdns eats network byte order */
+
LIST_INSERT_HEAD(&ggdns->req_list, req, entry);
ggdns->req_pending++;
- ereq = evdns_base_resolve_reverse(ggdns->evdns_base, ip, 0,
+ ereq = evdns_base_resolve_reverse(ggdns->evdns_base, &nip, 0,
_cb_evdns_reverse, req);
if (ereq == NULL) {
printf("libggnet_dns WARNING: dns request for %d returned immediately\n",