[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    [Linux-ha-dev] [PATCH] fix a bug that IPv6 does not work fine.
From:       Simon Horman <horms () verge ! net ! au>
Date:       2011-04-19 0:09:31
Message-ID: 1303171771-19319-2-git-send-email-horms () verge ! net ! au
[Download RAW message or body]

From: Sohgo Takeuchi <sohgo@sohgo.dyndns.org>

When added fixes to allow IPv4 and IPv6 services with same fwmark in a
following commits,
	(commit f9c76a0f1d6e7c86ac741ed534c6661e22556fc2
	 commit f85bdc302541aab3e32994b0d672e60a338a17c8)
the fixes made same fwmark work good, but broke a behaviour of IPv6
services. This commit fixes this problem.

Only when fwmark is used, generates special IDs of real and virtual services.

Signed-off-by: Simon Horman <horms@verge.net.au>
---
 ldirectord/ldirectord.in |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ldirectord/ldirectord.in b/ldirectord/ldirectord.in
index af55fda..646d687 100644
--- a/ldirectord/ldirectord.in
+++ b/ldirectord/ldirectord.in
@@ -2457,7 +2457,12 @@ sub get_real_service_str
 {
 	my ($v) = (@_);
 
-	return &get_virtual($v) . " "  . $v->{protocol} . ($v->{addressfamily} == AF_INET6 ? "6" : "");
+	if ($v->{"protocol"} eq "fwm") {
+		return &get_virtual($v) . " "  . $v->{protocol} . ($v->{addressfamily} == AF_INET6 ? "6" : "");
+	}
+	else {
+		return &get_virtual($v) . " "  . $v->{protocol};
+	}
 }
 
 sub ld_start
@@ -4119,7 +4124,7 @@ sub fallback_find
 	my ($virtual) = (@_);
 
 	my($global_fallback_ptr);	# fallback pointer
-	my $ipv6p = $virtual->{server} =~ /[\[\]]/ ? 1 : 0;
+	my $ipv6p = ($virtual->{addressfamily} == AF_INET6) ? 1 : 0;
 
 	if( defined $virtual->{"fallback"} ) {
 		return($virtual->{"fallback"});
@@ -4819,7 +4824,12 @@ sub get_virtual_id_str
 {
 	my ($v) = (@_);
 
-	return $v->{"protocol"} . ($v->{addressfamily} == AF_INET6?"6":"") . ":" .  &get_virtual($v);
+	if ($v->{"protocol"} eq "fwm") {
+		return $v->{"protocol"} . ($v->{addressfamily} == AF_INET6?"6":"") . ":" .  &get_virtual($v);
+	}
+	else {
+		return $v->{"protocol"} . ":" .  &get_virtual($v);
+	}
 }
 
 # get_forward_flag
-- 
1.7.4.1

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic