bdaebd
diff --git a/include/ap_listen.h b/include/ap_listen.h
bdaebd
index 58c2574..1a53292 100644
bdaebd
--- a/include/ap_listen.h
bdaebd
+++ b/include/ap_listen.h
bdaebd
@@ -137,6 +137,9 @@ AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd, void *dummy
bdaebd
 AP_DECLARE_NONSTD(const char *) ap_set_listencbratio(cmd_parms *cmd, void *dummy, const char *arg);
bdaebd
 AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
bdaebd
                                                 int argc, char *const argv[]);
bdaebd
+AP_DECLARE_NONSTD(const char *) ap_set_freelistener(cmd_parms *cmd, void *dummy,
bdaebd
+                                                    int argc, char *const argv[]);
bdaebd
+
bdaebd
 AP_DECLARE_NONSTD(const char *) ap_set_send_buffer_size(cmd_parms *cmd, void *dummy,
bdaebd
                                                         const char *arg);
bdaebd
 AP_DECLARE_NONSTD(const char *) ap_set_receive_buffer_size(cmd_parms *cmd,
bdaebd
@@ -150,6 +153,8 @@ AP_INIT_TAKE1("ListenCoresBucketsRatio", ap_set_listencbratio, NULL, RSRC_CONF,
bdaebd
   "Ratio between the number of CPU cores (online) and the number of listeners buckets"), \
bdaebd
 AP_INIT_TAKE_ARGV("Listen", ap_set_listener, NULL, RSRC_CONF, \
bdaebd
   "A port number or a numeric IP address and a port number, and an optional protocol"), \
bdaebd
+AP_INIT_TAKE_ARGV("ListenFree", ap_set_freelistener, NULL, RSRC_CONF, \
bdaebd
+  "A port number or a numeric IP address and a port number, and an optional protocol"), \
bdaebd
 AP_INIT_TAKE1("SendBufferSize", ap_set_send_buffer_size, NULL, RSRC_CONF, \
bdaebd
   "Send buffer size in bytes"), \
bdaebd
 AP_INIT_TAKE1("ReceiveBufferSize", ap_set_receive_buffer_size, NULL, \
bdaebd
diff --git a/server/listen.c b/server/listen.c
bdaebd
index 1a6c1d3..d375fee 100644
bdaebd
--- a/server/listen.c
bdaebd
+++ b/server/listen.c
bdaebd
@@ -63,6 +63,7 @@ static int ap_listenbacklog;
bdaebd
 static int ap_listencbratio;
bdaebd
 static int send_buffer_size;
bdaebd
 static int receive_buffer_size;
bdaebd
+static int ap_listenfreebind;
bdaebd
 #ifdef HAVE_SYSTEMD
bdaebd
 static int use_systemd = -1;
bdaebd
 #endif
bdaebd
@@ -162,6 +163,21 @@ static apr_status_t make_sock(apr_pool_t *p, ap_listen_rec *server, int do_bind_
bdaebd
     }
bdaebd
 #endif
bdaebd
 
bdaebd
+
bdaebd
+#if defined(APR_SO_FREEBIND)
bdaebd
+    if (ap_listenfreebind) {
bdaebd
+        if (apr_socket_opt_set(s, APR_SO_FREEBIND, one) < 0) {
bdaebd
+            stat = apr_get_netos_error();
bdaebd
+            ap_log_perror(APLOG_MARK, APLOG_CRIT, stat, p, APLOGNO(02182)
bdaebd
+                          "make_sock: apr_socket_opt_set: "
bdaebd
+                          "error setting APR_SO_FREEBIND");
bdaebd
+            apr_socket_close(s);
bdaebd
+            return stat;
bdaebd
+       }
bdaebd
+   }
bdaebd
+#endif
bdaebd
+
bdaebd
+
bdaebd
     if (do_bind_listen) {
bdaebd
 #if APR_HAVE_IPV6
bdaebd
         if (server->bind_addr->family == APR_INET6) {
bdaebd
@@ -956,6 +972,7 @@ AP_DECLARE(void) ap_listen_pre_config(void)
bdaebd
     }
bdaebd
 }
bdaebd
 
bdaebd
+
bdaebd
 AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
bdaebd
                                                 int argc, char *const argv[])
bdaebd
 {
bdaebd
@@ -1016,6 +1033,14 @@ AP_DECLARE_NONSTD(const char *) ap_set_listener(cmd_parms *cmd, void *dummy,
bdaebd
     return alloc_listener(cmd->server->process, host, port, proto, NULL);
bdaebd
 }
bdaebd
 
bdaebd
+AP_DECLARE_NONSTD(const char *) ap_set_freelistener(cmd_parms *cmd, void *dummy,
bdaebd
+                                                    int argc,
bdaebd
+                                                    char *const argv[])
bdaebd
+{
bdaebd
+    ap_listenfreebind = 1;
bdaebd
+    return ap_set_listener(cmd, dummy, argc, argv);
bdaebd
+}
bdaebd
+
bdaebd
 AP_DECLARE_NONSTD(const char *) ap_set_listenbacklog(cmd_parms *cmd,
bdaebd
                                                      void *dummy,
bdaebd
                                                      const char *arg)
bdaebd
diff --git a/docs/manual/mod/mpm_common.html.en b/docs/manual/mod/mpm_common.html.en
bdaebd
index 5d688e4..eb66c19 100644
bdaebd
--- a/docs/manual/mod/mpm_common.html.en
bdaebd
+++ b/docs/manual/mod/mpm_common.html.en
bdaebd
@@ -42,6 +42,7 @@ more than one multi-processing module (MPM)
bdaebd
 
  • EnableExceptionHook
  • bdaebd
     
  • GracefulShutdownTimeout
  • bdaebd
     
  • Listen
  • bdaebd
    +
  • ListenFree
  • bdaebd
     
  • ListenBackLog
  • bdaebd
     
  • ListenCoresBucketsRatio
  • bdaebd
     
  • MaxConnectionsPerChild
  • bdaebd
    @@ -233,6 +234,31 @@ discussion of the Address already in use error message,
    bdaebd
     including other causes.
    bdaebd
     
    bdaebd
     
    bdaebd
    +
    bdaebd
    +
    top
    bdaebd
    +
    bdaebd
    +
    bdaebd
    +Description:IP addresses and ports that the server
    bdaebd
    +listens to. Doesn't require IP address to be up
    bdaebd
    +Syntax:ListenFree [IP-address:]portnumber [protocol]
    bdaebd
    +Context:server config
    bdaebd
    +Status:MPM
    bdaebd
    +Module:event, worker, prefork, mpm_winnt, mpm_netware, mpmt_os2
    bdaebd
    +Compatibility:This directive is currently available only in Red Hat Enterprise Linux
    bdaebd
    +
    bdaebd
    +    

    The ListenFree directive is

    bdaebd
    +    identical to the Listen directive. 
    bdaebd
    +    The only difference is in the usage of the IP_FREEBIND socket 
    bdaebd
    +    option, which is enabled by default with ListenFree. 
    bdaebd
    +    If IP_FREEBIND is enabled, it allows httpd to bind to an IP
    bdaebd
    +    address that is nonlocal or does not (yet) exist. This allows httpd to 
    bdaebd
    +    listen on a socket without requiring the underlying network interface
    bdaebd
    +    or the specified dynamic IP address to be up at the time when httpd
    bdaebd
    +    is trying to bind to it.
    bdaebd
    +    

    bdaebd
    +
    bdaebd
    +
    bdaebd
    +
    bdaebd
     
    top
    bdaebd
     
    bdaebd
     
    bdaebd