LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

RE: ldirectord checktype=connect false positive

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: RE: ldirectord checktype=connect false positive
From: "Purcocks, Graham" <grahamp@xxxxxxxxxxxxx>
Date: Wed, 21 Sep 2005 05:41:28 -0400
Horm

Do you need to test for a TCP check before dying? You may have removed
this test for the UDP (SIP?) change. I don't know the logic but you may
break UDP again. I don't know whether an undef $sock is ok for UDP.

I.e.

If( ! $sock and <TCP CHECK> ) die()

Graham

-----Original Message-----
From: lvs-users-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:lvs-users-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Horms
Sent: 21 September 2005 05:01
To: LinuxVirtualServer.org users mailing list.
Subject: Re: ldirectord checktype=connect false positive

On Tue, Sep 20, 2005 at 05:40:24PM +0100, Graham David Purcocks
M.A.(Oxon.) wrote:
> Yes. It's Ultramonkey V3.
> 
> Surprising if the CVS is worse than that :(
> 
> The fact it uses $sock rather then $result means its different code.
> 
> Ah. Whats your ld_open_socket look like. Maybe the check is in there.
> See the close is within ld_open_socket in my older version but you
have
> a close outside.
> 
>         $result = connect(SOCK, $paddr);
>         close(SOCK) || die "close: $!" if ($result);
>         return $result;
> }

It seems that this was a regression added when I put the SIP 
check into CVS, which incolved reworking ld_open_socket a little bit.
I have put the following fix into CVS as 1.121/1.77.2.32

-- 
Horms

Index: ldirectord
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/ldirectord/ldirectord,v
retrieving revision 1.120
diff -u -r1.120 ldirectord
--- ldirectord  7 Sep 2005 07:31:23 -0000       1.120
+++ ldirectord  21 Sep 2005 03:59:19 -0000
@@ -1995,11 +1995,11 @@
                local $SIG{'ALRM'} = sub { die "Timeout Alarm" };
                &ld_debug(4, "Timeout is $$v{checktimeout}");
                alarm $$v{checktimeout};
-               # N.B: ld_open_socket dies on error, which
-               #      will throw us out of the eval
                my $sock = &ld_open_socket($$r{server}, $port,
$$v{protocol});
                if ($sock) {
                        close($sock);
+               } else {
+                       die(); #socket attempt failed immediately (not
timeout)
                }
                &ld_debug(3, "Connected to $1 (port $port)");
                alarm 0; # Cancel the alarm
@@ -2032,10 +2032,11 @@
                &ld_debug(4, "Timeout is $$v{checktimeout}");
                alarm $$v{checktimeout};
 
-               # N.B: ld_open_socket dies on error, which
-               #      will throw us out of the eval
                my $sock = &ld_open_socket($$r{server}, $sip_d_port, 
                                        $$v{protocol});
+               unless ($sock) {
+                       die(); #socket attempt failed immediately (not
timeout)
+               }
 
                my $sip_sockaddr = getsockname($sock);
                my ($sip_s_port, $sip_s_addr) =
sockaddr_in($sip_sockaddr);
@@ -3094,7 +3095,7 @@
 #      protocol: Prococol to use. Should be either "tcp" or "udp"
 # post: A Socket connection is opened to the remote host
 # return: Open socket
-#         Programe dies on error (may be caught by calling function)
+#         undef on error
 
 sub ld_open_socket
 {


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