LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [lvs-users] "connection refused" when persistence enabled

To: Julian Anastasov <ja@xxxxxx>
Subject: Re: [lvs-users] "connection refused" when persistence enabled
Cc: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Fri, 11 Dec 2009 16:32:11 +1100
On Tue, Dec 08, 2009 at 11:06:30AM +0200, Julian Anastasov wrote:
> 
>       Hello,
> 
> On Tue, 8 Dec 2009, Simon Horman wrote:
> 
> > Hi Julian,
> > 
> > here are the results of some tests that I ran today.
> > They seem to indicate that this problem is real.
> > 
> > -                   if (svc->port)
> > +                   if (svc->port) {
> > +                           IP_VS_DBG(6, "p-schedule: non-zero svc port: "
> > +                                     "0x%x\n", svc->port);
> >                             return NULL;
> > +                   }
> >  
> >                     dest = svc->scheduler->schedule(svc, skb);
> >                     if (dest == NULL) {
> 
>       I think, the problem is at another place. It seems
> you are using netlink. May be you should fix ip_vs_genl_find_service
> to memset usvc before parsing the service. Check other such
> places such as ip_vs_genl_set_cmd. Or may be memset should be in
> ip_vs_genl_parse_service. I don't have much time today but
> if you walk the genl functions may be other such problems can popup.
> Better create fix for these problems and I think your problem
> will disappear.

Hi Julian,

I took a look at your suggestion and zeroing usvc in
ip_vs_genl_parse_service() also seems to does seem to resolve the problem
that was reported. And inspecting the code it looks like it should
be sufficient to resolve any similar problems that may be lurking.

How do you feel about the following?

----------------------------------------------------------------------

ipvs: zero usvc

Make sure that any otherwise uninitialised fields of usvc are zero.

This has been obvserved to cause a problem whereby the port of
fwmark services may end up as a non-zero value which causes
scheduling of a destination server to fail for persisitent services.

As observed by Deon van der Merwe <dvdm@xxxxxxxxxxxx>.
This fix suggested by Julian Anastasov <ja@xxxxxx>.

Cc: Deon van der Merwe <dvdm@xxxxxxxxxxxx>
Cc: Julian Anastasov <ja@xxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

Index: linux-2.6/net/netfilter/ipvs/ip_vs_ctl.c
===================================================================
--- linux-2.6.orig/net/netfilter/ipvs/ip_vs_ctl.c       2009-12-11 
14:22:23.000000000 +0900
+++ linux-2.6/net/netfilter/ipvs/ip_vs_ctl.c    2009-12-11 14:25:03.000000000 
+0900
@@ -2714,6 +2714,8 @@ static int ip_vs_genl_parse_service(stru
        if (!(nla_af && (nla_fwmark || (nla_port && nla_protocol && nla_addr))))
                return -EINVAL;
 
+       memset(usvc, 0, sizeof(*usvc));
+
        usvc->af = nla_get_u16(nla_af);
 #ifdef CONFIG_IP_VS_IPV6
        if (usvc->af != AF_INET && usvc->af != AF_INET6)

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