corosync  2.4.2
totemconfig.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002-2005 MontaVista Software, Inc.
3  * Copyright (c) 2006-2013 Red Hat, Inc.
4  *
5  * All rights reserved.
6  *
7  * Author: Steven Dake (sdake@redhat.com)
8  * Jan Friesse (jfriesse@redhat.com)
9  *
10  * This software licensed under BSD license, the text of which follows:
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * - Redistributions of source code must retain the above copyright notice,
16  * this list of conditions and the following disclaimer.
17  * - Redistributions in binary form must reproduce the above copyright notice,
18  * this list of conditions and the following disclaimer in the documentation
19  * and/or other materials provided with the distribution.
20  * - Neither the name of the MontaVista Software, Inc. nor the names of its
21  * contributors may be used to endorse or promote products derived from this
22  * software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
34  * THE POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37 #include <config.h>
38 
39 #include <stdio.h>
40 #include <string.h>
41 #include <stdlib.h>
42 #include <errno.h>
43 #include <unistd.h>
44 #include <sys/socket.h>
45 #include <sys/types.h>
46 #include <sys/stat.h>
47 #include <fcntl.h>
48 #include <netinet/in.h>
49 #include <arpa/inet.h>
50 #include <sys/param.h>
51 
52 #include <corosync/swab.h>
53 #include <corosync/list.h>
54 #include <qb/qbdefs.h>
55 #include <corosync/totem/totem.h>
56 #include <corosync/config.h>
57 #include <corosync/logsys.h>
58 #include <corosync/icmap.h>
59 
60 #include "util.h"
61 #include "totemconfig.h"
62 
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 
81 #define DEFAULT_PORT 5405
82 
83 static char error_string_response[512];
84 
85 static void add_totem_config_notification(struct totem_config *totem_config);
86 
87 
88 /* All the volatile parameters are uint32s, luckily */
89 static uint32_t *totem_get_param_by_name(struct totem_config *totem_config, const char *param_name)
90 {
91  if (strcmp(param_name, "totem.token") == 0)
92  return &totem_config->token_timeout;
93  if (strcmp(param_name, "totem.token_retransmit") == 0)
94  return &totem_config->token_retransmit_timeout;
95  if (strcmp(param_name, "totem.hold") == 0)
96  return &totem_config->token_hold_timeout;
97  if (strcmp(param_name, "totem.token_retransmits_before_loss_const") == 0)
98  return &totem_config->token_retransmits_before_loss_const;
99  if (strcmp(param_name, "totem.join") == 0)
100  return &totem_config->join_timeout;
101  if (strcmp(param_name, "totem.send_join") == 0)
102  return &totem_config->send_join_timeout;
103  if (strcmp(param_name, "totem.consensus") == 0)
104  return &totem_config->consensus_timeout;
105  if (strcmp(param_name, "totem.merge") == 0)
106  return &totem_config->merge_timeout;
107  if (strcmp(param_name, "totem.downcheck") == 0)
108  return &totem_config->downcheck_timeout;
109  if (strcmp(param_name, "totem.fail_recv_const") == 0)
110  return &totem_config->fail_to_recv_const;
111  if (strcmp(param_name, "totem.seqno_unchanged_const") == 0)
112  return &totem_config->seqno_unchanged_const;
113  if (strcmp(param_name, "totem.rrp_token_expired_timeout") == 0)
114  return &totem_config->rrp_token_expired_timeout;
115  if (strcmp(param_name, "totem.rrp_problem_count_timeout") == 0)
116  return &totem_config->rrp_problem_count_timeout;
117  if (strcmp(param_name, "totem.rrp_problem_count_threshold") == 0)
118  return &totem_config->rrp_problem_count_threshold;
119  if (strcmp(param_name, "totem.rrp_problem_count_mcast_threshold") == 0)
120  return &totem_config->rrp_problem_count_mcast_threshold;
121  if (strcmp(param_name, "totem.rrp_autorecovery_check_timeout") == 0)
122  return &totem_config->rrp_autorecovery_check_timeout;
123  if (strcmp(param_name, "totem.heartbeat_failures_allowed") == 0)
124  return &totem_config->heartbeat_failures_allowed;
125  if (strcmp(param_name, "totem.max_network_delay") == 0)
126  return &totem_config->max_network_delay;
127  if (strcmp(param_name, "totem.window_size") == 0)
128  return &totem_config->window_size;
129  if (strcmp(param_name, "totem.max_messages") == 0)
130  return &totem_config->max_messages;
131  if (strcmp(param_name, "totem.miss_count_const") == 0)
132  return &totem_config->miss_count_const;
133 
134  return NULL;
135 }
136 
137 /*
138  * Read key_name from icmap. If key is not found or key_name == delete_key or if allow_zero is false
139  * and readed value is zero, default value is used and stored into totem_config.
140  */
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)
144 {
145  char runtime_key_name[ICMAP_KEYNAME_MAXLEN];
146 
147  if (icmap_get_uint32(key_name, totem_get_param_by_name(totem_config, key_name)) != CS_OK ||
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;
151  }
152 
153  /*
154  * Store totem_config value to cmap runtime section
155  */
156  if (strlen("runtime.config.") + strlen(key_name) >= ICMAP_KEYNAME_MAXLEN) {
157  /*
158  * This shouldn't happen
159  */
160  return ;
161  }
162 
163  strcpy(runtime_key_name, "runtime.config.");
164  strcat(runtime_key_name, key_name);
165 
166  icmap_set_uint32(runtime_key_name, *totem_get_param_by_name(totem_config, key_name));
167 }
168 
169 
170 /*
171  * Read and validate config values from cmap and store them into totem_config. If key doesn't exists,
172  * default value is stored. deleted_key is name of key beeing processed by delete operation
173  * from cmap. It is considered as non existing even if it can be read. Can be NULL.
174  */
175 static void totem_volatile_config_read (struct totem_config *totem_config, const char *deleted_key)
176 {
177  uint32_t u32;
178 
179  totem_volatile_config_set_value(totem_config, "totem.token_retransmits_before_loss_const", deleted_key,
181 
182  totem_volatile_config_set_value(totem_config, "totem.token", deleted_key, TOKEN_TIMEOUT, 0);
183 
184  if (totem_config->interface_count > 0 && totem_config->interfaces[0].member_count > 2) {
185  u32 = TOKEN_COEFFICIENT;
186  icmap_get_uint32("totem.token_coefficient", &u32);
187  totem_config->token_timeout += (totem_config->interfaces[0].member_count - 2) * u32;
188 
189  /*
190  * Store totem_config value to cmap runtime section
191  */
192  icmap_set_uint32("runtime.config.totem.token", totem_config->token_timeout);
193  }
194 
195  totem_volatile_config_set_value(totem_config, "totem.max_network_delay", deleted_key, MAX_NETWORK_DELAY, 0);
196 
197  totem_volatile_config_set_value(totem_config, "totem.window_size", deleted_key, WINDOW_SIZE, 0);
198 
199  totem_volatile_config_set_value(totem_config, "totem.max_messages", deleted_key, MAX_MESSAGES, 0);
200 
201  totem_volatile_config_set_value(totem_config, "totem.miss_count_const", deleted_key, MISS_COUNT_CONST, 0);
202 
203  totem_volatile_config_set_value(totem_config, "totem.token_retransmit", deleted_key,
204  (int)(totem_config->token_timeout / (totem_config->token_retransmits_before_loss_const + 0.2)), 0);
205 
206  totem_volatile_config_set_value(totem_config, "totem.hold", deleted_key,
207  (int)(totem_config->token_retransmit_timeout * 0.8 - (1000/HZ)), 0);
208 
209  totem_volatile_config_set_value(totem_config, "totem.join", deleted_key, JOIN_TIMEOUT, 0);
210 
211  totem_volatile_config_set_value(totem_config, "totem.consensus", deleted_key,
212  (int)(float)(1.2 * totem_config->token_timeout), 0);
213 
214  totem_volatile_config_set_value(totem_config, "totem.merge", deleted_key, MERGE_TIMEOUT, 0);
215 
216  totem_volatile_config_set_value(totem_config, "totem.downcheck", deleted_key, DOWNCHECK_TIMEOUT, 0);
217 
218  totem_volatile_config_set_value(totem_config, "totem.fail_recv_const", deleted_key, FAIL_TO_RECV_CONST, 0);
219 
220  totem_volatile_config_set_value(totem_config, "totem.seqno_unchanged_const", deleted_key,
222 
223  totem_volatile_config_set_value(totem_config, "totem.send_join", deleted_key, 0, 1);
224 
225  totem_volatile_config_set_value(totem_config, "totem.rrp_problem_count_timeout", deleted_key,
227 
228  totem_volatile_config_set_value(totem_config, "totem.rrp_problem_count_threshold", deleted_key,
230 
231  totem_volatile_config_set_value(totem_config, "totem.rrp_problem_count_mcast_threshold", deleted_key,
232  totem_config->rrp_problem_count_threshold * 10, 0);
233 
234  totem_volatile_config_set_value(totem_config, "totem.rrp_token_expired_timeout", deleted_key,
235  totem_config->token_retransmit_timeout, 0);
236 
237  totem_volatile_config_set_value(totem_config, "totem.rrp_autorecovery_check_timeout", deleted_key,
239 
240  totem_volatile_config_set_value(totem_config, "totem.heartbeat_failures_allowed", deleted_key, 0, 1);
241 }
242 
243 static int totem_volatile_config_validate (
244  struct totem_config *totem_config,
245  const char **error_string)
246 {
247  static char local_error_reason[512];
248  const char *error_reason = local_error_reason;
249 
250  if (totem_config->max_network_delay < MINIMUM_TIMEOUT) {
251  snprintf (local_error_reason, sizeof(local_error_reason),
252  "The max_network_delay parameter (%d ms) may not be less than (%d ms).",
253  totem_config->max_network_delay, MINIMUM_TIMEOUT);
254  goto parse_error;
255  }
256 
257  if (totem_config->token_timeout < MINIMUM_TIMEOUT) {
258  snprintf (local_error_reason, sizeof(local_error_reason),
259  "The token timeout parameter (%d ms) may not be less than (%d ms).",
260  totem_config->token_timeout, MINIMUM_TIMEOUT);
261  goto parse_error;
262  }
263 
264  if (totem_config->token_retransmit_timeout < MINIMUM_TIMEOUT) {
265  snprintf (local_error_reason, sizeof(local_error_reason),
266  "The token retransmit timeout parameter (%d ms) may not be less than (%d ms).",
268  goto parse_error;
269  }
270 
271  if (totem_config->token_hold_timeout < MINIMUM_TIMEOUT) {
272  snprintf (local_error_reason, sizeof(local_error_reason),
273  "The token hold timeout parameter (%d ms) may not be less than (%d ms).",
274  totem_config->token_hold_timeout, MINIMUM_TIMEOUT);
275  goto parse_error;
276  }
277 
278  if (totem_config->join_timeout < MINIMUM_TIMEOUT) {
279  snprintf (local_error_reason, sizeof(local_error_reason),
280  "The join timeout parameter (%d ms) may not be less than (%d ms).",
281  totem_config->join_timeout, MINIMUM_TIMEOUT);
282  goto parse_error;
283  }
284 
285  if (totem_config->consensus_timeout < MINIMUM_TIMEOUT) {
286  snprintf (local_error_reason, sizeof(local_error_reason),
287  "The consensus timeout parameter (%d ms) may not be less than (%d ms).",
288  totem_config->consensus_timeout, MINIMUM_TIMEOUT);
289  goto parse_error;
290  }
291 
292  if (totem_config->consensus_timeout < totem_config->join_timeout) {
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).",
295  totem_config->consensus_timeout, totem_config->join_timeout);
296  goto parse_error;
297  }
298 
299  if (totem_config->merge_timeout < MINIMUM_TIMEOUT) {
300  snprintf (local_error_reason, sizeof(local_error_reason),
301  "The merge timeout parameter (%d ms) may not be less than (%d ms).",
302  totem_config->merge_timeout, MINIMUM_TIMEOUT);
303  goto parse_error;
304  }
305 
306  if (totem_config->downcheck_timeout < MINIMUM_TIMEOUT) {
307  snprintf (local_error_reason, sizeof(local_error_reason),
308  "The downcheck timeout parameter (%d ms) may not be less than (%d ms).",
309  totem_config->downcheck_timeout, MINIMUM_TIMEOUT);
310  goto parse_error;
311  }
312 
313  if (totem_config->rrp_problem_count_timeout < MINIMUM_TIMEOUT) {
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).",
317  goto parse_error;
318  }
319 
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).",
324  goto parse_error;
325  }
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).",
330  goto parse_error;
331  }
332 
333  if (totem_config->rrp_token_expired_timeout < MINIMUM_TIMEOUT) {
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).",
337  goto parse_error;
338  }
339 
340  return 0;
341 
342 parse_error:
343  snprintf (error_string_response, sizeof(error_string_response),
344  "parse error in config: %s\n", error_reason);
345  *error_string = error_string_response;
346  return (-1);
347 
348 }
349 
350 static int totem_get_crypto(struct totem_config *totem_config)
351 {
352  char *str;
353  const char *tmp_cipher;
354  const char *tmp_hash;
355 
356  tmp_hash = "sha1";
357  tmp_cipher = "aes256";
358 
359  if (icmap_get_string("totem.secauth", &str) == CS_OK) {
360  if (strcmp (str, "off") == 0) {
361  tmp_hash = "none";
362  tmp_cipher = "none";
363  }
364  free(str);
365  }
366 
367  if (icmap_get_string("totem.crypto_cipher", &str) == CS_OK) {
368  if (strcmp(str, "none") == 0) {
369  tmp_cipher = "none";
370  }
371  if (strcmp(str, "aes256") == 0) {
372  tmp_cipher = "aes256";
373  }
374  if (strcmp(str, "aes192") == 0) {
375  tmp_cipher = "aes192";
376  }
377  if (strcmp(str, "aes128") == 0) {
378  tmp_cipher = "aes128";
379  }
380  if (strcmp(str, "3des") == 0) {
381  tmp_cipher = "3des";
382  }
383  free(str);
384  }
385 
386  if (icmap_get_string("totem.crypto_hash", &str) == CS_OK) {
387  if (strcmp(str, "none") == 0) {
388  tmp_hash = "none";
389  }
390  if (strcmp(str, "md5") == 0) {
391  tmp_hash = "md5";
392  }
393  if (strcmp(str, "sha1") == 0) {
394  tmp_hash = "sha1";
395  }
396  if (strcmp(str, "sha256") == 0) {
397  tmp_hash = "sha256";
398  }
399  if (strcmp(str, "sha384") == 0) {
400  tmp_hash = "sha384";
401  }
402  if (strcmp(str, "sha512") == 0) {
403  tmp_hash = "sha512";
404  }
405  free(str);
406  }
407 
408  if ((strcmp(tmp_cipher, "none") != 0) &&
409  (strcmp(tmp_hash, "none") == 0)) {
410  return -1;
411  }
412 
413  free(totem_config->crypto_cipher_type);
414  free(totem_config->crypto_hash_type);
415 
416  totem_config->crypto_cipher_type = strdup(tmp_cipher);
417  totem_config->crypto_hash_type = strdup(tmp_hash);
418 
419  return 0;
420 }
421 
422 static int totem_config_get_ip_version(void)
423 {
424  int res;
425  char *str;
426 
427  res = AF_INET;
428  if (icmap_get_string("totem.ip_version", &str) == CS_OK) {
429  if (strcmp(str, "ipv4") == 0) {
430  res = AF_INET;
431  }
432  if (strcmp(str, "ipv6") == 0) {
433  res = AF_INET6;
434  }
435  free(str);
436  }
437 
438  return (res);
439 }
440 
441 static uint16_t generate_cluster_id (const char *cluster_name)
442 {
443  int i;
444  int value = 0;
445 
446  for (i = 0; i < strlen(cluster_name); i++) {
447  value <<= 1;
448  value += cluster_name[i];
449  }
450 
451  return (value & 0xFFFF);
452 }
453 
454 static int get_cluster_mcast_addr (
455  const char *cluster_name,
456  unsigned int ringnumber,
457  int ip_version,
458  struct totem_ip_address *res)
459 {
460  uint16_t clusterid;
461  char addr[INET6_ADDRSTRLEN + 1];
462  int err;
463 
464  if (cluster_name == NULL) {
465  return (-1);
466  }
467 
468  clusterid = generate_cluster_id(cluster_name) + ringnumber;
469  memset (res, 0, sizeof(*res));
470 
471  switch (ip_version) {
472  case AF_INET:
473  snprintf(addr, sizeof(addr), "239.192.%d.%d", clusterid >> 8, clusterid % 0xFF);
474  break;
475  case AF_INET6:
476  snprintf(addr, sizeof(addr), "ff15::%x", clusterid);
477  break;
478  default:
479  /*
480  * Unknown family
481  */
482  return (-1);
483  }
484 
485  err = totemip_parse (res, addr, ip_version);
486 
487  return (err);
488 }
489 
490 static unsigned int generate_nodeid_for_duplicate_test(
491  struct totem_config *totem_config,
492  char *addr)
493 {
494  unsigned int nodeid;
495  struct totem_ip_address totemip;
496 
497  /* AF_INET hard-coded here because auto-generated nodeids
498  are only for IPv4 */
499  if (totemip_parse(&totemip, addr, AF_INET) != 0)
500  return -1;
501 
502  memcpy (&nodeid, &totemip.addr, sizeof (unsigned int));
503 
504 #if __BYTE_ORDER == __LITTLE_ENDIAN
505  nodeid = swab32 (nodeid);
506 #endif
507 
508  if (totem_config->clear_node_high_bit) {
509  nodeid &= 0x7FFFFFFF;
510  }
511  return nodeid;
512 }
513 
514 static int check_for_duplicate_nodeids(
515  struct totem_config *totem_config,
516  const char **error_string)
517 {
518  icmap_iter_t iter;
519  icmap_iter_t subiter;
520  const char *iter_key;
521  int res = 0;
522  int retval = 0;
523  char tmp_key[ICMAP_KEYNAME_MAXLEN];
524  char *ring0_addr=NULL;
525  char *ring0_addr1=NULL;
526  unsigned int node_pos;
527  unsigned int node_pos1;
528  unsigned int nodeid;
529  unsigned int nodeid1;
530  int autogenerated;
531 
532  iter = icmap_iter_init("nodelist.node.");
533  while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
534  res = sscanf(iter_key, "nodelist.node.%u.%s", &node_pos, tmp_key);
535  if (res != 2) {
536  continue;
537  }
538 
539  if (strcmp(tmp_key, "ring0_addr") != 0) {
540  continue;
541  }
542 
543  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.nodeid", node_pos);
544  autogenerated = 0;
545  if (icmap_get_uint32(tmp_key, &nodeid) != CS_OK) {
546 
547  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.ring0_addr", node_pos);
548  if (icmap_get_string(tmp_key, &ring0_addr) != CS_OK) {
549  continue;
550  }
551 
552  /* Generate nodeid so we can check that auto-generated nodeids don't clash either */
553  nodeid = generate_nodeid_for_duplicate_test(totem_config, ring0_addr);
554  if (nodeid == -1) {
555  continue;
556  }
557  autogenerated = 1;
558  }
559 
560  node_pos1 = 0;
561  subiter = icmap_iter_init("nodelist.node.");
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)) {
565  continue;
566  }
567 
568  if (strcmp(tmp_key, "ring0_addr") != 0) {
569  continue;
570  }
571 
572  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.nodeid", node_pos1);
573  if (icmap_get_uint32(tmp_key, &nodeid1) != CS_OK) {
574 
575  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.ring0_addr", node_pos1);
576  if (icmap_get_string(tmp_key, &ring0_addr1) != CS_OK) {
577  continue;
578  }
579  nodeid1 = generate_nodeid_for_duplicate_test(totem_config, ring0_addr1);
580  if (nodeid1 == -1) {
581  continue;
582  }
583  }
584 
585  if (nodeid == nodeid1) {
586  retval = -1;
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?")":"");
592  log_printf (LOGSYS_LEVEL_ERROR, error_string_response);
593  *error_string = error_string_response;
594  break;
595  }
596  }
597  icmap_iter_finalize(subiter);
598  }
599  icmap_iter_finalize(iter);
600  return retval;
601 }
602 
603 
604 static int find_local_node_in_nodelist(struct totem_config *totem_config)
605 {
606  icmap_iter_t iter;
607  const char *iter_key;
608  int res = 0;
609  unsigned int node_pos;
610  int local_node_pos = -1;
611  struct totem_ip_address bind_addr;
612  int interface_up, interface_num;
613  char tmp_key[ICMAP_KEYNAME_MAXLEN];
614  char *node_addr_str;
615  struct totem_ip_address node_addr;
616 
617  res = totemip_iface_check(&totem_config->interfaces[0].bindnet,
618  &bind_addr, &interface_up, &interface_num,
619  totem_config->clear_node_high_bit);
620  if (res == -1) {
621  return (-1);
622  }
623 
624  iter = icmap_iter_init("nodelist.node.");
625  while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
626  res = sscanf(iter_key, "nodelist.node.%u.%s", &node_pos, tmp_key);
627  if (res != 2) {
628  continue;
629  }
630 
631  if (strcmp(tmp_key, "ring0_addr") != 0) {
632  continue;
633  }
634 
635  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.ring0_addr", node_pos);
636  if (icmap_get_string(tmp_key, &node_addr_str) != CS_OK) {
637  continue;
638  }
639 
640  res = totemip_parse (&node_addr, node_addr_str, totem_config->ip_version);
641  free(node_addr_str);
642  if (res == -1) {
643  continue ;
644  }
645 
646  if (totemip_equal(&bind_addr, &node_addr)) {
647  local_node_pos = node_pos;
648  }
649  }
650  icmap_iter_finalize(iter);
651 
652  return (local_node_pos);
653 }
654 
655 /*
656  * Compute difference between two set of totem interface arrays. set1 and set2
657  * are changed so for same ring, ip existing in both set1 and set2 are cleared
658  * (set to 0), and ips which are only in set1 or set2 remains untouched.
659  * totempg_node_add/remove is called.
660  */
661 static void compute_interfaces_diff(int interface_count,
662  struct totem_interface *set1,
663  struct totem_interface *set2)
664 {
665  int ring_no, set1_pos, set2_pos;
666  struct totem_ip_address empty_ip_address;
667 
668  memset(&empty_ip_address, 0, sizeof(empty_ip_address));
669 
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++) {
673  /*
674  * For current ring_no remove all set1 items existing
675  * in set2
676  */
677  if (memcmp(&set1[ring_no].member_list[set1_pos],
678  &set2[ring_no].member_list[set2_pos],
679  sizeof(struct totem_ip_address)) == 0) {
680  memset(&set1[ring_no].member_list[set1_pos], 0,
681  sizeof(struct totem_ip_address));
682  memset(&set2[ring_no].member_list[set2_pos], 0,
683  sizeof(struct totem_ip_address));
684  }
685  }
686  }
687  }
688 
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++) {
691  /*
692  * All items which remained in set1 doesn't exists in set2 any longer so
693  * node has to be removed.
694  */
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",
698  totemip_print(&set1[ring_no].member_list[set1_pos]),
699  ring_no);
700 
701  totempg_member_remove(&set1[ring_no].member_list[set1_pos], ring_no);
702  }
703  }
704  for (set2_pos = 0; set2_pos < set2[ring_no].member_count; set2_pos++) {
705  /*
706  * All items which remained in set2 doesn't existed in set1 so this is no node
707  * and has to be added.
708  */
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",
712  totemip_print(&set2[ring_no].member_list[set2_pos]),
713  ring_no);
714 
715  totempg_member_add(&set2[ring_no].member_list[set2_pos], ring_no);
716  }
717  }
718  }
719 }
720 
721 static void put_nodelist_members_to_config(struct totem_config *totem_config, int reload)
722 {
723  icmap_iter_t iter, iter2;
724  const char *iter_key, *iter_key2;
725  int res = 0;
726  unsigned int node_pos;
727  char tmp_key[ICMAP_KEYNAME_MAXLEN];
728  char tmp_key2[ICMAP_KEYNAME_MAXLEN];
729  char *node_addr_str;
730  int member_count;
731  unsigned int ringnumber = 0;
732  int i, j;
733  struct totem_interface *orig_interfaces = NULL;
734  struct totem_interface *new_interfaces = NULL;
735 
736  if (reload) {
737  /*
738  * We need to compute diff only for reload. Also for initial configuration
739  * not all totem structures are initialized so corosync will crash during
740  * member_add/remove
741  */
742  orig_interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
743  assert(orig_interfaces != NULL);
744  new_interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
745  assert(new_interfaces != NULL);
746 
747  memcpy(orig_interfaces, totem_config->interfaces, sizeof (struct totem_interface) * INTERFACE_MAX);
748  }
749 
750  /* Clear out nodelist so we can put the new one in if needed */
751  for (i = 0; i < totem_config->interface_count; i++) {
752  for (j = 0; j < PROCESSOR_COUNT_MAX; j++) {
753  memset(&totem_config->interfaces[i].member_list[j], 0, sizeof(struct totem_ip_address));
754  }
755  totem_config->interfaces[i].member_count = 0;
756  }
757 
758  iter = icmap_iter_init("nodelist.node.");
759  while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
760  res = sscanf(iter_key, "nodelist.node.%u.%s", &node_pos, tmp_key);
761  if (res != 2) {
762  continue;
763  }
764 
765  if (strcmp(tmp_key, "ring0_addr") != 0) {
766  continue;
767  }
768 
769  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.", node_pos);
770  iter2 = icmap_iter_init(tmp_key);
771  while ((iter_key2 = icmap_iter_next(iter2, NULL, NULL)) != NULL) {
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) {
774  continue;
775  }
776 
777  if (icmap_get_string(iter_key2, &node_addr_str) != CS_OK) {
778  continue;
779  }
780 
781  member_count = totem_config->interfaces[ringnumber].member_count;
782 
783  res = totemip_parse(&totem_config->interfaces[ringnumber].member_list[member_count],
784  node_addr_str, totem_config->ip_version);
785  if (res != -1) {
786  totem_config->interfaces[ringnumber].member_count++;
787  }
788  free(node_addr_str);
789  }
790 
791  icmap_iter_finalize(iter2);
792  }
793 
794  icmap_iter_finalize(iter);
795 
796  if (reload) {
797  memcpy(new_interfaces, totem_config->interfaces, sizeof (struct totem_interface) * INTERFACE_MAX);
798 
799  compute_interfaces_diff(totem_config->interface_count, orig_interfaces, new_interfaces);
800 
801  free(new_interfaces);
802  free(orig_interfaces);
803  }
804 }
805 
806 static void nodelist_dynamic_notify(
807  int32_t event,
808  const char *key_name,
809  struct icmap_notify_value new_val,
810  struct icmap_notify_value old_val,
811  void *user_data)
812 {
813  int res;
814  unsigned int ring_no;
815  unsigned int member_no;
816  char tmp_str[ICMAP_KEYNAME_MAXLEN];
817  uint8_t reloading;
818  struct totem_config *totem_config = (struct totem_config *)user_data;
819 
820  /*
821  * If a full reload is in progress then don't do anything until it's done and
822  * can reconfigure it all atomically
823  */
824  if (icmap_get_uint8("config.totemconfig_reload_in_progress", &reloading) == CS_OK && reloading) {
825  return ;
826  }
827 
828  res = sscanf(key_name, "nodelist.node.%u.ring%u%s", &member_no, &ring_no, tmp_str);
829  if (res != 3)
830  return ;
831 
832  if (strcmp(tmp_str, "_addr") != 0) {
833  return;
834  }
835 
836  put_nodelist_members_to_config(totem_config, 1);
837 }
838 
839 
840 /*
841  * Tries to find node (node_pos) in config nodelist which address matches any
842  * local interface. Address can be stored in ring0_addr or if ipaddr_key_prefix is not NULL
843  * key with prefix ipaddr_key is used (there can be multiuple of them)
844  * This function differs * from find_local_node_in_nodelist because it doesn't need bindnetaddr,
845  * but doesn't work when bind addr is network address (so IP must be exact
846  * match).
847  *
848  * Returns 1 on success (address was found, node_pos is then correctly set) or 0 on failure.
849  */
850 int totem_config_find_local_addr_in_nodelist(const char *ipaddr_key_prefix, unsigned int *node_pos)
851 {
852  struct list_head addrs;
853  struct totem_ip_if_address *if_addr;
854  icmap_iter_t iter, iter2;
855  const char *iter_key, *iter_key2;
856  struct list_head *list;
857  const char *ipaddr_key;
858  int ip_version;
859  struct totem_ip_address node_addr;
860  char *node_addr_str;
861  int node_found = 0;
862  int res = 0;
863  char tmp_key[ICMAP_KEYNAME_MAXLEN];
864 
865  if (totemip_getifaddrs(&addrs) == -1) {
866  return 0;
867  }
868 
869  ip_version = totem_config_get_ip_version();
870 
871  iter = icmap_iter_init("nodelist.node.");
872 
873  while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
874  res = sscanf(iter_key, "nodelist.node.%u.%s", node_pos, tmp_key);
875  if (res != 2) {
876  continue;
877  }
878 
879  if (strcmp(tmp_key, "ring0_addr") != 0) {
880  continue;
881  }
882 
883  if (icmap_get_string(iter_key, &node_addr_str) != CS_OK) {
884  continue ;
885  }
886 
887  free(node_addr_str);
888 
889  /*
890  * ring0_addr found -> let's iterate thru ipaddr_key_prefix
891  */
892  snprintf(tmp_key, sizeof(tmp_key), "nodelist.node.%u.%s", *node_pos,
893  (ipaddr_key_prefix != NULL ? ipaddr_key_prefix : "ring0_addr"));
894 
895  iter2 = icmap_iter_init(tmp_key);
896  while ((iter_key2 = icmap_iter_next(iter2, NULL, NULL)) != NULL) {
897  /*
898  * ring0_addr must be exact match, not prefix
899  */
900  ipaddr_key = (ipaddr_key_prefix != NULL ? iter_key2 : tmp_key);
901  if (icmap_get_string(ipaddr_key, &node_addr_str) != CS_OK) {
902  continue ;
903  }
904 
905  if (totemip_parse(&node_addr, node_addr_str, ip_version) == -1) {
906  free(node_addr_str);
907  continue ;
908  }
909  free(node_addr_str);
910 
911  /*
912  * Try to match ip with if_addrs
913  */
914  node_found = 0;
915  for (list = addrs.next; list != &addrs; list = list->next) {
916  if_addr = list_entry(list, struct totem_ip_if_address, list);
917 
918  if (totemip_equal(&node_addr, &if_addr->ip_addr)) {
919  node_found = 1;
920  break;
921  }
922  }
923 
924  if (node_found) {
925  break ;
926  }
927  }
928 
929  icmap_iter_finalize(iter2);
930 
931  if (node_found) {
932  break ;
933  }
934  }
935 
936  icmap_iter_finalize(iter);
937  totemip_freeifaddrs(&addrs);
938 
939  return (node_found);
940 }
941 
942 static void config_convert_nodelist_to_interface(struct totem_config *totem_config)
943 {
944  int res = 0;
945  unsigned int node_pos;
946  char tmp_key[ICMAP_KEYNAME_MAXLEN];
947  char tmp_key2[ICMAP_KEYNAME_MAXLEN];
948  char *node_addr_str;
949  unsigned int ringnumber = 0;
950  icmap_iter_t iter;
951  const char *iter_key;
952 
953  if (totem_config_find_local_addr_in_nodelist(NULL, &node_pos)) {
954  /*
955  * We found node, so create interface section
956  */
957  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.", node_pos);
958  iter = icmap_iter_init(tmp_key);
959  while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
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) {
962  continue ;
963  }
964 
965  if (icmap_get_string(iter_key, &node_addr_str) != CS_OK) {
966  continue;
967  }
968 
969  snprintf(tmp_key2, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.bindnetaddr", ringnumber);
970  icmap_set_string(tmp_key2, node_addr_str);
971  free(node_addr_str);
972  }
973  icmap_iter_finalize(iter);
974  }
975 }
976 
977 
978 extern int totem_config_read (
979  struct totem_config *totem_config,
980  const char **error_string,
981  uint64_t *warnings)
982 {
983  int res = 0;
984  char *str;
985  unsigned int ringnumber = 0;
986  int member_count = 0;
987  icmap_iter_t iter, member_iter;
988  const char *iter_key;
989  const char *member_iter_key;
990  char ringnumber_key[ICMAP_KEYNAME_MAXLEN];
991  char tmp_key[ICMAP_KEYNAME_MAXLEN];
992  uint8_t u8;
993  uint16_t u16;
994  char *cluster_name = NULL;
995  int i;
996  int local_node_pos;
997  int nodeid_set;
998 
999  *warnings = 0;
1000 
1001  memset (totem_config, 0, sizeof (struct totem_config));
1002  totem_config->interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
1003  if (totem_config->interfaces == 0) {
1004  *error_string = "Out of memory trying to allocate ethernet interface storage area";
1005  return -1;
1006  }
1007 
1008  memset (totem_config->interfaces, 0,
1009  sizeof (struct totem_interface) * INTERFACE_MAX);
1010 
1011  strcpy (totem_config->rrp_mode, "none");
1012 
1013  icmap_get_uint32("totem.version", (uint32_t *)&totem_config->version);
1014 
1015  if (totem_get_crypto(totem_config) != 0) {
1016  *error_string = "crypto_cipher requires crypto_hash with value other than none";
1017  return -1;
1018  }
1019 
1020  if (icmap_get_string("totem.rrp_mode", &str) == CS_OK) {
1021  if (strlen(str) >= TOTEM_RRP_MODE_BYTES) {
1022  *error_string = "totem.rrp_mode is too long";
1023  free(str);
1024 
1025  return -1;
1026  }
1027  strcpy (totem_config->rrp_mode, str);
1028  free(str);
1029  }
1030 
1031  icmap_get_uint32("totem.nodeid", &totem_config->node_id);
1032 
1033  totem_config->clear_node_high_bit = 0;
1034  if (icmap_get_string("totem.clear_node_high_bit", &str) == CS_OK) {
1035  if (strcmp (str, "yes") == 0) {
1036  totem_config->clear_node_high_bit = 1;
1037  }
1038  free(str);
1039  }
1040 
1041  icmap_get_uint32("totem.threads", &totem_config->threads);
1042 
1043  icmap_get_uint32("totem.netmtu", &totem_config->net_mtu);
1044 
1045  if (icmap_get_string("totem.cluster_name", &cluster_name) != CS_OK) {
1046  cluster_name = NULL;
1047  }
1048 
1049  totem_config->ip_version = totem_config_get_ip_version();
1050 
1051  if (icmap_get_string("totem.interface.0.bindnetaddr", &str) != CS_OK) {
1052  /*
1053  * We were not able to find ring 0 bindnet addr. Try to use nodelist informations
1054  */
1055  config_convert_nodelist_to_interface(totem_config);
1056  } else {
1057  free(str);
1058  }
1059 
1060  /*
1061  * Broadcast option is global but set in interface section,
1062  * so reset before processing interfaces.
1063  */
1064  totem_config->broadcast_use = 0;
1065 
1066  iter = icmap_iter_init("totem.interface.");
1067  while ((iter_key = icmap_iter_next(iter, NULL, NULL)) != NULL) {
1068  res = sscanf(iter_key, "totem.interface.%[^.].%s", ringnumber_key, tmp_key);
1069  if (res != 2) {
1070  continue;
1071  }
1072 
1073  if (strcmp(tmp_key, "bindnetaddr") != 0) {
1074  continue;
1075  }
1076 
1077  member_count = 0;
1078 
1079  ringnumber = atoi(ringnumber_key);
1080 
1081  if (ringnumber >= INTERFACE_MAX) {
1082  free(cluster_name);
1083 
1084  snprintf (error_string_response, sizeof(error_string_response),
1085  "parse error in config: interface ring number %u is bigger than allowed maximum %u\n",
1086  ringnumber, INTERFACE_MAX - 1);
1087 
1088  *error_string = error_string_response;
1089  return -1;
1090  }
1091 
1092  /*
1093  * Get the bind net address
1094  */
1095  if (icmap_get_string(iter_key, &str) == CS_OK) {
1096  res = totemip_parse (&totem_config->interfaces[ringnumber].bindnet, str,
1097  totem_config->ip_version);
1098  free(str);
1099  }
1100 
1101  /*
1102  * Get interface multicast address
1103  */
1104  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.mcastaddr", ringnumber);
1105  if (icmap_get_string(tmp_key, &str) == CS_OK) {
1106  res = totemip_parse (&totem_config->interfaces[ringnumber].mcast_addr, str, totem_config->ip_version);
1107  free(str);
1108  } else {
1109  /*
1110  * User not specified address -> autogenerate one from cluster_name key
1111  * (if available). Return code is intentionally ignored, because
1112  * udpu doesn't need mcastaddr and validity of mcastaddr for udp is
1113  * checked later anyway.
1114  */
1115  (void)get_cluster_mcast_addr (cluster_name,
1116  ringnumber,
1117  totem_config->ip_version,
1118  &totem_config->interfaces[ringnumber].mcast_addr);
1119  }
1120 
1121  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.broadcast", ringnumber);
1122  if (icmap_get_string(tmp_key, &str) == CS_OK) {
1123  if (strcmp (str, "yes") == 0) {
1124  totem_config->broadcast_use = 1;
1125  }
1126  free(str);
1127  }
1128 
1129  /*
1130  * Get mcast port
1131  */
1132  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.mcastport", ringnumber);
1133  if (icmap_get_uint16(tmp_key, &totem_config->interfaces[ringnumber].ip_port) != CS_OK) {
1134  if (totem_config->broadcast_use) {
1135  totem_config->interfaces[ringnumber].ip_port = DEFAULT_PORT + (2 * ringnumber);
1136  } else {
1137  totem_config->interfaces[ringnumber].ip_port = DEFAULT_PORT;
1138  }
1139  }
1140 
1141  /*
1142  * Get the TTL
1143  */
1144  totem_config->interfaces[ringnumber].ttl = 1;
1145 
1146  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.ttl", ringnumber);
1147 
1148  if (icmap_get_uint8(tmp_key, &u8) == CS_OK) {
1149  totem_config->interfaces[ringnumber].ttl = u8;
1150  }
1151 
1152  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.member.", ringnumber);
1153  member_iter = icmap_iter_init(tmp_key);
1154  while ((member_iter_key = icmap_iter_next(member_iter, NULL, NULL)) != NULL) {
1155  if (member_count == 0) {
1156  if (icmap_get_string("nodelist.node.0.ring0_addr", &str) == CS_OK) {
1157  free(str);
1159  break;
1160  } else {
1162  }
1163  }
1164 
1165  if (icmap_get_string(member_iter_key, &str) == CS_OK) {
1166  res = totemip_parse (&totem_config->interfaces[ringnumber].member_list[member_count++],
1167  str, totem_config->ip_version);
1168  }
1169  }
1170  icmap_iter_finalize(member_iter);
1171 
1172  totem_config->interfaces[ringnumber].member_count = member_count;
1173  totem_config->interface_count++;
1174  }
1175  icmap_iter_finalize(iter);
1176 
1177  /*
1178  * Use broadcast is global, so if set, make sure to fill mcast addr correctly
1179  */
1180  if (totem_config->broadcast_use) {
1181  for (ringnumber = 0; ringnumber < totem_config->interface_count; ringnumber++) {
1182  totemip_parse (&totem_config->interfaces[ringnumber].mcast_addr,
1183  "255.255.255.255", 0);
1184  }
1185  }
1186 
1187  /*
1188  * Store automatically generated items back to icmap
1189  */
1190  for (i = 0; i < totem_config->interface_count; i++) {
1191  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.mcastaddr", i);
1192  if (icmap_get_string(tmp_key, &str) == CS_OK) {
1193  free(str);
1194  } else {
1195  str = (char *)totemip_print(&totem_config->interfaces[i].mcast_addr);
1196  icmap_set_string(tmp_key, str);
1197  }
1198 
1199  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.mcastport", i);
1200  if (icmap_get_uint16(tmp_key, &u16) != CS_OK) {
1201  icmap_set_uint16(tmp_key, totem_config->interfaces[i].ip_port);
1202  }
1203  }
1204 
1205  totem_config->transport_number = TOTEM_TRANSPORT_UDP;
1206  if (icmap_get_string("totem.transport", &str) == CS_OK) {
1207  if (strcmp (str, "udpu") == 0) {
1208  totem_config->transport_number = TOTEM_TRANSPORT_UDPU;
1209  }
1210 
1211  if (strcmp (str, "iba") == 0) {
1212  totem_config->transport_number = TOTEM_TRANSPORT_RDMA;
1213  }
1214  free(str);
1215  }
1216 
1217  free(cluster_name);
1218 
1219  /*
1220  * Check existence of nodelist
1221  */
1222  if (icmap_get_string("nodelist.node.0.ring0_addr", &str) == CS_OK) {
1223  free(str);
1224  /*
1225  * find local node
1226  */
1227  local_node_pos = find_local_node_in_nodelist(totem_config);
1228  if (local_node_pos != -1) {
1229  icmap_set_uint32("nodelist.local_node_pos", local_node_pos);
1230 
1231  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.nodeid", local_node_pos);
1232 
1233  nodeid_set = (totem_config->node_id != 0);
1234  if (icmap_get_uint32(tmp_key, &totem_config->node_id) == CS_OK && nodeid_set) {
1236  }
1237 
1238  /*
1239  * Make localnode ring0_addr read only, so we can be sure that local
1240  * node never changes. If rebinding to other IP would be in future
1241  * supported, this must be changed and handled properly!
1242  */
1243  snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "nodelist.node.%u.ring0_addr", local_node_pos);
1244  icmap_set_ro_access(tmp_key, 0, 1);
1245  icmap_set_ro_access("nodelist.local_node_pos", 0, 1);
1246  }
1247 
1248  put_nodelist_members_to_config(totem_config, 0);
1249  }
1250 
1251  /*
1252  * Get things that might change in the future (and can depend on totem_config->interfaces);
1253  */
1254  totem_volatile_config_read(totem_config, NULL);
1255 
1256  icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
1257 
1258  add_totem_config_notification(totem_config);
1259 
1260  return 0;
1261 }
1262 
1263 
1265  struct totem_config *totem_config,
1266  const char **error_string)
1267 {
1268  static char local_error_reason[512];
1269  char parse_error[512];
1270  const char *error_reason = local_error_reason;
1271  int i, j;
1272  unsigned int interface_max = INTERFACE_MAX;
1273  unsigned int port1, port2;
1274 
1275  if (totem_config->interface_count == 0) {
1276  error_reason = "No interfaces defined";
1277  goto parse_error;
1278  }
1279 
1280  for (i = 0; i < totem_config->interface_count; i++) {
1281  /*
1282  * Some error checking of parsed data to make sure its valid
1283  */
1284 
1285  struct totem_ip_address null_addr;
1286  memset (&null_addr, 0, sizeof (struct totem_ip_address));
1287 
1288  if ((totem_config->transport_number == 0) &&
1289  memcmp (&totem_config->interfaces[i].mcast_addr, &null_addr,
1290  sizeof (struct totem_ip_address)) == 0) {
1291  error_reason = "No multicast address specified";
1292  goto parse_error;
1293  }
1294 
1295  if (totem_config->interfaces[i].ip_port == 0) {
1296  error_reason = "No multicast port specified";
1297  goto parse_error;
1298  }
1299 
1300  if (totem_config->interfaces[i].ttl > 255) {
1301  error_reason = "Invalid TTL (should be 0..255)";
1302  goto parse_error;
1303  }
1304  if (totem_config->transport_number != TOTEM_TRANSPORT_UDP &&
1305  totem_config->interfaces[i].ttl != 1) {
1306  error_reason = "Can only set ttl on multicast transport types";
1307  goto parse_error;
1308  }
1309 
1310  if (totem_config->interfaces[i].mcast_addr.family == AF_INET6 &&
1311  totem_config->node_id == 0) {
1312 
1313  error_reason = "An IPV6 network requires that a node ID be specified.";
1314  goto parse_error;
1315  }
1316 
1317  if (totem_config->broadcast_use == 0 && totem_config->transport_number == TOTEM_TRANSPORT_UDP) {
1318  if (totem_config->interfaces[i].mcast_addr.family != totem_config->interfaces[i].bindnet.family) {
1319  error_reason = "Multicast address family does not match bind address family";
1320  goto parse_error;
1321  }
1322 
1323  if (totemip_is_mcast (&totem_config->interfaces[i].mcast_addr) != 0) {
1324  error_reason = "mcastaddr is not a correct multicast address.";
1325  goto parse_error;
1326  }
1327  }
1328 
1329  if (totem_config->interfaces[0].bindnet.family != totem_config->interfaces[i].bindnet.family) {
1330  error_reason = "Not all bind address belong to the same IP family";
1331  goto parse_error;
1332  }
1333 
1334  /*
1335  * Ensure mcast address/port differs
1336  */
1337  if (totem_config->transport_number == TOTEM_TRANSPORT_UDP) {
1338  for (j = i + 1; j < totem_config->interface_count; j++) {
1339  port1 = totem_config->interfaces[i].ip_port;
1340  port2 = totem_config->interfaces[j].ip_port;
1341  if (totemip_equal(&totem_config->interfaces[i].mcast_addr,
1342  &totem_config->interfaces[j].mcast_addr) &&
1343  (((port1 > port2 ? port1 : port2) - (port1 < port2 ? port1 : port2)) <= 1)) {
1344  error_reason = "Interfaces multicast address/port pair must differ";
1345  goto parse_error;
1346  }
1347  }
1348  }
1349  }
1350 
1351  if (totem_config->version != 2) {
1352  error_reason = "This totem parser can only parse version 2 configurations.";
1353  goto parse_error;
1354  }
1355 
1356  if (totem_volatile_config_validate(totem_config, error_string) == -1) {
1357  return (-1);
1358  }
1359 
1360  if (check_for_duplicate_nodeids(totem_config, error_string) == -1) {
1361  return (-1);
1362  }
1363 
1364  /*
1365  * RRP values validation
1366  */
1367  if (strcmp (totem_config->rrp_mode, "none") &&
1368  strcmp (totem_config->rrp_mode, "active") &&
1369  strcmp (totem_config->rrp_mode, "passive")) {
1370  snprintf (local_error_reason, sizeof(local_error_reason),
1371  "The RRP mode \"%s\" specified is invalid. It must be none, active, or passive.\n", totem_config->rrp_mode);
1372  goto parse_error;
1373  }
1374 
1375  if (strcmp (totem_config->rrp_mode, "none") == 0) {
1376  interface_max = 1;
1377  }
1378  if (interface_max < totem_config->interface_count) {
1379  snprintf (parse_error, sizeof(parse_error),
1380  "%d is too many configured interfaces for the rrp_mode setting %s.",
1381  totem_config->interface_count,
1382  totem_config->rrp_mode);
1383  error_reason = parse_error;
1384  goto parse_error;
1385  }
1386 
1387  if (totem_config->net_mtu == 0) {
1388  totem_config->net_mtu = 1500;
1389  }
1390 
1391  return 0;
1392 
1393 parse_error:
1394  snprintf (error_string_response, sizeof(error_string_response),
1395  "parse error in config: %s\n", error_reason);
1396  *error_string = error_string_response;
1397  return (-1);
1398 
1399 }
1400 
1401 static int read_keyfile (
1402  const char *key_location,
1403  struct totem_config *totem_config,
1404  const char **error_string)
1405 {
1406  int fd;
1407  int res;
1408  ssize_t expected_key_len = sizeof (totem_config->private_key);
1409  int saved_errno;
1410  char error_str[100];
1411  const char *error_ptr;
1412 
1413  fd = open (key_location, O_RDONLY);
1414  if (fd == -1) {
1415  error_ptr = qb_strerror_r(errno, error_str, sizeof(error_str));
1416  snprintf (error_string_response, sizeof(error_string_response),
1417  "Could not open %s: %s\n",
1418  key_location, error_ptr);
1419  goto parse_error;
1420  }
1421 
1422  res = read (fd, totem_config->private_key, expected_key_len);
1423  saved_errno = errno;
1424  close (fd);
1425 
1426  if (res == -1) {
1427  error_ptr = qb_strerror_r (saved_errno, error_str, sizeof(error_str));
1428  snprintf (error_string_response, sizeof(error_string_response),
1429  "Could not read %s: %s\n",
1430  key_location, error_ptr);
1431  goto parse_error;
1432  }
1433 
1434  totem_config->private_key_len = expected_key_len;
1435 
1436  if (res != expected_key_len) {
1437  snprintf (error_string_response, sizeof(error_string_response),
1438  "Could only read %d bits of 1024 bits from %s.\n",
1439  res * 8, key_location);
1440  goto parse_error;
1441  }
1442 
1443  return 0;
1444 
1445 parse_error:
1446  *error_string = error_string_response;
1447  return (-1);
1448 }
1449 
1451  struct totem_config *totem_config,
1452  const char **error_string)
1453 {
1454  int got_key = 0;
1455  char *key_location = NULL;
1456  int res;
1457  size_t key_len;
1458 
1459  memset (totem_config->private_key, 0, 128);
1460  totem_config->private_key_len = 128;
1461 
1462  if (strcmp(totem_config->crypto_cipher_type, "none") == 0 &&
1463  strcmp(totem_config->crypto_hash_type, "none") == 0) {
1464  return (0);
1465  }
1466 
1467  /* cmap may store the location of the key file */
1468  if (icmap_get_string("totem.keyfile", &key_location) == CS_OK) {
1469  res = read_keyfile(key_location, totem_config, error_string);
1470  free(key_location);
1471  if (res) {
1472  goto key_error;
1473  }
1474  got_key = 1;
1475  } else { /* Or the key itself may be in the cmap */
1476  if (icmap_get("totem.key", NULL, &key_len, NULL) == CS_OK) {
1477  if (key_len > sizeof (totem_config->private_key)) {
1478  sprintf(error_string_response, "key is too long");
1479  goto key_error;
1480  }
1481  if (icmap_get("totem.key", totem_config->private_key, &key_len, NULL) == CS_OK) {
1482  totem_config->private_key_len = key_len;
1483  got_key = 1;
1484  } else {
1485  sprintf(error_string_response, "can't store private key");
1486  goto key_error;
1487  }
1488  }
1489  }
1490 
1491  /* In desperation we read the default filename */
1492  if (!got_key) {
1493  const char *filename = getenv("COROSYNC_TOTEM_AUTHKEY_FILE");
1494  if (!filename)
1495  filename = COROSYSCONFDIR "/authkey";
1496  res = read_keyfile(filename, totem_config, error_string);
1497  if (res)
1498  goto key_error;
1499 
1500  }
1501 
1502  return (0);
1503 
1504 key_error:
1505  *error_string = error_string_response;
1506  return (-1);
1507 
1508 }
1509 
1510 static void debug_dump_totem_config(const struct totem_config *totem_config)
1511 {
1512 
1513  log_printf(LOGSYS_LEVEL_DEBUG, "Token Timeout (%d ms) retransmit timeout (%d ms)",
1514  totem_config->token_timeout, totem_config->token_retransmit_timeout);
1515  log_printf(LOGSYS_LEVEL_DEBUG, "token hold (%d ms) retransmits before loss (%d retrans)",
1516  totem_config->token_hold_timeout, totem_config->token_retransmits_before_loss_const);
1517  log_printf(LOGSYS_LEVEL_DEBUG, "join (%d ms) send_join (%d ms) consensus (%d ms) merge (%d ms)",
1518  totem_config->join_timeout, totem_config->send_join_timeout, totem_config->consensus_timeout,
1519  totem_config->merge_timeout);
1520  log_printf(LOGSYS_LEVEL_DEBUG, "downcheck (%d ms) fail to recv const (%d msgs)",
1521  totem_config->downcheck_timeout, totem_config->fail_to_recv_const);
1523  "seqno unchanged const (%d rotations) Maximum network MTU %d",
1524  totem_config->seqno_unchanged_const, totem_config->net_mtu);
1526  "window size per rotation (%d messages) maximum messages per rotation (%d messages)",
1527  totem_config->window_size, totem_config->max_messages);
1528  log_printf(LOGSYS_LEVEL_DEBUG, "missed count const (%d messages)", totem_config->miss_count_const);
1529  log_printf(LOGSYS_LEVEL_DEBUG, "RRP token expired timeout (%d ms)",
1530  totem_config->rrp_token_expired_timeout);
1531  log_printf(LOGSYS_LEVEL_DEBUG, "RRP token problem counter (%d ms)",
1532  totem_config->rrp_problem_count_timeout);
1533  log_printf(LOGSYS_LEVEL_DEBUG, "RRP threshold (%d problem count)",
1534  totem_config->rrp_problem_count_threshold);
1535  log_printf(LOGSYS_LEVEL_DEBUG, "RRP multicast threshold (%d problem count)",
1536  totem_config->rrp_problem_count_mcast_threshold);
1537  log_printf(LOGSYS_LEVEL_DEBUG, "RRP automatic recovery check timeout (%d ms)",
1538  totem_config->rrp_autorecovery_check_timeout);
1539  log_printf(LOGSYS_LEVEL_DEBUG, "RRP mode set to %s.",
1540  totem_config->rrp_mode);
1541  log_printf(LOGSYS_LEVEL_DEBUG, "heartbeat_failures_allowed (%d)",
1542  totem_config->heartbeat_failures_allowed);
1543  log_printf(LOGSYS_LEVEL_DEBUG, "max_network_delay (%d ms)", totem_config->max_network_delay);
1544 }
1545 
1546 static void totem_change_notify(
1547  int32_t event,
1548  const char *key_name,
1549  struct icmap_notify_value new_val,
1550  struct icmap_notify_value old_val,
1551  void *user_data)
1552 {
1553  struct totem_config *totem_config = (struct totem_config *)user_data;
1554  uint32_t *param;
1555  uint8_t reloading;
1556  const char *deleted_key = NULL;
1557  const char *error_string;
1558 
1559  /*
1560  * If a full reload is in progress then don't do anything until it's done and
1561  * can reconfigure it all atomically
1562  */
1563  if (icmap_get_uint8("config.reload_in_progress", &reloading) == CS_OK && reloading)
1564  return;
1565 
1566  param = totem_get_param_by_name((struct totem_config *)user_data, key_name);
1567  /*
1568  * Process change only if changed key is found in totem_config (-> param is not NULL)
1569  * or for special key token_coefficient. token_coefficient key is not stored in
1570  * totem_config, but it is used for computation of token timeout.
1571  */
1572  if (!param && strcmp(key_name, "totem.token_coefficient") != 0)
1573  return;
1574 
1575  /*
1576  * Values other than UINT32 are not supported, or needed (yet)
1577  */
1578  switch (event) {
1579  case ICMAP_TRACK_DELETE:
1580  deleted_key = key_name;
1581  break;
1582  case ICMAP_TRACK_ADD:
1583  case ICMAP_TRACK_MODIFY:
1584  deleted_key = NULL;
1585  break;
1586  default:
1587  break;
1588  }
1589 
1590  totem_volatile_config_read (totem_config, deleted_key);
1591  log_printf(LOGSYS_LEVEL_DEBUG, "Totem related config key changed. Dumping actual totem config.");
1592  debug_dump_totem_config(totem_config);
1593  if (totem_volatile_config_validate(totem_config, &error_string) == -1) {
1594  log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
1595  /*
1596  * TODO: Consider corosync exit and/or load defaults for volatile
1597  * values. For now, log error seems to be enough
1598  */
1599  }
1600 }
1601 
1602 static void totem_reload_notify(
1603  int32_t event,
1604  const char *key_name,
1605  struct icmap_notify_value new_val,
1606  struct icmap_notify_value old_val,
1607  void *user_data)
1608 {
1609  struct totem_config *totem_config = (struct totem_config *)user_data;
1610  uint32_t local_node_pos;
1611  const char *error_string;
1612 
1613  /* Reload has completed */
1614  if (*(uint8_t *)new_val.data == 0) {
1615  put_nodelist_members_to_config (totem_config, 1);
1616  totem_volatile_config_read (totem_config, NULL);
1617  log_printf(LOGSYS_LEVEL_DEBUG, "Configuration reloaded. Dumping actual totem config.");
1618  debug_dump_totem_config(totem_config);
1619  if (totem_volatile_config_validate(totem_config, &error_string) == -1) {
1620  log_printf (LOGSYS_LEVEL_ERROR, "%s", error_string);
1621  /*
1622  * TODO: Consider corosync exit and/or load defaults for volatile
1623  * values. For now, log error seems to be enough
1624  */
1625  }
1626 
1627  /* Reinstate the local_node_pos */
1628  local_node_pos = find_local_node_in_nodelist(totem_config);
1629  if (local_node_pos != -1) {
1630  icmap_set_uint32("nodelist.local_node_pos", local_node_pos);
1631  }
1632 
1633  icmap_set_uint8("config.totemconfig_reload_in_progress", 0);
1634  } else {
1635  icmap_set_uint8("config.totemconfig_reload_in_progress", 1);
1636  }
1637 }
1638 
1639 static void add_totem_config_notification(struct totem_config *totem_config)
1640 {
1642 
1643  icmap_track_add("totem.",
1645  totem_change_notify,
1646  totem_config,
1647  &icmap_track);
1648 
1649  icmap_track_add("config.reload_in_progress",
1651  totem_reload_notify,
1652  totem_config,
1653  &icmap_track);
1654 
1655  icmap_track_add("nodelist.node.",
1657  nodelist_dynamic_notify,
1658  (void *)totem_config,
1659  &icmap_track);
1660 }
unsigned int clear_node_high_bit
Definition: totem.h:117
unsigned short family
Definition: coroapi.h:113
const char * icmap_iter_next(icmap_iter_t iter, size_t *value_len, icmap_value_types_t *type)
Return next item in iterator iter.
Definition: icmap.c:1103
#define RRP_PROBLEM_COUNT_TIMEOUT
Definition: totemconfig.c:76
uint32_t value
struct totem_interface * interfaces
Definition: totem.h:114
unsigned int interface_count
Definition: totem.h:115
struct list_head * next
Definition: list.h:47
The totem_ip_address struct.
Definition: coroapi.h:111
#define DEFAULT_PORT
Definition: totemconfig.c:81
const char * totemip_print(const struct totem_ip_address *addr)
Definition: totemip.c:214
void icmap_iter_finalize(icmap_iter_t iter)
Finalize iterator.
Definition: icmap.c:1124
totem_transport_t transport_number
Definition: totem.h:185
int totemip_parse(struct totem_ip_address *totemip, const char *addr, int family)
Definition: totemip.c:263
#define DOWNCHECK_TIMEOUT
Definition: totemconfig.c:68
unsigned int token_hold_timeout
Definition: totem.h:133
int member_count
Definition: totem.h:70
struct totem_ip_address member_list[PROCESSOR_COUNT_MAX]
Definition: totem.h:71
unsigned char private_key[TOTEM_PRIVATE_KEY_LEN]
Definition: totem.h:122
char rrp_mode[TOTEM_RRP_MODE_BYTES]
Definition: totem.h:161
unsigned char addr[TOTEMIP_ADDRLEN]
Definition: coroapi.h:77
#define COROSYSCONFDIR
Definition: config.h:11
unsigned int rrp_problem_count_timeout
Definition: totem.h:153
cs_error_t icmap_set_string(const char *key_name, const char *value)
Definition: icmap.c:641
int totemip_is_mcast(struct totem_ip_address *addr)
Definition: totemip.c:114
#define RRP_AUTORECOVERY_CHECK_TIMEOUT
Definition: totemconfig.c:79
unsigned int downcheck_timeout
Definition: totem.h:145
unsigned int private_key_len
Definition: totem.h:124
Definition: list.h:46
#define SEQNO_UNCHANGED_CONST
Definition: totemconfig.c:70
unsigned int max_network_delay
Definition: totem.h:171
#define log_printf(level, format, args...)
Definition: logsys.h:319
unsigned int heartbeat_failures_allowed
Definition: totem.h:169
unsigned int send_join_timeout
Definition: totem.h:139
unsigned int window_size
Definition: totem.h:173
unsigned int rrp_problem_count_threshold
Definition: totem.h:155
#define ICMAP_TRACK_DELETE
Definition: icmap.h:77
#define INTERFACE_MAX
Definition: coroapi.h:88
#define RRP_PROBLEM_COUNT_THRESHOLD_MIN
Definition: totemconfig.c:78
#define ICMAP_KEYNAME_MAXLEN
Maximum length of key in icmap.
Definition: icmap.h:48
#define MINIMUM_TIMEOUT
Definition: totemconfig.c:71
cs_error_t icmap_get_uint8(const char *key_name, uint8_t *u8)
Definition: icmap.c:842
uint16_t ttl
Definition: totem.h:69
unsigned int node_id
Definition: totem.h:116
int totem_config_keyread(struct totem_config *totem_config, const char **error_string)
Definition: totemconfig.c:1450
#define ICMAP_TRACK_MODIFY
Definition: icmap.h:78
unsigned int token_retransmits_before_loss_const
Definition: totem.h:135
int totemip_iface_check(struct totem_ip_address *bindnet, struct totem_ip_address *boundto, int *interface_up, int *interface_num, int mask_high_bit)
Definition: totemip.c:405
#define FAIL_TO_RECV_CONST
Definition: totemconfig.c:69
cs_error_t icmap_set_uint32(const char *key_name, uint32_t value)
Definition: icmap.c:611
unsigned int seqno_unchanged_const
Definition: totem.h:149
void * user_data
Definition: sam.c:127
unsigned int miss_count_const
Definition: totem.h:187
unsigned int join_timeout
Definition: totem.h:137
int totem_config_validate(struct totem_config *totem_config, const char **error_string)
Definition: totemconfig.c:1264
const void * data
Definition: icmap.h:94
#define ICMAP_TRACK_ADD
Definition: icmap.h:76
int totem_config_find_local_addr_in_nodelist(const char *ipaddr_key_prefix, unsigned int *node_pos)
Definition: totemconfig.c:850
char * crypto_hash_type
Definition: totem.h:183
struct totem_ip_address mcast_addr
Definition: totem.h:67
#define LOGSYS_LEVEL_ERROR
Definition: logsys.h:70
Linked list API.
unsigned int rrp_autorecovery_check_timeout
Definition: totem.h:159
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.
Definition: icmap.c:739
#define LOGSYS_LEVEL_DEBUG
Definition: logsys.h:74
cs_error_t icmap_set_uint16(const char *key_name, uint16_t value)
Definition: icmap.c:599
unsigned int fail_to_recv_const
Definition: totem.h:147
#define TOKEN_COEFFICIENT
Definition: totemconfig.c:65
int totempg_member_remove(const struct totem_ip_address *member, int ring_no)
Definition: totempg.c:1517
#define TOTEM_CONFIG_WARNING_MEMBERS_DEPRECATED
Definition: totemconfig.h:47
cs_error_t icmap_get_uint32(const char *key_name, uint32_t *u32)
Definition: icmap.c:866
uint8_t param
#define TOTEM_CONFIG_WARNING_MEMBERS_IGNORED
Definition: totemconfig.h:46
uint16_t ip_port
Definition: totem.h:68
void totemip_freeifaddrs(struct list_head *addrs)
Definition: totemip.c:389
#define swab32(x)
The swab32 macro.
Definition: swab.h:51
#define WINDOW_SIZE
Definition: totemconfig.c:73
int version
Definition: totem.h:109
unsigned int net_mtu
Definition: totem.h:165
#define MAX_NETWORK_DELAY
Definition: totemconfig.c:72
#define TOKEN_TIMEOUT
Definition: totemconfig.c:64
int ip_version
Definition: totem.h:189
#define MERGE_TIMEOUT
Definition: totemconfig.c:67
unsigned int token_timeout
Definition: totem.h:129
#define JOIN_TIMEOUT
Definition: totemconfig.c:66
unsigned int consensus_timeout
Definition: totem.h:141
int totemip_getifaddrs(struct list_head *addrs)
Definition: totemip.c:321
#define PROCESSOR_COUNT_MAX
Definition: coroapi.h:96
#define TOKEN_RETRANSMITS_BEFORE_LOSS_CONST
Definition: totemconfig.c:63
#define MISS_COUNT_CONST
Definition: totemconfig.c:75
unsigned int broadcast_use
Definition: totem.h:179
unsigned int rrp_problem_count_mcast_threshold
Definition: totem.h:157
cs_error_t icmap_get_string(const char *key_name, char **str)
Shortcut for icmap_get for string type.
Definition: icmap.c:896
#define list_entry(ptr, type, member)
Definition: list.h:84
cs_error_t icmap_set_uint8(const char *key_name, uint8_t value)
Definition: icmap.c:587
unsigned int max_messages
Definition: totem.h:175
char * crypto_cipher_type
Definition: totem.h:181
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.
Definition: icmap.c:1233
unsigned int merge_timeout
Definition: totem.h:143
unsigned int token_retransmit_timeout
Definition: totem.h:131
struct totem_ip_address bindnet
Definition: totem.h:65
unsigned int nodeid
Definition: coroapi.h:75
icmap_iter_t icmap_iter_init(const char *prefix)
Initialize iterator with given prefix.
Definition: icmap.c:1097
int totemip_equal(const struct totem_ip_address *addr1, const struct totem_ip_address *addr2)
Definition: totemip.c:71
struct totem_ip_address ip_addr
Definition: totemip.h:72
cs_error_t icmap_get_uint16(const char *key_name, uint16_t *u16)
Definition: icmap.c:854
#define TOTEM_CONFIG_WARNING_TOTEM_NODEID_IGNORED
Definition: totemconfig.h:48
#define MAX_MESSAGES
Definition: totemconfig.c:74
unsigned int rrp_token_expired_timeout
Definition: totem.h:151
unsigned int threads
Definition: totem.h:167
qb_map_iter_t * icmap_iter_t
Itterator type.
Definition: icmap.h:123
Structure passed as new_value and old_value in change callback.
Definition: icmap.h:91
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.
Definition: icmap.c:1167
int totem_config_read(struct totem_config *totem_config, const char **error_string, uint64_t *warnings)
Definition: totemconfig.c:978
#define ICMAP_TRACK_PREFIX
Whole prefix is tracked, instead of key only (so "totem." tracking means that "totem.nodeid", "totem.version", ...
Definition: icmap.h:85
#define RRP_PROBLEM_COUNT_THRESHOLD_DEFAULT
Definition: totemconfig.c:77
int totempg_member_add(const struct totem_ip_address *member, int ring_no)
Definition: totempg.c:1510