Merge branch 'release-1.0beta-refresh' into cmake_build
This commit is contained in:
@ -35,6 +35,9 @@
|
||||
* 23/05/14 Massimiliano Pinto Added automatic set of maxscale-id: first listening ipv4_raw + port + pid
|
||||
* 28/05/14 Massimiliano Pinto Added detect_replication_lag parameter
|
||||
* 28/08/14 Massimiliano Pinto Added detect_stale_master parameter
|
||||
* 09/09/14 Massimiliano Pinto Added localhost_match_wildcard_host parameter
|
||||
* 12/09/14 Mark Riddoch Addition of checks on servers list and
|
||||
* internal router suppression of messages
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
@ -62,6 +65,7 @@ static int handle_global_item(const char *, const char *);
|
||||
static void global_defaults();
|
||||
static void check_config_objects(CONFIG_CONTEXT *context);
|
||||
static int config_truth_value(char *str);
|
||||
static int internalService(char *router);
|
||||
|
||||
static char *config_file = NULL;
|
||||
static GATEWAY_CONF gateway;
|
||||
@ -288,6 +292,9 @@ int error_count = 0;
|
||||
is_rwsplit = true;
|
||||
}
|
||||
|
||||
char *allow_localhost_match_wildcard_host =
|
||||
config_get_value(obj->parameters, "localhost_match_wildcard_host");
|
||||
|
||||
if (obj->element == NULL) /*< if module load failed */
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
@ -322,6 +329,11 @@ int error_count = 0;
|
||||
if (weightby)
|
||||
serviceWeightBy(obj->element, weightby);
|
||||
|
||||
if (allow_localhost_match_wildcard_host)
|
||||
serviceEnableLocalhostMatchWildcardHost(
|
||||
obj->element,
|
||||
config_truth_value(allow_localhost_match_wildcard_host));
|
||||
|
||||
if (!auth)
|
||||
auth = config_get_value(obj->parameters,
|
||||
"auth");
|
||||
@ -605,36 +617,50 @@ int error_count = 0;
|
||||
{
|
||||
char *servers;
|
||||
char *roptions;
|
||||
char *router;
|
||||
char *filters = config_get_value(obj->parameters,
|
||||
"filters");
|
||||
servers = config_get_value(obj->parameters, "servers");
|
||||
roptions = config_get_value(obj->parameters,
|
||||
"router_options");
|
||||
router = config_get_value(obj->parameters, "router");
|
||||
if (servers && obj->element)
|
||||
{
|
||||
char *s = strtok(servers, ",");
|
||||
while (s)
|
||||
{
|
||||
CONFIG_CONTEXT *obj1 = context;
|
||||
int found = 0;
|
||||
while (obj1)
|
||||
{
|
||||
if (strcmp(trim(s), obj1->object) == 0 &&
|
||||
obj->element && obj1->element)
|
||||
{
|
||||
found = 1;
|
||||
serviceAddBackend(
|
||||
obj->element,
|
||||
obj1->element);
|
||||
}
|
||||
obj1 = obj1->next;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Unable to find "
|
||||
"server '%s' that is "
|
||||
"configured as part of "
|
||||
"service '%s'.",
|
||||
s, obj->object)));
|
||||
}
|
||||
s = strtok(NULL, ",");
|
||||
}
|
||||
}
|
||||
else if (servers == NULL)
|
||||
else if (servers == NULL && internalService(router) == 0)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : The service '%s' is missing a "
|
||||
"Warning: The service '%s' is missing a "
|
||||
"definition of the servers that provide "
|
||||
"the service.",
|
||||
obj->object)));
|
||||
@ -787,17 +813,29 @@ int error_count = 0;
|
||||
while (s)
|
||||
{
|
||||
CONFIG_CONTEXT *obj1 = context;
|
||||
int found = 0;
|
||||
while (obj1)
|
||||
{
|
||||
if (strcmp(s, obj1->object) == 0 &&
|
||||
obj->element && obj1->element)
|
||||
{
|
||||
found = 1;
|
||||
monitorAddServer(
|
||||
obj->element,
|
||||
obj1->element);
|
||||
}
|
||||
obj1 = obj1->next;
|
||||
}
|
||||
if (!found)
|
||||
LOGIF(LE,
|
||||
(skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Unable to find "
|
||||
"server '%s' that is "
|
||||
"configured in the "
|
||||
"monitor '%s'.",
|
||||
s, obj->object)));
|
||||
|
||||
s = strtok(NULL, ",");
|
||||
}
|
||||
}
|
||||
@ -1162,6 +1200,7 @@ SERVER *server;
|
||||
char* max_slave_conn_str;
|
||||
char* max_slave_rlag_str;
|
||||
char *version_string;
|
||||
char *allow_localhost_match_wildcard_host;
|
||||
|
||||
enable_root_user = config_get_value(obj->parameters, "enable_root_user");
|
||||
|
||||
@ -1172,6 +1211,8 @@ SERVER *server;
|
||||
|
||||
version_string = config_get_value(obj->parameters, "version_string");
|
||||
|
||||
allow_localhost_match_wildcard_host = config_get_value(obj->parameters, "localhost_match_wildcard_host");
|
||||
|
||||
if (version_string) {
|
||||
if (service->version_string) {
|
||||
free(service->version_string);
|
||||
@ -1185,6 +1226,11 @@ SERVER *server;
|
||||
auth);
|
||||
if (enable_root_user)
|
||||
serviceEnableRootUser(service, atoi(enable_root_user));
|
||||
|
||||
if (allow_localhost_match_wildcard_host)
|
||||
serviceEnableLocalhostMatchWildcardHost(
|
||||
service,
|
||||
atoi(allow_localhost_match_wildcard_host));
|
||||
|
||||
/** Read, validate and set max_slave_connections */
|
||||
max_slave_conn_str =
|
||||
@ -1279,10 +1325,13 @@ SERVER *server;
|
||||
char *user;
|
||||
char *auth;
|
||||
char *enable_root_user;
|
||||
char *allow_localhost_match_wildcard_host;
|
||||
|
||||
enable_root_user =
|
||||
config_get_value(obj->parameters,
|
||||
"enable_root_user");
|
||||
allow_localhost_match_wildcard_host =
|
||||
config_get_value(obj->parameters, "localhost_match_wildcard_host");
|
||||
|
||||
user = config_get_value(obj->parameters,
|
||||
"user");
|
||||
@ -1298,6 +1347,11 @@ SERVER *server;
|
||||
auth);
|
||||
if (enable_root_user)
|
||||
serviceEnableRootUser(service, atoi(enable_root_user));
|
||||
|
||||
if (allow_localhost_match_wildcard_host)
|
||||
serviceEnableLocalhostMatchWildcardHost(
|
||||
service,
|
||||
atoi(allow_localhost_match_wildcard_host));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1391,11 +1445,13 @@ SERVER *server;
|
||||
while (s)
|
||||
{
|
||||
CONFIG_CONTEXT *obj1 = context;
|
||||
int found = 0;
|
||||
while (obj1)
|
||||
{
|
||||
if (strcmp(s, obj1->object) == 0 &&
|
||||
obj->element && obj1->element)
|
||||
{
|
||||
found = 1;
|
||||
if (!serviceHasBackend(obj->element, obj1->element))
|
||||
{
|
||||
serviceAddBackend(
|
||||
@ -1405,6 +1461,16 @@ SERVER *server;
|
||||
}
|
||||
obj1 = obj1->next;
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error: Unable to find "
|
||||
"server '%s' that is "
|
||||
"configured as part of "
|
||||
"service '%s'.",
|
||||
s, obj->object)));
|
||||
}
|
||||
s = strtok(NULL, ",");
|
||||
}
|
||||
}
|
||||
@ -1503,6 +1569,7 @@ static char *service_params[] =
|
||||
"user",
|
||||
"passwd",
|
||||
"enable_root_user",
|
||||
"localhost_match_wildcard_host",
|
||||
"max_slave_connections",
|
||||
"max_slave_replication_lag",
|
||||
"use_sql_variables_in", /*< rwsplit only */
|
||||
@ -1667,3 +1734,29 @@ config_truth_value(char *str)
|
||||
return atoi(str);
|
||||
}
|
||||
|
||||
static char *InternalRouters[] = {
|
||||
"debugcli",
|
||||
"cli",
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if the router is one of the special internal services that
|
||||
* MaxScale offers.
|
||||
*
|
||||
* @param router The router name
|
||||
* @return Non-zero if the router is in the InternalRouters table
|
||||
*/
|
||||
static int
|
||||
internalService(char *router)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (router)
|
||||
{
|
||||
for (i = 0; InternalRouters[i]; i++)
|
||||
if (strcmp(router, InternalRouters[i]) == 0)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -375,23 +375,23 @@ char *stat;
|
||||
if (ptr)
|
||||
{
|
||||
dcb_printf(dcb, "Servers.\n");
|
||||
dcb_printf(dcb, "-------------------+-----------------+-------+----------------------+------------\n");
|
||||
dcb_printf(dcb, "%-18s | %-15s | Port | %-20s | Connections\n",
|
||||
dcb_printf(dcb, "-------------------+-----------------+-------+-------------+--------------------\n");
|
||||
dcb_printf(dcb, "%-18s | %-15s | Port | Connections | %-20s\n",
|
||||
"Server", "Address", "Status");
|
||||
dcb_printf(dcb, "-------------------+-----------------+-------+----------------------+------------\n");
|
||||
dcb_printf(dcb, "-------------------+-----------------+-------+-------------+--------------------\n");
|
||||
}
|
||||
while (ptr)
|
||||
{
|
||||
stat = server_status(ptr);
|
||||
dcb_printf(dcb, "%-18s | %-15s | %5d | %-20s | %4d\n",
|
||||
dcb_printf(dcb, "%-18s | %-15s | %5d | %11d | %s\n",
|
||||
ptr->unique_name, ptr->name,
|
||||
ptr->port, stat,
|
||||
ptr->stats.n_current);
|
||||
ptr->port,
|
||||
ptr->stats.n_current, stat);
|
||||
free(stat);
|
||||
ptr = ptr->next;
|
||||
}
|
||||
if (allServers)
|
||||
dcb_printf(dcb, "-------------------+-----------------+-------+----------------------+------------\n\n");
|
||||
dcb_printf(dcb, "-------------------+-----------------+-------+-------------+--------------------\n");
|
||||
spinlock_release(&server_spin);
|
||||
}
|
||||
|
||||
@ -424,6 +424,8 @@ char *status = NULL;
|
||||
strcat(status, "Slave of External Server, ");
|
||||
if (server->status & SERVER_STALE_STATUS)
|
||||
strcat(status, "Stale Status, ");
|
||||
if (server->status & SERVER_AUTH_ERROR)
|
||||
strcat(status, "Auth Error, ");
|
||||
if (server->status & SERVER_RUNNING)
|
||||
strcat(status, "Running");
|
||||
else
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
* 07/05/14 Massimiliano Pinto Added: version_string initialized to NULL
|
||||
* 23/05/14 Mark Riddoch Addition of service validation call
|
||||
* 29/05/14 Mark Riddoch Filter API implementation
|
||||
* 09/09/14 Massimiliano Pinto Added service option for localhost authentication
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
@ -128,6 +129,7 @@ SERVICE *service;
|
||||
service->credentials.name = NULL;
|
||||
service->credentials.authdata = NULL;
|
||||
service->enable_root = 0;
|
||||
service->localhost_match_wildcard_host = 0;
|
||||
service->routerOptions = NULL;
|
||||
service->databases = NULL;
|
||||
service->svc_config_param = NULL;
|
||||
@ -1288,3 +1290,23 @@ serviceGetWeightingParameter(SERVICE *service)
|
||||
{
|
||||
return service->weightby;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable localhost authentication match criteria
|
||||
* associated with this service.
|
||||
*
|
||||
* @param service The service we are setting the data for
|
||||
* @param action 1 for enable, 0 for disable access
|
||||
* @return 0 on failure
|
||||
*/
|
||||
|
||||
int
|
||||
serviceEnableLocalhostMatchWildcardHost(SERVICE *service, int action)
|
||||
{
|
||||
if (action != 0 && action != 1)
|
||||
return 0;
|
||||
|
||||
service->localhost_match_wildcard_host = action;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -693,7 +693,17 @@ int i;
|
||||
service->name)));
|
||||
return 0;
|
||||
}
|
||||
session->tail = *tail;
|
||||
|
||||
/*
|
||||
* filterUpstream may simply return the 3 parameter if
|
||||
* the filter has no upstream entry point. So no need
|
||||
* to copy the contents or free tail in this case.
|
||||
*/
|
||||
if (tail != &session->tail)
|
||||
{
|
||||
session->tail = *tail;
|
||||
free(tail);
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user