Article View: demon.ip.developers
Article #844Re: DNS caching; is it *truly* possible to flush locally?
From: Robert Mortimer
Date: Mon, 29 Jul 1996 00:00
Date: Mon, 29 Jul 1996 00:00
66 lines
3424 bytes
3424 bytes
Previously Brian {Hamilton Kelly} <bhk@dsl.co.uk> said:
>[Supplemental info: that's why I'm following up my own posting.]
>In article <838400731snz@dsl.co.uk>
> bhk@dsl.co.uk "Brian {Hamilton Kelly}" writes:
>> In article <838306928snz.4895@grempc.demon.co.uk>
>> Graham@grempc.demon.co.uk "Graham E Kinns" writes:
[huge snip]
>I've been looking at the code for KA9Q, and think I've solved the mystery
>(or rather, located it: it cannot be solved without a *lot* of
>cross-checking).
>The definition of the structure used internally to hold RRs is (from
>DOMAIN.H):
> struct rr
> {
> struct rr *last;
> struct rr *next;
> char source;
> char *comment; /* optional comment */
> char *name; /* Domain name, ascii form */
> char *suffix; /* Suffix name */
> int32 ttl; /* Time-to-live */
> int16 class; /* IN, etc */
> int16 type; /* A, MX, etc */
> int16 rdlength; /* Length of data field */
> union
> {
> int32 addr; /* Used for type == A */
> struct soa soa; /* Used for type == SOA */
> struct mx mx; /* Used for type == MX */
> struct hinfo hinfo; /* Used for type == HINFO */
> struct minfo minfo; /* Used for type == MINFO */
> struct wks wks; /* Used for type == WKS */
> char *name; /* for domain names */
> char *data; /* for anything else */
> } rdata;
> };
>(I've deleted a lot of #defines that provide symbolic constants.)
>The TTL field is certainly *used* as if it were, as Graham, says, a
>signed 32-bit integer (from DOMAIN.C):
> if(test_rrp->ttl > 0L
> && (test_rrp->ttl -= elapsed) <= 0L)
> test_rrp->ttl = 0L;
>(Similar code appears in other routines too). On this basis, if
>decrementing the TTL makes it -ve, it gets replaced by zero. So why are
>there negative values in the cache and the DOMAIN.TXT file?
>Well, let's look at the definition of int32 (from GLOBAL.H):
> typedef unsigned long int32; /* 32-bit signed integer */
>Note that *carefully*: the comment says that it's a signed integer (which
>it needs to be for the code fragment above to work). But the actual C
What version of KA9Q did you get that code fragment from??
Looking at global.h for demon from the ftp server:
typedef long int32; /* 32-bit signed integer */
This is hte same for Phil Karns new version of KA9Q and
for JNOS1.10x. As the comments above this line said
it assumes your longs are 32 bits, but it's not
declared as unsigned. The unsigned int is uint32.
CC'd to poster.
--
RobertM
Demon Internet Ltd
"Trust the computer, the computer is your fiend"
Technical Details
Message-ID:
<31fc8a5b.7116726@news.demon.co.uk>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<838060435snz@dsl.co.uk> <838306928snz.4895@grempc.demon.co.uk> <838400731snz@dsl.co.uk> <838411052snz@dsl.co.uk>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bb05,467f920bc280412f X-Google-Attributes: gid10bb05,public From: robm@demon.net (Robert Mortimer) Subject: Re: DNS caching; is it *truly* possible to flush locally? Date: 1996/07/29 Message-ID: <31fc8a5b.7116726@news.demon.co.uk> X-Deja-AN: 170894157 x-nntp-posting-host: bob1.support.demon.net references: <838060435snz@dsl.co.uk> <838306928snz.4895@grempc.demon.co.uk> <838400731snz@dsl.co.uk> <838411052snz@dsl.co.uk> organization: Demon Internet Ltd reply-to: robm@demon.net newsgroups: demon.ip.developers