[squid-users] Re-reding /etc/hosts file with -k

From: Andre D. Correa <andre.correa@dont-contact.us>
Date: Thu, 07 Jul 2005 16:21:13 -0300

Hi Squid-users, my question is more to the dev list but I'm not a Squid
developer so its better not disturb then.

In my setup I need to be able to send a signal to Squid to force it to
read /etc/hosts again. I need it because I have a PPPoE concentrator and
the hosts file is updated each time a new user connects or disconnects.

I couldn't find a way to enable this behavior so I decided to mess with
the code a little and this is where I need a helping hand.

Looking arround I found the function idnsInit() that looks promissing. I
added something like this to src/main.c

static void mainResetDNS(void);

...

static void
mainResetDNS(void)
{
     idnsInit();
}

...

At mainInitialize()

...
squid_signal(SIGRTMIN, mainResetDNS, SA_NODEFER);
...

and to get a command line option to send the signal I made something
like this:

...
         case 'k':
             if ((int) strlen(optarg) < 1)
                 usage();
             if (!strncmp(optarg, "dns", strlen(optarg)))
                 opt_send_signal = SIGRTMIN;
             else if (!strncmp(optarg, "reconfigure", strlen(optarg)))
                 opt_send_signal = SIGHUP;
...

Compilation happens with no probs and when I run "squid -k dns" it
re-reads the hosts file but it kills childs too. Killing child
proccesess stop all active transfers and this is something that cannot
happen.

Can anybody help me find the right function(s) to call so it re-reads
the hosts file?

Thanks for the attetion...

------------------------------
Andre D. Correa, CISSP
andre.correa (at) pobox.com
http://andre.hiperlinks.com.br
Sao Paulo / SP / Brazil
------------------------------
Received on Thu Jul 07 2005 - 13:21:22 MDT

This archive was generated by hypermail pre-2.1.9 : Mon Aug 01 2005 - 12:00:02 MDT