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
80 #define BLOCK_UNLISTED_IPS 1
81 #define CANCEL_TOKEN_HOLD_ON_RETRANSMIT 0
83 #define DEFAULT_PORT 5405
85 static char error_string_response[768];
93 if (strcmp(param_name,
"totem.token") == 0)
95 if (strcmp(param_name,
"totem.token_retransmit") == 0)
97 if (strcmp(param_name,
"totem.hold") == 0)
99 if (strcmp(param_name,
"totem.token_retransmits_before_loss_const") == 0)
101 if (strcmp(param_name,
"totem.join") == 0)
103 if (strcmp(param_name,
"totem.send_join") == 0)
105 if (strcmp(param_name,
"totem.consensus") == 0)
107 if (strcmp(param_name,
"totem.merge") == 0)
109 if (strcmp(param_name,
"totem.downcheck") == 0)
111 if (strcmp(param_name,
"totem.fail_recv_const") == 0)
113 if (strcmp(param_name,
"totem.seqno_unchanged_const") == 0)
115 if (strcmp(param_name,
"totem.rrp_token_expired_timeout") == 0)
117 if (strcmp(param_name,
"totem.rrp_problem_count_timeout") == 0)
119 if (strcmp(param_name,
"totem.rrp_problem_count_threshold") == 0)
121 if (strcmp(param_name,
"totem.rrp_problem_count_mcast_threshold") == 0)
123 if (strcmp(param_name,
"totem.rrp_autorecovery_check_timeout") == 0)
125 if (strcmp(param_name,
"totem.heartbeat_failures_allowed") == 0)
127 if (strcmp(param_name,
"totem.max_network_delay") == 0)
129 if (strcmp(param_name,
"totem.window_size") == 0)
131 if (strcmp(param_name,
"totem.max_messages") == 0)
133 if (strcmp(param_name,
"totem.miss_count_const") == 0)
135 if (strcmp(param_name,
"totem.block_unlisted_ips") == 0)
137 if (strcmp(param_name,
"totem.cancel_token_hold_on_retransmit") == 0)
147 static void totem_volatile_config_set_value (
struct totem_config *totem_config,
148 const char *key_name,
const char *deleted_key,
unsigned int default_value,
149 int allow_zero_value)
154 (deleted_key != NULL && strcmp(deleted_key, key_name) == 0) ||
155 (!allow_zero_value && *totem_get_param_by_name(totem_config, key_name) == 0)) {
156 *totem_get_param_by_name(totem_config, key_name) = default_value;
169 strcpy(runtime_key_name,
"runtime.config.");
170 strcat(runtime_key_name, key_name);
172 icmap_set_uint32(runtime_key_name, *totem_get_param_by_name(totem_config, key_name));
182 static void totem_volatile_config_set_boolean_value (
struct totem_config *totem_config,
183 const char *key_name,
const char *deleted_key,
unsigned int default_value)
192 if ((deleted_key != NULL && strcmp(deleted_key, key_name) == 0) ||
199 if (strcmp(str,
"yes") == 0) {
201 }
else if (strcmp(str,
"no") == 0) {
217 strcpy(runtime_key_name,
"runtime.config.");
218 strcat(runtime_key_name, key_name);
220 *totem_get_param_by_name(totem_config, key_name) = val;
230 static void totem_volatile_config_read (
struct totem_config *totem_config,
const char *deleted_key)
234 totem_volatile_config_set_value(totem_config,
"totem.token_retransmits_before_loss_const", deleted_key,
237 totem_volatile_config_set_value(totem_config,
"totem.token", deleted_key,
TOKEN_TIMEOUT, 0);
250 totem_volatile_config_set_value(totem_config,
"totem.max_network_delay", deleted_key,
MAX_NETWORK_DELAY, 0);
252 totem_volatile_config_set_value(totem_config,
"totem.window_size", deleted_key,
WINDOW_SIZE, 0);
254 totem_volatile_config_set_value(totem_config,
"totem.max_messages", deleted_key,
MAX_MESSAGES, 0);
256 totem_volatile_config_set_value(totem_config,
"totem.miss_count_const", deleted_key,
MISS_COUNT_CONST, 0);
258 totem_volatile_config_set_value(totem_config,
"totem.token_retransmit", deleted_key,
261 totem_volatile_config_set_value(totem_config,
"totem.hold", deleted_key,
264 totem_volatile_config_set_value(totem_config,
"totem.join", deleted_key,
JOIN_TIMEOUT, 0);
266 totem_volatile_config_set_value(totem_config,
"totem.consensus", deleted_key,
269 totem_volatile_config_set_value(totem_config,
"totem.merge", deleted_key,
MERGE_TIMEOUT, 0);
271 totem_volatile_config_set_value(totem_config,
"totem.downcheck", deleted_key,
DOWNCHECK_TIMEOUT, 0);
273 totem_volatile_config_set_value(totem_config,
"totem.fail_recv_const", deleted_key,
FAIL_TO_RECV_CONST, 0);
275 totem_volatile_config_set_value(totem_config,
"totem.seqno_unchanged_const", deleted_key,
278 totem_volatile_config_set_value(totem_config,
"totem.send_join", deleted_key, 0, 1);
280 totem_volatile_config_set_value(totem_config,
"totem.rrp_problem_count_timeout", deleted_key,
283 totem_volatile_config_set_value(totem_config,
"totem.rrp_problem_count_threshold", deleted_key,
286 totem_volatile_config_set_value(totem_config,
"totem.rrp_problem_count_mcast_threshold", deleted_key,
289 totem_volatile_config_set_value(totem_config,
"totem.rrp_token_expired_timeout", deleted_key,
292 totem_volatile_config_set_value(totem_config,
"totem.rrp_autorecovery_check_timeout", deleted_key,
295 totem_volatile_config_set_value(totem_config,
"totem.heartbeat_failures_allowed", deleted_key, 0, 1);
297 totem_volatile_config_set_boolean_value(totem_config,
"totem.block_unlisted_ips", deleted_key,
300 totem_volatile_config_set_boolean_value(totem_config,
"totem.cancel_token_hold_on_retransmit",
304 static int totem_volatile_config_validate (
305 struct totem_config *totem_config,
306 const char **error_string)
308 static char local_error_reason[512];
309 const char *error_reason = local_error_reason;
312 snprintf (local_error_reason,
sizeof(local_error_reason),
313 "The max_network_delay parameter (%d ms) may not be less than (%d ms).",
319 snprintf (local_error_reason,
sizeof(local_error_reason),
320 "The token timeout parameter (%d ms) may not be less than (%d ms).",
326 snprintf (local_error_reason,
sizeof(local_error_reason),
327 "The token retransmit timeout parameter (%d ms) may not be less than (%d ms).",
333 snprintf (local_error_reason,
sizeof(local_error_reason),
334 "The token hold timeout parameter (%d ms) may not be less than (%d ms).",
340 snprintf (local_error_reason,
sizeof(local_error_reason),
341 "The join timeout parameter (%d ms) may not be less than (%d ms).",
347 snprintf (local_error_reason,
sizeof(local_error_reason),
348 "The consensus timeout parameter (%d ms) may not be less than (%d ms).",
354 snprintf (local_error_reason,
sizeof(local_error_reason),
355 "The consensus timeout parameter (%d ms) may not be less than join timeout (%d ms).",
361 snprintf (local_error_reason,
sizeof(local_error_reason),
362 "The merge timeout parameter (%d ms) may not be less than (%d ms).",
368 snprintf (local_error_reason,
sizeof(local_error_reason),
369 "The downcheck timeout parameter (%d ms) may not be less than (%d ms).",
375 snprintf (local_error_reason,
sizeof(local_error_reason),
376 "The RRP problem count timeout parameter (%d ms) may not be less than (%d ms).",
382 snprintf (local_error_reason,
sizeof(local_error_reason),
383 "The RRP problem count threshold (%d problem count) may not be less than (%d problem count).",
388 snprintf (local_error_reason,
sizeof(local_error_reason),
389 "The RRP multicast problem count threshold (%d problem count) may not be less than (%d problem count).",
395 snprintf (local_error_reason,
sizeof(local_error_reason),
396 "The RRP token expired timeout parameter (%d ms) may not be less than (%d ms).",
404 snprintf (error_string_response,
sizeof(error_string_response),
405 "parse error in config: %s\n", error_reason);
406 *error_string = error_string_response;
411 static int totem_get_crypto(
struct totem_config *totem_config)
414 const char *tmp_cipher;
415 const char *tmp_hash;
418 tmp_cipher =
"aes256";
421 if (strcmp (str,
"off") == 0) {
429 if (strcmp(str,
"none") == 0) {
432 if (strcmp(str,
"aes256") == 0) {
433 tmp_cipher =
"aes256";
435 if (strcmp(str,
"aes192") == 0) {
436 tmp_cipher =
"aes192";
438 if (strcmp(str,
"aes128") == 0) {
439 tmp_cipher =
"aes128";
441 if (strcmp(str,
"3des") == 0) {
448 if (strcmp(str,
"none") == 0) {
451 if (strcmp(str,
"md5") == 0) {
454 if (strcmp(str,
"sha1") == 0) {
457 if (strcmp(str,
"sha256") == 0) {
460 if (strcmp(str,
"sha384") == 0) {
463 if (strcmp(str,
"sha512") == 0) {
469 if ((strcmp(tmp_cipher,
"none") != 0) &&
470 (strcmp(tmp_hash,
"none") == 0)) {
483 static int totem_config_get_ip_version(
void)
490 if (strcmp(str,
"ipv4") == 0) {
493 if (strcmp(str,
"ipv6") == 0) {
502 static uint16_t generate_cluster_id (
const char *cluster_name)
507 for (i = 0; i < strlen(cluster_name); i++) {
509 value += cluster_name[i];
512 return (value & 0xFFFF);
515 static int get_cluster_mcast_addr (
516 const char *cluster_name,
517 unsigned int ringnumber,
522 char addr[INET6_ADDRSTRLEN + 1];
525 if (cluster_name == NULL) {
529 clusterid = generate_cluster_id(cluster_name) + ringnumber;
530 memset (res, 0,
sizeof(*res));
532 switch (ip_version) {
534 snprintf(addr,
sizeof(addr),
"239.192.%d.%d", clusterid >> 8, clusterid % 0xFF);
537 snprintf(addr,
sizeof(addr),
"ff15::%x", clusterid);
551 static unsigned int generate_nodeid_for_duplicate_test(
552 struct totem_config *totem_config,
563 memcpy (&nodeid, &totemip.addr, sizeof (
unsigned int));
565 #if __BYTE_ORDER == __LITTLE_ENDIAN
570 nodeid &= 0x7FFFFFFF;
575 static int check_for_duplicate_nodeids(
576 struct totem_config *totem_config,
577 const char **error_string)
581 const char *iter_key;
585 char *ring0_addr=NULL;
586 char *ring0_addr1=NULL;
587 unsigned int node_pos;
588 unsigned int node_pos1;
590 unsigned int nodeid1;
595 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos, tmp_key);
600 if (strcmp(tmp_key,
"ring0_addr") != 0) {
614 nodeid = generate_nodeid_for_duplicate_test(totem_config, ring0_addr);
623 while (((iter_key =
icmap_iter_next(subiter, NULL, NULL)) != NULL) && (node_pos1 < node_pos)) {
624 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos1, tmp_key);
625 if ((res != 2) || (node_pos1 >= node_pos)) {
629 if (strcmp(tmp_key,
"ring0_addr") != 0) {
640 nodeid1 = generate_nodeid_for_duplicate_test(totem_config, ring0_addr1);
646 if (nodeid == nodeid1) {
648 snprintf (error_string_response,
sizeof(error_string_response),
649 "Nodeid %u%s%s%s appears twice in corosync.conf", nodeid,
650 autogenerated?
"(autogenerated from ":
"",
651 autogenerated?ring0_addr:
"",
652 autogenerated?
")":
"");
654 *error_string = error_string_response;
665 static int find_local_node_in_nodelist(
struct totem_config *totem_config)
668 const char *iter_key;
670 unsigned int node_pos;
671 int local_node_pos = -1;
673 int interface_up, interface_num;
679 &bind_addr, &interface_up, &interface_num,
687 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos, tmp_key);
692 if (strcmp(tmp_key,
"ring0_addr") != 0) {
708 local_node_pos = node_pos;
713 return (local_node_pos);
722 static void compute_interfaces_diff(
int interface_count,
726 int ring_no, set1_pos, set2_pos;
729 memset(&empty_ip_address, 0,
sizeof(empty_ip_address));
731 for (ring_no = 0; ring_no < interface_count; ring_no++) {
732 for (set1_pos = 0; set1_pos < set1[ring_no].
member_count; set1_pos++) {
733 for (set2_pos = 0; set2_pos < set2[ring_no].
member_count; set2_pos++) {
738 if (memcmp(&set1[ring_no].member_list[set1_pos],
739 &set2[ring_no].member_list[set2_pos],
741 memset(&set1[ring_no].member_list[set1_pos], 0,
743 memset(&set2[ring_no].member_list[set2_pos], 0,
750 for (ring_no = 0; ring_no < interface_count; ring_no++) {
751 for (set1_pos = 0; set1_pos < set1[ring_no].
member_count; set1_pos++) {
756 if (memcmp(&set1[ring_no].member_list[set1_pos], &empty_ip_address,
sizeof(empty_ip_address)) != 0) {
758 "removing dynamic member %s for ring %u",
765 for (set2_pos = 0; set2_pos < set2[ring_no].
member_count; set2_pos++) {
770 if (memcmp(&set2[ring_no].member_list[set2_pos], &empty_ip_address,
sizeof(empty_ip_address)) != 0) {
772 "adding dynamic member %s for ring %u",
782 static void put_nodelist_members_to_config(
struct totem_config *totem_config,
int reload)
785 const char *iter_key, *iter_key2;
787 unsigned int node_pos;
792 unsigned int ringnumber = 0;
804 assert(orig_interfaces != NULL);
806 assert(new_interfaces != NULL);
821 res = sscanf(iter_key,
"nodelist.node.%u.%s", &node_pos, tmp_key);
826 if (strcmp(tmp_key,
"ring0_addr") != 0) {
833 res = sscanf(iter_key2,
"nodelist.node.%u.ring%u%s", &node_pos, &ringnumber, tmp_key2);
834 if (res != 3 || strcmp(tmp_key2,
"_addr") != 0) {
860 compute_interfaces_diff(totem_config->
interface_count, orig_interfaces, new_interfaces);
862 free(new_interfaces);
863 free(orig_interfaces);
867 static void nodelist_dynamic_notify(
869 const char *key_name,
875 unsigned int ring_no;
876 unsigned int member_no;
879 struct totem_config *totem_config = (
struct totem_config *)user_data;
885 if (
icmap_get_uint8(
"config.totemconfig_reload_in_progress", &reloading) ==
CS_OK && reloading) {
889 res = sscanf(key_name,
"nodelist.node.%u.ring%u%s", &member_no, &ring_no, tmp_str);
893 if (strcmp(tmp_str,
"_addr") != 0) {
897 put_nodelist_members_to_config(totem_config, 1);
916 const char *iter_key, *iter_key2;
918 const char *ipaddr_key;
930 ip_version = totem_config_get_ip_version();
935 res = sscanf(iter_key,
"nodelist.node.%u.%s", node_pos, tmp_key);
940 if (strcmp(tmp_key,
"ring0_addr") != 0) {
953 snprintf(tmp_key,
sizeof(tmp_key),
"nodelist.node.%u.%s", *node_pos,
954 (ipaddr_key_prefix != NULL ? ipaddr_key_prefix :
"ring0_addr"));
961 ipaddr_key = (ipaddr_key_prefix != NULL ? iter_key2 : tmp_key);
966 if (
totemip_parse(&node_addr, node_addr_str, ip_version) == -1) {
976 for (list = addrs.
next; list != &addrs; list = list->
next) {
1000 return (node_found);
1003 static void config_convert_nodelist_to_interface(
struct totem_config *totem_config)
1006 unsigned int node_pos;
1009 char *node_addr_str;
1010 unsigned int ringnumber = 0;
1012 const char *iter_key;
1021 res = sscanf(iter_key,
"nodelist.node.%u.ring%u%s", &node_pos, &ringnumber, tmp_key2);
1022 if (res != 3 || strcmp(tmp_key2,
"_addr") != 0) {
1032 free(node_addr_str);
1040 struct totem_config *totem_config,
1041 const char **error_string,
1045 char *str, *ring0_addr_str;
1046 unsigned int ringnumber = 0;
1047 int member_count = 0;
1049 const char *iter_key;
1050 const char *member_iter_key;
1055 char *cluster_name = NULL;
1062 memset (totem_config, 0,
sizeof (
struct totem_config));
1065 *error_string =
"Out of memory trying to allocate ethernet interface storage area";
1072 strcpy (totem_config->
rrp_mode,
"none");
1076 if (totem_get_crypto(totem_config) != 0) {
1077 *error_string =
"crypto_cipher requires crypto_hash with value other than none";
1083 *error_string =
"totem.rrp_mode is too long";
1088 strcpy (totem_config->
rrp_mode, str);
1096 if (strcmp (str,
"yes") == 0) {
1107 cluster_name = NULL;
1110 totem_config->
ip_version = totem_config_get_ip_version();
1116 config_convert_nodelist_to_interface(totem_config);
1125 config_convert_nodelist_to_interface(totem_config);
1127 free(ring0_addr_str);
1141 res = sscanf(iter_key,
"totem.interface.%[^.].%s", ringnumber_key, tmp_key);
1146 if (strcmp(tmp_key,
"bindnetaddr") != 0) {
1152 ringnumber = atoi(ringnumber_key);
1154 if (ringnumber >= INTERFACE_MAX) {
1157 snprintf (error_string_response,
sizeof(error_string_response),
1158 "parse error in config: interface ring number %u is bigger than allowed maximum %u\n",
1159 ringnumber, INTERFACE_MAX - 1);
1161 *error_string = error_string_response;
1188 (void)get_cluster_mcast_addr (cluster_name,
1196 if (strcmp (str,
"yes") == 0) {
1227 while ((member_iter_key =
icmap_iter_next(member_iter, NULL, NULL)) != NULL) {
1228 if (member_count == 0) {
1254 for (ringnumber = 0; ringnumber < totem_config->
interface_count; ringnumber++) {
1256 "255.255.255.255", 0);
1280 if (strcmp (str,
"udpu") == 0) {
1284 if (strcmp (str,
"iba") == 0) {
1300 local_node_pos = find_local_node_in_nodelist(totem_config);
1301 if (local_node_pos != -1) {
1306 nodeid_set = (totem_config->
node_id != 0);
1321 put_nodelist_members_to_config(totem_config, 0);
1327 totem_volatile_config_read(totem_config, NULL);
1331 add_totem_config_notification(totem_config);
1338 struct totem_config *totem_config,
1339 const char **error_string)
1341 static char local_error_reason[512];
1342 char parse_error[512];
1343 const char *error_reason = local_error_reason;
1346 unsigned int port1, port2;
1349 error_reason =
"No interfaces defined";
1364 error_reason =
"No multicast address specified";
1369 error_reason =
"No multicast port specified";
1374 error_reason =
"Invalid TTL (should be 0..255)";
1379 error_reason =
"Can only set ttl on multicast transport types";
1386 error_reason =
"An IPV6 network requires that a node ID be specified.";
1392 error_reason =
"Multicast address family does not match bind address family";
1397 error_reason =
"mcastaddr is not a correct multicast address.";
1403 error_reason =
"Not all bind address belong to the same IP family";
1416 (((port1 > port2 ? port1 : port2) - (port1 < port2 ? port1 : port2)) <= 1)) {
1417 error_reason =
"Interfaces multicast address/port pair must differ";
1424 if (totem_config->
version != 2) {
1425 error_reason =
"This totem parser can only parse version 2 configurations.";
1429 if (totem_volatile_config_validate(totem_config, error_string) == -1) {
1433 if (check_for_duplicate_nodeids(totem_config, error_string) == -1) {
1440 if (strcmp (totem_config->
rrp_mode,
"none") &&
1441 strcmp (totem_config->
rrp_mode,
"active") &&
1442 strcmp (totem_config->
rrp_mode,
"passive")) {
1443 snprintf (local_error_reason,
sizeof(local_error_reason),
1444 "The RRP mode \"%s\" specified is invalid. It must be none, active, or passive.\n", totem_config->
rrp_mode);
1448 if (strcmp (totem_config->
rrp_mode,
"none") == 0) {
1451 if (interface_max < totem_config->interface_count) {
1452 snprintf (parse_error,
sizeof(parse_error),
1453 "%d is too many configured interfaces for the rrp_mode setting %s.",
1456 error_reason = parse_error;
1460 if (totem_config->
net_mtu == 0) {
1467 snprintf (error_string_response,
sizeof(error_string_response),
1468 "parse error in config: %s\n", error_reason);
1469 *error_string = error_string_response;
1474 static int read_keyfile (
1475 const char *key_location,
1476 struct totem_config *totem_config,
1477 const char **error_string)
1481 ssize_t expected_key_len =
sizeof (totem_config->
private_key);
1483 char error_str[100];
1484 const char *error_ptr;
1486 fd = open (key_location, O_RDONLY);
1488 error_ptr = qb_strerror_r(errno, error_str,
sizeof(error_str));
1489 snprintf (error_string_response,
sizeof(error_string_response),
1490 "Could not open %s: %s\n",
1491 key_location, error_ptr);
1495 res = read (fd, totem_config->
private_key, expected_key_len);
1496 saved_errno = errno;
1500 error_ptr = qb_strerror_r (saved_errno, error_str,
sizeof(error_str));
1501 snprintf (error_string_response,
sizeof(error_string_response),
1502 "Could not read %s: %s\n",
1503 key_location, error_ptr);
1509 if (res != expected_key_len) {
1510 snprintf (error_string_response,
sizeof(error_string_response),
1511 "Could only read %d bits of 1024 bits from %s.\n",
1512 res * 8, key_location);
1519 *error_string = error_string_response;
1524 struct totem_config *totem_config,
1525 const char **error_string)
1528 char *key_location = NULL;
1542 res = read_keyfile(key_location, totem_config, error_string);
1550 if (key_len >
sizeof (totem_config->
private_key)) {
1551 sprintf(error_string_response,
"key is too long");
1558 sprintf(error_string_response,
"can't store private key");
1566 const char *filename = getenv(
"COROSYNC_TOTEM_AUTHKEY_FILE");
1569 res = read_keyfile(filename, totem_config, error_string);
1578 *error_string = error_string_response;
1583 static void debug_dump_totem_config(
const struct totem_config *totem_config)
1596 "seqno unchanged const (%d rotations) Maximum network MTU %d",
1599 "window size per rotation (%d messages) maximum messages per rotation (%d messages)",
1619 static void totem_change_notify(
1621 const char *key_name,
1626 struct totem_config *totem_config = (
struct totem_config *)user_data;
1629 const char *deleted_key = NULL;
1630 const char *error_string;
1639 param = totem_get_param_by_name((
struct totem_config *)user_data, key_name);
1645 if (!param && strcmp(key_name,
"totem.token_coefficient") != 0)
1653 deleted_key = key_name;
1663 totem_volatile_config_read (totem_config, deleted_key);
1665 debug_dump_totem_config(totem_config);
1666 if (totem_volatile_config_validate(totem_config, &error_string) == -1) {
1675 static void totem_reload_notify(
1677 const char *key_name,
1682 struct totem_config *totem_config = (
struct totem_config *)user_data;
1683 uint32_t local_node_pos;
1684 const char *error_string;
1687 if (*(uint8_t *)new_val.
data == 0) {
1688 put_nodelist_members_to_config (totem_config, 1);
1689 totem_volatile_config_read (totem_config, NULL);
1691 debug_dump_totem_config(totem_config);
1692 if (totem_volatile_config_validate(totem_config, &error_string) == -1) {
1701 local_node_pos = find_local_node_in_nodelist(totem_config);
1702 if (local_node_pos != -1) {
1712 static void add_totem_config_notification(
struct totem_config *totem_config)
1718 totem_change_notify,
1724 totem_reload_notify,
1730 nodelist_dynamic_notify,
1731 (
void *)totem_config,
unsigned int clear_node_high_bit
#define BLOCK_UNLISTED_IPS
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.
unsigned int block_unlisted_ips
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)
#define CANCEL_TOKEN_HOLD_ON_RETRANSMIT
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
unsigned int cancel_token_hold_on_retransmit
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)