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: RHEL5 - cman: Allow use of broadcast communications Date: Tue, 26 May 2009 10:34:00 -0000 [thread overview] Message-ID: <20090526103410.B2494120373@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=958bac9a2e8938fb743b89d268c765cb020b30f0 Commit: 958bac9a2e8938fb743b89d268c765cb020b30f0 Parent: 28daa9be2045dc307701144631d118e46ed685d3 Author: Christine Caulfield <ccaulfie@redhat.com> AuthorDate: Tue May 26 11:32:13 2009 +0100 Committer: Christine Caulfield <ccaulfie@redhat.com> CommitterDate: Tue May 26 11:32:13 2009 +0100 cman: Allow use of broadcast communications The latest version of openais allows broadcast to be configured as an option. This makes it available from cman with the option <cman broadcast = "yes"/> bz# 492808 Signed-off-by: Christine Caulfield <ccaulfie@redhat.com> --- cman/daemon/ais.c | 15 +++++++++++---- cman/daemon/ais.h | 2 +- cman/daemon/cmanccs.c | 11 ++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/cman/daemon/ais.c b/cman/daemon/ais.c index 97f7034..817ce42 100644 --- a/cman/daemon/ais.c +++ b/cman/daemon/ais.c @@ -292,7 +292,7 @@ int cman_exit_fn(void *conn_info) /* END Plugin-specific code */ -int ais_add_ifaddr(char *mcast, char *ifaddr, int portnum) +int ais_add_ifaddr(char *mcast, char *ifaddr, int portnum, int broadcast) { struct totem_ip_address localhost; unsigned int totem_object_handle; @@ -319,13 +319,20 @@ int ais_add_ifaddr(char *mcast, char *ifaddr, int portnum) global_objdb->object_key_create(interface_object_handle, "bindnetaddr", strlen("bindnetaddr"), ifaddr, strlen(ifaddr)+1); - global_objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"), - mcast, strlen(mcast)+1); - sprintf(tmp, "%d", portnum); global_objdb->object_key_create(interface_object_handle, "mcastport", strlen("mcastport"), tmp, strlen(tmp)+1); + if (broadcast) { + global_objdb->object_key_create(interface_object_handle, "broadcast", strlen("broadcast"), + "yes", strlen("yes")+1); + mcast = "255.255.255.255"; + } + else { + global_objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"), + mcast, strlen(mcast)+1); + } + /* Save a local copy */ ret = totemip_parse(&mcast_addr[num_interfaces], mcast, 0); if (!ret) diff --git a/cman/daemon/ais.h b/cman/daemon/ais.h index eb1c3cf..db3bbd6 100644 --- a/cman/daemon/ais.h +++ b/cman/daemon/ais.h @@ -14,7 +14,7 @@ #include <openais/totem/totem.h> -extern int ais_add_ifaddr(char *mcast, char *ifaddr, int portnum); +extern int ais_add_ifaddr(char *mcast, char *ifaddr, int portnum, int broadcast); extern int comms_send_message(void *buf, int len, unsigned char toport, unsigned char fromport, int nodeid, diff --git a/cman/daemon/cmanccs.c b/cman/daemon/cmanccs.c index d8995e1..941cece 100644 --- a/cman/daemon/cmanccs.c +++ b/cman/daemon/cmanccs.c @@ -46,6 +46,7 @@ #define PORT_PATH "/cluster/cman/@port" #define KEY_PATH "/cluster/cman/@keyfile" #define MAXQUEUED_PATH "/cluster/cman/@max_queued" +#define BROADCAST_PATH "/cluster/cman/@broadcast" #define NODEI_NAME_PATH "/cluster/clusternodes/clusternode[%d]/@name" #define NODE_NAME_PATH_BYNAME "/cluster/clusternodes/clusternode[@name=\"%s\"]/@name" @@ -68,6 +69,7 @@ static int num_nodenames; int two_node; char *key_filename; static char *mcast_name; +static int use_broadcast = 0; static unsigned char votes; static unsigned int expected_votes; static unsigned short cluster_id; @@ -237,7 +239,7 @@ static int join(void) * Setup the interface/multicast addresses */ for (i = 0; i<num_nodenames; i++) { - error = ais_add_ifaddr(mcast[i], nodenames[i], portnums[i]); + error = ais_add_ifaddr(mcast[i], nodenames[i], portnums[i], use_broadcast); if (error) { if (errno == EADDRINUSE) write_cman_pipe("Local host name resolves to 127.0.0.1; fix /etc/hosts before starting cluster."); @@ -558,6 +560,13 @@ static int get_ccs_join_info(void) } portnums[0] = port; + + error = ccs_get(cd, BROADCAST_PATH, &str); + if (!error) { + if (strcmp(str, "yes") == 0) + use_broadcast = 1; + } + /* optional security key filename */ if (getenv("CMAN_KEYFILE")) { key_filename = strdup(getenv("CMAN_KEYFILE"));
reply other threads:[~2009-05-26 10:34 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=20090526103410.B2494120373@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: linkBe 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).