diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-10-16 21:53:30 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-10-16 21:53:30 +0000 |
commit | 47dc024f7eb268dca65949d68914aa29b2840711 (patch) | |
tree | f22f9795384bff92c731d95872804bc416abca82 /src/or/connection.c | |
parent | 8300c4ae6a0d55c40d94613b5e22cb25b5723bd1 (diff) | |
download | tor-47dc024f7eb268dca65949d68914aa29b2840711.tar.gz tor-47dc024f7eb268dca65949d68914aa29b2840711.zip |
Change interface of parse_addr_port() to return address in host order, since most users seem to want that.
svn:r2542
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 971ff370a4..87cb3c10d9 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -317,17 +317,19 @@ static int connection_create_listener(const char *bindaddress, uint16_t bindport struct sockaddr_in bindaddr; /* where to bind */ connection_t *conn; uint16_t usePort; + uint32_t addr; int s; /* the socket we're going to make */ int one=1; memset(&bindaddr,0,sizeof(struct sockaddr_in)); - if (parse_addr_port(bindaddress, NULL, &(bindaddr.sin_addr.s_addr), - &usePort)<0) { + if (parse_addr_port(bindaddress, NULL, &addr, &usePort)<0) { log_fn(LOG_WARN, "Error parsing/resolving BindAddress %s",bindaddress); return -1; } + if (usePort==0) usePort = bindport; + binaddrr.sin_addr.s_addr = htonl(addr); bindaddr.sin_family = AF_INET; bindaddr.sin_port = htons((uint16_t) usePort); |