From: Sohgo Takeuchi <[email protected]>

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 <[email protected]>
---
 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: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to