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: Lloyd Brown <somewhere_or_other@xxxxxxx>
Date: Tue, 20 Sep 2005 10:50:09 -0600
I noticed the difference with the variable names too. I was going to try UM, but I couldn't find any x86_64 packages, so I went back to using everything from source. It's being put on a RHEL 3 system, but we don't have licenses for Redhat's cluster services packages, etc. Bring on the SRPMS and CVS!!

As far as the check being in the ld_open_socket, I don't think that is the case. While I'm not that good at Perl, I'm going on emperical evidence: it didn't work until I made the change. Besides that, I can't find the check in the code.

Anyway, here's the ld_open_socket in its entirety:

sub ld_open_socket
{
   my ($remote, $port, $protocol) = @_;
   my ($iaddr, $paddr, $pro, $result);
   local *SOCK;

   $iaddr = inet_aton($remote) || die "no host: $remote";
   $paddr = sockaddr_in($port, $iaddr);
   $pro = getprotobyname($protocol);
   if ($protocol eq "udp") {
       socket(SOCK, PF_INET, SOCK_DGRAM, $pro) || die "socket: $!";
   }
   else {
       socket(SOCK, PF_INET, SOCK_STREAM, $pro) || die "socket: $!";
   }
   $result = connect(SOCK, $paddr);
   unless ($result) {
       return undef;
   }
   return *SOCK;
}


Thanks again,
Lloyd


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;
}


On Tue, 2005-09-20 at 17:27, Lloyd Brown wrote:
I'm actually pulling from CVS. I just re-retrieved it a few minutes ago, and it still doesn't have the change. It claims to be working revision 1.120, if that helps. To quote the same block of code you did, from the ld_open socket to the cancel alarm, I have this:

       my $sock = &ld_open_socket($$r{server}, $port, $$v{protocol});
       if ($sock) {
           close($sock);
       }
       &ld_debug(3, "Connected to $1 (port $port)");
       alarm 0; # Cancel the alarm

Did your version come from a distribution? Often times distro packages patch things without publicizing that fact. I kinda like your code, though. It looks a little better. I hope you don't mind if I use it.

Thanks,
Lloyd



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