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 <dpejesh@yahoo.com>,
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
Changes with Apache 2.0.40
+ *) Restore the ability to specify host names on Listen directives.
+ PR 11030. [Jeff Trawick, David Shane Holden <dpejesh@yahoo.com>]
+
*) 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
ap_listen_rec **walk;
ap_listen_rec *new;
apr_status_t status;
- char *oldaddr;
apr_port_t oldport;
apr_sockaddr_t *sa;
/* 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;