public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Christine Caulfield <chrissie@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: STABLE3 - cman: Allow use of broadcast communications
Date: Wed, 27 May 2009 12:14:00 -0000	[thread overview]
Message-ID: <20090527121402.9311F12020E@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=7558ead77b63ab732b6288571142e021625aab2e
Commit:        7558ead77b63ab732b6288571142e021625aab2e
Parent:        987b5478c3e572b0288c20aeadadf4eeb5841760
Author:        Christine Caulfield <ccaulfie@redhat.com>
AuthorDate:    Wed May 27 13:12:42 2009 +0100
Committer:     Christine Caulfield <ccaulfie@redhat.com>
CommitterDate: Wed May 27 13:12:42 2009 +0100

cman: Allow use of broadcast communications

The latest version of corosync allows broadcast to be configured as
an option. This makes it available from cman with the option
<cman broadcast = "yes"/>

Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
---
 cman/daemon/cman-preconfig.c |   27 ++++++++++++++++++++++-----
 cman/daemon/commands.c       |    3 +++
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index 6221169..05c8f71 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -217,7 +217,7 @@ static hdb_handle_t find_cman_logger(struct objdb_iface_ver0 *objdb, hdb_handle_
 }
 
 
-static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int port)
+static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int port, int broadcast)
 {
 	hdb_handle_t totem_object_handle;
 	hdb_handle_t find_handle;
@@ -266,8 +266,12 @@ static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr,
 		objdb->object_key_create(interface_object_handle, "bindnetaddr", strlen("bindnetaddr"),
 					 tmp, strlen(tmp)+1);
 
-		objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"),
-					 mcast, strlen(mcast)+1);
+		if (broadcast)
+			objdb->object_key_create(interface_object_handle, "broadcast", strlen("broadcast"),
+						 "yes", strlen("yes")+1);
+		else
+			objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"),
+						 mcast, strlen(mcast)+1);
 
 		sprintf(tmp, "%d", port);
 		objdb->object_key_create(interface_object_handle, "mcastport", strlen("mcastport"),
@@ -510,6 +514,8 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 	hdb_handle_t find_handle;
 	hdb_handle_t node_object_handle;
 	hdb_handle_t alt_object;
+	int broadcast = 0;
+	char *str;
 	int error;
 
 	if (!getenv("CMAN_NOCONFIG")) {
@@ -602,7 +608,18 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 		objdb_get_int(objdb, object_handle, "port", &portnum, DEFAULT_PORT);
 	}
 
-	if (add_ifaddr(objdb, mcast_name, nodename, portnum))
+	/* Check for broadcast */
+	if (!objdb_get_string(objdb, object_handle, "broadcast", &str)) {
+		if (strcmp(str, "yes") == 0) {
+			mcast_name = strdup("255.255.255.255");
+			if (!mcast_name)
+				return -1;
+			broadcast = 1;
+		}
+		free(str);
+	}
+
+	if (add_ifaddr(objdb, mcast_name, nodename, portnum, broadcast))
 		return -1;
 
 	/* Get all alternative node names */
@@ -623,7 +640,7 @@ static int get_nodename(struct objdb_iface_ver0 *objdb)
 			mcast = mcast_name;
 		}
 
-		if (add_ifaddr(objdb, mcast, node, portnum))
+		if (add_ifaddr(objdb, mcast, node, portnum, broadcast))
 			return -1;
 
 		num_nodenames++;
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
index de0fefb..b343bcb 100644
--- a/cman/daemon/commands.c
+++ b/cman/daemon/commands.c
@@ -579,6 +579,9 @@ static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *r
 			struct sockaddr_in6 *saddr6;
 
 			objdb_get_string(corosync, object_handle, "mcastaddr", &mcast);
+			/* If this fails, it must be using broadcast*/
+			if (!mcast)
+				mcast = "255.255.255.255";
 			memset(ptr, 0, sizeof(struct sockaddr_storage));
 
 			saddr4 = (struct sockaddr_in *)ptr;


                 reply	other threads:[~2009-05-27 12:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090527121402.9311F12020E@lists.fedorahosted.org \
    --to=chrissie@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).