From: Jeff Trawick Date: Wed, 31 Jul 2002 12:44:55 +0000 (+0000) Subject: Restore the ability to specify host names on Listen directives. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86e02241f5bfb45fdfb67cf9547b5fbf5b97cdbf;p=apache Restore the ability to specify host names on Listen directives. We needed to compare on the value we pass to apr_sockaddr_info_get(), not the IP address string. Sometimes this is an IP address string and sometimes it is a host name. Otherwise, on the second pass through this code we won't find the existing listen_rec for a Listen directive which had a host name, and we'll create a new listen_rec and try to bind again to the same addr/port. PR: 11030 Helped immensely by: David Shane Holden , who debugged it and submitted a patch which showed the problem; a much simpler change was committed though git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96258 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 6c0fdcdc62..ffc740db47 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,8 @@ Changes with Apache 2.0.40 + *) Restore the ability to specify host names on Listen directives. + PR 11030. [Jeff Trawick, David Shane Holden ] + *) When deciding on the default address family for listening sockets, make sure we can actually bind to an AF_INET6 socket before deciding that we should default to AF_INET6. This fixes a startup diff --git a/server/listen.c b/server/listen.c index 60f936f4a8..e57bef075e 100644 --- a/server/listen.c +++ b/server/listen.c @@ -251,7 +251,6 @@ static const char *alloc_listener(process_rec *process, char *addr, apr_port_t p ap_listen_rec **walk; ap_listen_rec *new; apr_status_t status; - char *oldaddr; apr_port_t oldport; apr_sockaddr_t *sa; @@ -279,8 +278,7 @@ static const char *alloc_listener(process_rec *process, char *addr, apr_port_t p /* Some listeners are not real so they will not have a bind_addr. */ if (sa) { apr_sockaddr_port_get(&oldport, sa); - apr_sockaddr_ip_get(&oldaddr, sa); - if (!strcmp(oldaddr, addr) && port == oldport) { + if (!strcmp(sa->hostname, addr) && port == oldport) { /* re-use existing record */ new = *walk; *walk = new->next;