[rbldnsd] [PATCH] maxttl option
Bradley Baetz
bradley.baetz at optusnet.com.au
Tue Feb 24 04:42:57 MSK 2004
We are running rbldnsd as nameserver, which bind speaks to via a forward
zone.
So that bind doesn't cache these entries (which are being updated
regularly via rsync), I've patched rbldnsd to have a maxttl option, so
that bind will regularly requery rbldbsd.
Option defaults to unlimited (signified by using 0).
Bradley
-------------- next part --------------
diff -urN rbldnsd-0.991/rbldnsd.8 rbldnsd/rbldnsd.8
--- rbldnsd-0.991/rbldnsd.8 2003-11-30 21:24:55.000000000 +1100
+++ rbldnsd/rbldnsd.8 2004-02-23 13:08:08.000000000 +1100
@@ -146,6 +146,12 @@
If TTL is specified inside the data (see below), it takes precedence
over this option.
+.IP "\fB\-T\fR \fImaxttl\fR"
+Set the maximum time\-to\-live value to be \fImaxttl\fR seconds. This
+option is useful when running a local mirror of an array, and fowarding
+through bind (or some other nameserver). This avoids the other nameserver
+keeping the records cached for too long. Zero (the default) means unlimited.
+
.IP "\fB\-c\fR \fIcheck\fR"
Set interval between checking for zone file changes to be \fIcheck\fR,
default is 1m (one minute). \fBrbldnsd\fR will check zone file's last
diff -urN rbldnsd-0.991/rbldnsd.c rbldnsd/rbldnsd.c
--- rbldnsd-0.991/rbldnsd.c 2003-12-01 04:51:51.000000000 +1100
+++ rbldnsd/rbldnsd.c 2004-02-23 13:12:47.000000000 +1100
@@ -78,6 +78,7 @@
static char *logfile; /* log file name */
static int logmemtms; /* print memory usage and (re)load time info */
unsigned def_ttl = 35*60; /* default record TTL 35m */
+unsigned max_ttl = 0; /* Max TTL - default unlimited */
const char def_rr[5] = "\177\0\0\2\0"; /* default A RR */
struct dataset *ds_loading; /* a dataset currently being loaded if any */
@@ -171,6 +172,7 @@
" -6 - use IPv6 socket type\n"
#endif
" -t ttl - TTL value set in answers (35m)\n"
+" -T maxttl - Maximum TTL value to use (unlimited)\n"
" -v - hide version information in replies to version.bind CH TXT\n"
" (second -v makes rbldnsd to refuse such requests completely)\n"
" -e - enable CIDR ranges where prefix is not on the range boundary\n"
@@ -360,7 +362,7 @@
if (argc <= 1) usage(1);
- while((c = getopt(argc, argv, "u:r:b:w:t:c:p:nel:qsh46dv")) != EOF)
+ while((c = getopt(argc, argv, "u:r:b:w:t:T:c:p:nel:qsh46dv")) != EOF)
switch(c) {
case 'u': user = optarg; break;
case 'r': rootdir = optarg; break;
@@ -382,6 +384,10 @@
if (!(p = parse_time(optarg, &def_ttl)) || *p || !def_ttl)
error(0, "invalid ttl (-t) value `%.50s'", optarg);
break;
+ case 'T':
+ if (!(p = parse_time(optarg, &max_ttl)) || *p)
+ error(0, "invalid max ttl (-T) value `%.50s'", optarg);
+ break;
case 'c':
if (!(p = parse_time(optarg, &recheck)) || *p)
error(0, "invalid check interval (-c) value `%.50s'", optarg);
diff -urN rbldnsd-0.991/rbldnsd.h rbldnsd/rbldnsd.h
--- rbldnsd-0.991/rbldnsd.h 2003-12-01 04:50:56.000000000 +1100
+++ rbldnsd/rbldnsd.h 2004-02-23 11:25:21.000000000 +1100
@@ -297,6 +297,7 @@
int ds_combined_newset(struct dataset *ds, char *line, int lineno);
extern unsigned def_ttl;
+extern unsigned max_ttl;
extern const char def_rr[5];
extern const char *show_version; /* version.bind CH TXT */
diff -urN rbldnsd-0.991/rbldnsd_util.c rbldnsd/rbldnsd_util.c
--- rbldnsd-0.991/rbldnsd_util.c 2003-12-01 04:50:56.000000000 +1100
+++ rbldnsd/rbldnsd_util.c 2004-02-23 11:28:26.000000000 +1100
@@ -76,6 +76,8 @@
s = parse_time(s, ttlp);
if (*ttlp == 0)
*ttlp = defttl;
+ if (max_ttl && *ttlp > max_ttl)
+ *ttlp = max_ttl;
return s;
}
More information about the rbldnsd
mailing list