* [Cluster-devel] cluster/fence/agents/xvm fence_xvm.c mcast.c m ...
@ 2008-01-30 18:45 lhh
0 siblings, 0 replies; only message in thread
From: lhh @ 2008-01-30 18:45 UTC (permalink / raw)
To: cluster-devel.redhat.com
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 {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-01-30 18:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 18:45 [Cluster-devel] cluster/fence/agents/xvm fence_xvm.c mcast.c m lhh
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 NNTP newsgroup(s).