Author: jfrederic.clere(a)jboss.com
Date: 2009-05-25 11:06:11 -0400 (Mon, 25 May 2009)
New Revision: 2446
Modified:
trunk/mod_cluster/native/advertise/mod_advertise.c
Log:
Fix for MODCLUSTER-76.
Modified: trunk/mod_cluster/native/advertise/mod_advertise.c
===================================================================
--- trunk/mod_cluster/native/advertise/mod_advertise.c 2009-05-25 12:20:31 UTC (rev 2445)
+++ trunk/mod_cluster/native/advertise/mod_advertise.c 2009-05-25 15:06:11 UTC (rev 2446)
@@ -71,6 +71,10 @@
static char *ma_advertise_skey = NULL;
+static int ma_bind_set = 0;
+static char *ma_bind_adrs = NULL;
+static char *ma_bind_adsi = NULL;
+static apr_port_t ma_bind_port = 0;
static ma_advertise_srv_t ma_advs_server;
@@ -199,6 +203,34 @@
/*--------------------------------------------------------------------------*/
/* */
+/* AdvertiseBindAddress directive */
+/* */
+/*--------------------------------------------------------------------------*/
+static const char *cmd_bindaddr(cmd_parms *cmd, void *dummy,
+ const char *arg)
+{
+ if (ma_server_rec !=NULL && ma_server_rec != cmd->server)
+ return "All Advertise directives must be in the same VirtualHost";
+ if (ma_server_rec == NULL)
+ ma_server_rec = cmd->server;
+
+ if (ma_bind_set)
+ return "Duplicate AdvertiseBindAddress directives are not allowed";
+
+ if (apr_parse_addr_port(&ma_bind_adrs,
+ &ma_bind_adsi,
+ &ma_bind_port,
+ arg, cmd->pool) != APR_SUCCESS)
+ return "Invalid AdvertiseBindAddress address";
+ if (!ma_bind_adrs)
+ return "Missing Ip part from AdvertiseBindAddress address";
+ if (!ma_bind_port)
+ ma_bind_port = MA_DEFAULT_ADVPORT;
+ ma_bind_set = 1;
+ return NULL;
+}
+/*--------------------------------------------------------------------------*/
+/* */
/* AdvertiseFrequency directive */
/* */
/*--------------------------------------------------------------------------*/
@@ -343,11 +375,11 @@
addr, port);
return rv;
}
- if ((rv = apr_sockaddr_info_get(&ma_listen_sa, NULL,
- ma_mgroup_sa->family, 0,
+ if ((rv = apr_sockaddr_info_get(&ma_listen_sa, ma_bind_adrs,
+ ma_mgroup_sa->family, ma_bind_port,
APR_UNSPEC, pool)) != APR_SUCCESS) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, s,
- "mod_advertise: ma_group_join apr_sockaddr_info_get(0.0.0.0:0)
failed");
+ "mod_advertise: ma_group_join apr_sockaddr_info_get(%s:%d)
failed", ma_bind_adsi, ma_bind_port);
return rv;
}
if ((rv = apr_sockaddr_info_get(&ma_niface_sa, NULL,
@@ -700,6 +732,13 @@
RSRC_CONF, /* where available */
"Advertise manager url"
),
+ AP_INIT_TAKE1(
+ "AdvertiseBindAddress", /* directive name */
+ cmd_bindaddr, /* config action routine */
+ NULL, /* argument to include in call */
+ RSRC_CONF, /* where available */
+ "Local adress to bind to for Multicast logic"
+ ),
{NULL}
};
Show replies by date