LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

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

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [lvs-users] IPv6 vs IPv4 fwmark services
From: Ferenc Wagner <wferi@xxxxxxx>
Date: Fri, 11 Feb 2011 16:50:51 +0100
Simon Horman <horms@xxxxxxxxxxxx> writes:

> On Wed, Feb 09, 2011 at 02:17:01PM +0100, Ferenc Wagner wrote:
> 
>> 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?
>
> My initial reaction is that this is just an oversight.

(I suppose this was your answer to the above question, not the below one.)
That was my impression as well.  There's some confusion in ldirectord
around $virtual_id, as it seems to be assigned twice each time.  So the
attached patch also removes the superfluous assignments in its first two
hunks.  Or did I overlook something important?

Anyway, this rather simple change seems to work for me, comments
welcome!

>> Two loosely related subquestions:
>> 
>>   1. Did anybody think about somehow enabling symbolic fwmarks in
>>      virtual service declarations?
>>   2. Why aren't IPv6 real server addresses resolved from DNS in the
>>      ipvsadm -L output, just like IPv4 ones are?
>
> I am surprised that doesn't work, I suspect it is also an oversight.

OK, I'll check this out.
-- 
Thanks,
Feri.

--- /usr/sbin/ldirectord        2011-01-19 16:20:51.009894922 +0100
+++ /home/wferi/ldirectord.fwm6 2011-02-11 16:19:24.842202041 +0100
@@ -1296,11 +1296,11 @@
                        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";
                        } elsif ($vattr =~ 
/^([0-9A-Za-z._+-]+):([0-9A-Za-z]+)/) {
-                               $virtual_id = $ip_port = "$1:$2";
+                               $ip_port = "$1:$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) {
@@ -1309,7 +1309,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";
                        } else {
                                &config_error($line,
                                        "invalid address for virtual server");
@@ -4769,7 +4769,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>