From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/fence/agents/xvm fence_xvm.c mcast.c m ...
Date: 30 Jan 2008 18:45:15 -0000 [thread overview]
Message-ID: <20080130184515.6740.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: lhh at sourceware.org 2008-01-30 18:45:14
Modified files:
fence/agents/xvm: fence_xvm.c mcast.c mcast.h options.c
options.h xvm.h
Log message:
Make default TTL 4 instead of 2 per Fabio's recommendation (e.g. RFC2608). Make TTL configurable in cluster.conf/command line for fence_xvm.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/fence_xvm.c.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/mcast.c.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/mcast.h.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/options.c.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/options.h.diff?cvsroot=cluster&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/agents/xvm/xvm.h.diff?cvsroot=cluster&r1=1.3&r2=1.4
--- cluster/fence/agents/xvm/fence_xvm.c 2007/10/17 18:27:27 1.7
+++ cluster/fence/agents/xvm/fence_xvm.c 2008/01/30 18:45:14 1.8
@@ -155,7 +155,8 @@
mc_sock = ipv4_send_sk(ipa->ipa_address, args->addr,
args->port,
(struct sockaddr *)&tgt4,
- sizeof(struct sockaddr_in));
+ sizeof(struct sockaddr_in),
+ args->ttl);
tgt = (struct sockaddr *)&tgt4;
tgt_len = sizeof(tgt4);
@@ -163,7 +164,8 @@
mc_sock = ipv6_send_sk(ipa->ipa_address, args->addr,
args->port,
(struct sockaddr *)&tgt6,
- sizeof(struct sockaddr_in6));
+ sizeof(struct sockaddr_in6),
+ args->ttl);
tgt = (struct sockaddr *)&tgt6;
tgt_len = sizeof(tgt6);
} else {
@@ -317,7 +319,7 @@
main(int argc, char **argv)
{
fence_xvm_args_t args;
- char *my_options = "di:a:p:r:C:c:k:H:uo:t:?hV";
+ char *my_options = "di:a:p:T:r:C:c:k:H:uo:t:?hV";
args_init(&args);
if (argc == 1) {
--- cluster/fence/agents/xvm/mcast.c 2007/10/17 18:27:27 1.3
+++ cluster/fence/agents/xvm/mcast.c 2008/01/30 18:45:14 1.4
@@ -111,7 +111,7 @@
*/
int
ipv4_send_sk(char *send_addr, char *addr, int port, struct sockaddr *tgt,
- socklen_t tgt_len)
+ socklen_t tgt_len, int ttl)
{
int val;
struct ip_mreq mreq;
@@ -182,8 +182,8 @@
/*
* set time to live to 2 hops.
*/
- dbg_printf(4, "Setting TTL to 2 for fd%d\n", sock);
- val = 2;
+ dbg_printf(4, "Setting TTL to %d for fd%d\n", ttl, sock);
+ val = ttl;
if (setsockopt(sock, SOL_IP, IP_MULTICAST_TTL, &val,
sizeof(val)))
printf("warning: setting TTL failed %s\n", strerror(errno));
@@ -278,7 +278,7 @@
*/
int
ipv6_send_sk(char *send_addr, char *addr, int port, struct sockaddr *tgt,
- socklen_t tgt_len)
+ socklen_t tgt_len, int ttl)
{
int val;
struct ipv6_mreq mreq;
@@ -361,7 +361,7 @@
/*
* set time to live to 2 hops.
*/
- val = 2;
+ val = ttl;
if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val,
sizeof(val)))
printf("warning: setting TTL failed %s\n", strerror(errno));
--- cluster/fence/agents/xvm/mcast.h 2006/10/05 16:11:36 1.1
+++ cluster/fence/agents/xvm/mcast.h 2008/01/30 18:45:14 1.2
@@ -24,9 +24,11 @@
int ipv4_recv_sk(char *addr, int port);
int ipv4_send_sk(char *src_addr, char *addr, int port,
- struct sockaddr *src, socklen_t slen);
+ struct sockaddr *src, socklen_t slen,
+ int ttl);
int ipv6_recv_sk(char *addr, int port);
int ipv6_send_sk(char *src_addr, char *addr, int port,
- struct sockaddr *src, socklen_t slen);
+ struct sockaddr *src, socklen_t slen,
+ int ttl);
#endif
--- cluster/fence/agents/xvm/options.c 2008/01/07 05:52:28 1.6
+++ cluster/fence/agents/xvm/options.c 2008/01/30 18:45:14 1.7
@@ -96,6 +96,17 @@
static inline void
+assign_ttl(fence_xvm_args_t *args, struct arg_info *arg, char *value)
+{
+ int ttl;
+ ttl = atoi(value);
+ if (ttl < 1 || ttl > 255)
+ ttl = DEFAULT_TTL;
+ args->ttl = ttl;
+}
+
+
+static inline void
assign_port(fence_xvm_args_t *args, struct arg_info *arg, char *value)
{
args->port = atoi(value);
@@ -260,6 +271,7 @@
}
+
/** ALL valid command line and stdin arguments for this fencing agent */
static struct arg_info _arg_info[] = {
{ '\xff', NULL, "agent",
@@ -286,6 +298,10 @@
"Multicast address (default=225.0.0.12 / ff02::3:1)",
assign_address },
+ { 'T', "-T <ttl>", "multicast_ttl",
+ "Multicast time-to-live (in hops; default=2)",
+ assign_ttl },
+
{ 'p', "-p <port>", "port",
"IP port (default=1229)",
assign_port },
@@ -399,6 +415,7 @@
args->retr_time = 20;
args->flags = 0;
args->debug = 0;
+ args->ttl = DEFAULT_TTL;
}
--- cluster/fence/agents/xvm/options.h 2007/06/26 17:23:41 1.3
+++ cluster/fence/agents/xvm/options.h 2008/01/30 18:45:14 1.4
@@ -45,6 +45,7 @@
int retr_time;
arg_flags_t flags;
int debug;
+ int ttl;
} fence_xvm_args_t;
/* Private structure for commandline / stdin fencing args */
--- cluster/fence/agents/xvm/xvm.h 2007/10/17 18:27:27 1.3
+++ cluster/fence/agents/xvm/xvm.h 2008/01/30 18:45:14 1.4
@@ -56,6 +56,8 @@
/* FENCE_ON = 0x3 Turn the VM on */
} fence_cmd_t;
+#define DEFAULT_TTL 4
+
#define MAX_HASH_LENGTH SHA512_LENGTH
typedef struct __attribute__ ((packed)) _fence_req {
reply other threads:[~2008-01-30 18:45 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=20080130184515.6740.qmail@sourceware.org \
--to=lhh@sourceware.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.