LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [lvs-users] request/receive issue using simpletcp

To: Niles Ingalls <nilesi@xxxxxxxxxxxxxxxxxxxx>
Subject: Re: [lvs-users] request/receive issue using simpletcp
Cc: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>, Michael Peters <MRPeters@xxxxxxxxxxxxxx>, Robert Jackson <RJackson@xxxxxxxxxxxxxx>, Rick Deuschle <rickd@xxxxxxxxxxxxxxxxxxxx>, Adam Bowling <adbowling@xxxxxxxxxxxxxx>, Sohgo Takeuchi <sohgo@xxxxxxxxxxxxxxxx>
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Thu, 14 Oct 2010 08:04:22 +0900
On Tue, Oct 12, 2010 at 08:39:07AM -0400, Niles Ingalls wrote:
> 
> On Oct 12, 2010, at 5:52 AM, Sohgo Takeuchi wrote:
> 
> > 
> > From: Sohgo Takeuchi <sohgo@xxxxxxxxxxxxxxxx>
> > |
> >> From: Niles Ingalls <nilesi@xxxxxxxxxxxxxxxxxxxx>
> >> |
> >>> On Oct 7, 2010, at 11:37 PM, Sohgo Takeuchi wrote:
> >>> 
> >>>> From: Niles Ingalls <nilesi@xxxxxxxxxxxxxxxxxxxx>
> >>>> |
> >>>>> Hello lvs-users,
> >>>>> 
> >>>>> I'm having a problem doing request receive authentication that I'm 
> >>>>> unable to resolve on my own.
> >>>>> 
> >>>>> I'm using the ldirectord version that comes with debian 5 supplied with 
> >>>>> Linux-HA (2.1.3-6lenny4)
> >>>>> I've also tested this with dowload/ldirectord-latest from the 
> >>>>> ldirectord download page. 
> >>>>> (http://horms.net/projects/ldirectord/download/ldirectord-latest).
> >>>>> 
> >>>>> I'm using ldirectord for load balancing 3M Standard Interchange 
> >>>>> Protocol (also known as SIP, not to be confused for Session Initiation 
> >>>>> Protocol)
> >>>>> 
> >>>>> Here's what the config looks like.
> >>>>> 
> >>>>> virtual=192.168.80.2:6001
> >>>>>       real=192.168.80.25:6001 masq
> >>>>>       request="9300CNredacted|redacted|AY0AZF63B"
> >>>>>       receive="^941AY0AZFDFD"
> >>>>>       service=simpletcp
> >>>> 
> >>>> 
> >>>> Hi,
> >>>> 
> >>>> How about specifying like this as a workaround.
> >>>> 
> >>>> virtual=192.168.80.2:6001
> >>>>       real=192.168.80.25:6001 masq "9300CNredacted|redacted|AY0AZF63B" 
> >>>> "^941AY0AZFDFD"
> >>>>       service=simpletcp
> >>>> 
> >>> 
> >>> Hello Sohgo,
> >>> 
> >>> Your workaround fixed my problem, and the SIP server is
> >>> authenticating properly.
> >> 
> >> Hello Niles,
> >> 
> >> That's good.
> >> 
> >> When I checked the
> >> http://horms.net/projects/ldirectord/download/ldirectord-latest,
> >> I found that it was not latest. The real latest version does not
> >> need this workaround.
> >> 
> >> If you want to get a latest code, please follow a below
> >> instruction written at
> >> http://horms.net/projects/ldirectord/download.shtml
> >> 
> >> "The Latest Un-Released Version" -> "Download linux-ha tree
> >> using Mercurial"
> >> 
> >>> Oct  8 08:25:52 xenb2sip acs-server: INPUT MSG: 
> >>> '9300CNredacted|CO_redacted|AY0AZF63B '
> >>> Oct  8 08:25:52 xenb2sip acs-server: Sip::MsgType::new('Sip::MsgType', 
> >>> '9300CNredacted', '93'): msgtag '0'
> >>> Oct  8 08:25:52 xenb2sip acs-server: Sip::MsgType:_initialize('Login', 
> >>> '00CNredacted|CO_re...')
> >>> Oct  8 08:25:52 xenb2sip acs-server: Sip::MsgType::_initialize('Login', 
> >>> '00CNHredacted|CO_redacted|', 'A1A1', '2', ...
> >>> Oct  8 08:25:52 xenb2sip acs-server: Successful login for 'redacted' of 
> >>> 'indiana'
> >>> 
> >>> As you can see, the SIP server is happy.
> >>> New problem, the negotiation between ldirectord and my SIP server 
> >>> timeout, as if the response is never received.
> >>> 
> >>> DEBUG2: Checking negotiate: real 
> >>> server=negotiate:simpletcp:tcp:192.168.80.25:6001:::1:masq:9300CNredacted\|COredacted\|AY0AZF63B\\n:\^941AY0AZFDFD
> >>>  (virtual=tcp:192.168.80.2:6001)
> >>> DEBUG2: Checking simpletcp server=192.168.80.25 port=6001
> >>> DEBUG3: Connected from 192.168.80.2:41853 to 192.168.80.25:6001
> >>> DEBUG2: Checking simpletcp server=192.168.80.25 port=6001 request:
> >>> 9300CNredacted|COredacted|AY0AZF63B
> >>> DEBUG2: Disabled real 
> >>> server=negotiate:simpletcp:tcp:192.168.80.25:6001:::1:masq:9300CNredacted\|COredacted\|AY0AZF63B\\n:\^941AY0AZFDFD
> >>>  (virtual=tcp:192.168.80.2:6001)
> >>> DEBUG3: Deactivated service 192.168.80.25:6001: Timeout Alarm at 
> >>> /usr/sbin/ldirectord line 3022.
> >>> 
> >>> I've tried this with and without adding \n at the end of the request 
> >>> without success.
> >>> When using telnet, I have to hit return after sending the request 
> >>> 9300CNredacted|COredacted|AY0AZF63B , and after receiving the response 
> >>> 941AY0AZFDFD before the connection is closed.
> >>> I assume that since the SIP server isn't closing the connection, this is 
> >>> why I'm timing out.
> >> 
> >> The ldirectord assumes that the response has a \n. Do you find
> >> the SIP server returns response which contains a \n like
> >> "941AY0AZFDFD\n" ?
> > 
> > Could you try following patch? This patch can be applied to
> > http://horms.net/projects/ldirectord/download/ldirectord-latest
> > 
> > --- ldirectord-latest.orig  2009-09-15 14:59:34.000000000 +0900
> > +++ ldirectord-latest       2010-10-12 18:50:12.270363918 +0900
> > @@ -3355,6 +3355,7 @@
> > 
> >             &ld_debug(2, "Checking simpletcp server=$$r{server} 
> > port=$d_port request:\n$request");
> >             print $sock $request;
> > +           shutdown($sock, SHUT_WR);
> > 
> >             my $ok;
> >             my $reply;
> > 
> 
> I'm now using the latest Un-Released version with your patch, and it's
> working very well.

Thanks. Sohgo, are you comfortable with me merging this patch?


> I did notice that if the request/receive is defined with the server
> (real=192.168.80.25:6001 masq "9300CNredacted|redacted|AY0AZF63B"
> "^941AY0AZFDFD"), it truncates the first character like this.
> 300CNredacted|redacted|AY0AZF63B If I define the request/receive
> independent of the real server line, all works perfectly.  As this was my
> original configuration, my problem is resolved.

Thanks, I believe that the following patch will resolve that problem.


ldirectord: Receive string must always start with "/"

There are two locations where the receive string can be set.
One corresponding with the real=... configuration directive and one
corresponding with the request=... directive. Unfortunately
the parsing of these was slightly inconsistent which lead to
the truncation of the first letter of the request string
when the real=... syntax is used in conjunction with the simpletcp check.

Reported-by: Niles Ingalls <nilesi@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

Index: linux-ha/hg/hg.linux-ha.org/agents/ldirectord/ldirectord.in
===================================================================
--- linux-ha.orig/hg/hg.linux-ha.org/agents/ldirectord/ldirectord.in    
2010-10-14 07:54:21.000000000 +0900
+++ linux-ha/hg/hg.linux-ha.org/agents/ldirectord/ldirectord.in 2010-10-14 
07:54:23.000000000 +0900
@@ -2078,6 +2078,9 @@ sub add_real_server
 
        if(defined($flags) and $flags =~ /\s+\"(.*)\"[, ]\s*\"(.*)\"(.*)/) {
                $new_rsrv->{"request"} = $1;
+               unless ($new_rsrv->{request}=~/^\//) {
+                       $new_rsrv->{request} = "/" . $new_rsrv->{request};
+               }
                $new_rsrv->{"receive"} = $2;
                $flags = $3;
        }

_______________________________________________
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>