Re: IP Cache Round Robin

From: Jim Richey <jrichey@dont-contact.us>
Date: Fri, 11 Feb 2000 10:20:45 -0500

Well, since there was no quick answer I had to fire up some brain cells
and figure this out myself. The change is in ipcache.c in the function
ipcacheCycleAddr. The change causes the first IP address to always be
handed out unless it is marked BAD. Perhap's not the most efficient
change, but here it is:

/* Original Code to Round Robin IP addresses in cache
    for (k = 0; k < ia->count; k++)
{
        if (++ia->cur ==
ia->count)
            ia->cur =
0;
        if
(!ia->bad_mask[ia->cur])
           
break;;
   
}
*/
                                                                       
/* Modified Code to Not Round Robin */
    for (k = 0; k < ia->count; k++)
{
        if (++ia->cur ==
ia->count)
            ia->cur =
0;
        if (!ia->bad_mask[ia->cur])
{
            if (!ia->bad_mask[0])
{
                ia->cur =
0;
           
}
           
break;
       
}
   
}
                                                                           

Henrik Nordstrom wrote:
>
> Jim Richey wrote:
> >
> > To answer part of my own question, I've found the ipcacheCycleAddr
> > function in ipcache.c. Now before I totally destroy something, does
> > anyone know what change is needed to only hand out the first IP address
> > when an entry has several listed for it? That is don't rotate them.
>
> Remove the calls to that function (or make it a NOP), or change the DNS
> server to only hand out the IP address the client (i.e. Squid) should
> use?
>
> The round-robin sheduling of IP addresses was introduced as there are
> more round-robin DNS servers than load-balancing, and without it a Squid
> server would send all users to the same IP for the TTL of the DNS cache
> entry.
>
> --
> Henrik Nordstrom
> Squid hacker

-- 
Jim Richey
jrichey@highmark.com
Highmark, Inc.
http://www.highmark.com
Received on Fri Feb 11 2000 - 08:30:45 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:51:11 MST