LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: Ldirectord and DNS problem using TCP and UDP

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Ldirectord and DNS problem using TCP and UDP
From: Horms <horms@xxxxxxxxxxxx>
Date: Tue, 18 Oct 2005 12:56:29 +0900
On Mon, Oct 17, 2005 at 11:50:57AM -0700, Todd Lyons wrote:
> David Craigon wanted us to know:
> 
> >Hi there,
> >     I'm trying to configure a DNS recursive resolver (cache)
> >cluster. I am attempting to use ldirectord to detect realserver failure.
> >
> >Now, in my configuration file I want to do something like this:
> >     service=dns
> >     protocol=udp
> ...
> >     service=dns
> >     protocol=tcp
> >since DNS uses both UDP and TCP. Unfortunately ldirectord doesn't like
> >this config- it gets confused and thinks there is a duplicate config in
> >the file saying "duplicate virtual server". But the service is on UDP
> >and TCP, so they are different. Any advice? Is this a bug?
> 
> Yes.  ldirectord needs to be adjusted to check for tcp/udp specification
> and set it.  The Net::DNS::Resolver has an function usevc(int) that
> tells it to use TCP instead of UDP.  You could probably add the code if
> you knew which hash it was in.  Something like $$r{"protocol"}, but that
> is 100% guess on my part.

Here is a patch that should resolve that problem. I have
committed to CVS as 1.122 / 1.77.2.34

-- 
Horms


Index: ldirectord
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord,v
retrieving revision 1.122
diff -u -r1.122 ldirectord
--- ldirectord  17 Oct 2005 08:16:23 -0000      1.122
+++ ldirectord  18 Oct 2005 03:53:54 -0000
@@ -726,12 +726,6 @@
                                        "invalid address for virtual server");
                        }
 
-                       if (defined $virtual_seen{$virtual_id}) {
-                               &config_error($line, 
-                                       "duplicate virtual server");
-                       }
-                       $virtual_seen{$virtual_id} = 1;
-
                        my (%vsrv, @rsrv);
                        if ($ip_port) {
                                $vsrv{checktype} = "negotiate";
@@ -914,6 +908,15 @@
                                $ip_port);
                        &_ld_read_config_real_resolve(\%vsrv, \@rsrv_todo);
 
+                       # Check for duplicate now we have all the
+                       # information to generate the id
+                       $virtual_id = get_virtual_id_str(\%vsrv);
+                       if (defined $virtual_seen{$virtual_id}) {
+                               &config_error($line, 
+                                       "duplicate virtual server");
+                       }
+                       $virtual_seen{$virtual_id} = 1;
+
                        #Arggh a goto :(
                        goto outer_loop;
                }
@@ -3031,7 +3034,7 @@
 {
        my ($v) = (@_);
 
-       my $virtual = $v->{"protocol"} . ":" .  &get_virtual($v);
+       return $v->{"protocol"} . ":" .  &get_virtual($v);
 }
 
 

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