override ttl=0

Herve Guehl herve.guehl at gmail.com
Fri Dec 21 14:15:01 UTC 2007


Hi everybody,
I'm getting troubles with a DNS-ALG machine that send ttl=0 for every
question I send to it.
I browsed archive but did not find any solution to my problem.
I just need to override ttl for A record when the ttl=0.
Here a patch for bind 9.3.3rc2 (redhat 5.0).
I know, that TTL should not be overrided, but in some case this
functionality can be helpfull.

The status of this patch is 'works for me'.

Please let me know if there is another implementation

Regard
Hervé Guehl

Note : dont blame me if i'm not using the right list, just say me where I
should write



diff -urN bind-9.3.3rc2.ori/bin/named/server.c bind-9.3.3rc2
/bin/named/server.c
--- bind-9.3.3rc2.ori/bin/named/server.c        2006-05-24 06:30:
24.000000000 +0200
+++ bind-9.3.3rc2/bin/named/server.c    2007-12-18 22:01:47.000000000 +0100
@@ -1245,6 +1245,11 @@
        result = ns_config_get(maps, "max-cache-ttl", &obj);
        INSIST(result == ISC_R_SUCCESS);
        view->maxcachettl = cfg_obj_asuint32(obj);
+
+       obj = NULL;
+       result = ns_config_get(maps, "override-zero-cache-ttl", &obj);
+       INSIST(result == ISC_R_SUCCESS);
+       view->overridezerocachettl = cfg_obj_asuint32(obj);

        obj = NULL;
        result = ns_config_get(maps, "max-ncache-ttl", &obj);
diff -urN bind-9.3.3rc2.ori/lib/dns/include/dns/view.h bind-9.3.3rc2
/lib/dns/include/dns/view.h
--- bind-9.3.3rc2.ori/lib/dns/include/dns/view.h        2004-03-10 03:55:
58.000000000 +0100
+++ bind-9.3.3rc2/lib/dns/include/dns/view.h    2007-12-18 22:02:
01.000000000 +0100
@@ -116,6 +116,7 @@
        isc_boolean_t                   requestixfr;
        isc_boolean_t                   provideixfr;
        dns_ttl_t                       maxcachettl;
+       dns_ttl_t                       overridezerocachettl;
        dns_ttl_t                       maxncachettl;
        in_port_t                       dstport;
        dns_aclenv_t                    aclenv;
diff -urN bind-9.3.3rc2.ori/lib/dns/resolver.c bind-9.3.3rc2
/lib/dns/resolver.c
--- bind-9.3.3rc2.ori/lib/dns/resolver.c        2006-08-31 05:57:
11.000000000 +0200
+++ bind-9.3.3rc2/lib/dns/resolver.c    2007-12-18 22:02:56.000000000 +0100
@@ -3537,6 +3537,11 @@
                        rdataset->ttl = res->view->maxcachettl;

                /*
+                 * HGU configure minimum ttl if ttl=0 for A record
+               */
+               if  ( (rdataset->ttl == 0) && (rdataset->type ==
dns_rdatatype_a) )
+                        rdataset->ttl = res->view->overridezerocachettl;
+               /*
                 * If this rrset is in a secure domain, do DNSSEC validation
                 * for it, unless it is glue.
                 */
diff -urN bind-9.3.3rc2.ori/lib/isccfg/namedconf.c bind-9.3.3rc2
/lib/isccfg/namedconf.c
--- bind-9.3.3rc2.ori/lib/isccfg/namedconf.c    2006-03-02 01:37:
20.000000000 +0100
+++ bind-9.3.3rc2/lib/isccfg/namedconf.c        2007-12-19 15:11:
49.000000000 +0100
@@ -715,6 +715,7 @@
        { "lame-ttl", &cfg_type_uint32, 0 },
        { "max-ncache-ttl", &cfg_type_uint32, 0 },
        { "max-cache-ttl", &cfg_type_uint32, 0 },
+       { "override-zero-cache-ttl", &cfg_type_uint32, 0 },
        { "transfer-format", &cfg_type_transferformat, 0 },
        { "max-cache-size", &cfg_type_sizenodefault, 0 },
        { "check-names", &cfg_type_checknames, CFG_CLAUSEFLAG_MULTI },



More information about the bind-users mailing list