[Openais] [PATCH 2/3] Remove the ttl option from udpu and rely on the kernel ttl setting.

Angus Salkeld asalkeld at redhat.com
Mon Mar 14 16:44:46 PDT 2011


Signed-off-by: Angus Salkeld <asalkeld at redhat.com>
---
 exec/totemconfig.c  |    5 +++++
 exec/totemudpu.c    |   21 ---------------------
 man/corosync.conf.5 |    1 +
 3 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/exec/totemconfig.c b/exec/totemconfig.c
index 7039ba0..0b9732b 100644
--- a/exec/totemconfig.c
+++ b/exec/totemconfig.c
@@ -477,6 +477,11 @@ int totem_config_validate (
 			error_reason = "Invalid TTL (should be 0..255)";
 			goto parse_error;
 		}
+		if (totem_config->transport_number != TOTEM_TRANSPORT_UDP &&
+		    totem_config->interfaces[i].ttl != 1) {
+			error_reason = "Can only set ttl on multicast transport types";
+			goto parse_error;
+		}
 
 		if (totem_config->interfaces[i].mcast_addr.family == AF_INET6 &&
 			totem_config->node_id == 0) {
diff --git a/exec/totemudpu.c b/exec/totemudpu.c
index 1cf3cf6..2d6a3da 100644
--- a/exec/totemudpu.c
+++ b/exec/totemudpu.c
@@ -1302,7 +1302,6 @@ static int totemudpu_build_sockets_ip (
 	struct sockaddr_storage sockaddr;
 	int addrlen;
 	int res;
-	int flag;
 	unsigned int recvbuf_size;
 	unsigned int optlen = sizeof (recvbuf_size);
 
@@ -1326,26 +1325,6 @@ static int totemudpu_build_sockets_ip (
 	}
 
 	/*
-	 * Set packets TTL
-	 */
-	flag = instance->totem_interface->ttl;
-	if (bindnet_address->family == AF_INET6) {
-		res = setsockopt (instance->token_socket, IPPROTO_IPV6,
-			IPV6_UNICAST_HOPS, &flag, sizeof (flag));
-		if (res == -1) {
-			perror ("set udpu v6 TTL");
-			return (-1);
-		}
-	} else {
-		res = setsockopt(instance->token_socket, IPPROTO_IP, IP_TTL,
-			&flag, sizeof(flag));
-		if (res == -1) {
-			perror ("set udpu v4 TTL");
-			return (-1);
-		}
-	}
-
-	/*
 	 * Bind to unicast socket used for token send/receives
 	 * This has the side effect of binding to the correct interface
 	 */
diff --git a/man/corosync.conf.5 b/man/corosync.conf.5
index eaf58c4..2ebf802 100644
--- a/man/corosync.conf.5
+++ b/man/corosync.conf.5
@@ -132,6 +132,7 @@ ttl
 This specifies the Time To Live (TTL). If you run your cluster on a routed
 network then the default of "1" will be too small. This option provides
 a way to increase this up to 255. The valid range is 0..255.
+Note that this is only valid on multicast transport types.
 
 .TP
 member
-- 
1.7.4.1



More information about the Openais mailing list