|
|
597afd |
From 60565b7da7d271651c30cd7fdca6e3f3eb5327ac Mon Sep 17 00:00:00 2001
|
|
|
597afd |
From: Jan Friesse <jfriesse@redhat.com>
|
|
|
597afd |
Date: Wed, 6 Apr 2016 15:49:09 +0200
|
|
|
597afd |
Subject: [PATCH] totemconfig: Explicitly pass IP version
|
|
|
597afd |
|
|
|
597afd |
If resolver was set to prefer IPv6 (almost always) and interface section
|
|
|
597afd |
was not defined (almost all config files created by pcs), IP version was
|
|
|
597afd |
set to mcast_addr.family. Because mcast_addr.family was unset (reset to
|
|
|
597afd |
zero), IPv6 address was returned causing failure in totemsrp.
|
|
|
597afd |
Solution is to pass correct IP version stored in
|
|
|
597afd |
totem_config->ip_version.
|
|
|
597afd |
|
|
|
597afd |
Patch also simplifies get_cluster_mcast_addr. It was using mix of
|
|
|
597afd |
explicitly passed IP version and bindnet IP version.
|
|
|
597afd |
|
|
|
597afd |
Also return value of get_cluster_mcast_addr is now properly checked.
|
|
|
597afd |
|
|
|
597afd |
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
|
|
|
597afd |
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
|
|
|
597afd |
---
|
|
|
597afd |
exec/totemconfig.c | 10 ++++++----
|
|
|
597afd |
1 files changed, 6 insertions(+), 4 deletions(-)
|
|
|
597afd |
|
|
|
597afd |
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
|
|
|
597afd |
index f232ea8..32c9f88 100644
|
|
|
597afd |
--- a/exec/totemconfig.c
|
|
|
597afd |
+++ b/exec/totemconfig.c
|
|
|
597afd |
@@ -446,7 +446,6 @@ static uint16_t generate_cluster_id (const char *cluster_name)
|
|
|
597afd |
|
|
|
597afd |
static int get_cluster_mcast_addr (
|
|
|
597afd |
const char *cluster_name,
|
|
|
597afd |
- const struct totem_ip_address *bindnet,
|
|
|
597afd |
unsigned int ringnumber,
|
|
|
597afd |
int ip_version,
|
|
|
597afd |
struct totem_ip_address *res)
|
|
|
597afd |
@@ -462,7 +461,7 @@ static int get_cluster_mcast_addr (
|
|
|
597afd |
clusterid = generate_cluster_id(cluster_name) + ringnumber;
|
|
|
597afd |
memset (res, 0, sizeof(*res));
|
|
|
597afd |
|
|
|
597afd |
- switch (bindnet->family) {
|
|
|
597afd |
+ switch (ip_version) {
|
|
|
597afd |
case AF_INET:
|
|
|
597afd |
snprintf(addr, sizeof(addr), "239.192.%d.%d", clusterid >> 8, clusterid % 0xFF);
|
|
|
597afd |
break;
|
|
|
597afd |
@@ -1088,7 +1087,7 @@ extern int totem_config_read (
|
|
|
597afd |
*/
|
|
|
597afd |
if (icmap_get_string(iter_key, &str) == CS_OK) {
|
|
|
597afd |
res = totemip_parse (&totem_config->interfaces[ringnumber].bindnet, str,
|
|
|
597afd |
- totem_config->interfaces[ringnumber].mcast_addr.family);
|
|
|
597afd |
+ totem_config->ip_version);
|
|
|
597afd |
free(str);
|
|
|
597afd |
}
|
|
|
597afd |
|
|
|
597afd |
@@ -1105,10 +1104,13 @@ extern int totem_config_read (
|
|
|
597afd |
* (if available)
|
|
|
597afd |
*/
|
|
|
597afd |
res = get_cluster_mcast_addr (cluster_name,
|
|
|
597afd |
- &totem_config->interfaces[ringnumber].bindnet,
|
|
|
597afd |
ringnumber,
|
|
|
597afd |
totem_config->ip_version,
|
|
|
597afd |
&totem_config->interfaces[ringnumber].mcast_addr);
|
|
|
597afd |
+ if (res != 0) {
|
|
|
597afd |
+ *error_string = "Can't autogenerate multicast address";
|
|
|
597afd |
+ return -1;
|
|
|
597afd |
+ }
|
|
|
597afd |
}
|
|
|
597afd |
|
|
|
597afd |
snprintf(tmp_key, ICMAP_KEYNAME_MAXLEN, "totem.interface.%u.broadcast", ringnumber);
|
|
|
597afd |
--
|
|
|
597afd |
1.7.1
|
|
|
597afd |
|