]> git.proxmox.com Git - mirror_corosync.git/blobdiff - exec/totemconfig.c
totemconfig: change udp netmtu value as a constant
[mirror_corosync.git] / exec / totemconfig.c
index 45dd6ed6060a148c38ab9508078dfe0a9231648e..b8856073a82e02ef002e1ca5b50c8e43426e4746 100644 (file)
@@ -66,7 +66,7 @@
 #include "totemconfig.h"
 
 #define TOKEN_RETRANSMITS_BEFORE_LOSS_CONST    4
-#define TOKEN_TIMEOUT                          1000
+#define TOKEN_TIMEOUT                          3000
 #define TOKEN_WARNING                          75
 #define TOKEN_COEFFICIENT                      650
 #define JOIN_TIMEOUT                           50
@@ -81,6 +81,8 @@
 #define MAX_MESSAGES                           17
 #define MISS_COUNT_CONST                       5
 #define BLOCK_UNLISTED_IPS                     1
+/* This constant is not used for knet */
+#define UDP_NETMTU                              1500
 
 /* Currently all but PONG_COUNT match the defaults in libknet.h */
 #define KNET_PING_INTERVAL                      1000
@@ -1080,7 +1082,6 @@ static int check_for_duplicate_nodeids(
                                          autogenerated?"(autogenerated from ":"",
                                          autogenerated?ring0_addr:"",
                                          autogenerated?")":"");
-                               log_printf (LOGSYS_LEVEL_ERROR, error_string_response);
                                *error_string = error_string_response;
                                break;
                        }
@@ -1369,6 +1370,16 @@ static int put_nodelist_members_to_config(struct totem_config *totem_config, icm
                        if (res != 3 || strcmp(tmp_key2, "_addr") != 0) {
                                continue;
                        }
+                       if (linknumber >= INTERFACE_MAX) {
+                               snprintf (error_string_response, sizeof(error_string_response),
+                                               "parse error in config: interface ring number %u is bigger than allowed maximum %u\n",
+                                               linknumber, INTERFACE_MAX - 1);
+                               *error_string = error_string_response;
+
+                               icmap_iter_finalize(iter2);
+                               icmap_iter_finalize(iter);
+                               return (-1);
+                       }
 
                        if (icmap_get_string_r(map, iter_key2, &node_addr_str) != CS_OK) {
                                continue;
@@ -1980,49 +1991,57 @@ int totem_config_validate (
                if ((totem_config->transport_number == TOTEM_TRANSPORT_UDP) &&
                        memcmp (&totem_config->interfaces[i].mcast_addr, &null_addr,
                                sizeof (struct totem_ip_address)) == 0) {
-                       error_reason = "No multicast address specified";
+                       snprintf (local_error_reason, sizeof(local_error_reason),
+                                       "No multicast address specified for interface %u", i);
                        goto parse_error;
                }
 
                if (totem_config->interfaces[i].ip_port == 0) {
-                       error_reason = "No multicast port specified";
+                       snprintf (local_error_reason, sizeof(local_error_reason),
+                                       "No multicast port specified for interface %u", i);
                        goto parse_error;
                }
 
                if (totem_config->interfaces[i].ttl > 255) {
-                       error_reason = "Invalid TTL (should be 0..255)";
+                       snprintf (local_error_reason, sizeof(local_error_reason),
+                                       "Invalid TTL (should be 0..255) for interface %u", i);
                        goto parse_error;
                }
                if (totem_config->transport_number != TOTEM_TRANSPORT_UDP &&
                    totem_config->interfaces[i].ttl != 1) {
-                       error_reason = "Can only set ttl on multicast transport types";
+                       snprintf (local_error_reason, sizeof(local_error_reason),
+                                       "Can only set ttl on multicast transport types for interface %u", i);
                        goto parse_error;
                }
                if (totem_config->interfaces[i].knet_link_priority > 255) {
-                       error_reason = "Invalid link priority (should be 0..255)";
+                       snprintf (local_error_reason, sizeof(local_error_reason),
+                                       "Invalid link priority (should be 0..255) for interface %u", i);
                        goto parse_error;
                }
                if (totem_config->transport_number != TOTEM_TRANSPORT_KNET &&
                    totem_config->interfaces[i].knet_link_priority != 1) {
-                       error_reason = "Can only set link priority on knet transport type";
+                       snprintf (local_error_reason, sizeof(local_error_reason),
+                                       "Can only set link priority on knet transport type for interface %u", i);
                        goto parse_error;
                }
 
                if (totem_config->interfaces[i].mcast_addr.family == AF_INET6 &&
                        totem_config->node_id == 0) {
-
-                       error_reason = "An IPV6 network requires that a node ID be specified.";
+                       snprintf (local_error_reason, sizeof(local_error_reason),
+                                       "An IPV6 network requires that a node ID be specified for interface %u", i);
                        goto parse_error;
                }
 
                if (totem_config->broadcast_use == 0 && totem_config->transport_number == TOTEM_TRANSPORT_UDP) {
                        if (totem_config->interfaces[i].mcast_addr.family != totem_config->interfaces[i].bindnet.family) {
-                               error_reason = "Multicast address family does not match bind address family";
+                               snprintf (local_error_reason, sizeof(local_error_reason),
+                                               "Multicast address family does not match bind address family for interface %u", i);
                                goto parse_error;
                        }
 
                        if (totemip_is_mcast (&totem_config->interfaces[i].mcast_addr) != 0) {
-                               error_reason = "mcastaddr is not a correct multicast address.";
+                               snprintf (local_error_reason, sizeof(local_error_reason),
+                                               "mcastaddr is not a correct multicast address for interface %u", i);
                                goto parse_error;
                        }
                }
@@ -2082,7 +2101,7 @@ int totem_config_validate (
                        totem_config->net_mtu = KNET_MAX_PACKET_SIZE;
                }
                else {
-                       totem_config->net_mtu = 1500;
+                       totem_config->net_mtu = UDP_NETMTU;
                }
        }