[PATCH 3/4] Store auto generated mcast addr and port to icmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
---
 exec/totemconfig.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index 83c1eb2..3b3c2d5 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -223,7 +223,9 @@ extern int totem_config_read (
 	char ringnumber_key[ICMAP_KEYNAME_MAXLEN];
 	char tmp_key[ICMAP_KEYNAME_MAXLEN];
 	uint8_t u8;
+	uint16_t u16;
 	char *cluster_name = NULL;
+	int i;
 
 	memset (totem_config, 0, sizeof (struct totem_config));
 	totem_config->interfaces = malloc (sizeof (struct totem_interface) * INTERFACE_MAX);
@@ -375,6 +377,24 @@ extern int totem_config_read (
 	}
 	icmap_iter_finalize(iter);
 
+	/*
+	 * Store automatically generated items back to icmap
+	 */
+	for (i = 0; i < totem_config->interface_count; i++) {
+		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.mcastaddr", i);
+		if (icmap_get_string(tmp_key, &str) == CS_OK) {
+			free(str);
+		} else {
+			str = (char *)totemip_print(&totem_config->interfaces[i].mcast_addr);
+			icmap_set_string(tmp_key, str);
+		}
+
+		snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.mcastport", i);
+		if (icmap_get_uint16(tmp_key, &u16) != CS_OK) {
+			icmap_set_uint16(tmp_key, totem_config->interfaces[i].ip_port);
+		}
+	}
+
 	totem_config->transport_number = TOTEM_TRANSPORT_UDP;
 	if (icmap_get_string("totem.transport", &str) == CS_OK) {
 		if (strcmp (str, "udpu") == 0) {
-- 
1.7.1

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux