Re: small patch for controlling resolver information cache

2003-02-27 Thread David Malone
On Thu, Feb 27, 2003 at 06:25:31PM +0900, YAMAMOTO Shigeru wrote:
> If seting 'RES_NOCACHE' to 'yes', any application reads /etc/resolv.conf at
> any DNS quering.

I wonder if it would be better to have a RES_CACHETIME, which you
can set in seconds and if it is set then you reread if the last
reread of resolv.conf was more than that number of seconds ago?
You could set it to zero to get it to reread every time.

David.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message


small patch for controlling resolver information cache

2003-02-27 Thread YAMAMOTO Shigeru

Hi all,

I make a small patch for mobile users.
This patch is controlling cache of resolver information.

If seting 'RES_NOCACHE' to 'yes', any application reads /etc/resolv.conf at
any DNS quering.
I think, it is useful for using heavey network applications, such as
mozilla, in mobile environment.

Please try it if you want.

Thanks,
---
YAMAMOTO Shigeru<[EMAIL PROTECTED]>
cvs diff: Diffing .
Index: res_init.c
===
RCS file: /share/cvsup/FreeBSD/current/usr/src/lib/libc/net/res_init.c,v
retrieving revision 1.30
diff -u -r1.30 res_init.c
--- res_init.c  25 Sep 2002 04:06:35 -  1.30
+++ res_init.c  25 Feb 2003 06:34:52 -
@@ -493,7 +493,12 @@
_res.options |= RES_NOALIASES;
else if ((cp = getenv("RES_OPTIONS")) != NULL)
res_setoptions(cp, "env");
-   _res.options |= RES_INIT;
+   if (getenv("RES_NOCACHE") != NULL) {
+   _res.options &= ~(RES_INIT);
+   }
+   else {
+   _res.options |= RES_INIT;
+   }
return (0);
 }