minimum expire time

vectro at pipeline.com vectro at pipeline.com
Mon Sep 13 06:16:23 UTC 1999


When on a dialup connection, every UDP packet counts. So I find it
annoying that some domains set their expire time to 30 minutes (or less!).
To solve this problem, I wrote the attached patch, which allows the user
to violate the standard and specify a new min-expire-time option, which is
the minimum number of seconds to cache data. Although this does violate
the standard, I can't think of anything bad that would come from this,
except perhaps that some dynamic domains wouldn't get updated as fast.

I wanted to submit this patch to the maintainers to see if they wanted to
include it in the distribution, but I wasn't sure where to send it. I
don't subscribe to the bind-workers list, so if you want to e-mail me
please be sure to CC me.

The patch was designed for 8.2, but applies cleanly to 8.2.1.

Cheers,

Ian Turner


-- Attached file included as plaintext by Listar --
-- File: bind-8.2-minexp.patch

diff -Naur bind-8.2-old/src/bin/named/ns_config.c bind-8.2/src/bin/named/ns_config.c
--- bind-8.2-old/src/bin/named/ns_config.c	Tue Mar 16 09:58:04 1999
+++ bind-8.2/src/bin/named/ns_config.c	Sun Sep 12 17:58:27 1999
@@ -1098,6 +1098,7 @@
 	op->listen_list = NULL;
 	op->fwdtab = NULL;
 	/* XXX init forwarding */
+        op->min_exp_time = 0;
 	op->clean_interval = 3600;
 	op->interface_interval = 3600;
 	op->stats_interval = 3600;
diff -Naur bind-8.2-old/src/bin/named/ns_defs.h bind-8.2/src/bin/named/ns_defs.h
--- bind-8.2-old/src/bin/named/ns_defs.h	Mon Mar  1 22:24:41 1999
+++ bind-8.2/src/bin/named/ns_defs.h	Sun Sep 12 17:57:49 1999
@@ -704,6 +704,7 @@
 	listen_info_list listen_list;
 	struct fwdinfo *fwdtab;
 	/* XXX need to add forward option */
+        int min_exp_time;
 	int clean_interval;
 	int interface_interval;
 	int stats_interval;
diff -Naur bind-8.2-old/src/bin/named/ns_lexer.c bind-8.2/src/bin/named/ns_lexer.c
--- bind-8.2-old/src/bin/named/ns_lexer.c	Mon Mar 15 18:21:29 1999
+++ bind-8.2/src/bin/named/ns_lexer.c	Sun Sep 12 17:55:43 1999
@@ -278,6 +278,7 @@
 	{"max-ixfr-log-size", T_MAX_LOG_SIZE_IXFR},
 	{"max-ncache-ttl", T_MAX_NCACHE_TTL},
 	{"max-transfer-time-in", T_MAX_TRANSFER_TIME_IN},
+	{"min-expire-time", T_EXP_TIME},
 	{"memstatistics-file", T_MEMSTATS_FILE},
 	{"multiple-cnames", T_MULTIPLE_CNAMES},
 	{"name", T_NAME},
diff -Naur bind-8.2-old/src/bin/named/ns_parser.y bind-8.2/src/bin/named/ns_parser.y
--- bind-8.2-old/src/bin/named/ns_parser.y	Mon Mar  1 22:24:43 1999
+++ bind-8.2/src/bin/named/ns_parser.y	Sun Sep 12 17:57:04 1999
@@ -150,7 +150,7 @@
 %type	<axfr_fmt>	transfer_format
 %token			T_NOTIFY T_AUTH_NXDOMAIN T_MULTIPLE_CNAMES T_USE_IXFR T_MAINTAIN_IXFR_BASE
 %token			T_CLEAN_INTERVAL T_INTERFACE_INTERVAL T_STATS_INTERVAL T_MAX_LOG_SIZE_IXFR
-%token			T_HEARTBEAT T_USE_ID_POOL
+%token			T_HEARTBEAT T_USE_ID_POOL T_EXP_TIME
 %token			T_MAX_NCACHE_TTL T_HAS_OLD_CLIENTS T_RFC2308_TYPE1
 %token			T_LAME_TTL
 
@@ -480,6 +480,10 @@
 	{
 		current_options->clean_interval = $2 * 60;
 	}
+        | T_EXP_TIME L_NUMBER
+        {
+                current_options->min_exp_time = $2;
+        }
 	| T_INTERFACE_INTERVAL L_NUMBER
 	{
 		current_options->interface_interval = $2 * 60;
diff -Naur bind-8.2-old/src/bin/named/ns_resp.c bind-8.2/src/bin/named/ns_resp.c
--- bind-8.2-old/src/bin/named/ns_resp.c	Mon Mar 15 18:21:31 1999
+++ bind-8.2/src/bin/named/ns_resp.c	Sun Sep 12 18:05:30 1999
@@ -1975,6 +1975,15 @@
 			return ((cp - rrp) + dlen);
 		}
 
+		/* If expire time is too low, we should fix it. */
+               if (exptime < now + server_options->min_exp_time) {
+			ns_debug(ns_log_default, 3,
+				"increasing %s expire time from %d to %d.",
+				p_secstodate (exptime), exptime,
+				now + server_options->min_exp_time);
+			exptime = now + server_options->min_exp_time;
+		}
+
 		/* Lop off the TTL at the expiration time.  */
 		timetilexp = exptime - now;
 		if (timetilexp < ttl) {



More information about the bind-workers mailing list