|
@@ -77,6 +77,7 @@
|
|
|
#define RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT 10
|
|
#define RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT 10
|
|
|
#define RRP_PROBLEM_COUNT_THRESHOLD_MIN 2
|
|
#define RRP_PROBLEM_COUNT_THRESHOLD_MIN 2
|
|
|
#define RRP_AUTORECOVERY_CHECK_TIMEOUT 1000
|
|
#define RRP_AUTORECOVERY_CHECK_TIMEOUT 1000
|
|
|
|
|
+#define BLOCK_UNLISTED_IPS 1
|
|
|
|
|
|
|
|
#define DEFAULT_PORT 5405
|
|
#define DEFAULT_PORT 5405
|
|
|
|
|
|
|
@@ -130,6 +131,8 @@ static uint32_t *totem_get_param_by_name(struct totem_config *totem_config, cons
|
|
|
return &totem_config->max_messages;
|
|
return &totem_config->max_messages;
|
|
|
if (strcmp(param_name, "totem.miss_count_const") == 0)
|
|
if (strcmp(param_name, "totem.miss_count_const") == 0)
|
|
|
return &totem_config->miss_count_const;
|
|
return &totem_config->miss_count_const;
|
|
|
|
|
+ if (strcmp(param_name, "totem.block_unlisted_ips") == 0)
|
|
|
|
|
+ return &totem_config->block_unlisted_ips;
|
|
|
|
|
|
|
|
return NULL;
|
|
return NULL;
|
|
|
}
|
|
}
|
|
@@ -166,6 +169,55 @@ static void totem_volatile_config_set_value (struct totem_config *totem_config,
|
|
|
icmap_set_uint32(runtime_key_name, *totem_get_param_by_name(totem_config, key_name));
|
|
icmap_set_uint32(runtime_key_name, *totem_get_param_by_name(totem_config, key_name));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+/*
|
|
|
|
|
+ * Read string value stored in key_name from icmap, use it as a boolean (yes/no) type, convert it
|
|
|
|
|
+ * to integer value (1/0) and store into totem_config.
|
|
|
|
|
+ *
|
|
|
|
|
+ * If key is not found or key_name == delete_key default value is used
|
|
|
|
|
+ * and stored into totem_config.
|
|
|
|
|
+ */
|
|
|
|
|
+static void totem_volatile_config_set_boolean_value (struct totem_config *totem_config,
|
|
|
|
|
+ const char *key_name, const char *deleted_key, unsigned int default_value)
|
|
|
|
|
+{
|
|
|
|
|
+ char runtime_key_name[ICMAP_KEYNAME_MAXLEN];
|
|
|
|
|
+ char *str;
|
|
|
|
|
+ int val;
|
|
|
|
|
+
|
|
|
|
|
+ str = NULL;
|
|
|
|
|
+ val = default_value;
|
|
|
|
|
+
|
|
|
|
|
+ if ((deleted_key != NULL && strcmp(deleted_key, key_name) == 0) ||
|
|
|
|
|
+ (icmap_get_string(key_name, &str) != CS_OK)) {
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Do nothing. str is NULL (icmap_get_string ether not called or
|
|
|
|
|
+ * not changed str).
|
|
|
|
|
+ */
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (strcmp(str, "yes") == 0) {
|
|
|
|
|
+ val = 1;
|
|
|
|
|
+ } else if (strcmp(str, "no") == 0) {
|
|
|
|
|
+ val = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ free(str);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Store totem_config value to cmap runtime section
|
|
|
|
|
+ */
|
|
|
|
|
+ if (strlen("runtime.config.") + strlen(key_name) >= ICMAP_KEYNAME_MAXLEN) {
|
|
|
|
|
+ /*
|
|
|
|
|
+ * This shouldn't happen
|
|
|
|
|
+ */
|
|
|
|
|
+ return ;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ strcpy(runtime_key_name, "runtime.config.");
|
|
|
|
|
+ strcat(runtime_key_name, key_name);
|
|
|
|
|
+
|
|
|
|
|
+ *totem_get_param_by_name(totem_config, key_name) = val;
|
|
|
|
|
+
|
|
|
|
|
+ icmap_set_uint32(runtime_key_name, val);
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Read and validate config values from cmap and store them into totem_config. If key doesn't exists,
|
|
* Read and validate config values from cmap and store them into totem_config. If key doesn't exists,
|
|
@@ -238,6 +290,9 @@ static void totem_volatile_config_read (struct totem_config *totem_config, const
|
|
|
RRP_AUTORECOVERY_CHECK_TIMEOUT, 0);
|
|
RRP_AUTORECOVERY_CHECK_TIMEOUT, 0);
|
|
|
|
|
|
|
|
totem_volatile_config_set_value(totem_config, "totem.heartbeat_failures_allowed", deleted_key, 0, 1);
|
|
totem_volatile_config_set_value(totem_config, "totem.heartbeat_failures_allowed", deleted_key, 0, 1);
|
|
|
|
|
+
|
|
|
|
|
+ totem_volatile_config_set_boolean_value(totem_config, "totem.block_unlisted_ips", deleted_key,
|
|
|
|
|
+ BLOCK_UNLISTED_IPS);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static int totem_volatile_config_validate (
|
|
static int totem_volatile_config_validate (
|