Search squid archive

Re: Re-reding /etc/hosts file with -k

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




You guys are right, -k reconfigure re-reads the hosts file. Thanks for the information. I was complicating things. At least I learned something about Squid's source code.

Once again tks.

------------------------------
Andre D. Correa, CISSP
andre.correa (at) pobox.com
http://andre.hiperlinks.com.br
Sao Paulo / SP / Brazil
------------------------------



Andre D. Correa wrote:

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



[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux