|
|
906948 |
diff --git a/docs/manual/mod/mpm_common.html.en b/docs/manual/mod/mpm_common.html.en
|
|
|
906948 |
index e7af21d..01d54b7 100644
|
|
|
906948 |
--- a/docs/manual/mod/mpm_common.html.en
|
|
|
906948 |
+++ b/docs/manual/mod/mpm_common.html.en
|
|
|
906948 |
@@ -42,6 +42,7 @@ more than one multi-processing module (MPM)
|
|
|
906948 |
EnableExceptionHook
|
|
|
906948 |
GracefulShutdownTimeout
|
|
|
906948 |
Listen
|
|
|
906948 |
+ ListenFree
|
|
|
906948 |
ListenBackLog
|
|
|
906948 |
ListenCoresBucketsRatio
|
|
|
906948 |
MaxConnectionsPerChild
|
|
|
906948 |
@@ -244,6 +245,31 @@ discussion of the Address already in use error message,
|
|
|
906948 |
including other causes.
|
|
|
906948 |
|
|
|
906948 |
|
|
|
906948 |
+
|
|
|
906948 |
+
|
|
|
906948 |
+
|
|
|
906948 |
+
|
|
|
906948 |
+Description:IP addresses and ports that the server
|
|
|
906948 |
+listens to. Doesn't require IP address to be up
|
|
|
906948 |
+Syntax:ListenFree [IP-address:]portnumber [protocol]
|
|
|
906948 |
+Context:server config
|
|
|
906948 |
+Status:MPM
|
|
|
906948 |
+Module:event , worker , prefork , mpm_winnt , mpm_netware , mpmt_os2
|
|
|
906948 |
+Compatibility:This directive is currently available only in Red Hat Enterprise Linux
|
|
|
906948 |
+
|
|
|
906948 |
+ The ListenFree directive is
|
|
|
906948 |
+ identical to the Listen directive.
|
|
|
906948 |
+ The only difference is in the usage of the IP_FREEBIND socket
|
|
|
906948 |
+ option, which is enabled by default with ListenFree .
|
|
|
906948 |
+ If IP_FREEBIND is enabled, it allows httpd to bind to an IP
|
|
|
906948 |
+ address that is nonlocal or does not (yet) exist. This allows httpd to
|
|
|
906948 |
+ listen on a socket without requiring the underlying network interface
|
|
|
906948 |
+ or the specified dynamic IP address to be up at the time when httpd
|
|
|
906948 |
+ is trying to bind to it.
|
|
|
906948 |
+
|
|
|
906948 |
+
|
|
|
906948 |
+
|
|
|
906948 |
+
|
|
|
906948 |
|
|
|
906948 |
|
|
|
906948 |
|
|
|
906948 |
diff --git a/include/ap_listen.h b/include/ap_listen.h
|
|
|
906948 |
index 58c2574..1a53292 100644
|
|
|
906948 |
--- a/include/ap_listen.h
|
|
|
906948 |
+++ b/include/ap_listen.h
|
|
|
906948 |
@@ -137,6 +137,9 @@ AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd, void *dummy
|
|
|
906948 |
AP_DECLARE_NONSTD(const char *) ap_set_listencbratio(cmd_parms *cmd, void *dummy, const char *arg);
|
|
|
906948 |
AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
|
|
|
906948 |
int argc, char *const argv[]);
|
|
|
906948 |
+AP_DECLARE_NONSTD(const char *) ap_set_freelistener(cmd_parms *cmd, void *dummy,
|
|
|
906948 |
+ int argc, char *const argv[]);
|
|
|
906948 |
+
|
|
|
906948 |
AP_DECLARE_NONSTD(const char *) ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
|
|
|
906948 |
const char *arg);
|
|
|
906948 |
AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
|
|
|
906948 |
@@ -150,6 +153,8 @@ AP_INIT_TAKE1("ListenCoresBucketsRatio", ap_set_listencbratio, NULL, RSRC_CONF,
|
|
|
906948 |
"Ratio between the number of CPU cores (online) and the number of listeners buckets"), \
|
|
|
906948 |
AP_INIT_TAKE_ARGV("Listen", ap_set_listener, NULL, RSRC_CONF, \
|
|
|
906948 |
"A port number or a numeric IP address and a port number, and an optional protocol"), \
|
|
|
906948 |
+AP_INIT_TAKE_ARGV("ListenFree", ap_set_freelistener, NULL, RSRC_CONF, \
|
|
|
906948 |
+ "A port number or a numeric IP address and a port number, and an optional protocol"), \
|
|
|
906948 |
AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
|
|
|
906948 |
"Send buffer size in bytes"), \
|
|
|
906948 |
AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
|
|
|
906948 |
diff --git a/server/listen.c b/server/listen.c
|
|
|
906948 |
index e2e028a..6ef664b 100644
|
|
|
906948 |
--- a/server/listen.c
|
|
|
906948 |
+++ b/server/listen.c
|
|
|
906948 |
@@ -63,6 +63,7 @@ static int ap_listenbacklog;
|
|
|
906948 |
static int ap_listencbratio;
|
|
|
906948 |
static int send_buffer_size;
|
|
|
906948 |
static int receive_buffer_size;
|
|
|
906948 |
+static int ap_listenfreebind;
|
|
|
906948 |
#ifdef HAVE_SYSTEMD
|
|
|
906948 |
static int use_systemd = -1;
|
|
|
906948 |
#endif
|
|
|
906948 |
@@ -162,6 +163,21 @@ static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server, int do_bind_
|
|
|
906948 |
}
|
|
|
906948 |
#endif
|
|
|
906948 |
|
|
|
906948 |
+
|
|
|
906948 |
+#if defined(APR_SO_FREEBIND)
|
|
|
906948 |
+ if (ap_listenfreebind) {
|
|
|
906948 |
+ if (apr_socket_opt_set(s, APR_SO_FREEBIND, one) < 0) {
|
|
|
906948 |
+ stat = apr_get_netos_error();
|
|
|
906948 |
+ ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, APLOGNO(02182)
|
|
|
906948 |
+ "make_sock: apr_socket_opt_set: "
|
|
|
906948 |
+ "error setting APR_SO_FREEBIND");
|
|
|
906948 |
+ apr_socket_close(s);
|
|
|
906948 |
+ return stat;
|
|
|
906948 |
+ }
|
|
|
906948 |
+ }
|
|
|
906948 |
+#endif
|
|
|
906948 |
+
|
|
|
906948 |
+
|
|
|
906948 |
if (do_bind_listen) {
|
|
|
906948 |
#if APR_HAVE_IPV6
|
|
|
906948 |
if (server->bind_addr->family == APR_INET6) {
|
|
|
906948 |
@@ -956,6 +972,7 @@ AP_DECLARE(void) ap_listen_pre_config(void)
|
|
|
906948 |
}
|
|
|
906948 |
}
|
|
|
906948 |
|
|
|
906948 |
+
|
|
|
906948 |
AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
|
|
|
906948 |
int argc, char *const argv[])
|
|
|
906948 |
{
|
|
|
906948 |
@@ -1016,6 +1033,14 @@ AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
|
|
|
906948 |
return alloc_listener(cmd->server->process, host, port, proto, NULL);
|
|
|
906948 |
}
|
|
|
906948 |
|
|
|
906948 |
+AP_DECLARE_NONSTD(const char *) ap_set_freelistener(cmd_parms *cmd, void *dummy,
|
|
|
906948 |
+ int argc,
|
|
|
906948 |
+ char *const argv[])
|
|
|
906948 |
+{
|
|
|
906948 |
+ ap_listenfreebind = 1;
|
|
|
906948 |
+ return ap_set_listener(cmd, dummy, argc, argv);
|
|
|
906948 |
+}
|
|
|
906948 |
+
|
|
|
906948 |
AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd,
|
|
|
906948 |
void *dummy,
|
|
|
906948 |
const char *arg)
|