diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-08-07 19:13:35 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-08-07 19:13:35 +0000 |
commit | d9601c65e0529c1f79e52ca3576cbc8f0a82f8f6 (patch) | |
tree | 7025b74af0ad9c3bfb8a0ce6953864787d150e6a /src/or/dnsserv.c | |
parent | 635f3c8aeef717d03a86117dfa81944fb6788bca (diff) | |
download | tor-d9601c65e0529c1f79e52ca3576cbc8f0a82f8f6.tar.gz tor-d9601c65e0529c1f79e52ca3576cbc8f0a82f8f6.zip |
r17666@tombo: nickm | 2008-08-07 15:12:30 -0400
Make tor_addr_from_sockaddr also give away the port in a useful format
svn:r16458
Diffstat (limited to 'src/or/dnsserv.c')
-rw-r--r-- | src/or/dnsserv.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/or/dnsserv.c b/src/or/dnsserv.c index 5a1c023834..c65dfe08ca 100644 --- a/src/or/dnsserv.c +++ b/src/or/dnsserv.c @@ -46,7 +46,7 @@ evdns_server_callback(struct evdns_server_request *req, void *_data) } (void) addrlen; sa = (struct sockaddr*) &addr; - if (tor_addr_from_sockaddr(&tor_addr, sa)<0) { + if (tor_addr_from_sockaddr(&tor_addr, sa, &port)<0) { log_warn(LD_APP, "Requesting address wasn't recognized."); evdns_server_request_respond(req, DNS_ERR_SERVERFAILED); return; @@ -58,12 +58,6 @@ evdns_server_callback(struct evdns_server_request *req, void *_data) return; } - if (sa->sa_family == AF_INET) - port = ((struct sockaddr_in *)sa)->sin_port; - else - port = ((struct sockaddr_in6 *)sa)->sin6_port; - port = ntohs(port); - /* Now, let's find the first actual question of a type we can answer in this * DNS request. It makes us a little noncompliant to act like this; we * should fix that eventually if it turns out to make a difference for |