> -----Original Message----- > From: Andre D. Correa [mailto:andre.correa@xxxxxxxxx] > Sent: Thursday, July 07, 2005 11:21 AM > To: squid-users@xxxxxxxxxxxxxxx; andre.correa@xxxxxxxxx > Subject: Re-reding /etc/hosts file with -k > > > > 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. To the best of my knowledge, squid re-reads the host file on a "-k reconfigure". Looking at mainReconfigure(void) confirms this. > > Looking arround I found the function idnsInit() that looks promissing. I > added something like this to src/main.c > The function you would want to use is parseEtcHosts()... > 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 > ------------------------------ Hope this helps, Chris