summaryrefslogtreecommitdiffstats
path: root/server/vhost.c
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2017-11-29 10:07:48 +0100
committerJoe Orton <jorton@apache.org>2017-11-29 10:07:48 +0100
commit42b3eabb308df0c4da640ee2f6654f0a37181138 (patch)
tree94d8f2d19be43d6a69721519e370b208426d752f /server/vhost.c
parentOn the trunk: (diff)
downloadapache2-42b3eabb308df0c4da640ee2f6654f0a37181138.tar.xz
apache2-42b3eabb308df0c4da640ee2f6654f0a37181138.zip
Support IPv6 link-local scope IDs in Listen and VirtualHost, if built
with APR 1.7 or later: * server/listen.c (match_address): New function, factored out from find_listeners. (find_listeners): Use it; add scope and temp pool arguments. (alloc_listener): Take scope_id and pool arguments and pass through; set zone for addresses if present. (ap_set_listener): Pass through temp pool and scope id. * server/vhost.c (get_addresses): Set zone for vhost address if present. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1816609 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/vhost.c')
-rw-r--r--server/vhost.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/server/vhost.c b/server/vhost.c
index 5ad4efd381..15ba3bbb93 100644
--- a/server/vhost.c
+++ b/server/vhost.c
@@ -23,6 +23,7 @@
#include "apr.h"
#include "apr_strings.h"
#include "apr_lib.h"
+#include "apr_version.h"
#define APR_WANT_STRFUNC
#include "apr_want.h"
@@ -181,9 +182,14 @@ static const char *get_addresses(apr_pool_t *p, const char *w_,
if (!host) {
return "Missing address for VirtualHost";
}
+#if !APR_VERSION_AT_LEAST(1,7,0)
if (scope_id) {
- return "Scope ids are not supported";
+ return apr_pstrcat(p,
+ "Scope ID in address '", w,
+ "' not supported with APR " APR_VERSION_STRING,
+ NULL);
}
+#endif
if (!port && !wild_port) {
port = default_port;
}
@@ -202,6 +208,17 @@ static const char *get_addresses(apr_pool_t *p, const char *w_,
"Could not resolve host name %s -- ignoring!", host);
return NULL;
}
+#if APR_VERSION_AT_LEAST(1,7,0)
+ if (scope_id) {
+ rv = apr_sockaddr_zone_set(my_addr, scope_id);
+ if (rv) {
+ ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, APLOGNO()
+ "Could not set scope ID %s for %pI -- ignoring!",
+ scope_id, my_addr);
+ return NULL;
+ }
+ }
+#endif
}
/* Remember all addresses for the host */