LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [lvs-users] IPv6 vs IPv4 fwmark services

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: [lvs-users] IPv6 vs IPv4 fwmark services
Cc: Ferenc Wagner <wferi@xxxxxxx>
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Wed, 16 Feb 2011 14:51:56 +0900
On Wed, Feb 16, 2011 at 01:04:12AM +0100, Ferenc Wagner wrote:
> Simon Horman <horms@xxxxxxxxxxxx> writes:
> 
> > On Tue, Feb 15, 2011 at 05:44:32PM +0900, Sohgo Takeuchi wrote:
> >> 
> >> From: Ferenc Wagner <wferi@xxxxxxx>
> >>
> >>> Sohgo Takeuchi <sohgo@xxxxxxxxxxxxxxxx> writes:
> >>> 
> >>>> From: Ferenc Wagner <wferi@xxxxxxx>
> >>>>
> >>>>> I'm running ldirectord with
> >>>>> http://hg.linux-ha.org/agents/rev/6e8b562f5414 applied for better IPv6
> >>>>> support.  Basically, it works fine, thanks for implementing this.  But I
> >>>>> wonder whether there's a fundamental reason for not allowing IPv4 and
> >>>>> IPv6 virtual services with the same fwmark, like
> >>>>> 
> >>>>> virtual=1
> >>>>>   [...]
> >>>>> virtual6=1
> >>>>>   [...]
> >>>>> 
> >>>>> which results in
> >>>>> 
> >>>>> Error [21297] reading file /etc/ldirectord.cf at line 15: duplicate 
> >>>>> virtual server
> >>>>> 
> >>>>> if tried.  Is this only an overzealous sanity check in ldirectord, or
> >>>>> are iptables and ip6tables fwmarks actually related somehow?
> >>>>
> >>>> Thanks for the report.
> >>>>
> >>>> When I enhanced the IPv6 support of ldirectord, I forgotten to
> >>>> take care about this case. I also think that ldirectord should
> >>>> support this case.
> >>> 
> >>> Great, and thanks for taking care of IPv6 support in ldirectord!
> >>> So what do you think about my patch?  Not that I feel strongly about
> >>> it, but I'd better stop using it if it's broken...
> >> 
> >> I've used your patch. It works good in my environment too.
> >> Thanks for the patch!
> >
> > Thanks guys,
> >
> > Ferenc are you happy to have this patch included in ldirectord
> > which is GPLv2 licensed code?
> 
> Yes, absolutely.

Thanks, I have queued up the following for inclusion in
http://hg.linux-ha.org/agents.
Please take a moment to double check that it is correct.


# HG changeset patch
# User Ferenc Wagner <wferi@xxxxxxx>
# Date 1297835408 -32400
# Node ID 8427c046434779da1972463718443452f9fefdc1
# Parent  fa9903f21432e2b450bbb6bb16b5f44121629792
ldirectord: remove duplicate assignment of virtual_id

This allows IPv4 and IPv6 services to use the same fwmark.

Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

diff -r fa9903f21432 -r 8427c0464347 ldirectord/ldirectord.in
--- a/ldirectord/ldirectord.in  Sat Feb 12 19:32:35 2011 +0900
+++ b/ldirectord/ldirectord.in  Wed Feb 16 14:50:08 2011 +0900
@@ -1301,13 +1301,13 @@
                        my $fallback_line;
                        my @rsrv_todo;
                        if ($vattr =~ /^(\d+\.\d+\.\d+\.\d+):([0-9A-Za-z-_]+)/ 
&& $af == AF_INET) {
-                               $virtual_id = $ip_port = "$1:$2";
+                               $ip_port = "$1:$2";
                                $virtual_port = $2;
                        } elsif ($vattr =~ 
/^([0-9A-Za-z._+-]+):([0-9A-Za-z-_]+)/) {
-                               $virtual_id = $ip_port = "$1:$2";
+                               $ip_port = "$1:$2";
                                $virtual_port = $2;
                        } elsif ($vattr =~ /^(\d+)/){
-                               $virtual_id = $fwm = $1;
+                               $fwm = $1;
                        } elsif ($vattr =~ 
/^\[([0-9A-Fa-f:]+)\]:([0-9A-Za-z-_]+)/ && $af == AF_INET) {
                                &config_error($line, "cannot specify an IPv6 
address here. please use \"virtual6\" instead.");
                        } elsif ($vattr =~ 
/^\[([0-9A-Fa-f:]+)\]:([0-9A-Za-z-_]+)/ && $af == AF_INET6) {
@@ -1316,7 +1316,7 @@
                                if (!inet_pton(AF_INET6,$v6addr)) {
                                        &config_error($line,"invalid ipv6 
address for virtual server");
                                }
-                               $virtual_id = $ip_port = "[$v6addr]:$v6port";
+                               $ip_port = "[$v6addr]:$v6port";
                                $virtual_port = $v6port;
                        } else {
                                &config_error($line,
@@ -4804,7 +4804,7 @@
 {
        my ($v) = (@_);
 
-       return $v->{"protocol"} . ":" .  &get_virtual($v);
+       return $v->{"protocol"} . ($v->{addressfamily} == AF_INET6?"6":"") . 
":" .  &get_virtual($v);
 }
 
 # get_forward_flag

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Send requests to lvs-users-request@xxxxxxxxxxxxxxxxxxxxxx
or go to http://lists.graemef.net/mailman/listinfo/lvs-users

<Prev in Thread] Current Thread [Next in Thread>