[Openais] Proposed change to default nodeid generation
Andrew Beekhof
beekhof at gmail.com
Wed Oct 1 02:44:07 PDT 2008
And another that handles clear_node_high_bit as a yes/no value instead
of an integer.
--- whitetank-svn/exec/totem.h 2008-08-13 22:38:15.000000000 +0200
+++ whitetank-dev/exec/totem.h 2008-10-01 10:35:18.000000000 +0200
@@ -89,6 +89,7 @@ struct totem_config {
struct totem_interface *interfaces;
int interface_count;
unsigned int node_id;
+ unsigned int clear_node_high_bit;
/*
* key information
--- whitetank-svn/exec/totemconfig.c 2008-08-13 22:38:15.000000000 +0200
+++ whitetank-dev/exec/totemconfig.c 2008-10-01 11:35:42.000000000 +0200
@@ -174,6 +171,13 @@ extern int totem_config_read (
*/
objdb_get_int (objdb, object_totem_handle, "nodeid", &totem_config->node_id);
+ totem_config->clear_node_high_bit = 0;
+ if (!objdb_get_string (objdb,object_service_handle,
"clear_node_high_bit", &str)) {
+ if (strcmp (str, "yes") == 0) {
+ totem_config->clear_node_high_bit = 1;
+ }
+ }
+
objdb_get_int (objdb,object_totem_handle, "threads", &totem_config->threads);
--- whitetank-svn/exec/totemnet.c 2008-08-13 22:38:15.000000000 +0200
+++ whitetank-dev/exec/totemnet.c 2008-10-01 10:35:44.000000000 +0200
@@ -1227,6 +1227,15 @@ int totemnet_initialize (
instance->totemnet_poll_handle = poll_handle;
+ if(instance->totem_config->node_id == 0) {
+ int32_t nodeid = 0;
+ memcpy (&nodeid, instance->totem_interface->bindnet.addr, sizeof (int32_t));
+ if(nodeid < 0 && instance->totem_config->clear_node_high_bit) {
+ nodeid = 0 - nodeid;
+ }
+ instance->totem_config->node_id = nodeid;
+ }
+
instance->totem_interface->bindnet.nodeid = instance->totem_config->node_id;
instance->context = context;
--- whitetank-svn/man/openais.conf.5 2008-08-13 22:38:16.000000000 +0200
+++ whitetank-dev/man/openais.conf.5 2008-10-01 11:08:53.000000000 +0200
@@ -135,6 +135,17 @@ is bound with ring identifier of 0. The
reserved and should not be used.
.TP
+clear_node_high_bit
+This configuration option is optional and is only relevant when no nodeid is
+specified. Some openais clients require a signed 32 bit nodeid that is greater
+than zero however by default openais uses all 32 bits of the IPv4 address space
+when generating a nodeid. Set this option to yes to force the high bit to be
+zero and therefor ensure the nodeid is a positive signed 32 bit integer.
+
+WARNING: The clusters behavior is undefined if this option is enabled on only
+a subset of the cluster (for example during a rolling upgrade).
+
+.TP
secauth
This specifies that HMAC/SHA1 authentication should be used to authenticate
all messages. It further specifies that all data should be encrypted with the
More information about the Openais
mailing list