summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-04-28 20:57:03 +0000
committerRoger Dingledine <arma@torproject.org>2004-04-28 20:57:03 +0000
commitdd335d9bb25b1e772f0d42aa35d25895d8031c36 (patch)
tree54759a16a39b72e15d225b4060b7a4f1eb928c6c
parent3a66f523a1237d6295f306f6698d238f21c6e9e8 (diff)
downloadtor-dd335d9bb25b1e772f0d42aa35d25895d8031c36.tar.gz
tor-dd335d9bb25b1e772f0d42aa35d25895d8031c36.zip
use tor_lookup_hostname for binding local addresses too
svn:r1744
-rw-r--r--src/or/connection.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 225b92b247..a2e1a95eea 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -257,7 +257,6 @@ void connection_expire_held_open(void)
int connection_create_listener(char *bindaddress, uint16_t bindport, int type) {
struct sockaddr_in bindaddr; /* where to bind */
- struct hostent *rent;
connection_t *conn;
int s; /* the socket we're going to make */
int one=1;
@@ -265,14 +264,10 @@ int connection_create_listener(char *bindaddress, uint16_t bindport, int type) {
memset(&bindaddr,0,sizeof(struct sockaddr_in));
bindaddr.sin_family = AF_INET;
bindaddr.sin_port = htons(bindport);
- rent = gethostbyname(bindaddress);
- if (!rent) {
+ if(tor_lookup_hostname(bindaddress, &(bindaddr.sin_addr.s_addr)) != 0) {
log_fn(LOG_WARN,"Can't resolve BindAddress %s",bindaddress);
return -1;
}
- if(rent->h_length != 4)
- return -1; /* XXX complain */
- memcpy(&(bindaddr.sin_addr.s_addr),rent->h_addr,rent->h_length);
s = socket(PF_INET,SOCK_STREAM,IPPROTO_TCP);
if (s < 0) {