44 #include <sys/socket.h>
45 #include <sys/types.h>
48 #include <netinet/in.h>
49 #include <arpa/inet.h>
50 #include <sys/param.h>
54 #include <qb/qbdefs.h>
63 #define TOKEN_RETRANSMITS_BEFORE_LOSS_CONST 4
64 #define TOKEN_TIMEOUT 1000
65 #define TOKEN_COEFFICIENT 650
66 #define JOIN_TIMEOUT 50
67 #define MERGE_TIMEOUT 200
68 #define DOWNCHECK_TIMEOUT 1000
69 #define FAIL_TO_RECV_CONST 2500
70 #define SEQNO_UNCHANGED_CONST 30
71 #define MINIMUM_TIMEOUT (int)(1000/HZ)*3
72 #define MAX_NETWORK_DELAY 50
73 #define WINDOW_SIZE 50
74 #define MAX_MESSAGES 17
75 #define MISS_COUNT_CONST 5
76 #define RRP_PROBLEM_COUNT_TIMEOUT 2000
77 #define RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT 10
78 #define RRP_PROBLEM_COUNT_THRESHOLD_MIN 2
79 #define RRP_AUTORECOVERY_CHECK_TIMEOUT 1000
81 #define DEFAULT_PORT 5405
83 static char error_string_response[512];
91 if (strcmp(param_name,
"totem.token") == 0)
93 if (strcmp(param_name,
"totem.token_retransmit") == 0)
95 if (strcmp(param_name,
"totem.hold") == 0)
97 if (strcmp(param_name,
"totem.token_retransmits_before_loss_const") == 0)
99 if (strcmp(param_name,
"totem.join") == 0)
101 if (strcmp(param_name,
"totem.send_join") == 0)
103 if (strcmp(param_name,
"totem.consensus") == 0)
105 if (strcmp(param_name,
"totem.merge") == 0)
107 if (strcmp(param_name,
"totem.downcheck") == 0)
109 if (strcmp(param_name,
"totem.fail_recv_const") == 0)
111 if (strcmp(param_name,
"totem.seqno_unchanged_const") == 0)
113 if (strcmp(param_name,
"totem.rrp_token_expired_timeout") == 0)
115 if (strcmp(param_name,
"totem.rrp_problem_count_timeout") == 0)
117 if (strcmp(param_name,
"totem.rrp_problem_count_threshold") == 0)
119 if (strcmp(param_name,
"totem.rrp_problem_count_mcast_threshold") == 0)
121 if (strcmp(param_name,
"totem.rrp_autorecovery_check_timeout") == 0)
123 if (strcmp(param_name,
"totem.heartbeat_failures_allowed") == 0)
125 if (strcmp(param_name,
"totem.max_network_delay") == 0)
127 if (strcmp(param_name,
"totem.window_size") == 0)
129 if (strcmp(param_name,
"totem.max_messages") == 0)
131 if (strcmp(param_name,
"totem.miss_count_const") == 0)
141 static void totem_volatile_config_set_value (
struct totem_config *totem_config,
142 const char *key_name,
const char *deleted_key,
unsigned int default_value,
143 int allow_zero_value)
148 (deleted_key != NULL && strcmp(deleted_key, key_name) == 0) ||
149 (!allow_zero_value && *totem_get_param_by_name(totem_config, key_name) == 0)) {
150 *totem_get_param_by_name(totem_config, key_name) = default_value;
163 strcpy(runtime_key_name,
"runtime.config.");
164 strcat(runtime_key_name, key_name);
166 icmap_set_uint32(runtime_key_name, *totem_get_param_by_name(totem_config, key_name));
175 static void totem_volatile_config_read (
struct totem_config *totem_config,
const char *deleted_key)
179 totem_volatile_config_set_value(totem_config,
"totem.token_retransmits_before_loss_const", deleted_key,
182 totem_volatile_config_set_value(totem_config,
"totem.token", deleted_key,
TOKEN_TIMEOUT, 0);
195 totem_volatile_config_set_value(totem_config,
"totem.max_network_delay", deleted_key,
MAX_NETWORK_DELAY, 0);
197 totem_volatile_config_set_value(totem_config,
"totem.window_size", deleted_key,
WINDOW_SIZE, 0);
199 totem_volatile_config_set_value(totem_config,
"totem.max_messages", deleted_key,
MAX_MESSAGES, 0);
201 totem_volatile_config_set_value(totem_config,
"totem.miss_count_const", deleted_key,
MISS_COUNT_CONST, 0);
203 totem_volatile_config_set_value(totem_config,
"totem.token_retransmit", deleted_key,
206 totem_volatile_config_set_value(totem_config,
"totem.hold", deleted_key,
209 totem_volatile_config_set_value(totem_config,
"totem.join", deleted_key,
JOIN_TIMEOUT, 0);
211 totem_volatile_config_set_value(totem_config,
"totem.consensus", deleted_key,
214 totem_volatile_config_set_value(totem_config,
"totem.merge", deleted_key,
MERGE_TIMEOUT, 0);
216 totem_volatile_config_set_value(totem_config,
"totem.downcheck", deleted_key,
DOWNCHECK_TIMEOUT, 0);
218 totem_volatile_config_set_value(totem_config,
"totem.fail_recv_const", deleted_key,
FAIL_TO_RECV_CONST, 0);
220 totem_volatile_config_set_value(totem_config,
"totem.seqno_unchanged_const", deleted_key,
223 totem_volatile_config_set_value(totem_config,
"totem.send_join", deleted_key, 0, 1);
225 totem_volatile_config_set_value(totem_config,
"totem.rrp_problem_count_timeout", deleted_key,
228 totem_volatile_config_set_value(totem_config,
"totem.rrp_problem_count_threshold", deleted_key,
231 totem_volatile_config_set_value(totem_config,
"totem.rrp_problem_count_mcast_threshold", deleted_key,
234 totem_volatile_config_set_value(totem_config,
"totem.rrp_token_expired_timeout", deleted_key,
237 totem_volatile_config_set_value(totem_config,
"totem.rrp_autorecovery_check_timeout", deleted_key,
240 totem_volatile_config_set_value(totem_config,
"totem.heartbeat_failures_allowed", deleted_key, 0, 1);
243 static int totem_volatile_config_validate (
244 struct totem_config *totem_config,
245 const char **error_string)
247 static char local_error_reason[512];
248 const char *error_reason = local_error_reason;
251 snprintf (local_error_reason,
sizeof(local_error_reason),
252 "The max_network_delay parameter (%d ms) may not be less than (%d ms).",
258 snprintf (local_error_reason,
sizeof(local_error_reason),
259 "The token timeout parameter (%d ms) may not be less than (%d ms).",
265 snprintf (local_error_reason,
sizeof(local_error_reason),
266 "The token retransmit timeout parameter (%d ms) may not be less than (%d ms).",
272 snprintf (local_error_reason,
sizeof(local_error_reason),
273 "The token hold timeout parameter (%d ms) may not be less than (%d ms).",
279 snprintf (local_error_reason,
sizeof(local_error_reason),
280 "The join timeout parameter (%d ms) may not be less than (%d ms).",
286 snprintf (local_error_reason,
sizeof(local_error_reason),
287 "The consensus timeout parameter (%d ms) may not be less than (%d ms).",
293 snprintf (local_error_reason,
sizeof(local_error_reason),
294 "The consensus timeout parameter (%d ms) may not be less than join timeout (%d ms).",
300 snprintf (local_error_reason,
sizeof(local_error_reason),
301 "The merge timeout parameter (%d ms) may not be less than (%d ms).",
307 snprintf (local_error_reason,
sizeof(local_error_reason),
308 "The downcheck timeout parameter (%d ms) may not be less than (%d ms).",
314 snprintf (local_error_reason,
sizeof(local_error_reason),
315 "The RRP problem count timeout parameter (%d ms) may not be less than (%d ms).",
321 snprintf (local_error_reason,
sizeof(local_error_reason),
322 "The RRP problem count threshold (%d problem count) may not be less than (%d problem count).",
327 snprintf (local_error_reason,
sizeof(local_error_reason),
328 "The RRP multicast problem count threshold (%d problem count) may not be less than (%d problem count).",
334 snprintf (local_error_reason,
sizeof(local_error_reason),
335 "The RRP token expired timeout parameter (%d ms) may not be less than (%d ms).",
343 snprintf (error_string_response,
sizeof(error_string_response),
344 "parse error in config: %s\n", error_reason);
345 *error_string = error_string_response;
350 static int totem_get_crypto(
struct totem_config *totem_config)
353 const char *tmp_cipher;
354 const char *tmp_hash;
357 tmp_cipher =
"aes256";
360 if (strcmp (str,
"off") == 0) {
368 if (strcmp(str,
"none") == 0) {
371 if (strcmp(str,
"aes256") == 0) {
372 tmp_cipher =
"aes256";
374 if (strcmp(str,
"aes192") == 0) {
375 tmp_cipher =
"aes192";
377 if (strcmp(str,
"aes128") == 0) {
378 tmp_cipher =
"aes128";
380 if (strcmp(str,
"3des") == 0) {
387 if (strcmp(str,
"none") == 0) {
390 if (strcmp(str,
"md5") == 0) {
393 if (strcmp(str,
"sha1") == 0) {
396 if (strcmp(str,
"sha256") == 0) {
399 if (strcmp(str,
"sha384") == 0) {
402 if (strcmp(str,
"sha512") == 0) {
408 if ((strcmp(tmp_cipher,
"none") != 0) &&
409 (strcmp(tmp_hash,
"none") == 0)) {
422 static int totem_config_get_ip_version(
void)
429 if (strcmp(str,
"ipv4") == 0) {
432 if (strcmp(str,
"ipv6") == 0) {
441 static uint16_t generate_cluster_id (
const char *cluster_name)
446 for (i = 0; i < strlen(cluster_name); i++) {
448 value += cluster_name[i];
451 return (value & 0xFFFF);
454 static int get_cluster_mcast_addr (
455 const char *cluster_name,
456 unsigned int ringnumber,
461 char addr[INET6_ADDRSTRLEN + 1];
464 if (cluster_name == NULL) {
468 clusterid = generate_cluster_id(cluster_name) + ringnumber;
469 memset (res, 0,
sizeof(*res));
471 switch (ip_version) {
473 snprintf(addr,
sizeof(addr),
"239.192.%d.%d", clusterid >> 8, clusterid % 0xFF);
476 snprintf(addr,
sizeof(addr),
"ff15::%x", clusterid);
490 static unsigned int generate_nodeid_for_duplicate_test(
491 struct totem_config *totem_config,
502 memcpy (&nodeid, &totemip.addr, sizeof (
unsigned int));
504 #if __BYTE_ORDER == __LITTLE_ENDIAN
509 nodeid &= 0x7FFFFFFF;
514 static int check_for_duplicate_nodeids(
515 struct totem_config *totem_config,
516 const char **error_string)
520 const char *iter_key;
524 char *ring0_addr=NULL;
525 char *ring0_addr1=NULL;
526 unsigned int node_pos;
527 unsigned int node_pos1;
529 unsigned int nodeid1;
534 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos, tmp_key);
539 if (strcmp(tmp_key,
"ring0_addr") != 0) {
553 nodeid = generate_nodeid_for_duplicate_test(totem_config, ring0_addr);
562 while (((iter_key =
icmap_iter_next(subiter, NULL, NULL)) != NULL) && (node_pos1 < node_pos)) {
563 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos1, tmp_key);
564 if ((res != 2) || (node_pos1 >= node_pos)) {
568 if (strcmp(tmp_key,
"ring0_addr") != 0) {
579 nodeid1 = generate_nodeid_for_duplicate_test(totem_config, ring0_addr1);
585 if (nodeid == nodeid1) {
587 snprintf (error_string_response,
sizeof(error_string_response),
588 "Nodeid %u%s%s%s appears twice in corosync.conf", nodeid,
589 autogenerated?
"(autogenerated from ":
"",
590 autogenerated?ring0_addr:
"",
591 autogenerated?
")":
"");
593 *error_string = error_string_response;
604 static int find_local_node_in_nodelist(
struct totem_config *totem_config)
607 const char *iter_key;
609 unsigned int node_pos;
610 int local_node_pos = -1;
612 int interface_up, interface_num;
618 &bind_addr, &interface_up, &interface_num,
626 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos, tmp_key);
631 if (strcmp(tmp_key,
"ring0_addr") != 0) {
647 local_node_pos = node_pos;
652 return (local_node_pos);
661 static void compute_interfaces_diff(
int interface_count,
665 int ring_no, set1_pos, set2_pos;
668 memset(&empty_ip_address, 0,
sizeof(empty_ip_address));
670 for (ring_no = 0; ring_no < interface_count; ring_no++) {
671 for (set1_pos = 0; set1_pos < set1[ring_no].
member_count; set1_pos++) {
672 for (set2_pos = 0; set2_pos < set2[ring_no].
member_count; set2_pos++) {
677 if (memcmp(&set1[ring_no].member_list[set1_pos],
678 &set2[ring_no].member_list[set2_pos],
680 memset(&set1[ring_no].member_list[set1_pos], 0,
682 memset(&set2[ring_no].member_list[set2_pos], 0,
689 for (ring_no = 0; ring_no < interface_count; ring_no++) {
690 for (set1_pos = 0; set1_pos < set1[ring_no].
member_count; set1_pos++) {
695 if (memcmp(&set1[ring_no].member_list[set1_pos], &empty_ip_address,
sizeof(empty_ip_address)) != 0) {
697 "removing dynamic member %s for ring %u",
704 for (set2_pos = 0; set2_pos < set2[ring_no].
member_count; set2_pos++) {
709 if (memcmp(&set2[ring_no].member_list[set2_pos], &empty_ip_address,
sizeof(empty_ip_address)) != 0) {
711 "adding dynamic member %s for ring %u",
721 static void put_nodelist_members_to_config(
struct totem_config *totem_config,
int reload)
724 const char *iter_key, *iter_key2;
726 unsigned int node_pos;
731 unsigned int ringnumber = 0;
743 assert(orig_interfaces != NULL);
745 assert(new_interfaces != NULL);
760 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos, tmp_key);
765 if (strcmp(tmp_key,
"ring0_addr") != 0) {
772 res = sscanf(iter_key2,
"nodelist.node.%u.ring%u%s", &node_pos, &ringnumber, tmp_key2);
773 if (res != 3 || strcmp(tmp_key2,
"_addr") != 0) {
799 compute_interfaces_diff(totem_config->
interface_count, orig_interfaces, new_interfaces);
801 free(new_interfaces);
802 free(orig_interfaces);
806 static void nodelist_dynamic_notify(
808 const char *key_name,
814 unsigned int ring_no;
815 unsigned int member_no;
818 struct totem_config *totem_config = (
struct totem_config *)user_data;
824 if (
icmap_get_uint8(
"config.totemconfig_reload_in_progress", &reloading) ==
CS_OK && reloading) {
828 res = sscanf(key_name,
"nodelist.node.%u.ring%u%s", &member_no, &ring_no, tmp_str);
832 if (strcmp(tmp_str,
"_addr") != 0) {
836 put_nodelist_members_to_config(totem_config, 1);
855 const char *iter_key, *iter_key2;
857 const char *ipaddr_key;
869 ip_version = totem_config_get_ip_version();
874 res = sscanf(iter_key,
"nodelist.node.%u.%s", node_pos, tmp_key);
879 if (strcmp(tmp_key,
"ring0_addr") != 0) {
892 snprintf(tmp_key,
sizeof(tmp_key),
"nodelist.node.%u.%s", *node_pos,
893 (ipaddr_key_prefix != NULL ? ipaddr_key_prefix :
"ring0_addr"));
900 ipaddr_key = (ipaddr_key_prefix != NULL ? iter_key2 : tmp_key);
905 if (
totemip_parse(&node_addr, node_addr_str, ip_version) == -1) {
915 for (list = addrs.
next; list != &addrs; list = list->
next) {
942 static void config_convert_nodelist_to_interface(
struct totem_config *totem_config)
945 unsigned int node_pos;
949 unsigned int ringnumber = 0;
951 const char *iter_key;
960 res = sscanf(iter_key,
"nodelist.node.%u.ring%u%s", &node_pos, &ringnumber, tmp_key2);
961 if (res != 3 || strcmp(tmp_key2,
"_addr") != 0) {
979 struct totem_config *totem_config,
980 const char **error_string,
984 char *str, *ring0_addr_str;
985 unsigned int ringnumber = 0;
986 int member_count = 0;
988 const char *iter_key;
989 const char *member_iter_key;
994 char *cluster_name = NULL;
1001 memset (totem_config, 0,
sizeof (
struct totem_config));
1004 *error_string =
"Out of memory trying to allocate ethernet interface storage area";
1011 strcpy (totem_config->
rrp_mode,
"none");
1015 if (totem_get_crypto(totem_config) != 0) {
1016 *error_string =
"crypto_cipher requires crypto_hash with value other than none";
1022 *error_string =
"totem.rrp_mode is too long";
1027 strcpy (totem_config->
rrp_mode, str);
1035 if (strcmp (str,
"yes") == 0) {
1046 cluster_name = NULL;
1049 totem_config->
ip_version = totem_config_get_ip_version();
1055 config_convert_nodelist_to_interface(totem_config);
1064 config_convert_nodelist_to_interface(totem_config);
1066 free(ring0_addr_str);
1080 res = sscanf(iter_key,
"totem.interface.%[^.].%s", ringnumber_key, tmp_key);
1085 if (strcmp(tmp_key,
"bindnetaddr") != 0) {
1091 ringnumber = atoi(ringnumber_key);
1093 if (ringnumber >= INTERFACE_MAX) {
1096 snprintf (error_string_response,
sizeof(error_string_response),
1097 "parse error in config: interface ring number %u is bigger than allowed maximum %u\n",
1098 ringnumber, INTERFACE_MAX - 1);
1100 *error_string = error_string_response;
1127 (void)get_cluster_mcast_addr (cluster_name,
1135 if (strcmp (str,
"yes") == 0) {
1166 while ((member_iter_key =
icmap_iter_next(member_iter, NULL, NULL)) != NULL) {
1167 if (member_count == 0) {
1193 for (ringnumber = 0; ringnumber < totem_config->
interface_count; ringnumber++) {
1195 "255.255.255.255", 0);
1219 if (strcmp (str,
"udpu") == 0) {
1223 if (strcmp (str,
"iba") == 0) {
1239 local_node_pos = find_local_node_in_nodelist(totem_config);
1240 if (local_node_pos != -1) {
1245 nodeid_set = (totem_config->
node_id != 0);
1260 put_nodelist_members_to_config(totem_config, 0);
1266 totem_volatile_config_read(totem_config, NULL);
1270 add_totem_config_notification(totem_config);
1277 struct totem_config *totem_config,
1278 const char **error_string)
1280 static char local_error_reason[512];
1281 char parse_error[512];
1282 const char *error_reason = local_error_reason;
1285 unsigned int port1, port2;
1288 error_reason =
"No interfaces defined";
1303 error_reason =
"No multicast address specified";
1308 error_reason =
"No multicast port specified";
1313 error_reason =
"Invalid TTL (should be 0..255)";
1318 error_reason =
"Can only set ttl on multicast transport types";
1325 error_reason =
"An IPV6 network requires that a node ID be specified.";
1331 error_reason =
"Multicast address family does not match bind address family";
1336 error_reason =
"mcastaddr is not a correct multicast address.";
1342 error_reason =
"Not all bind address belong to the same IP family";
1355 (((port1 > port2 ? port1 : port2) - (port1 < port2 ? port1 : port2)) <= 1)) {
1356 error_reason =
"Interfaces multicast address/port pair must differ";
1363 if (totem_config->
version != 2) {
1364 error_reason =
"This totem parser can only parse version 2 configurations.";
1368 if (totem_volatile_config_validate(totem_config, error_string) == -1) {
1372 if (check_for_duplicate_nodeids(totem_config, error_string) == -1) {
1379 if (strcmp (totem_config->
rrp_mode,
"none") &&
1380 strcmp (totem_config->
rrp_mode,
"active") &&
1381 strcmp (totem_config->
rrp_mode,
"passive")) {
1382 snprintf (local_error_reason,
sizeof(local_error_reason),
1383 "The RRP mode \"%s\" specified is invalid. It must be none, active, or passive.\n", totem_config->
rrp_mode);
1387 if (strcmp (totem_config->
rrp_mode,
"none") == 0) {
1390 if (interface_max < totem_config->interface_count) {
1391 snprintf (parse_error,
sizeof(parse_error),
1392 "%d is too many configured interfaces for the rrp_mode setting %s.",
1395 error_reason = parse_error;
1399 if (totem_config->
net_mtu == 0) {
1406 snprintf (error_string_response,
sizeof(error_string_response),
1407 "parse error in config: %s\n", error_reason);
1408 *error_string = error_string_response;
1413 static int read_keyfile (
1414 const char *key_location,
1415 struct totem_config *totem_config,
1416 const char **error_string)
1420 ssize_t expected_key_len =
sizeof (totem_config->
private_key);
1422 char error_str[100];
1423 const char *error_ptr;
1425 fd = open (key_location, O_RDONLY);
1427 error_ptr = qb_strerror_r(errno, error_str,
sizeof(error_str));
1428 snprintf (error_string_response,
sizeof(error_string_response),
1429 "Could not open %s: %s\n",
1430 key_location, error_ptr);
1434 res = read (fd, totem_config->
private_key, expected_key_len);
1435 saved_errno = errno;
1439 error_ptr = qb_strerror_r (saved_errno, error_str,
sizeof(error_str));
1440 snprintf (error_string_response,
sizeof(error_string_response),
1441 "Could not read %s: %s\n",
1442 key_location, error_ptr);
1448 if (res != expected_key_len) {
1449 snprintf (error_string_response,
sizeof(error_string_response),
1450 "Could only read %d bits of 1024 bits from %s.\n",
1451 res * 8, key_location);
1458 *error_string = error_string_response;
1463 struct totem_config *totem_config,
1464 const char **error_string)
1467 char *key_location = NULL;
1481 res = read_keyfile(key_location, totem_config, error_string);
1489 if (key_len >
sizeof (totem_config->
private_key)) {
1490 sprintf(error_string_response,
"key is too long");
1497 sprintf(error_string_response,
"can't store private key");
1505 const char *filename = getenv(
"COROSYNC_TOTEM_AUTHKEY_FILE");
1508 res = read_keyfile(filename, totem_config, error_string);
1517 *error_string = error_string_response;
1522 static void debug_dump_totem_config(
const struct totem_config *totem_config)
1535 "seqno unchanged const (%d rotations) Maximum network MTU %d",
1538 "window size per rotation (%d messages) maximum messages per rotation (%d messages)",
1558 static void totem_change_notify(
1560 const char *key_name,
1565 struct totem_config *totem_config = (
struct totem_config *)user_data;
1568 const char *deleted_key = NULL;
1569 const char *error_string;
1578 param = totem_get_param_by_name((
struct totem_config *)user_data, key_name);
1584 if (!param && strcmp(key_name,
"totem.token_coefficient") != 0)
1592 deleted_key = key_name;
1602 totem_volatile_config_read (totem_config, deleted_key);
1604 debug_dump_totem_config(totem_config);
1605 if (totem_volatile_config_validate(totem_config, &error_string) == -1) {
1614 static void totem_reload_notify(
1616 const char *key_name,
1621 struct totem_config *totem_config = (
struct totem_config *)user_data;
1622 uint32_t local_node_pos;
1623 const char *error_string;
1626 if (*(uint8_t *)new_val.
data == 0) {
1627 put_nodelist_members_to_config (totem_config, 1);
1628 totem_volatile_config_read (totem_config, NULL);
1630 debug_dump_totem_config(totem_config);
1631 if (totem_volatile_config_validate(totem_config, &error_string) == -1) {
1640 local_node_pos = find_local_node_in_nodelist(totem_config);
1641 if (local_node_pos != -1) {
1651 static void add_totem_config_notification(
struct totem_config *totem_config)
1657 totem_change_notify,
1663 totem_reload_notify,
1669 nodelist_dynamic_notify,
1670 (
void *)totem_config,
unsigned int clear_node_high_bit
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
#define RRP_PROBLEM_COUNT_TIMEOUT
struct totem_interface * interfaces
unsigned int interface_count
The totem_ip_address struct.
const char * totemip_print(const struct totem_ip_address *addr)
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
totem_transport_t transport_number
int totemip_parse(struct totem_ip_address *totemip, const char *addr, int family)
#define DOWNCHECK_TIMEOUT
unsigned int token_hold_timeout
struct totem_ip_address member_list[PROCESSOR_COUNT_MAX]
unsigned char private_key[TOTEM_PRIVATE_KEY_LEN]
char rrp_mode[TOTEM_RRP_MODE_BYTES]
unsigned char addr[TOTEMIP_ADDRLEN]
unsigned int rrp_problem_count_timeout
cs_error_t icmap_set_string(const char *key_name, const char *value)
int totemip_is_mcast(struct totem_ip_address *addr)
#define RRP_AUTORECOVERY_CHECK_TIMEOUT
unsigned int downcheck_timeout
unsigned int private_key_len
#define SEQNO_UNCHANGED_CONST
unsigned int max_network_delay
#define log_printf(level, format, args...)
unsigned int heartbeat_failures_allowed
unsigned int send_join_timeout
unsigned int rrp_problem_count_threshold
#define ICMAP_TRACK_DELETE
#define RRP_PROBLEM_COUNT_THRESHOLD_MIN
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
cs_error_t icmap_get_uint8(const char *key_name, uint8_t *u8)
int totem_config_keyread(struct totem_config *totem_config, const char **error_string)
#define ICMAP_TRACK_MODIFY
unsigned int token_retransmits_before_loss_const
int totemip_iface_check(struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num, int mask_high_bit)
#define FAIL_TO_RECV_CONST
cs_error_t icmap_set_uint32(const char *key_name, uint32_t value)
unsigned int seqno_unchanged_const
unsigned int miss_count_const
unsigned int join_timeout
int totem_config_validate(struct totem_config *totem_config, const char **error_string)
#define TOTEM_CONFIG_BINDNETADDR_NODELIST_SET
int totem_config_find_local_addr_in_nodelist(const char *ipaddr_key_prefix, unsigned int *node_pos)
struct totem_ip_address mcast_addr
#define LOGSYS_LEVEL_ERROR
unsigned int rrp_autorecovery_check_timeout
cs_error_t icmap_get(const char *key_name, void *value, size_t *value_len, icmap_value_types_t *type)
Retrieve value of key key_name and store it in user preallocated value pointer.
#define LOGSYS_LEVEL_DEBUG
cs_error_t icmap_set_uint16(const char *key_name, uint16_t value)
unsigned int fail_to_recv_const
#define TOKEN_COEFFICIENT
int totempg_member_remove(const struct totem_ip_address *member, int ring_no)
#define TOTEM_CONFIG_WARNING_MEMBERS_DEPRECATED
cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32)
#define TOTEM_CONFIG_WARNING_MEMBERS_IGNORED
void totemip_freeifaddrs(struct list_head *addrs)
#define swab32(x)
The swab32 macro.
#define MAX_NETWORK_DELAY
unsigned int token_timeout
unsigned int consensus_timeout
int totemip_getifaddrs(struct list_head *addrs)
#define PROCESSOR_COUNT_MAX
#define TOKEN_RETRANSMITS_BEFORE_LOSS_CONST
unsigned int broadcast_use
unsigned int rrp_problem_count_mcast_threshold
cs_error_t icmap_get_string(const char *key_name, char **str)
Shortcut for icmap_get for string type.
#define list_entry(ptr, type, member)
cs_error_t icmap_set_uint8(const char *key_name, uint8_t value)
unsigned int max_messages
char * crypto_cipher_type
cs_error_t icmap_set_ro_access(const char *key_name, int prefix, int ro_access)
Set read-only access for given key (key_name) or prefix, If prefix is set.
unsigned int merge_timeout
unsigned int token_retransmit_timeout
struct totem_ip_address bindnet
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
int totemip_equal(const struct totem_ip_address *addr1, const struct totem_ip_address *addr2)
struct totem_ip_address ip_addr
cs_error_t icmap_get_uint16(const char *key_name, uint16_t *u16)
#define TOTEM_CONFIG_WARNING_TOTEM_NODEID_IGNORED
unsigned int rrp_token_expired_timeout
qb_map_iter_t * icmap_iter_t
Itterator type.
Structure passed as new_value and old_value in change callback.
cs_error_t icmap_track_add(const char *key_name, int32_t track_type, icmap_notify_fn_t notify_fn, void *user_data, icmap_track_t *icmap_track)
Add tracking function for given key_name.
int totem_config_read(struct totem_config *totem_config, const char **error_string, uint64_t *warnings)
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ...
#define RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT
int totempg_member_add(const struct totem_ip_address *member, int ring_no)